Commit a98af82f by Ramesh Babu Puvvadi

Initial commit

parent 1e1d27d5
......@@ -47,7 +47,7 @@ android {
applicationId "com.example.photoshoot"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
......
......@@ -5,4 +5,11 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
</manifest>
......@@ -2,6 +2,12 @@
package="com.example.photoshoot">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
<application
android:label="photoshoot"
......
......@@ -5,4 +5,11 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.intent.action.TTS_SERVICE" />
</intent>
</queries>
</manifest>
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
......
......@@ -9,6 +9,8 @@ PODS:
- Flutter (1.0.0)
- flutter_barcode_scanner (2.0.0):
- Flutter
- flutter_tts (0.0.1):
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
......@@ -20,14 +22,20 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- platform_device_id (0.0.1):
- Flutter
- Reachability (3.2)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- speech_to_text (0.0.1):
- Flutter
- Try
- Toast (4.0.0)
- TOCropViewController (2.6.1)
- Try (2.1.1)
DEPENDENCIES:
- connectivity (from `.symlinks/plugins/connectivity/ios`)
......@@ -35,18 +43,22 @@ DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
- flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)
- flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- platform_device_id (from `.symlinks/plugins/platform_device_id/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
SPEC REPOS:
trunk:
- Reachability
- Toast
- TOCropViewController
- Try
EXTERNAL SOURCES:
connectivity:
......@@ -59,6 +71,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_barcode_scanner:
:path: ".symlinks/plugins/flutter_barcode_scanner/ios"
flutter_tts:
:path: ".symlinks/plugins/flutter_tts/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
image_cropper:
......@@ -67,10 +81,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
platform_device_id:
:path: ".symlinks/plugins/platform_device_id/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios"
SPEC CHECKSUMS:
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
......@@ -78,16 +96,20 @@ SPEC CHECKSUMS:
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_barcode_scanner: 7a1144744c28dc0c57a8de7218ffe5ec59a9e4bf
flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
fluttertoast: 48c57db1b71b0ce9e6bba9f31c940ff4b001293c
image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
PODFILE CHECKSUM: 1119d1c4de683e572c54a0dff7a594860d13ec5e
COCOAPODS: 1.13.0
COCOAPODS: 1.15.2
......@@ -7,7 +7,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Photoshoot</string>
<string>GrcCaptureImages</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
......@@ -15,7 +15,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>photoshoot</string>
<string>GrcCaptureImages</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
......@@ -42,6 +42,8 @@
<false/>
<key>UIStatusBarStyle</key>
<string></string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Speech recognition allows you to use text-to-speech and speech</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
......
import 'dart:convert';
import 'dart:core';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart' as http;
import 'package:photoshoot/Model/NamedFile.dart';
import '../Model/LoginResponse.dart';
import '../Model/NamedFile.dart';
import '../Model/Store.dart';
import '../Model/Upload.dart';
class RemoteData {
String baseUrl = 'http://posapi.plutokm.com/';
String storeid = 'http://posapi.plutokm.com/login/getStoresMappedToUser/';
String loginurl = 'http://posapi.plutokm.com/login/doLogin';
String logout = 'http://posapi.plutokm.com/login/doLogout/';
String loginurl= 'http://posapi.plutokm.com/login/doLogin';
String logout = 'http://posapi.plutokm.com/login/doLogout/';
String speechtotext = 'http://192.168.65.148:5113/mobile_response/';
String validbarcode =
'https://plutokm.com/tools/MobileApps_onlyklm_MagicCommonBackend/is_barcode_alreadygrcd.php?barcode=';
String uploadimages =
'https://plutokm.com/tools/MobileApps_onlyklm_MagicCommonBackend/catalog_capture_images.php';
String type = "Content-Type";
String type = "Content-Type";
String appjson = "application/json";
//8978968396
//Stores List Request GET Method
Future<List<Datum>?> getStoreList(String id) async {
......@@ -42,8 +45,7 @@ class RemoteData {
}
//Login Request POST Method
Future<LoginResponse> getLoginRequest(
String email, String pass, int storeId) async {
Future<LoginResponse> getLoginRequest(String email, String pass, int storeId) async {
Map<String, dynamic> body = {
'emp_id': email,
'password': pass,
......@@ -60,6 +62,25 @@ class RemoteData {
}
}
Future<String> getSpeechResponse(String? text) async {
var header = {type: appjson};
var res = '';
var response = await http.post(
Uri.parse('$speechtotext$text'),
headers: header,
);
if (kDebugMode) {
print(response.statusCode);
}
if (response.statusCode == 200) {
res = response.body;
if (kDebugMode) {
print('Logout : $res');
}
}
return res;
}
//Logout Request GET Method
Future<String> getLogout(String? id) async {
var header = {type: appjson};
......@@ -85,7 +106,11 @@ class RemoteData {
type: appjson,
});
request.fields['barcode'] = barcode;
request.fields['APPOS'] = 'IOS';
if (Platform.isAndroid) {
request.fields['APPOS'] = 'ANDROID';
} else if (Platform.isIOS) {
request.fields['APPOS'] = 'IOS';
}
request.fields['DeviceModel'] = model;
request.fields['DeviceUUID'] = '';
request.fields['Channels'] = channels;
......
import 'dart:async';
import 'dart:io';
import 'package:GrccaptureImages/Screen/Constants.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart' show FlutterBarcodeScanner, ScanMode;
import 'package:photoshoot/Screen/Constants.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'
show FlutterBarcodeScanner, ScanMode;
@immutable
class Home extends StatefulWidget {
const Home({super.key});
@override
State<StatefulWidget> createState() => _Home();
}
......@@ -37,14 +38,6 @@ class _Home extends State<Home> {
imagefile = File(image!.path);
} else {
image = await _picker.pickImage(source: ImageSource.camera);
//Toast.show('Enter UserId', duration: 2000, gravity: Toast.center);
/* Fluttertoast.showToast(
msg: 'Enter UserId',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
textColor: Colors.black,
fontSize: 16.0); */
}
}
}
......@@ -65,10 +58,10 @@ class _Home extends State<Home> {
}
setState(() {
_barcodevalue.text = barcodeScanRes;
//if (barcodeScanRes == '-1') {
// _barcodevalue.text = '';
//} else {
// _barcodevalue.text = barcodeScanRes;
//if(barcodeScanRes == '-1') {
// _barcodevalue.text = '';
//}else{
// _barcodevalue.text = barcodeScanRes;
// if (RegExp(r'^[0-9]+$').hasMatch(_barcodevalue.text)) {
// _barcodevalue.text = '';
// startBarcodeScanStream();
......
......@@ -6,14 +6,16 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'package:photoshoot/Model/NamedFile.dart';
import 'package:photoshoot/Model/Upload.dart';
import 'package:photoshoot/Remote/RemoteData.dart';
import 'package:photoshoot/Screen/Constants.dart';
import 'package:photoshoot/Screen/SignUp.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import '../Model/NamedFile.dart';
import '../Model/Upload.dart';
import '../Remote/RemoteData.dart';
import 'Constants.dart';
import 'SignUp.dart';
@immutable
class MultipleImages extends StatefulWidget {
const MultipleImages({super.key});
......@@ -202,20 +204,28 @@ class _MultipleImages extends State<MultipleImages> {
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(title: const Text('Multiple Images'), actions: [
IconButton(
icon: const Icon(Icons.logout),
onPressed: () async {
bool valid = await Constants.checkInternetConnectivity();
if (valid) {
signOut();
} else {
Constants('Upload Images', 'Check your internet connection')
.showAlertDialog(context);
}
},
),
]),
appBar: AppBar(
title: const Text('GRC Capture Images'),
backgroundColor: const Color.fromARGB(255, 23, 94, 228),
titleTextStyle: const TextStyle(color: Colors.white, fontSize: 22),
actions: [
IconButton(
icon: const Icon(
Icons.logout,
color: Colors.white,
),
onPressed: () async {
bool valid = await Constants.checkInternetConnectivity();
if (valid) {
signOut();
} else {
Constants('Upload Images', 'Check your internet connection')
.showAlertDialog(context);
}
},
),
],
),
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.all(10.0),
......@@ -439,8 +449,8 @@ class _MultipleImages extends State<MultipleImages> {
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
minimumSize: const Size.fromHeight(50),
backgroundColor: const Color.fromARGB(255, 23, 94, 228),
minimumSize: const Size.fromHeight(55),
),
onPressed: () async {
int count = 0;
......@@ -659,7 +669,6 @@ class _MultipleImages extends State<MultipleImages> {
shoot = 'KANCHIVML';
}
}
if (_isChecked2) {
if (shoot != null) {
shoot = '$shoot,BRANDMANDIR';
......@@ -682,31 +691,15 @@ class _MultipleImages extends State<MultipleImages> {
var storeId = prefs.getString("store_Id");
String? token = prefs.getString('userToken');
String? model = '';
// /* String uniqueDeviceId = (await PlatformDeviceId.getDeviceId)!;
// if (Platform.isAndroid) {
// final info = await DeviceInfoPlugin().iosInfo;
// Model = info.model!;
// print(info.model);
// //print(info.systemVersion);
// }
// if (Platform.isIOS) {
// final info = await DeviceInfoPlugin().iosInfo;
// print(info.utsname.machine); // "iPhone15,2"
// print(info.utsname.version); // "iPhone 14 Pro"
// }
if (kDebugMode) {
print('Selected Shoot :$shoot');
}
showDialog(
context: context,
builder: (context) {
return const Center(
child: CircularProgressIndicator());
});
Upload? upload;
if (token != null) {
upload = await RemoteData().uploadImages(
......@@ -794,7 +787,8 @@ class _MultipleImages extends State<MultipleImages> {
}
//_showMyDialog(context);
},
child: const Text('Upload Images'),
child: const Text('Upload Images',
style: TextStyle(fontSize: 16, color: Colors.white)),
),
],
),
......
import 'package:flutter/cupertino.dart';
import 'package:photoshoot/Screen/PieChart.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'PieChart.dart';
class MyPieChart extends StatelessWidget {
final List<ChartData> data;
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photoshoot/Screen/MyPieChart.dart';
import 'MyPieChart.dart';
class PieChart extends StatelessWidget {
@override
......
......@@ -59,8 +59,6 @@ class _SignUpState extends State<SignUp> {
super.dispose();
}
//
@override
void initState() {
super.initState();
......@@ -69,26 +67,26 @@ class _SignUpState extends State<SignUp> {
if (item) {
if (_focusNode.hasFocus) {
bool isInternetConnected =
await Constants.checkInternetConnectivity();
if(isInternetConnected) {
showDialog(
await Constants.checkInternetConnectivity();
if (isInternetConnected) {
showDialog(
context: context,
builder: (context) {
return const Center(child: CircularProgressIndicator());
}
);
item = false;
storesList = await RemoteData().getStoreList(_email.text);
setState(() {
Navigator.pop(context);
storesList = storesList;
});
);
item = false;
storesList = await RemoteData().getStoreList(_email.text);
setState(() {
Navigator.pop(context);
storesList = storesList;
});
} else {
Constants('LoginPage', 'Check your network connection')
.showAlertDialog(context);
Constants('LoginPage', 'check your network connection')
.showAlertDialog(context);
}
} else {
//_focusNode.unfocus();
//_focusNode.unfocus();
}
}
} else {
......@@ -105,12 +103,15 @@ class _SignUpState extends State<SignUp> {
}
});
}
final FocusNode _focusNode = FocusNode();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Login '),
backgroundColor: const Color.fromARGB(255, 23, 94, 228),
titleTextStyle: const TextStyle(color: Colors.white, fontSize: 22),
),
resizeToAvoidBottomInset: false,
body: Container(
......@@ -166,6 +167,10 @@ class _SignUpState extends State<SignUp> {
),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(255, 23, 94, 228),
minimumSize: const Size.fromHeight(60),
),
onPressed: () async {
if (_email.text.isEmpty && _pass.text.isEmpty) {
Constants('Login ', 'Enter email and password')
......@@ -194,7 +199,8 @@ class _SignUpState extends State<SignUp> {
? const CircularProgressIndicator(
color: Colors.amber,
)
: const Text('Sign In'),
: const Text('Sign In',
style: TextStyle(fontSize: 16, color: Colors.white)),
),
),
),
......
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_recognition_result.dart';
import 'package:speech_to_text/speech_to_text.dart';
import '../Remote/RemoteData.dart';
class SpeechSampleApp extends StatefulWidget {
const SpeechSampleApp({Key? key}) : super(key: key);
@override
State<SpeechSampleApp> createState() => _SpeechSampleAppState();
}
/// An example that demonstrates the basic functionality of the
/// SpeechToText plugin for using the speech recognition capability
/// of the underlying platform.
class _SpeechSampleAppState extends State<SpeechSampleApp> {
bool _hasSpeech = false;
bool _logEvents = false;
bool _onDevice = false;
FlutterTts ftts = FlutterTts();
final TextEditingController _pauseForController =
TextEditingController(text: '5');
final TextEditingController _listenForController =
TextEditingController(text: '30');
double level = 0.0;
double minSoundLevel = 50000;
double maxSoundLevel = -50000;
String lastWords = '';
String lastError = '';
String lastStatus = '';
String _currentLocaleId = '';
SpeechToText speech = SpeechToText();
List<Data>? data = [];
@override
void initState() {
initSpeechState();
if (Platform.isAndroid) {
checkAndRequestMicrophonePermission();
}
if (Platform.isIOS) {
//IOS requires this permission to record audio, otherwise it will fail silently.
}
super.initState();
}
Future<void> checkAndRequestMicrophonePermission() async {
PermissionStatus status = await Permission.microphone.status;
if (status.isGranted) {
if (kDebugMode) {
print('Microphone permission is granted.');
}
} else {
status = await Permission.microphone.request();
if (status.isGranted) {
if (kDebugMode) {
print('Microphone permission is granted.');
}
} else {
if (kDebugMode) {
print('Microphone permission is denied.');
}
}
}
}
/// This initializes SpeechToText. That only has to be done
/// once per application, though calling it again is harmless
/// it also does nothing. The UX of the sample app ensures that
/// it can only be called once.
Future<void> initSpeechState() async {
_logEvent('Initialize');
try {
var hasSpeech = await speech.initialize(
onError: errorListener,
onStatus: statusListener,
debugLogging: _logEvents,
);
if (hasSpeech) {
var systemLocale = await speech.systemLocale();
_currentLocaleId = systemLocale?.localeId ?? '';
}
if (!mounted) return;
setState(() {
_hasSpeech = hasSpeech;
});
} catch (e) {
setState(() {
lastError = 'Speech recognition failed: ${e.toString()}';
_hasSpeech = false;
});
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Speech to Text Example'),
),
body: Column(children: [
//const HeaderWidget(),
Column(
children: <Widget>[
// InitSpeechWidget(_hasSpeech, initSpeechState),
SpeechControlWidget(
lastWords,
level,
_hasSpeech,
speech.isListening,
startListening,
stopListening,
cancelListening),
// SessionOptionsWidget(
// _currentLocaleId,
// _switchLang,
// _localeNames,
// _logEvents,
// _switchLogging,
// _pauseForController,
// _listenForController,
// _onDevice,
// _switchOnDevice,
// ),
],
),
// Expanded(
// flex: 4,
// child: RecognitionResultsWidget(lastWords: lastWords, level: level),
// ),
// Expanded(
// flex: 1,
// child: ErrorWidget(lastError: lastError),
// ),
//SpeechStatusWidget(speech: speech),
]),
),
);
}
// This is called each time the users wants to start a new speech
// recognition session
void startListening() {
_logEvent('start listening');
lastWords = '';
lastError = '';
final pauseFor = int.tryParse(_pauseForController.text);
final listenFor = int.tryParse(_listenForController.text);
final options = SpeechListenOptions(
onDevice: _onDevice,
listenMode: ListenMode.confirmation,
cancelOnError: true,
partialResults: true,
autoPunctuation: true,
enableHapticFeedback: true);
// Note that `listenFor` is the maximum, not the minimum, on some
// systems recognition will be stopped before this value is reached.
// Similarly `pauseFor` is a maximum not a minimum and may be ignored
// on some devices.
speech.listen(
onResult: resultListener,
listenFor: Duration(seconds: listenFor ?? 30),
pauseFor: Duration(seconds: pauseFor ?? 3),
localeId: _currentLocaleId,
onSoundLevelChange: soundLevelListener,
listenOptions: options,
);
setState(() {});
}
void stopListening() {
_logEvent('stop');
speech.stop();
setState(() {
level = 0.0;
});
}
void cancelListening() {
_logEvent('cancel');
speech.cancel();
setState(() {
level = 0.0;
});
}
// This callback is invoked each time new recognition results are
// available after `listen` is called.
void resultListener(SpeechRecognitionResult result) {
_logEvent(
'Result listener final: ${result.finalResult}, words: ${result.recognizedWords}');
setState(() async {
//lastWords = '${result.recognizedWords} - ${result.finalResult}';
lastWords = result.recognizedWords;
if (result.finalResult) {
if (kDebugMode) {
print('Final Result: $lastWords');
}
String res = await RemoteData().getSpeechResponse(lastWords);
//var response = jsonDecode(res);
Map<String, dynamic> jsonResponse = jsonDecode(res);
List<dynamic> output1 = jsonResponse['output1'];
if (output1.isNotEmpty) {
Map<String, dynamic> firstItem = output1[0];
String zoneValue = firstItem['ZONE'];
Data dataInstance = Data(question: lastWords, answer: zoneValue);
await ftts.setLanguage("en-US");
await ftts.setSpeechRate(0.5); //speed of speech
await ftts.setVolume(1.0); //volume of speech
await ftts.setPitch(2.0); //pitc of sound
//await ftts.setVoice('en-us-x-sfg#male_1-local');
//play text to sp
var result = await ftts.speak(zoneValue);
if (kDebugMode) {
print(result);
}
if (result == 1) {
if (kDebugMode) {
print("Flutter Campus speaking...");
}
} else {
if (kDebugMode) {
print("Flutter Campus not speaking...");
}
}
if (kDebugMode) {
print("ZONE value: $zoneValue");
}
data!.add(dataInstance);
} else {
if (kDebugMode) {
print("No items in 'output1'");
}
}
if (kDebugMode) {
print('Speech Text Resposne =====>$res');
}
// Create a list to hold instances of Data
//List<Data> dataList = [];
// Add the instance to the list
SpeechControlWidget.UpdateList(data!);
setState(() {
data = data;
});
}
});
}
void soundLevelListener(double level) {
minSoundLevel = min(minSoundLevel, level);
maxSoundLevel = max(maxSoundLevel, level);
// _logEvent('sound level $level: $minSoundLevel - $maxSoundLevel ');
setState(() {
this.level = level;
});
}
void errorListener(SpeechRecognitionError error) {
_logEvent(
'Received error status: $error, listening: ${speech.isListening}');
setState(() {
lastError = '${error.errorMsg} - ${error.permanent}';
});
}
void statusListener(String status) {
_logEvent(
'Received listener status: $status, listening: ${speech.isListening}');
setState(() {
lastStatus = status;
});
}
//void _switchLang(selectedVal){
// setState((){
// _currentLocaleId = selectedVal;
// });
// debugPrint(selectedVal);
//}
void _logEvent(String eventDescription) {
if (_logEvents) {
var eventTime = DateTime.now().toIso8601String();
debugPrint('$eventTime $eventDescription');
}
}
//void _switchLogging(bool? val){
// setState(() {
// _logEvents = val ?? false;
// });
//}
// void _switchOnDevice(bool? val) {
// setState(() {
// _onDevice = val ?? false;
// });
// }'
}
/// Displays the most recently recognized words and the sound level.
class RecognitionResultsWidget extends StatelessWidget {
const RecognitionResultsWidget({
Key? key,
required this.lastWords,
required this.level,
}) : super(key: key);
final String lastWords;
final double level;
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
const Center(
child: Text(
'Recognized Words',
style: TextStyle(fontSize: 22.0),
),
),
Expanded(
child: Stack(
children: <Widget>[
Container(
color: Theme.of(context).secondaryHeaderColor,
child: Center(
child: Text(
lastWords,
textAlign: TextAlign.start,
),
),
),
Positioned.fill(
bottom: 10,
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 40,
height: 40,
alignment: Alignment.center,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
blurRadius: .26,
spreadRadius: level * 1.5,
color: Colors.black.withOpacity(.05))
],
color: Colors.white,
borderRadius: const BorderRadius.all(Radius.circular(50)),
),
child: IconButton(
icon: const Icon(Icons.mic),
onPressed: () {},
),
),
),
),
],
),
),
],
);
}
}
class HeaderWidget extends StatelessWidget {
const HeaderWidget({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Center(
child: Text(
'Speech recognition available',
style: TextStyle(fontSize: 22.0),
),
);
}
}
/// Display the current error status from the speech
/// recognizer
class ErrorWidget extends StatelessWidget {
const ErrorWidget({
Key? key,
required this.lastError,
}) : super(key: key);
final String lastError;
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
const Center(
child: Text(
'Error Status',
style: TextStyle(fontSize: 22.0),
),
),
Center(
child: Text(lastError),
),
],
);
}
}
/// Controls to start and stop speech recognition
class SpeechControlWidget extends StatelessWidget {
// final List<Data>? datalist;
// SpeechControlWidget.withListeners({Key? key, this.datalist}) : super(key: key);
SpeechControlWidget(this.total, this.level, this.hasSpeech, this.isListening,
this.startListening, this.stopListening, this.cancelListening,
{Key? key})
: super(key: key);
final double level;
final String total;
final bool hasSpeech;
final bool isListening;
final void Function() startListening;
final void Function() stopListening;
final void Function() cancelListening;
static List<Data>? data1 = [];
//final TextEditingController _dateTime = TextEditingController();
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.80,
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 249, 248, 248),
border: Border.all(
style: BorderStyle.solid,
color: const Color.fromARGB(255, 164, 149, 120),
),
borderRadius: BorderRadius.circular(7),
),
child: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: data1?.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.fromLTRB(5, 5, 1, 5),
//height: 60,
//color: const Color.fromARGB(255, 16, 16, 16),
child: SizedBox(
width: MediaQuery.of(context).size.width / 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
data1![index].question,
textAlign: TextAlign.left,
softWrap: true,
maxLines: 4,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Text(
data1![index].answer,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.right,
maxLines: 4,
),
),
],
),
],
),
),
);
},
),
),
],
),
),
),
TextFormField(
// style: Constants.Titletextstyle,
// enabled: false,
readOnly: true,
controller: TextEditingController(text: total),
onTap: () {},
decoration: InputDecoration(
// border: Border.all(color: Colors.grey),
filled: true,
fillColor: const Color.fromARGB(255, 250, 248, 248),
contentPadding:
const EdgeInsets.symmetric(vertical: 15, horizontal: 10),
isDense: true,
hintText: '',
border: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 0.0),
borderRadius: BorderRadius.circular(2.0),
),
suffixIcon: IconButton(
icon: const Icon(Icons.mic),
onPressed: () {
startListening();
},
),
),
),
],
),
],
);
}
static UpdateList(List<Data> dataList) {
// setState(() {
// data = dataList;
// });
data1 = dataList;
print(dataList);
//data = dataList;
}
}
class Data {
String question = ''; // Use camelCase for variable names
String answer = ''; // Use camelCase for variable names
// Constructor
Data({required this.question, required this.answer});
// Named constructor for creating an instance from a Map
Data.fromMap(Map<String, dynamic> map)
: question = map['Question'] ?? '',
answer = map['Answer'] ?? '';
// Convert the object to a Map
Map<String, dynamic> toMap() {
return {
'Question': question,
'Answer': answer,
};
}
}
class InitSpeechWidget extends StatelessWidget {
const InitSpeechWidget(this.hasSpeech, this.initSpeechState, {Key? key})
: super(key: key);
final bool hasSpeech;
final Future<void> Function() initSpeechState;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
TextButton(
onPressed: hasSpeech ? null : initSpeechState,
child: const Text('Initialize'),
),
],
);
}
}
class SpeechStatusWidget extends StatelessWidget {
const SpeechStatusWidget({
Key? key,
required this.speech,
}) : super(key: key);
final SpeechToText speech;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 20),
color: Theme.of(context).colorScheme.background,
child: Center(
child: speech.isListening
? const Text(
"I'm listening...",
style: TextStyle(fontWeight: FontWeight.bold),
)
: const Text(
'Not listening',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
);
}
}
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:photoshoot/Screen/MultipleImages.dart';
import 'package:photoshoot/Screen/SignUp.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'MultipleImages.dart';
import 'SignUp.dart';
class UserPreferences {
static const String isLoggedInKey = 'isLoggedIn';
......
import 'package:flutter/material.dart';
import 'package:photoshoot/Screen/SplashScreen.dart';
import 'Screen/SplashScreen.dart';
void main() => runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
......
......@@ -7,16 +7,20 @@ import Foundation
import connectivity_macos
import device_info_plus
import flutter_tts
import path_provider_foundation
import platform_device_id
import platform_device_id_macos
import shared_preferences_foundation
import speech_to_text_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PlatformDeviceIdMacosPlugin.register(with: registry.registrar(forPlugin: "PlatformDeviceIdMacosPlugin"))
PlatformDeviceIdMacosPlugin.register(with: registry.registrar(forPlugin: "PlatformDeviceIdMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SpeechToTextMacosPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextMacosPlugin"))
}
......@@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8"
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
url: "https://pub.dev"
source: hosted
version: "47.0.0"
version: "64.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80"
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
url: "https://pub.dev"
source: hosted
version: "4.7.0"
version: "6.2.0"
archive:
dependency: transitive
description:
......@@ -117,10 +117,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
connectivity:
dependency: "direct main"
description:
......@@ -307,6 +307,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_tts:
dependency: "direct main"
description:
name: flutter_tts
sha256: cbb3fd43b946e62398560235469e6113e4fe26c40eab1b7cb5e7c417503fb3a8
url: "https://pub.dev"
source: hosted
version: "3.8.5"
flutter_web_plugins:
dependency: transitive
description: flutter
......@@ -500,10 +508,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
mime:
dependency: transitive
description:
......@@ -592,6 +600,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.5"
pedantic:
dependency: transitive
description:
name: pedantic
sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: bc56bfe9d3f44c3c612d8d393bd9b174eb796d706759f9b495ac254e4294baa5
url: "https://pub.dev"
source: hosted
version: "10.4.5"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "59c6322171c29df93a22d150ad95f3aa19ed86542eaec409ab2691b8f35f9a47"
url: "https://pub.dev"
source: hosted
version: "10.3.6"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
url: "https://pub.dev"
source: hosted
version: "9.1.4"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4"
url: "https://pub.dev"
source: hosted
version: "3.12.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
url: "https://pub.dev"
source: hosted
version: "0.1.3"
petitparser:
dependency: transitive
description:
......@@ -821,14 +877,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.0"
speech_to_text:
dependency: "direct main"
description:
name: speech_to_text
sha256: "57fef1d41bdebe298e84842c89bb4ac91f31cdbec7830c8cb1fc6b91d03abd42"
url: "https://pub.dev"
source: hosted
version: "6.6.0"
speech_to_text_macos:
dependency: transitive
description:
name: speech_to_text_macos
sha256: e685750f7542fcaa087a5396ee471e727ec648bf681f4da83c84d086322173f6
url: "https://pub.dev"
source: hosted
version: "1.1.0"
speech_to_text_platform_interface:
dependency: transitive
description:
name: speech_to_text_platform_interface
sha256: a0df1a907091ea09880077dc25aae02af9f79811264e6e97ddb08639b7f771c2
url: "https://pub.dev"
source: hosted
version: "2.2.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
state_notifier:
dependency: transitive
description:
......@@ -841,10 +921,10 @@ packages:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
......@@ -865,26 +945,26 @@ packages:
dependency: transitive
description:
name: test
sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46"
sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f
url: "https://pub.dev"
source: hosted
version: "1.24.3"
version: "1.24.9"
test_api:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
test_core:
dependency: transitive
description:
name: test_core
sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e"
sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a
url: "https://pub.dev"
source: hosted
version: "0.5.3"
version: "0.5.9"
typed_data:
dependency: transitive
description:
......@@ -921,10 +1001,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:
......@@ -974,5 +1054,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=3.1.0-185.0.dev <3.7.0"
flutter: ">=3.3.0"
dart: ">=3.2.0-194.0.dev <3.7.0"
flutter: ">=3.10.0"
name: photoshoot
name: GrccaptureImages
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
......@@ -48,6 +48,10 @@ dependencies:
carousel_slider: ^4.2.1
flutter_spinkit: ^5.1.0
flutter_launcher_icons: ^0.11.0
permission_handler: ^10.4.0
speech_to_text: ^6.6.0
flutter_tts: ^3.5.1
#audio_session: ^2.1.0
dev_dependencies:
flutter_test:
......
......@@ -6,9 +6,15 @@
#include "generated_plugin_registrant.h"
#include <flutter_tts/flutter_tts_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <platform_device_id_windows/platform_device_id_windows_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
FlutterTtsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterTtsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
PlatformDeviceIdWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PlatformDeviceIdWindowsPlugin"));
}
......@@ -3,6 +3,8 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
flutter_tts
permission_handler_windows
platform_device_id_windows
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment