Skip to content

Commit

Permalink
added about_page and IBM Watson TTS service
Browse files Browse the repository at this point in the history
  • Loading branch information
vijethph committed Jul 10, 2021
1 parent 9a25fbe commit cce91de
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 21 deletions.
6 changes: 6 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
<application
android:label="insight"
android:icon="@mipmap/ic_launcher">
Expand Down
2 changes: 1 addition & 1 deletion lib/VideoCall.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:agora_rtc_engine/rtc_remote_view.dart' as RtcRemoteView;
import 'package:flutter/material.dart';

/// Define App ID and Token
const APP_ID = "cdd52111046f405da1cec65c3b576f4d";
const APP_ID = "AGORA_APP_ID";

class VideoCall extends StatefulWidget {
/// non-modifiable channel name of the page
Expand Down
165 changes: 165 additions & 0 deletions lib/about_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:flutter_tts/flutter_tts.dart';

enum TtsState { playing, stopped }

class AboutPage extends StatefulWidget {
AboutPage();

@override
_AboutPageState createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
_AboutPageState();

// FlutterTts flutterTts;
// TtsState ttsState = TtsState.stopped;

@override
void initState() {
super.initState();
// initTTS();
//
//
// _getVoice("Command Accepted. Translating");
}

// void _getVoice(String value) async {
// if (value != null && value.isNotEmpty) {
// if (ttsState != TtsState.playing) {
// var result = await flutterTts.speak(value);
// if (result == 1) setState(() => ttsState = TtsState.playing);
// }
// }
// }

@override
void dispose() {
super.dispose();

//flutterTts.stop();
}

// initTTS() {
// flutterTts = new FlutterTts();
// flutterTts.setStartHandler(() {
// setState(() {
// print("Playing");
// ttsState = TtsState.playing;
// });
// });
//
// flutterTts.setCompletionHandler(() {
// setState(() {
// print("Complete");
// ttsState = TtsState.stopped;
// });
// });
// flutterTts.setCancelHandler(() {
// setState(() {
// print("Cancel");
// ttsState = TtsState.stopped;
// });
// });
// }

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
title: Text('About App'),
backgroundColor: Colors.indigo,
), //AppBar
body: Center(
/** Card Widget **/
child: SingleChildScrollView(
child: Card(
elevation: 50,
shadowColor: Colors.black,
color: Colors.blue[600],
child: SizedBox(
width: 320,
height: 500,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
child: Container(
child: Image.asset(
"assets/eye.png",
height: 120,
width: 120,
),
),
),
SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.all(4),
width: double.infinity,
child: Center(
child: Text(
"Insight App",
style: TextStyle(
fontSize: 20,
color: Colors.yellow,
fontWeight: FontWeight.w900),
),
),
), //Text
SizedBox(
height: 18,
), //SizedBox
Container(
padding: const EdgeInsets.all(4),
child: Text(
"Developed By:",
style: TextStyle(fontSize: 18, color: Colors.black87,fontWeight: FontWeight.w700),
),
width: double.infinity,
),
Container(
padding: const EdgeInsets.all(4),
child: Text(
"Vijeth P H, Sathya M, Shashank Ashok Gadavi & Sagar V",
style: TextStyle(fontSize: 18, color: Colors.amber),
),
width: double.infinity,
),
SizedBox(
height: 10,
), //SizedBox
Container(
padding: const EdgeInsets.all(4),
child: Text(
"App Commands:",
style: TextStyle(fontSize: 18, color: Colors.black87,fontWeight: FontWeight.w700),
),
width: double.infinity,
),
Container(
padding: const EdgeInsets.all(4),
child: Text(
"1. Recognize Face\n2. Detect Objects\n3. Read Text\n4. Send My Location\n5. Translate <sentence> to <language>\n6. Video Call",
style: TextStyle(fontSize: 18, color: Colors.white),
),
width: double.infinity,
), //Text
],
), //Column
), //Padding
), //SizedBox
),
), //Card
), //Center
//Scaffold
);
}
}
25 changes: 24 additions & 1 deletion lib/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ to specific page based on the given input

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'OCR.dart';
import 'about_page.dart';
import 'textsummarize.dart';
import 'package:camera/camera.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -166,7 +168,13 @@ class _HomePageState extends State<HomePage> {
);
} else if (lastWords.compareTo("video call") == 0) {
var url = Uri.parse('https://insightbackend.herokuapp.com/token');
var response = await http.get(url);
var response = await http.get(
url,
headers: {
'Authorization':
"Token APP_AUTH_TOKEN"
},
);
if (response.statusCode == 200) {
String token = response.body;
// await for camera and mic permissions before pushing video page
Expand Down Expand Up @@ -283,6 +291,18 @@ class _HomePageState extends State<HomePage> {
appBar: AppBar(
backgroundColor: Colors.indigo,
title: const Text('Insight'),
actions: [
IconButton(
icon: Icon(
Icons.info_outline,
color: Colors.white,
),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => AboutPage()));
},
),
],
),
body: Container(
child: GestureDetector(
Expand Down Expand Up @@ -314,6 +334,9 @@ class _HomePageState extends State<HomePage> {
),
),
),
SizedBox(
height: 10.0,
),
Text(
"Tap on screen",
style: TextStyle(color: Colors.white, fontSize: 25),
Expand Down
Loading

0 comments on commit cce91de

Please sign in to comment.