Skip to content

Commit cce91de

Browse files
committed
added about_page and IBM Watson TTS service
1 parent 9a25fbe commit cce91de

File tree

7 files changed

+301
-21
lines changed

7 files changed

+301
-21
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
77
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
88
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
9+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
10+
<queries>
11+
<intent>
12+
<action android:name="android.speech.RecognitionService" />
13+
</intent>
14+
</queries>
915
<application
1016
android:label="insight"
1117
android:icon="@mipmap/ic_launcher">

lib/VideoCall.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:agora_rtc_engine/rtc_remote_view.dart' as RtcRemoteView;
55
import 'package:flutter/material.dart';
66

77
/// Define App ID and Token
8-
const APP_ID = "cdd52111046f405da1cec65c3b576f4d";
8+
const APP_ID = "AGORA_APP_ID";
99

1010
class VideoCall extends StatefulWidget {
1111
/// non-modifiable channel name of the page

lib/about_page.dart

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter/material.dart';
3+
4+
import 'package:flutter_tts/flutter_tts.dart';
5+
6+
enum TtsState { playing, stopped }
7+
8+
class AboutPage extends StatefulWidget {
9+
AboutPage();
10+
11+
@override
12+
_AboutPageState createState() => _AboutPageState();
13+
}
14+
15+
class _AboutPageState extends State<AboutPage> {
16+
_AboutPageState();
17+
18+
// FlutterTts flutterTts;
19+
// TtsState ttsState = TtsState.stopped;
20+
21+
@override
22+
void initState() {
23+
super.initState();
24+
// initTTS();
25+
//
26+
//
27+
// _getVoice("Command Accepted. Translating");
28+
}
29+
30+
// void _getVoice(String value) async {
31+
// if (value != null && value.isNotEmpty) {
32+
// if (ttsState != TtsState.playing) {
33+
// var result = await flutterTts.speak(value);
34+
// if (result == 1) setState(() => ttsState = TtsState.playing);
35+
// }
36+
// }
37+
// }
38+
39+
@override
40+
void dispose() {
41+
super.dispose();
42+
43+
//flutterTts.stop();
44+
}
45+
46+
// initTTS() {
47+
// flutterTts = new FlutterTts();
48+
// flutterTts.setStartHandler(() {
49+
// setState(() {
50+
// print("Playing");
51+
// ttsState = TtsState.playing;
52+
// });
53+
// });
54+
//
55+
// flutterTts.setCompletionHandler(() {
56+
// setState(() {
57+
// print("Complete");
58+
// ttsState = TtsState.stopped;
59+
// });
60+
// });
61+
// flutterTts.setCancelHandler(() {
62+
// setState(() {
63+
// print("Cancel");
64+
// ttsState = TtsState.stopped;
65+
// });
66+
// });
67+
// }
68+
69+
@override
70+
Widget build(BuildContext context) {
71+
return Scaffold(
72+
backgroundColor: Colors.blueGrey,
73+
appBar: AppBar(
74+
title: Text('About App'),
75+
backgroundColor: Colors.indigo,
76+
), //AppBar
77+
body: Center(
78+
/** Card Widget **/
79+
child: SingleChildScrollView(
80+
child: Card(
81+
elevation: 50,
82+
shadowColor: Colors.black,
83+
color: Colors.blue[600],
84+
child: SizedBox(
85+
width: 320,
86+
height: 500,
87+
child: Padding(
88+
padding: const EdgeInsets.all(12.0),
89+
child: Column(
90+
children: [
91+
ClipRRect(
92+
borderRadius: BorderRadius.all(Radius.circular(10.0)),
93+
child: Container(
94+
child: Image.asset(
95+
"assets/eye.png",
96+
height: 120,
97+
width: 120,
98+
),
99+
),
100+
),
101+
SizedBox(
102+
height: 10,
103+
),
104+
Container(
105+
padding: const EdgeInsets.all(4),
106+
width: double.infinity,
107+
child: Center(
108+
child: Text(
109+
"Insight App",
110+
style: TextStyle(
111+
fontSize: 20,
112+
color: Colors.yellow,
113+
fontWeight: FontWeight.w900),
114+
),
115+
),
116+
), //Text
117+
SizedBox(
118+
height: 18,
119+
), //SizedBox
120+
Container(
121+
padding: const EdgeInsets.all(4),
122+
child: Text(
123+
"Developed By:",
124+
style: TextStyle(fontSize: 18, color: Colors.black87,fontWeight: FontWeight.w700),
125+
),
126+
width: double.infinity,
127+
),
128+
Container(
129+
padding: const EdgeInsets.all(4),
130+
child: Text(
131+
"Vijeth P H, Sathya M, Shashank Ashok Gadavi & Sagar V",
132+
style: TextStyle(fontSize: 18, color: Colors.amber),
133+
),
134+
width: double.infinity,
135+
),
136+
SizedBox(
137+
height: 10,
138+
), //SizedBox
139+
Container(
140+
padding: const EdgeInsets.all(4),
141+
child: Text(
142+
"App Commands:",
143+
style: TextStyle(fontSize: 18, color: Colors.black87,fontWeight: FontWeight.w700),
144+
),
145+
width: double.infinity,
146+
),
147+
Container(
148+
padding: const EdgeInsets.all(4),
149+
child: Text(
150+
"1. Recognize Face\n2. Detect Objects\n3. Read Text\n4. Send My Location\n5. Translate <sentence> to <language>\n6. Video Call",
151+
style: TextStyle(fontSize: 18, color: Colors.white),
152+
),
153+
width: double.infinity,
154+
), //Text
155+
],
156+
), //Column
157+
), //Padding
158+
), //SizedBox
159+
),
160+
), //Card
161+
), //Center
162+
//Scaffold
163+
);
164+
}
165+
}

lib/homepage.dart

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ to specific page based on the given input
55

66
import 'dart:async';
77
import 'dart:convert';
8+
import 'dart:io';
89
import 'dart:math';
910
import 'OCR.dart';
11+
import 'about_page.dart';
1012
import 'textsummarize.dart';
1113
import 'package:camera/camera.dart';
1214
import 'package:flutter/cupertino.dart';
@@ -166,7 +168,13 @@ class _HomePageState extends State<HomePage> {
166168
);
167169
} else if (lastWords.compareTo("video call") == 0) {
168170
var url = Uri.parse('https://insightbackend.herokuapp.com/token');
169-
var response = await http.get(url);
171+
var response = await http.get(
172+
url,
173+
headers: {
174+
'Authorization':
175+
"Token APP_AUTH_TOKEN"
176+
},
177+
);
170178
if (response.statusCode == 200) {
171179
String token = response.body;
172180
// await for camera and mic permissions before pushing video page
@@ -283,6 +291,18 @@ class _HomePageState extends State<HomePage> {
283291
appBar: AppBar(
284292
backgroundColor: Colors.indigo,
285293
title: const Text('Insight'),
294+
actions: [
295+
IconButton(
296+
icon: Icon(
297+
Icons.info_outline,
298+
color: Colors.white,
299+
),
300+
onPressed: () {
301+
Navigator.push(context,
302+
MaterialPageRoute(builder: (context) => AboutPage()));
303+
},
304+
),
305+
],
286306
),
287307
body: Container(
288308
child: GestureDetector(
@@ -314,6 +334,9 @@ class _HomePageState extends State<HomePage> {
314334
),
315335
),
316336
),
337+
SizedBox(
338+
height: 10.0,
339+
),
317340
Text(
318341
"Tap on screen",
319342
style: TextStyle(color: Colors.white, fontSize: 25),

0 commit comments

Comments
 (0)