Commit 03cd7684 by Ramesh Babu Puvvadi

added voice record

parent 5d111162
......@@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 33
compileSdkVersion 34
ndkVersion flutter.ndkVersion
compileOptions {
......@@ -48,7 +48,7 @@ android {
applicationId "com.sopt.storemonitor"
// 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 21
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
......
......@@ -9,10 +9,16 @@
<!-- <uses-permission android:name="android.permission.CALL_PHONE" /> -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- <uses-permission android:name="android.permission.SEND_SMS"/> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"/>
......
......@@ -6,6 +6,9 @@
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
......
......@@ -10,6 +10,10 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!-- <uses-permission android:name="android.permission.CALL_PHONE" /> -->
<!-- <uses-permission android:name="android.permission.SEND_SMS"/> -->
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
......
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.21'
repositories {
google()
mavenCentral()
......
......@@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
......@@ -2,7 +2,7 @@
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
platform :ios, '11.0'
platform :ios, '12.0'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
......@@ -39,8 +39,25 @@ target 'Runner' do
# end
end
# post_install do |installer|
# installer.pods_project.targets.each do |target|
# flutter_additional_ios_build_settings(target)
# end
# end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'PERMISSION_CAMERA=1',
'PERMISSION_MICROPHONE=1',
'PERMISSION_PHOTOS=1',
'PERMISSION_MEDIA_LIBRARY=1',
'PERMISSION_STORAGE=1',
]
end
end
end
end
\ No newline at end of file
PODS:
- audio_session (0.0.1):
- Flutter
- connectivity (0.0.1):
- Flutter
- Reachability
- Firebase/CoreOnly (10.15.0):
- FirebaseCore (= 10.15.0)
- Firebase/Messaging (10.15.0):
- Firebase/CoreOnly (10.22.0):
- FirebaseCore (= 10.22.0)
- Firebase/Messaging (10.22.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.15.0)
- firebase_core (2.16.0):
- Firebase/CoreOnly (= 10.15.0)
- FirebaseMessaging (~> 10.22.0)
- firebase_core (2.27.0):
- Firebase/CoreOnly (= 10.22.0)
- Flutter
- firebase_messaging (14.6.8):
- Firebase/Messaging (= 10.15.0)
- firebase_messaging (14.7.19):
- Firebase/Messaging (= 10.22.0)
- firebase_core
- Flutter
- FirebaseCore (10.15.0):
- FirebaseCore (10.22.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreInternal (10.15.0):
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreInternal (10.23.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.15.0):
- FirebaseInstallations (10.23.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.15.0):
- FirebaseMessaging (10.22.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleDataTransport (~> 9.3)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30910.0, >= 2.30908.0)
- nanopb (< 2.30911.0, >= 2.30908.0)
- Flutter (1.0.0)
- flutter_inappwebview (0.0.1):
- Flutter
......@@ -46,42 +48,57 @@ PODS:
- Flutter
- flutter_tts (0.0.1):
- Flutter
- GoogleDataTransport (9.2.5):
- fluttertoast (0.0.2):
- Flutter
- Toast
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.11.5):
- GoogleUtilities/AppDelegateSwizzler (7.13.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.11.5):
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (7.13.0):
- GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.11.5):
- GoogleUtilities/Logger (7.13.0):
- GoogleUtilities/Environment
- GoogleUtilities/Network (7.11.5):
- GoogleUtilities/Privacy
- GoogleUtilities/Network (7.13.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.11.5)"
- GoogleUtilities/Reachability (7.11.5):
- "GoogleUtilities/NSData+zlib (7.13.0)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (7.13.0)
- GoogleUtilities/Reachability (7.13.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.5):
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (7.13.0):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- just_audio (0.0.1):
- Flutter
- nanopb (2.30910.0):
- nanopb/decode (= 2.30910.0)
- nanopb/encode (= 2.30910.0)
- nanopb/decode (2.30910.0)
- nanopb/encode (2.30910.0)
- OrderedSet (5.0.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- PromisesObjC (2.3.1)
- Reachability (3.2)
- PromisesObjC (2.4.0)
- Reachability (3.7.5)
- record (0.0.1):
- Flutter
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
......@@ -90,6 +107,12 @@ PODS:
- speech_to_text (0.0.1):
- Flutter
- Try
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- text_to_speech (0.0.1):
- Flutter
- Toast (4.1.0)
- Try (2.1.1)
- url_launcher_ios (0.0.1):
- Flutter
......@@ -101,6 +124,7 @@ PODS:
- Flutter
DEPENDENCIES:
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
......@@ -108,12 +132,17 @@ DEPENDENCIES:
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_sms (from `.symlinks/plugins/flutter_sms/ios`)
- flutter_tts (from `.symlinks/plugins/flutter_tts/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- just_audio (from `.symlinks/plugins/just_audio/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- record (from `.symlinks/plugins/record/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- text_to_speech (from `.symlinks/plugins/text_to_speech/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
......@@ -132,9 +161,12 @@ SPEC REPOS:
- OrderedSet
- PromisesObjC
- Reachability
- Toast
- Try
EXTERNAL SOURCES:
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
firebase_core:
......@@ -149,18 +181,28 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_sms/ios"
flutter_tts:
:path: ".symlinks/plugins/flutter_tts/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
just_audio:
:path: ".symlinks/plugins/just_audio/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
record:
:path: ".symlinks/plugins/record/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
text_to_speech:
:path: ".symlinks/plugins/text_to_speech/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
......@@ -171,36 +213,43 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS:
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
Firebase: 66043bd4579e5b73811f96829c694c7af8d67435
firebase_core: 77172d0a9d8d19d07606e24406e4c2fc14d3265b
firebase_messaging: 6aff54d420b7ce7080c26dd131b08bc632666852
FirebaseCore: 2cec518b43635f96afe7ac3a9c513e47558abd2e
FirebaseCoreInternal: 2f4bee5ed00301b5e56da0849268797a2dd31fb4
FirebaseInstallations: cae95cab0f965ce05b805189de1d4c70b11c76fb
FirebaseMessaging: 0c0ae1eb722ef0c07f7801e5ded8dccd1357d6d4
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Firebase: 797fd7297b7e1be954432743a0b3f90038e45a71
firebase_core: 100945864b4aedce3cfef0c62ab864858bf013cf
firebase_messaging: e65050bf9b187511d80ea3a4de7cf5573d2c7543
FirebaseCore: 0326ec9b05fbed8f8716cddbf0e36894a13837f7
FirebaseCoreInternal: 6a292e6f0bece1243a737e81556e56e5e19282e3
FirebaseInstallations: 42d6ead4605d6eafb3b6683674e80e18eb6f2c35
FirebaseMessaging: 9f71037fd9db3376a4caa54e5a3949d1027b4b6e
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
flutter_sms: 91ce41530f55c85d6524d82307a5d555844c086a
flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
nanopb: 438bc412db1928dac798aa6fd75726007be04262
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
Reachability: 44d15955cdaee6cef699877e1f6647dd6f6698cc
record: cae05d8dd3cdb1dea3511b20e5a5811a1ae00d0d
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
text_to_speech: 8669facdbd5b72d2939b810493defd991634f6f9
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
PODFILE CHECKSUM: dd31c1bf6b51c37b388429451c263d4920d5d285
PODFILE CHECKSUM: f5c401d70a85c1a2bcb5bb955d432bb93ef7870b
COCOAPODS: 1.13.0
COCOAPODS: 1.15.2
......@@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
// import UIKit
// import Flutter
// @main
// @objc class AppDelegate: FlutterAppDelegate {
// override func application(
// _ application: UIApplication,
// didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
// ) -> Bool {
// GeneratedPluginRegistrant.register(with: self)
// return super.application(application, didFinishLaunchingWithOptions: launchOptions)
// }
// }
import AVFoundation
import UIKit
import Flutter
@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Set up the audio session
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.defaultToSpeaker, .allowBluetooth])
try audioSession.setActive(true)
} catch {
print("Failed to set up audio session: \(error.localizedDescription)")
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
......@@ -14,13 +16,14 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="121" y="-2"/>
</scene>
</scenes>
</document>
......@@ -33,14 +33,26 @@
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tel</string>
</array>
<key>NSCameraUsageDescription</key>
<string>Camera access is required to capture</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>We need access to add photos to your library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required to dial a call</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Speech recognition allows you to use text-to-speech and speech</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need access to your location to provide better services.</string>
<key>NSContactsUsageDescription</key>
<string>This app requires access to phone calls to function properly.</string>
<key>REVERSED_CLIENT_ID</key>
<string>d6689d068c6b4290aba903</string>
......
class Store {
final String region;
final String storename;
Store({required this.region, required this.storename});
factory Store.fromJson(Map<String, dynamic> json) {
return Store(
region: json['region'] ?? 'Unknown Region',
storename: json['storename'] ?? 'Unknown Store',
);
}
}
......@@ -43,16 +43,20 @@ class UserResponse {
class Store {
Store({
required this.region,
required this.storename,
});
String storename;
String region;
factory Store.fromJson(Map<String, dynamic> json) => Store(
storename: json["storename"],
region: json["region"],
);
Map<String, dynamic> toJson() => {
"storename": storename,
"region": region,
};
}
// import 'dart:io';
// import 'package:flutter/foundation.dart';
// import 'package:flutter/material.dart';
// import 'package:permission_handler/permission_handler.dart';
// import 'package:record/record.dart';
// import '../Services/RemoteData.dart';
// class AudioRecorder extends StatefulWidget {
// @override
// _AudioRecorderState createState() => _AudioRecorderState();
// }
// class _AudioRecorderState extends State<AudioRecorder> {
// final Record _record = Record();
// bool isRecording = false;
// @override
// void initState() {
// super.initState();
// _checkPermissions();
// }
// Future<void> _checkPermissions() async {
// if (await Permission.microphone.isGranted) {
// // Do nothing
// } else {
// await Permission.microphone.request();
// }
// }
// Future<void> startRecording() async {
// if (await Permission.microphone.isGranted) {
// isRecording = true;
// try {
// if (await _record.hasPermission()) {
// await _record.start();
// } else {}
// } catch (e) {
// print('Error starting recording: $e');
// }
// } else {
// print("Permission not granted");
// }
// }
// Future<void> stopRecording() async {
// if (await _record.isRecording()) {
// try {
// String? path = await _record.stop();
// if (path == null) {
// return;
// }
// isRecording = false;
// Uri fileUri = Uri.parse(path);
// File recordedFile = File.fromUri(fileUri);
// bool fileExists = await recordedFile.exists();
// if (fileExists) {
// if (kDebugMode) {
// print('Recording saved Data ====> : $path');
// }
// String res = await RemoteData().getVoiceResponse(recordedFile, '78');
// if (kDebugMode) {
// print(res);
// }
// return;
// } else {
// if (kDebugMode) {
// print('File does not exist at path: $path');
// }
// }
// } catch (e) {
// if (kDebugMode) {
// print('Error stopping recording: $e');
// }
// } finally {
// setState(() {
// isRecording = false;
// });
// }
// }
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text('Audio Recorder'),
// ),
// body: Center(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// ElevatedButton(
// onPressed: startRecording,
// child: Text('Start Recording'),
// ),
// ElevatedButton(
// onPressed: stopRecording,
// child: Text('Stop Recording'),
// ),
// ],
// ),
// ),
// );
// }
// }
import 'dart:async';
import 'dart:convert';
import 'dart:core';
import 'dart:io';
import 'dart:math';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:record/record.dart';
import 'package:shared_preferences/shared_preferences.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 'package:typewritertext/typewritertext.dart';
import '../Services/RemoteData.dart';
import 'Constants.dart';
class AudioRecorder extends StatefulWidget {
const AudioRecorder({Key? key}) : super(key: key);
@override
State<AudioRecorder> 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<AudioRecorder> {
bool _hasSpeech = false;
bool speech_validate = false;
bool mute = false;
final bool _logEvents = false;
final bool _onDevice = false;
final 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 = [];
String femalevoice = "cmn-CN-Standard-A";
String malevoice = "cmn-CN-Standard-B";
String? userid;
String zoneValue = '';
String? textSample = '';
bool isListening = false;
final _record = Record();
bool isRecording = false;
String? filePath;
bool _isPressed = false;
Future<void> _getSharedPreferencesValues() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
setState(() {
//UserId = sharedPreferences.getString('userId');
userid = sharedPreferences.getString('empId');
//access = sharedPreferences.getString('access');
});
}
Future<void> startRecording() async {
if (await Permission.microphone.isGranted) {
// Directory tempDir = await getTemporaryDirectory();
// String path = join(tempDir.path, 'temp_audio.mp3');
// filePath = path;
//print('Start Recording :$filePath');
setState(() {
isRecording = true;
});
// Check and request for microphone permission
try {
if (await _record.hasPermission()) {
// Start recording
print('Hitting Karthik');
await _record.start();
// await _record.start(
// path: filePath!,
// );
} else {
// Handle permission denied
print("Microphone permission denied");
}
} catch (e) {
print('Error: $e');
}
} else {
// Handle permission denied
print("Permission not granted");
}
}
Future<void> stopRecording() async {
//print('Stop Recording :$filePath');
if (await _record.isRecording()) {
//await _record.stop();
try {
String? path = await _record.stop();
print('Stop Recording :$path');
if (path == null) {
print('Recording path is null');
return;
}
Uri fileUri = Uri.parse(path);
File recordedFile = File.fromUri(fileUri);
bool fileExists = await recordedFile.exists();
print('File exists: $fileExists, Path: $path');
setState(() {
isRecording = false;
});
print('Stop Recording!!!! :$path');
if (path != null) {
print('Recording saved to: $path');
//await sendAudioToWhisperAPI();
remotevalidate(recordedFile);
// print('Response from API :$res');
}
//_loadFiles();
} catch (e) {
print('Exception : $e');
}
}
}
// }
Future<void> requestPermissions() async {
var status = await Permission.microphone.request();
var status1 = await Permission.storage.request();
//var storage = await Permission.storage.request();
if (status.isGranted) {
// Permission granted, proceed with recording
//startRecording();
print('Sucessfully Granted');
}
if (status1.isGranted) {
// Permission granted, proceed with recording
//startRecording();
print('Sucessfully Granted1 ====>');
} else if (status.isPermanentlyDenied) {
// Permission permanently denied, open settings to enable
openAppSettings();
} else {
// Handle other cases (e.g., PermissionStatus.restricted)
print('Microphone permission denied or restricted');
}
}
@override
void initState() {
requestPermissions();
initSpeechState();
if (Platform.isAndroid) {
checkAndRequestMicrophonePermission();
}
if (Platform.isIOS) {
//iOS needs to wait until the widget is shown before requesting permission
}
if (data!.isNotEmpty) {
data!.clear();
}
_getSharedPreferencesValues();
//ftts.setVolume(1.0);
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 Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Image.asset(
"assets/images/back_arrow.png",
width: 24,
height: 24,
color: Colors.white,
),
//color: Colors.white,
onPressed: () {
Navigator.pop(context);
data!.clear();
ftts.stop();
}),
title: RichText(
text: const TextSpan(
children: <TextSpan>[
TextSpan(
text: 'SSKL',
style: Constants.fontStyle,
),
TextSpan(
text: ' Chat Bot ',
style: Constants.fontStyle,
),
],
),
),
actions: [
if (speech_validate)
IconButton(
icon: Image.asset(
"assets/images/stop.png",
width: 24,
height: 24,
color: Colors.white,
),
onPressed: () async {
ftts.stop();
setState(() {
speech_validate = false;
});
},
),
// IconButton(
// icon: const Icon(Icons.volume_up),
// onPressed: () {
// //performAction(isMuted ? TtsAction.unmute : TtsAction.mute);
// if (mute) {
// const Icon(Icons.volume_mute);
// ftts.pause();
// mute = false;
// } else {
// const Icon(Icons.volume_mute);
// ftts.speak(zoneValue);
// mute = true;
// }
// },
// )
//if (mute)
IconButton(
icon: Icon(mute ? Icons.volume_up : Icons.volume_mute),
onPressed: () {
setState(() {
if (mute) {
ftts.pause();
// Unmute TTS
//stopRecording();
} else {
ftts.speak(zoneValue);
//startRecording();
// Mute TTS
}
mute = !mute; // Toggle mute state
});
},
)
// IconButton(
// icon: Image.asset(
// "assets/images/stop.png",
// width: 24,
// height: 24,
// color: Colors.white,
// ),
// onPressed: () async {
// setState(() {
// if (mute) {
// // Mute the FlutterTts
// ftts.pause();
// mute = false;
// print('if ==========> Hitting or not ');
// } else {
// mute = true;
// // Unmute the FlutterTts
// ftts.setVolume(1.0);
// print('if ==========> Hitting or not ');
// }
// });
// },
// ),
],
// title: const Text(
// 'Speech to Text / Text to Speech',
// style: Constants.fontStyle,
// ),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: Constants.getReturn(),
),
),
),
//resizeToAvoidBottomInset: true,
//resizeToAvoidBottomPadding: false,
body: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image:
AssetImage('assets/images/bg.png'), // Set your image path here
fit: BoxFit.cover, // Adjust the image fitting as needed
),
// color: const Color.fromARGB(255, 247, 217, 217),
// border: Border.all(
// style: BorderStyle.solid,
// color: const Color.fromARGB(255, 247, 217, 217),
// ),
// borderRadius: BorderRadius.circular(0),
), // Set the background color for the entire screen
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.78,
child: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: data?.length,
itemBuilder: (context, index) {
return Padding(
padding:
const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: SizedBox(
width:
MediaQuery.of(context).size.width / 1,
// Add padding as needed
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
GestureDetector(
onLongPress: () {
Clipboard.setData(ClipboardData(
text: data![index].question));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(
227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 20.0, left: 60.0),
child: Container(
padding:
const EdgeInsets.fromLTRB(
10, 10, 10, 10),
decoration: const BoxDecoration(
color: Color.fromARGB(
255, 238, 177, 64),
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(16.0),
topRight: Radius.circular(0),
bottomLeft:
Radius.circular(16.0),
bottomRight:
Radius.circular(16.0),
),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Expanded(
child: Text(
data![index].question,
style: Constants
.speeachfontStyle,
textAlign:
TextAlign.right,
softWrap: true,
maxLines: 4,
),
),
],
),
),
),
),
const SizedBox(
height: 10,
),
GestureDetector(
onLongPress: () {
Clipboard.setData(ClipboardData(
text: data![index].answer));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(
227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 60.0, left: 20.0),
child: Container(
decoration: const BoxDecoration(
color: Color.fromARGB(
255, 239, 242, 247),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(0),
topRight:
Radius.circular(16.0),
bottomLeft:
Radius.circular(16.0),
bottomRight:
Radius.circular(16.0),
), // Adjust the value as needed
),
// Set your desired background color here
padding:
const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
if (data![index].image !=
'None')
Image.memory(
base64Decode(
data![index].image),
fit: BoxFit.cover,
height: 200,
width: 250,
),
const SizedBox(height: 10),
TypeWriter(
controller:
TypeWriterController(
text:
data![index].answer,
duration:
const Duration(
milliseconds:
50),
),
builder:
(context, value) {
// Otherwise, render text using HtmlWidget
return HtmlWidget(
value.text,
textStyle: Constants
.LoginbuttonsfontStyle,
);
}),
],
),
),
),
),
],
),
),
);
},
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0), // Adjust the padding as needed
child: Row(
children: [
Expanded(
child:
// FloatingActionButton(
// onPressed: toggleRecording,
// child: Icon(
// isListening ? Icons.circle : Icons.mic,
// size: 35,
// ),
// ),
GestureDetector(
onLongPress: startRecording,
onLongPressUp: stopRecording,
child: IconButton(
onPressed:
null, // Disable onPressed for IconButton
icon: isRecording
? Image.asset(
'assets/images/mic.gif', // Replace with your GIF path
width: 52,
height: 72,
)
: Image.asset(
'assets/images/micicon.png',
width: 52,
height: 72,
),
),
),
),
],
),
),
],
),
// child: Column(children: <Widget>[
// SpeechControlWidget(
// lastWords,
// level,
// _hasSpeech,
// speech.isListening,
// startListening,
// stopListening,
// cancelListening,
// remotevalidate),
// ]),
),
),
],
),
),
);
}
// 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}');
if (kDebugMode) {
print(
'\nTesting 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');
}
//await Future.delayed(Duration.zero);
//remotevalidate(lastWords);
}
});
}
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');
}
}
Future<void> remotevalidate(File lastWords) async {
//Constants.showLoader(context);
if (kDebugMode) {
print('Hitting from Keyboard or voice !!!!!!!!!!!!$lastWords');
}
//String res = await RemoteData().getSpeechResponse(lastWords, userid!);
String res = await RemoteData().getVoiceResponse(lastWords, userid!);
//var response = jsonDecode(res);
Map<String, dynamic> jsonResponse = jsonDecode(res);
//List<dynamic> output1 = jsonResponse['output1'];
if (kDebugMode) {
print('DataFetching $jsonResponse');
}
if (jsonResponse.containsKey('error')) {
//Constants.dismissAlertDialog1(context);
//lastWords = '';
setState(() {});
//Constants.showAlertDialog(context, val);
}
if (jsonResponse['output'].isNotEmpty) {
//Constants.dismissAlertDialog1(context);
//Map<String, dynamic> firstItem = output1[0];
zoneValue = jsonResponse['output'];
if (kDebugMode) {
print('DataFetching1 $zoneValue');
}
Data dataInstance =
Data(question: '', answer: zoneValue, image: jsonResponse['image']);
await ftts.setLanguage('en-IN');
//await ftts.setLanguage("en-IN");
await ftts.setSpeechRate(0.5); //speed of speech
await ftts.setVolume(1.0); //volume of speech
await ftts.setPitch(1.2); //pitch of sound
//Map<String, String> reference = {'setVoice': malevoice};
if (Platform.isIOS) {
if (kDebugMode) {
print(await ftts.getLanguages);
print(await ftts.getVoices);
}
await ftts.setVoice({'name': 'Rishi', 'locale': 'en-IN'});
//await ftts.setVoice(ftts.getDefaultVoice());
//await ftts.setIosAudioCategory(
//[IosTextToSpeechAudioCategory.playAndRecord,
//IosTextToSpeechAudioCategoryOptions.defaultToSpeaker],
//);
await ftts.setIosAudioCategory(
IosTextToSpeechAudioCategory.playback,
[
IosTextToSpeechAudioCategoryOptions.allowBluetooth,
IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
IosTextToSpeechAudioCategoryOptions.mixWithOthers,
IosTextToSpeechAudioCategoryOptions.defaultToSpeaker
],
IosTextToSpeechAudioMode.defaultMode);
} else {
await ftts.setVoice({'name': ' Rishi', "locale": "en-IN"});
}
//await ftts.setVoice(reference);
//play text to sp
var result = await ftts.speak(zoneValue);
speech_validate = true;
mute = true;
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);
ftts.setCompletionHandler(() {
if (kDebugMode) {
print('completed for sskl');
}
setState(() {
//lastWords = '';
speech_validate = false;
//mute = false;
});
});
} else {
//Constants.dismissAlertDialog1(context);
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;
});
//lastWords = '';
setState(() {});
}
}
/// 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,
style: Constants.fontStyle,
),
),
),
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,
this.remoteValidate,
{Key? key})
: super(key: key);
final double level;
late String? total;
final bool hasSpeech;
late final bool isListening;
final Future<void> Function(String) remoteValidate;
final void Function() startListening;
final void Function() stopListening;
final void Function() cancelListening;
static List<Data>? data1 = [];
final TextStyle _textFieldStyle = Constants.LoginbuttonsfontStyle;
//final TextEditingController _dateTime = TextEditingController();
late bool isavailable = false;
bool isTextEntered = false;
final TextEditingController _textEditingController = TextEditingController();
String? textSample = '';
final _record = Record();
bool isRecording = false;
String? filePath;
Future<void> startRecording() async {
if (await Permission.microphone.isGranted) {
Directory tempDir = await getTemporaryDirectory();
String path = join(tempDir.path, 'temp_audio.mp3');
filePath = path;
print('Start Recording :$filePath');
isRecording = true;
// Check and request for microphone permission
if (await _record.hasPermission()) {
// Start recording
// await _record.start(
// const RecordConfig(),
// path: filePath!, // by default
// );
} else {
// Handle permission denied
print("Microphone permission denied");
}
} else {
// Handle permission denied
print("Permission not granted");
}
}
Future<void> stopRecording() async {
print('Stop Recording :$filePath');
if (await _record.isRecording()) {
await _record.stop();
if (filePath != null) {
print('Recording saved to: $filePath');
//await sendAudioToWhisperAPI();
}
}
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.78,
child: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: data1?.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: SizedBox(
width: MediaQuery.of(context).size.width / 1,
// Add padding as needed
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onLongPress: () {
Clipboard.setData(ClipboardData(
text: data1![index].question));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 20.0, left: 60.0),
child: Container(
padding:
const EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: const BoxDecoration(
color: Color.fromARGB(255, 238, 177, 64),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(0),
bottomLeft: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Text(
data1![index].question,
style: Constants.speeachfontStyle,
textAlign: TextAlign.right,
softWrap: true,
maxLines: 4,
),
),
],
),
),
),
),
const SizedBox(
height: 10,
),
GestureDetector(
onLongPress: () {
Clipboard.setData(
ClipboardData(text: data1![index].answer));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 60.0, left: 20.0),
child: Container(
decoration: const BoxDecoration(
color: Color.fromARGB(255, 239, 242, 247),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(0),
topRight: Radius.circular(16.0),
bottomLeft: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
), // Adjust the value as needed
),
// Set your desired background color here
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (data1![index].image != 'None')
Image.memory(
base64Decode(data1![index].image),
fit: BoxFit.cover,
height: 200,
width: 250,
),
const SizedBox(height: 10),
TypeWriter(
controller: TypeWriterController(
text: data1![index].answer,
duration: const Duration(
milliseconds: 50),
),
builder: (context, value) {
// Otherwise, render text using HtmlWidget
return HtmlWidget(
value.text,
textStyle: Constants
.LoginbuttonsfontStyle,
);
}),
],
),
),
),
),
],
),
),
);
},
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0), // Adjust the padding as needed
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
10.0), // Set the border radius here
color: const Color.fromARGB(255, 255, 255, 255),
),
child: TextFormField(
controller: _textEditingController,
onChanged: (text) {
isTextEntered = text.isNotEmpty;
},
onTap: () {},
decoration: const InputDecoration(
fillColor: Color.fromARGB(255, 255, 255, 255),
contentPadding:
EdgeInsets.symmetric(vertical: 15, horizontal: 10),
isDense: true,
hintText: 'Type Message',
border: InputBorder.none,
),
style: _textFieldStyle,
onFieldSubmitted: (value) {
total = _textEditingController.text;
if (total != '') {
remoteValidate(total!);
}
},
textInputAction: TextInputAction.done,
),
),
),
// FloatingActionButton(
// onPressed: toggleRecording,
// child: Icon(
// isListening ? Icons.circle : Icons.mic,
// size: 35,
// ),
// ),
GestureDetector(
onTap: () {
if (_textEditingController.text.isEmpty) {
//startListening();
startRecording();
setState() {
isRecording = true;
}
// Perform action if text is non-empty
//toggleRecording();
}
},
child: IconButton(
onPressed: null, // Disable onPressed for IconButton
icon: isRecording
? Image.asset(
'assets/images/mic.gif', // Replace with your GIF path
width: 150,
height: 120,
)
: Image.asset(
'assets/images/micicon.png',
width: 150,
height: 120,
),
),
),
],
),
),
],
);
}
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
String image = '';
// Constructor
Data({required this.question, required this.answer, required this.image});
// Named constructor for creating an instance from a Map
Data.fromMap(Map<String, dynamic> map)
: question = map['Question'] ?? '',
answer = map['Answer'] ?? '',
image = map['image'] ?? '';
// Convert the object to a Map
Map<String, dynamic> toMap() {
return {
'Question': question,
'Answer': answer,
'image': image,
};
}
}
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 'dart:convert';
import 'dart:core';
import 'dart:io';
import 'dart:math';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:record/record.dart';
import 'package:shared_preferences/shared_preferences.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 'package:typewritertext/typewritertext.dart';
import '../Services/RemoteData.dart';
import 'Constants.dart';
class SpeechSampleApp1 extends StatefulWidget {
const SpeechSampleApp1({Key? key}) : super(key: key);
@override
State<SpeechSampleApp1> 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<SpeechSampleApp1> {
bool _hasSpeech = false;
bool speech_validate = false;
bool mute = false;
final bool _logEvents = false;
final bool _onDevice = false;
final 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 = [];
String femalevoice = "cmn-CN-Standard-A";
String malevoice = "cmn-CN-Standard-B";
String? userid;
String zoneValue = '';
String? textSample = '';
bool isListening = false;
final _record = Record();
bool isRecording = false;
String? filePath;
Future<void> _getSharedPreferencesValues() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
setState(() {
//UserId = sharedPreferences.getString('userId');
userid = sharedPreferences.getString('empId');
//access = sharedPreferences.getString('access');
});
}
Future<void> startRecording() async {
if (await Permission.microphone.isGranted) {
// Directory tempDir = await getTemporaryDirectory();
// String path = join(tempDir.path, 'temp_audio.mp3');
// filePath = path;
//print('Start Recording :$filePath');
isRecording = true;
// Check and request for microphone permission
try {
if (await _record.hasPermission()) {
// Start recording
print('Hitting Karthik');
await _record.start();
// await _record.start(
// path: filePath!,
// );
} else {
// Handle permission denied
print("Microphone permission denied");
}
} catch (e) {
print('Error: $e');
}
} else {
// Handle permission denied
print("Permission not granted");
}
}
Future<void> stopRecording() async {
//print('Stop Recording :$filePath');
if (await _record.isRecording()) {
//await _record.stop();
try {
String? path = await _record.stop();
print('Stop Recording :$path');
if (path == null) {
print('Recording path is null');
return;
}
File recordedFile = File(path);
bool fileExists = await recordedFile.exists();
print('File exists: $fileExists, Path: $path');
isRecording = false;
print('Stop Recording!!!! :$path');
if (path != null) {
print('Recording saved to: $path');
//await sendAudioToWhisperAPI();
// String res = await RemoteData().getSpeechResponse(path, userid!);
// print('Response from API :$res');
}
//_loadFiles();
} catch (e) {
print('Exception : $e');
}
}
}
// }
Future<void> requestPermissions() async {
var status = await Permission.microphone.request();
var status1 = await Permission.storage.request();
//var storage = await Permission.storage.request();
if (status.isGranted) {
// Permission granted, proceed with recording
//startRecording();
print('Sucessfully Granted');
}
if (status1.isGranted) {
// Permission granted, proceed with recording
//startRecording();
print('Sucessfully Granted1 ====>');
} else if (status.isPermanentlyDenied) {
// Permission permanently denied, open settings to enable
openAppSettings();
} else {
// Handle other cases (e.g., PermissionStatus.restricted)
print('Microphone permission denied or restricted');
}
}
@override
void initState() {
requestPermissions();
initSpeechState();
if (Platform.isAndroid) {
checkAndRequestMicrophonePermission();
}
if (Platform.isIOS) {
//iOS needs to wait until the widget is shown before requesting permission
}
if (data!.isNotEmpty) {
data!.clear();
}
_getSharedPreferencesValues();
//ftts.setVolume(1.0);
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 Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Image.asset(
"assets/images/back_arrow.png",
width: 24,
height: 24,
color: Colors.white,
),
//color: Colors.white,
onPressed: () {
Navigator.pop(context);
data!.clear();
ftts.stop();
}),
title: RichText(
text: const TextSpan(
children: <TextSpan>[
TextSpan(
text: 'SSKL',
style: Constants.fontStyle,
),
TextSpan(
text: ' Chat Bot ',
style: Constants.fontStyle,
),
],
),
),
actions: [
if (speech_validate)
IconButton(
icon: Image.asset(
"assets/images/stop.png",
width: 24,
height: 24,
color: Colors.white,
),
onPressed: () async {
ftts.stop();
setState(() {
speech_validate = false;
});
},
),
// IconButton(
// icon: const Icon(Icons.volume_up),
// onPressed: () {
// //performAction(isMuted ? TtsAction.unmute : TtsAction.mute);
// if (mute) {
// const Icon(Icons.volume_mute);
// ftts.pause();
// mute = false;
// } else {
// const Icon(Icons.volume_mute);
// ftts.speak(zoneValue);
// mute = true;
// }
// },
// )
//if (mute)
IconButton(
icon: Icon(mute ? Icons.volume_up : Icons.volume_mute),
onPressed: () {
setState(() {
if (mute) {
ftts.pause();
// Unmute TTS
//stopRecording();
} else {
ftts.speak(zoneValue);
//startRecording();
// Mute TTS
}
mute = !mute; // Toggle mute state
});
},
)
// IconButton(
// icon: Image.asset(
// "assets/images/stop.png",
// width: 24,
// height: 24,
// color: Colors.white,
// ),
// onPressed: () async {
// setState(() {
// if (mute) {
// // Mute the FlutterTts
// ftts.pause();
// mute = false;
// print('if ==========> Hitting or not ');
// } else {
// mute = true;
// // Unmute the FlutterTts
// ftts.setVolume(1.0);
// print('if ==========> Hitting or not ');
// }
// });
// },
// ),
],
// title: const Text(
// 'Speech to Text / Text to Speech',
// style: Constants.fontStyle,
// ),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: Constants.getReturn(),
),
),
),
//resizeToAvoidBottomInset: true,
//resizeToAvoidBottomPadding: false,
body: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image:
AssetImage('assets/images/bg.png'), // Set your image path here
fit: BoxFit.cover, // Adjust the image fitting as needed
),
// color: const Color.fromARGB(255, 247, 217, 217),
// border: Border.all(
// style: BorderStyle.solid,
// color: const Color.fromARGB(255, 247, 217, 217),
// ),
// borderRadius: BorderRadius.circular(0),
), // Set the background color for the entire screen
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(children: <Widget>[
SpeechControlWidget(
lastWords,
level,
_hasSpeech,
speech.isListening,
startListening,
stopListening,
cancelListening,
remotevalidate),
]),
),
),
],
),
),
);
}
// 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}');
if (kDebugMode) {
print(
'\nTesting 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');
}
//await Future.delayed(Duration.zero);
remotevalidate(lastWords);
}
});
}
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');
}
}
Future<void> remotevalidate(String lastWords) async {
//Constants.showLoader(context);
if (kDebugMode) {
print('Hitting from Keyboard or voice !!!!!!!!!!!!$lastWords');
}
//String res = await RemoteData().getSpeechResponse(lastWords, userid!);
String res = await RemoteData().getSpeechResponse(lastWords, userid!);
//var response = jsonDecode(res);
Map<String, dynamic> jsonResponse = jsonDecode(res);
//List<dynamic> output1 = jsonResponse['output1'];
if (kDebugMode) {
print('DataFetching $jsonResponse');
}
if (jsonResponse.containsKey('error')) {
//Constants.dismissAlertDialog1(context);
lastWords = '';
setState(() {});
//Constants.showAlertDialog(context, val);
}
if (jsonResponse['output'].isNotEmpty) {
//Constants.dismissAlertDialog1(context);
//Map<String, dynamic> firstItem = output1[0];
zoneValue = jsonResponse['output'];
if (kDebugMode) {
print('DataFetching1 $zoneValue');
}
Data dataInstance =
Data(question: lastWords, answer: zoneValue, image: 'None');
await ftts.setLanguage('en-IN');
//await ftts.setLanguage("en-IN");
await ftts.setSpeechRate(0.5); //speed of speech
await ftts.setVolume(1.0); //volume of speech
await ftts.setPitch(1.2); //pitch of sound
//Map<String, String> reference = {'setVoice': malevoice};
if (Platform.isIOS) {
if (kDebugMode) {
print(await ftts.getLanguages);
print(await ftts.getVoices);
}
await ftts.setVoice({'name': 'Rishi', 'locale': 'en-IN'});
//await ftts.setVoice(ftts.getDefaultVoice());
//await ftts.setIosAudioCategory(
//[IosTextToSpeechAudioCategory.playAndRecord,
//IosTextToSpeechAudioCategoryOptions.defaultToSpeaker],
//);
await ftts.setIosAudioCategory(
IosTextToSpeechAudioCategory.playback,
[
IosTextToSpeechAudioCategoryOptions.allowBluetooth,
IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
IosTextToSpeechAudioCategoryOptions.mixWithOthers,
IosTextToSpeechAudioCategoryOptions.defaultToSpeaker
],
IosTextToSpeechAudioMode.defaultMode);
} else {
await ftts.setVoice({'name': ' Rishi', "locale": "en-IN"});
}
//await ftts.setVoice(reference);
//play text to sp
var result = await ftts.speak(zoneValue);
speech_validate = true;
mute = true;
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);
ftts.setCompletionHandler(() {
if (kDebugMode) {
print('completed for sskl');
}
setState(() {
lastWords = '';
speech_validate = false;
//mute = false;
});
});
} else {
//Constants.dismissAlertDialog1(context);
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;
});
lastWords = '';
setState(() {});
}
}
/// 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,
style: Constants.fontStyle,
),
),
),
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,
this.remoteValidate,
{Key? key})
: super(key: key);
final double level;
late String? total;
final bool hasSpeech;
late final bool isListening;
final Future<void> Function(String) remoteValidate;
final void Function() startListening;
final void Function() stopListening;
final void Function() cancelListening;
static List<Data>? data1 = [];
final TextStyle _textFieldStyle = Constants.LoginbuttonsfontStyle;
//final TextEditingController _dateTime = TextEditingController();
late bool isavailable = false;
bool isTextEntered = false;
final TextEditingController _textEditingController = TextEditingController();
String? textSample = '';
final _record = Record();
bool isRecording = false;
String? filePath;
Future<void> startRecording() async {
if (await Permission.microphone.isGranted) {
Directory tempDir = await getTemporaryDirectory();
String path = join(tempDir.path, 'temp_audio.mp3');
filePath = path;
print('Start Recording :$filePath');
isRecording = true;
// Check and request for microphone permission
if (await _record.hasPermission()) {
// Start recording
// await _record.start(
// const RecordConfig(),
// path: filePath!, // by default
// );
} else {
// Handle permission denied
print("Microphone permission denied");
}
} else {
// Handle permission denied
print("Permission not granted");
}
}
Future<void> stopRecording() async {
print('Stop Recording :$filePath');
if (await _record.isRecording()) {
await _record.stop();
if (filePath != null) {
print('Recording saved to: $filePath');
//await sendAudioToWhisperAPI();
}
}
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.78,
child: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: data1?.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.fromLTRB(5, 10, 5, 5),
child: SizedBox(
width: MediaQuery.of(context).size.width / 1,
// Add padding as needed
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onLongPress: () {
Clipboard.setData(ClipboardData(
text: data1![index].question));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 20.0, left: 60.0),
child: Container(
padding:
const EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: const BoxDecoration(
color: Color.fromARGB(255, 238, 177, 64),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(0),
bottomLeft: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Text(
data1![index].question,
style: Constants.speeachfontStyle,
textAlign: TextAlign.right,
softWrap: true,
maxLines: 4,
),
),
],
),
),
),
),
const SizedBox(
height: 10,
),
GestureDetector(
onLongPress: () {
Clipboard.setData(
ClipboardData(text: data1![index].answer));
Fluttertoast.showToast(
msg: 'Copied',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
backgroundColor:
const Color.fromARGB(227, 159, 159, 158),
textColor: Colors.white,
);
},
child: Padding(
padding: const EdgeInsets.only(
right: 60.0, left: 20.0),
child: Container(
decoration: const BoxDecoration(
color: Color.fromARGB(255, 239, 242, 247),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(0),
topRight: Radius.circular(16.0),
bottomLeft: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
), // Adjust the value as needed
),
// Set your desired background color here
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (data1![index].image != 'None')
Image.memory(
base64Decode(data1![index].image),
fit: BoxFit.cover,
height: 200,
width: 250,
),
const SizedBox(height: 10),
TypeWriter(
controller: TypeWriterController(
text: data1![index].answer,
duration: const Duration(
milliseconds: 50),
),
builder: (context, value) {
// Otherwise, render text using HtmlWidget
return HtmlWidget(
value.text,
textStyle: Constants
.LoginbuttonsfontStyle,
);
}),
],
),
),
),
),
],
),
),
);
},
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 5.0), // Adjust the padding as needed
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
10.0), // Set the border radius here
color: const Color.fromARGB(255, 255, 255, 255),
),
child: TextFormField(
controller: _textEditingController,
onChanged: (text) {
isTextEntered = text.isNotEmpty;
},
onTap: () {},
decoration: const InputDecoration(
fillColor: Color.fromARGB(255, 255, 255, 255),
contentPadding:
EdgeInsets.symmetric(vertical: 15, horizontal: 10),
isDense: true,
hintText: 'Type Message',
border: InputBorder.none,
),
style: _textFieldStyle,
onFieldSubmitted: (value) {
total = _textEditingController.text;
if (total != '') {
remoteValidate(total!);
}
},
textInputAction: TextInputAction.done,
),
),
),
// FloatingActionButton(
// onPressed: toggleRecording,
// child: Icon(
// isListening ? Icons.circle : Icons.mic,
// size: 35,
// ),
// ),
GestureDetector(
onTap: () {
if (_textEditingController.text.isEmpty) {
//startListening();
startRecording();
setState() {
isRecording = true;
}
// Perform action if text is non-empty
//toggleRecording();
}
},
child: IconButton(
onPressed: null, // Disable onPressed for IconButton
icon: isRecording
? Image.asset(
'assets/images/mic.gif', // Replace with your GIF path
width: 52,
height: 72,
)
: Image.asset(
'assets/images/micicon.png',
width: 52,
height: 72,
),
),
),
],
),
),
],
);
}
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
String image = '';
// Constructor
Data({required this.question, required this.answer, required this.image});
// Named constructor for creating an instance from a Map
Data.fromMap(Map<String, dynamic> map)
: question = map['Question'] ?? '',
answer = map['Answer'] ?? '',
image = map['image'] ?? '';
// Convert the object to a Map
Map<String, dynamic> toMap() {
return {
'Question': question,
'Answer': answer,
'image': image,
};
}
}
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),
),
),
);
}
}
......@@ -74,6 +74,16 @@ class _CheckList extends State<CheckList> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Image.asset(
"assets/images/back_arrow.png",
width: 24,
height: 24,
color: Colors.white,
),
//color: Colors.white,
onPressed: () => Navigator.pop(context),
),
title: const Text(
'FootFall Verification',
style: Constants.fontStyle,
......
......@@ -88,13 +88,11 @@ class _CheckRegistration extends State<CheckRegistration> {
//getVideo(_empId.text);
getValidReg(_empId.text);
} else {
Constants('Check Registration', 'Enter emp id')
.showAlertDialog(context, false);
Constants('Check Registration', 'Enter emp id').showAlertDialog(context, false);
}
},
style: ElevatedButton.styleFrom(
backgroundColor:
Colors.transparent, // make the button transparent
backgroundColor: Colors.transparent, // make the button transparent
elevation: 0, // remove the button's shadow
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
......@@ -156,7 +154,6 @@ class _CheckRegistration extends State<CheckRegistration> {
File file = File(image!.path);
//String filecontents = await fileToString(file);
String fileName = file.path.split(Platform.pathSeparator).last;
final response =
await RemoteData().UploadEmpVideo(file, fileName, empid, store);
Map<String, dynamic> responseMap = jsonDecode(response);
......@@ -165,7 +162,9 @@ class _CheckRegistration extends State<CheckRegistration> {
String message = "$responseMap";
// Extract the status value from the message
String status = message.split('status:').last.split('}').first.trim();
print(status);
if (kDebugMode) {
print(status);
}
if (status == 'Success') {
Navigator.pop(context);
file.delete();
......
......@@ -19,11 +19,37 @@ class Constants {
this.color = color;
}
static const TextStyle LoginfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 18,
fontWeight: FontWeight.normal,
color: Colors.grey);
static const TextStyle HeaderStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 18,
fontWeight: FontWeight.w400,
color: Colors.black);
static const TextStyle fontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 18,
fontWeight: FontWeight.normal,
color: Colors.white);
static const TextStyle speeachfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.white);
static const TextStyle LoginbuttonsfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.normal,
color: Color.fromARGB(255, 12, 18, 22),
);
static const TextStyle headerfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
......@@ -123,17 +149,11 @@ class Constants {
);
static const TextStyle unregisterfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 14,
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.red,
);
static const TextStyle LoginbuttonsfontStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
fontWeight: FontWeight.normal,
color: Color.fromARGB(255, 12, 18, 22),
);
static const TextStyle LoginuseridStyle = TextStyle(
fontFamily: 'Poppins',
fontSize: 16,
......@@ -208,8 +228,8 @@ class Constants {
prefs.setString('userId', username);
prefs.setString('empId', empid);
prefs.setString('stores_list', storeslist);
prefs.setString('storeName', storeName);
prefs.setString('access', accessLevel);
//prefs.setString('storeName', storeName);
prefs.setBool('islogged', validate);
}
......
......@@ -60,7 +60,7 @@ class _DepartmentSearch extends State<DepartmentSearch> {
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
empid = prefs.getString('empId')!;
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
......
......@@ -41,7 +41,7 @@ class _EmployeeReport extends State<EmployeeReport> {
// Constants.showLoader(context);
//});
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
if (kDebugMode) {
print(userId);
}
......@@ -414,36 +414,34 @@ class _EmployeeReport extends State<EmployeeReport> {
// color: Color.fromARGB(255, 173, 57, 230),
// ));
// });
//8919290229
Map<String, dynamic> body = {
'STORE': selectedDropdownItem!,
};
dynamic response = await _apiServices.getPostApiResponse(
'http://vaman.plutokm.com/regstatusreport', body);
dynamic response = await _apiServices.getPostApiResponse('http://vaman.plutokm.com/regstatusreport', body);
print("response is ----------->$response");
final respon = await RemoteData().getUserReport(selectedDropdownItem);
Map<String, dynamic> responseMap = jsonDecode(respon);
empReport = EmpReport.fromJson(responseMap);
final res = await RemoteData().getUserReport(selectedDropdownItem);
Map<String, dynamic> responseMap = jsonDecode(res);
empReport = EmpReport.fromJson(responseMap);
empreportlist = empReport!.data;
//Constants.dismissAlertDialog1(context);
setState(() {
total = empreportlist!.length;
total = empreportlist!.length;
filteredreortlist = empReport!.data
?.where((alert) =>
alert.rEGSTATUS == 'Not Registered' ||
alert.rEGSTATUS == 'NOT REGISTERED')
.toList();
unregistered = filteredreortlist!.length;
unregistered= filteredreortlist!.length;
filteredreortlist = empReport!.data
?.where((alert) => alert.rEGSTATUS == 'Registered')
.toList();
registered = filteredreortlist!.length;
registered = filteredreortlist!.length;
Navigator.of(context).pop();
});
} else {
Navigator.of(context).pop();
Constants('Employee Report', 'Please check your internet connection')
.showAlertDialog(context, false);
Constants('Employee Report', 'Please check your internet connection').showAlertDialog(context, false);
}
}
}
......@@ -62,7 +62,7 @@ class employeeStatus extends State<EmployeeStatus> {
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
.toList();
......
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:intl/intl.dart';
......@@ -85,7 +86,7 @@ class _FootFall extends State<FootFall> {
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
.toList();
......@@ -154,10 +155,14 @@ class _FootFall extends State<FootFall> {
),
body: GestureDetector(
onForcePressUpdate: (details) {
print('force press update');
if (kDebugMode) {
print('force press update');
}
},
onHorizontalDragStart: (details) {
print('force press start');
if (kDebugMode) {
print('force press start');
}
},
onHorizontalDragDown: (details) {},
child: FutureBuilder<Foot?>(
......@@ -216,6 +221,7 @@ class _FootFall extends State<FootFall> {
),
TextFormField(
controller: _dateTime,
readOnly: true,
onTap: () => '',
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
......
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
......@@ -11,6 +10,8 @@ import 'package:storemonitor/Screens/NavBar.dart';
import 'package:intl/intl.dart';
import 'package:storemonitor/Services/RemoteData.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:toggle_switch/toggle_switch.dart';
import '../Models/Store.dart';
import 'Constants.dart';
import 'FootFall.dart';
import 'NotificationReport.dart';
......@@ -26,36 +27,59 @@ class Home extends StatefulWidget {
}
class _Home extends State<Home> {
String? selectedDropdownItem;
String? selectedRegion;
String? selectedDropdownItem = '';
String? empId;
List<String>? namesList;
List<String> storeNames = [];
List<Store> stores = [];
List<String> regions = [];
late List<GDPData> _chartData;
DateTime _selectedDate = DateTime.now();
final TextEditingController _dateTime = TextEditingController();
bool isAuthenticated = false;
bool iswarehouserelated = false;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final _controller = TextEditingController();
List<Insight>? insightslist = [];
bool isSwitched = false;
@override
void initState() {
super.initState();
loadData();
_chartData = getChartData(0, 0);
_selectedDate = DateTime.now();
_chartData = getChartData(0.0, 0.0);
_selectedDate = DateTime.now();
_dateTime.text = DateFormat('yyyy/MM/dd').format(_selectedDate);
}
loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
empId = prefs.getString('empId');
String? userId = prefs.getString("stores_list");
empId = prefs.getString('empId');
if (kDebugMode) {
print(empId);
}
namesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
.toList();
selectedDropdownItem = namesList![0];
final List<dynamic> jsonResponse = json.decode(userId!);
if (kDebugMode) {
print(jsonResponse);
}
stores = jsonResponse.map((data) => Store.fromJson(data)).toList();
if (kDebugMode) {
print(stores);
}
// Get unique regions
regions = stores.map((store) => store.region).toSet().toList();
selectedRegion = regions[0];
updateStoreNames(selectedRegion!);
setState(() {});
//namesList = (json.decode(userId!) as List<dynamic>)
//.map((map) => map['name'] as String)
//.toList();
selectedDropdownItem = storeNames[0];
getupdateData(selectedDropdownItem);
if (prefs.getString('access') == 'ADMIN' ||
prefs.getString('access') == 'MANAGER') {
......@@ -108,12 +132,25 @@ class _Home extends State<Home> {
});
}
void updateStoreNames(String region) {
storeNames = stores
.where((store) => store.region == region)
.map((store) => store.storename)
.toList();
selectedDropdownItem = storeNames[0]; // Reset the selected store
setState(() {
getupdateData(selectedDropdownItem);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
drawer: NavBar(
message: selectedDropdownItem.toString(),
storeNames: storeNames.toString(),
),
appBar: AppBar(
leading: IconButton(
......@@ -138,13 +175,19 @@ class _Home extends State<Home> {
body: SingleChildScrollView(
child: GestureDetector(
onForcePressUpdate: (details) {
print('force press update');
if (kDebugMode) {
print('force press update');
}
},
onHorizontalDragStart: (details) {
print('force press start');
if (kDebugMode) {
print('force press start');
}
},
onHorizontalDragDown: (details) {
print('force press down');
if (kDebugMode) {
print('force press down');
}
//Navigator.pop(context);
},
child: Container(
......@@ -162,22 +205,53 @@ class _Home extends State<Home> {
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
menuMaxHeight: Constants.getDropdownItemHeight(context),
value: selectedDropdownItem,
value: selectedRegion,
onChanged: (newValue) {
setState(() {
selectedRegion = newValue;
updateStoreNames(newValue!);
});
},
items: regions.map((region) {
return DropdownMenuItem<String>(
value: region,
child: Text(region),
);
}).toList(),
icon: const Icon(Icons.arrow_drop_down),
isExpanded: true,
),
),
),
const SizedBox(
height: 15,
width: 1,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey),
borderRadius: BorderRadius.circular(5.0),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
menuMaxHeight: Constants.getDropdownItemHeight(context),
value: selectedDropdownItem!,
onChanged: (newValue) {
setState(() {
selectedDropdownItem = newValue;
getupdateData(selectedDropdownItem);
if (selectedDropdownItem == 'WH KISMATPUR' ||
selectedDropdownItem == 'WH BANGALORE' ||
selectedDropdownItem == 'WH VIJAYAWADA' ||
selectedDropdownItem == 'WH KANCHI') {
iswarehouserelated = true;
} else {
iswarehouserelated = false;
}
// if (selectedDropdownItem == 'WH KISMATPUR' ||
// selectedDropdownItem == 'WH BANGALORE' ||
// selectedDropdownItem == 'WH VIJAYAWADA' ||
// selectedDropdownItem == 'WH KANCHI') {
// iswarehouserelated = true;
// } else {
// iswarehouserelated = false;
// }
});
},
items: namesList?.map((item) {
items: storeNames.map((item) {
return DropdownMenuItem<String>(
value: item,
child: Text(item),
......@@ -194,6 +268,7 @@ class _Home extends State<Home> {
),
TextFormField(
controller: _dateTime,
readOnly: true,
onTap: () {},
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(
......@@ -214,7 +289,138 @@ class _Home extends State<Home> {
),
),
const SizedBox(height: 10),
const Text('AI Powered Alerts',
const Text('AI Powered Insights',
textAlign: TextAlign.right,
style: Constants.headerfontStyle),
const SizedBox(
width: 0,
height: 5,
),
Container(
height: 2,
width: 60,
color: const Color.fromARGB(255, 170, 57, 243),
),
const SizedBox(
height: 15,
width: 1,
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.15,
child: ListView.builder(
itemCount: insightslist?.length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(2.0),
child: Container(
height: 60,
color: index % 2 == 0
? const Color.fromARGB(255, 245, 242, 251)
: Colors.white,
child: GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('View Insights'),
content: Text(
Constants.capitalizeFirstLetter(
insightslist![index].content)),
actions: <Widget>[
ToggleSwitch(
minWidth: 90.0,
minHeight: 50.0,
cornerRadius: 20.0,
activeBgColors: const [
[Colors.green],
[Colors.redAccent]
],
activeFgColor: Colors.white,
inactiveBgColor: Colors.grey,
inactiveFgColor: Colors.white,
initialLabelIndex: 0,
totalSwitches: 2,
labels: const ['YES', 'NO'],
onToggle: (index) {
if (kDebugMode) {
print('Switched to: $index');
}
},
),
],
);
},
);
},
child: Column(
children: [
const SizedBox(
width: 5,
height: 2,
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 2.0, horizontal: 2.0),
child: Row(children: [
SizedBox(
width: MediaQuery.of(context).size.width *
0.68,
child: Text(
Constants.capitalizeFirstLetter(
insightslist![index].heading),
style: Constants.headerlistitems1,
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
),
),
SizedBox(
width: MediaQuery.of(context).size.width *
0.22,
child: IconButton(
icon: const Icon(
false
? Icons.visibility
: Icons.visibility_off,
// You can customize the color, size, and other properties of the icon as needed
),
onPressed: () {},
),
),
]),
),
// const VerticalDivider(
// width: 1.0,
// color: Colors.white,
// ),
// SizedBox(
// width:
// MediaQuery.of(context).size.width / 0.8,
// height: 100,
// child: Text(
// insightslist![index].ins2.last,
// style: Constants.headerlistitems,
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// //softWrap: true,
// ),
// ),
const VerticalDivider(
width: 1.0,
color: Colors.white,
),
],
),
),
),
);
},
),
),
const SizedBox(height: 10),
const Text('AI Alert Status',
textAlign: TextAlign.right,
style: Constants.headerfontStyle),
const SizedBox(
......@@ -243,51 +449,260 @@ class _Home extends State<Home> {
),
],
),
child: SfCircularChart(
//backgroundColor: Colors.white,
margin: const EdgeInsets.all(10),
legend: Legend(
isVisible: true,
position: LegendPosition.top,
),
tooltipBehavior: TooltipBehavior(
enable: true,
textStyle:
const TextStyle(fontSize: 22.0, color: Colors.white),
),
palette: const <Color>[
Color.fromARGB(255, 4, 145, 74),
Color.fromARGB(255, 241, 92, 34)
],
series: <CircularSeries>[
PieSeries<GDPData, String>(
dataSource: _chartData,
xValueMapper: (GDPData data, _) => data.continent,
yValueMapper: (GDPData data, _) => data.gdp,
dataLabelSettings: const DataLabelSettings(
isVisible: true,
textStyle:
TextStyle(fontSize: 32.0, color: Colors.white),
),
enableTooltip: true,
radius: '100%',
explode: true,
child: SizedBox(
height: 150,
child: SfCartesianChart(
primaryXAxis: CategoryAxis(
majorGridLines: const MajorGridLines(
width: 0), // Remove major grid lines
minorGridLines: const MinorGridLines(
width: 0), // Remove minor grid lines
axisLine: const AxisLine(width: 0), // Remove axis line
labelStyle:
const TextStyle(fontSize: 0), // Hide axis labels
majorTickLines: const MajorTickLines(
size: 0), // Hide major tick lines
minorTickLines: const MinorTickLines(
size: 0), // Hide minor tick lines
),
],
onDataLabelRender: (DataLabelRenderArgs args) {
args.textStyle = args.textStyle.copyWith(
fontSize: 18, // Set the desired font size
fontFamily: 'Poppins',
fontWeight: FontWeight.bold,
); // Set the desired font size
},
primaryYAxis: NumericAxis(
majorGridLines: const MajorGridLines(
width: 0), // Remove major grid lines
minorGridLines: const MinorGridLines(
width: 0), // Remove minor grid lines
axisLine: const AxisLine(width: 0), // Remove axis line
labelStyle:
const TextStyle(fontSize: 0), // Hide axis labels
majorTickLines: const MajorTickLines(
size: 0), // Hide major tick lines
minorTickLines: const MinorTickLines(
size: 0), // Hide minor tick lines
),
plotAreaBorderWidth: 0, // Remove plot area border
title: ChartTitle(text: ''), // Empty title
legend: Legend(
isVisible: true,
position: LegendPosition.bottom,
),
// tooltipBehavior: TooltipBehavior(
// textStyle:
// const TextStyle(fontSize: 12, color: Colors.white),
// ),
series: <ChartSeries>[
StackedBarSeries<GDPData, String>(
dataSource: _chartData,
xValueMapper: (GDPData data, _) => data.continent,
yValueMapper: (GDPData data, _) => data.resolved,
name: 'Resolved',
legendIconType: LegendIconType.circle,
color: Colors.green,
dataLabelSettings: const DataLabelSettings(
isVisible: true,
textStyle:
Constants.fontStyle), // Show data labels
pointColorMapper: (GDPData data, _) => Colors.green,
),
StackedBarSeries<GDPData, String>(
dataSource: _chartData,
xValueMapper: (GDPData data, _) => data.continent,
yValueMapper: (GDPData data, _) => data.unresolved,
name: 'Unresolved',
legendIconType: LegendIconType.circle,
color: Colors.red,
dataLabelSettings: const DataLabelSettings(
isVisible: true,
textStyle:
Constants.fontStyle), // Show data labels
pointColorMapper: (GDPData data, _) => Colors.red,
),
],
),
),
// child: SfCartesianChart(
// primaryXAxis: NumericAxis(),
// primaryYAxis: CategoryAxis(),
// title: ChartTitle(text: 'Sales analysis'),
// legend: Legend(isVisible: true),
// tooltipBehavior: TooltipBehavior(enable: true),
// palette: const <Color>[
// Color.fromARGB(255, 4, 145, 74),
// Color.fromARGB(255, 241, 92, 34)
// ],
// series: <ChartSeries<GDPData, String>>[
// StackedBarSeries<GDPData, String>(
// dataSource: _chartData,
// xValueMapper: (GDPData sales, _) => sales.continent,
// yValueMapper: (GDPData sales, _) => 0,
// name: 'Alerts Graph',
// dataLabelSettings: DataLabelSettings(isVisible: true),
// ),
// ],
// ),
// child: SfCartesianChart(
// primaryXAxis: CategoryAxis(),
// title: ChartTitle(text: 'Sales analysis'),
// legend: Legend(isVisible: true),
// tooltipBehavior: TooltipBehavior(enable: true),
// palette: const <Color>[
// Color.fromARGB(255, 4, 145, 74),
// Color.fromARGB(255, 241, 92, 34)
// ],
// series: <ChartSeries<GDPData, String>>[
// LineSeries<GDPData, String>(
// dataSource: _chartData,
// xValueMapper: (GDPData sales, _) => sales.continent,
// yValueMapper: (GDPData sales, _) => sales.gdp,
// name: 'Sales',
// dataLabelSettings: DataLabelSettings(isVisible: true),
// )
// ],
// onDataLabelRender: (DataLabelRenderArgs args) {
// args.textStyle = args.textStyle.copyWith(
// fontSize: 18, // Set the desired font size
// fontFamily: 'Poppins',
// fontWeight: FontWeight.bold,
// ); // Set the desired font size
// },
// ),
// child: SfCircularChart(
// //backgroundColor: Colors.white,
// margin: const EdgeInsets.all(10),
// legend: Legend(
// isVisible: true,
// position: LegendPosition.top,
// ),
// tooltipBehavior: TooltipBehavior(
// enable: true,
// textStyle:
// const TextStyle(fontSize: 22.0, color: Colors.white),
// ),
// palette: const <Color>[
// Color.fromARGB(255, 4, 145, 74),
// Color.fromARGB(255, 241, 92, 34)
// ],
// series: <CircularSeries>[
// PieSeries<GDPData, String>(
// dataSource: _chartData,
// xValueMapper: (GDPData data, _) => data.continent,
// yValueMapper: (GDPData data, _) => data.gdp,
// dataLabelSettings: const DataLabelSettings(
// isVisible: true,
// textStyle:
// TextStyle(fontSize: 32.0, color: Colors.white),
// ),
// enableTooltip: true,
// radius: '100%',
// explode: true,
// ),
// ],
// onDataLabelRender: (DataLabelRenderArgs args) {
// args.textStyle = args.textStyle.copyWith(
// fontSize: 18, // Set the desired font size
// fontFamily: 'Poppins',
// fontWeight: FontWeight.bold,
// ); // Set the desired font size
// },
// ),
),
const SizedBox(
height: 15,
width: 1,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Container(
margin: const EdgeInsets.only(
left: 0, top: 0, right: 0, bottom: 0),
width: MediaQuery.of(context).size.width * 0.44,
//visible: isAuthenticated,
child: Container(
//height: MediaQuery.of(context).size.width * 0.12,
padding: const EdgeInsets.all(1),
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.bottomLeft,
end: Alignment.bottomCenter,
colors: [
Color.fromARGB(255, 170, 133, 220),
//Color(0xFFC2185B),
Color.fromARGB(255, 201, 175, 236),
],
),
borderRadius: BorderRadius.circular(7),
),
child: TextFormField(
controller: _controller,
readOnly: true,
enabled: false,
decoration: const InputDecoration(
border: InputBorder.none),
style: Constants.whitefontStyle,
textAlign: TextAlign.left,
onEditingComplete: () {
FocusScope.of(context)
.unfocus(); // remove the focus from the TextFormField
},
)),
),
),
],
),
// const SizedBox(
// height: 10,
// width: 1,
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Expanded(
// child: Container(
// margin: const EdgeInsets.only(
// left: 0, top: 0, right: 0, bottom: 0),
// width: MediaQuery.of(context).size.width * 0.44,
// //visible: isAuthenticated,
// child: Container(
// padding: const EdgeInsets.all(1),
// decoration: BoxDecoration(
// gradient: const LinearGradient(
// begin: Alignment.bottomLeft,
// end: Alignment.bottomCenter,
// colors: [
// Color.fromARGB(255, 249, 68, 2),
// Color.fromARGB(255, 250, 59, 37),
// ],
// ),
// borderRadius: BorderRadius.circular(7),
// ),
// child: TextFormField(
// controller: _controller1,
// readOnly: true,
// enabled: false,
// decoration: const InputDecoration(
// border: InputBorder.none,
// ),
// style: Constants.whitefontStyle,
// textAlign: TextAlign.left,
// onEditingComplete: () {
// FocusScope.of(context).unfocus();
// },
// ),
// ),
// ),
// ),
// ],
// ),
const SizedBox(
height: 10,
width: 1,
),
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
Expanded(
child: SizedBox(
......@@ -674,6 +1089,46 @@ class _Home extends State<Home> {
),
),
),
// child: Container(
// margin: const EdgeInsets.only(
// left: 0, top: 0, right: 0, bottom: 0),
// width: MediaQuery.of(context).size.width * 0.44,
// child: GestureDetector(
// onTap: () {
// // Navigator.push(
// // context,
// // MaterialPageRoute(
// // builder: (context) =>
// // const SpeechSampleApp()));
// },
// child: Container(
// width: MediaQuery.of(context).size.width * 0.44,
// height: MediaQuery.of(context).size.width * 0.22,
// padding: const EdgeInsets.all(5),
// decoration: BoxDecoration(
// gradient: const LinearGradient(
// begin: Alignment.bottomLeft,
// end: Alignment.bottomRight,
// colors: [
// Color(0xFF2c3e50),
// //Color(0xFFC2185B),
// Color(0xFF5aacba),
// ],
// ),
// borderRadius: BorderRadius.circular(7),
// ),
// child: Row(
// children: [
// Image.asset(
// 'assets/images/weekly_report.png',
// // width: 145,
// // height: 160,
// ),
// ],
// ),
// ),
// ),
// ),
),
],
),
......@@ -685,13 +1140,13 @@ class _Home extends State<Home> {
);
}
List<GDPData> getChartData(int res, int un) {
final List<GDPData> chartData = [
GDPData('Resolved', res),
GDPData('UnResolved', un),
];
return chartData;
}
// List<GDPData> getChartData(int res, int un) {
// final List<GDPData> chartData = [
// GDPData('Resolved', res),
// GDPData('UnResolved', un),
// ];
// return chartData;
// }
Future<void> getupdateData(String? selectedDropdownItem) async {
showDialog(
......@@ -711,23 +1166,49 @@ class _Home extends State<Home> {
selectedday = '0${_selectedDate.day}';
}
final String respon;
if (Platform.isAndroid) {
//Response data;
respon = await RemoteData().geAlertSummary(selectedDropdownItem!,
'${_selectedDate.year}-$selectedmonth-$selectedday', 'Android');
} else {
respon = await RemoteData().geAlertSummary(selectedDropdownItem!,
'${_selectedDate.year}-$selectedmonth-$selectedday', 'Ios');
}
final String res;
//Response data;
respon = await RemoteData().geAlertSummary(selectedDropdownItem!,
'${_selectedDate.year}-$selectedmonth-$selectedday');
res = await RemoteData().getpendingAlerts(
selectedDropdownItem,
'${_selectedDate.year}-$selectedmonth-$selectedday',
);
if (kDebugMode) {
print(respon);
print(res);
}
Navigator.of(context).pop();
final chart = chartdataFromJson(respon);
Map<String, dynamic> jsonMap = jsonDecode(res);
var pending_alerts = jsonMap['no_of_pending_alerts'];
var pending_video_alerts = jsonMap['no_of_pending_alert_videos'];
setState(() {
_chartData =
getChartData(int.parse(chart.resolved), int.parse(chart.unresolved));
_chartData = getChartData(
double.parse(chart.resolved), double.parse(chart.unresolved));
_controller.text =
'\t\t Pending \t: $pending_alerts \t Alerts | $pending_video_alerts \tvideos';
//_controller1.text = '\t\t Pending Videos Alerts : $pending_video_alerts';
});
String insights = await RemoteData().getInsights(
selectedRegion!,
selectedDropdownItem,
'${_selectedDate.year}-$selectedmonth-$selectedday',
);
print('Testing Data : $insights');
List<dynamic> parsedJson = json.decode(insights);
print(parsedJson);
List<Insight> insightsList =
parsedJson.map((json) => Insight.fromJson(json)).toList();
setState(() {
insightslist = insightsList;
});
}
}
......@@ -736,8 +1217,55 @@ class MyData {
String? store;
}
// class GDPData {
// GDPData(this.continent, this.gdp);
// final String continent;
// final int gdp;
// }
class GDPData {
GDPData(this.continent, this.gdp);
final String continent;
final int gdp;
final double resolved;
final double unresolved;
GDPData(this.continent, this.resolved, this.unresolved);
}
List<GDPData> getChartData(double res, double un) {
final List<GDPData> chartData = [
GDPData('', res, un), // Example data
// Add more data as needed
];
return chartData;
}
class Insight {
int id;
String content;
String feedback;
String heading;
Insight(
{required this.id,
required this.content,
required this.feedback,
required this.heading});
factory Insight.fromJson(Map<String, dynamic> json) {
return Insight(
id: json['IN_ID'],
content: json['insight_content'],
feedback: json['insight_feedback'],
heading: json['insight_heading'],
);
}
Map<String, dynamic> toJson() {
return {
'IN_ID': id,
'insight_content': content,
'insight_feedback': feedback,
'insight_heading': heading,
};
}
}
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:share_plus/share_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:storemonitor/Screens/Issue.dart';
import 'package:storemonitor/Screens/SurvellianceView.dart';
......@@ -40,21 +38,18 @@ class _IssueVideos extends State<IssueVideos> {
if (kDebugMode) {
print('Granted');
}
// You have the permission, you can now access storage.
} else if (status.isDenied) {
if (kDebugMode) {
print('Not Granted');
}
// The user denied the permission. You can explain why you need it and request again.
} else if (status.isPermanentlyDenied) {
// The user permanently denied the permission. You can open the app settings to let the user manually enable it.
openAppSettings();
}
}
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
//print(userId);
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
......@@ -82,14 +77,12 @@ class _IssueVideos extends State<IssueVideos> {
child: CircularProgressIndicator(
color: Color.fromARGB(255, 29, 20, 34)));
});
//Response data;
final respon = await RemoteData().getIssueVideos(name);
Map<String, dynamic> responseMap = jsonDecode(respon);
if (kDebugMode) {
print(responseMap['data']);
}
if (responseMap['data'] == null ||
!(responseMap['data'] as List).isNotEmpty) {
if (responseMap['data'] == null || !(responseMap['data'] as List).isNotEmpty) {
notificationslist = [];
setState(() {
notificationslist;
......@@ -107,7 +100,9 @@ class _IssueVideos extends State<IssueVideos> {
}
}
Navigator.of(context).pop();
} else {}
} else {
}
// } catch (e) {
// Constants('Review', e.).showAlertDialog(context);
// }shareImageWithText(String Text, 'Reason: ${filteredAlerts![itemIndex].alertReason}\nCamera:${filteredAlerts![itemIndex].cameraName}\nTime:${filteredAlerts![itemIndex].alertTime}\nID:${filteredAlerts![itemIndex].notificationID}');
......@@ -160,6 +155,7 @@ class _IssueVideos extends State<IssueVideos> {
//crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
// SizedBox(
// width: double.infinity,
// //height: double.infinity,
......@@ -180,6 +176,7 @@ class _IssueVideos extends State<IssueVideos> {
// }).toList(),
// ),
// ),
Container(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
decoration: BoxDecoration(
......
......@@ -17,7 +17,6 @@ class LoginPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
//resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
......@@ -28,7 +27,6 @@ class LoginPage extends StatelessWidget {
colors: [
Color.fromARGB(255, 125, 50, 253),
Color.fromARGB(255, 125, 50, 253),
// Color.fromARGB(255, 157, 55, 237)
],
),
),
......@@ -36,19 +34,19 @@ class LoginPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 30),
// GifImage(
// image: AssetImage('assets/sample.gif'), // Replace with your actual GIF image path
// ),
//GifImage(
// image: AssetImage('assets/sample.gif'), // Replace with your actual GIF image path
//),
GifView.asset(
'assets/images/login.gif',
height: 350,
width: 350,
frameRate: 30, // default is 15 FPS
frameRate: 30, //default is 15 FPS
),
// Image.asset(
// 'assets/images/login_header_image.png',
// height: 350,
// width: 350,
//Image.asset(
// 'assets/images/login_header_image.png',
// height: 350,
// width: 350,
//),
const SizedBox(height: 30),
const LoginForm(),
......@@ -91,7 +89,6 @@ class LoginFormState extends State<LoginForm> {
Future<void> login(String email, String pass) async {
//Constants.showAlertDialog1(context);
//final DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
// String? deviceId;
// if (Platform.isAndroid) {
// const androidId = AndroidId();
......@@ -111,6 +108,9 @@ class LoginFormState extends State<LoginForm> {
// Handle success status
final userResponse = userResponseFromJson(response);
if (userResponse.status.contains('Success')) {
if (kDebugMode) {
print('Login Response $responseMap');
}
List<Map<String, dynamic>>? normalArray;
if (userResponse.stores.isNotEmpty) {
normalArray = userResponse.stores.map((item) {
......@@ -119,11 +119,18 @@ class LoginFormState extends State<LoginForm> {
};
}).toList();
}
String jsonStr = json.encode(normalArray);
String str = json.encode(normalArray);
if (kDebugMode) {
print('Testing Stores List : str');
}
String jsonStr = json.encode(userResponse.stores);
if (kDebugMode) {
print('Final Data $jsonStr');
}
Navigator.pop(context);
//print(userResponse.level);
Constants.saveLoginCredentials(userResponse.empName, _email.text,
jsonStr, '', userResponse.level, true);
jsonStr, str, userResponse.level, true);
Navigator.pushReplacement(
context,
MaterialPageRoute(
......@@ -174,7 +181,7 @@ class LoginFormState extends State<LoginForm> {
height: 50,
child: TextFormField(
cursorColor: const Color.fromARGB(255, 125, 50, 253),
style: Constants.fontStyle,
style: Constants.LoginfontStyle,
controller: _email,
//obscureText: true,
decoration: InputDecoration(
......@@ -188,7 +195,6 @@ class LoginFormState extends State<LoginForm> {
// Align the label text to the left by specifying the padding
//contentPadding: const EdgeInsets.all(15.0),
// Align the suffix icon to the right by wrapping it in a Row
suffix: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
......@@ -202,7 +208,6 @@ class LoginFormState extends State<LoginForm> {
)
],
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey, // Set the desired color here
......@@ -216,6 +221,7 @@ class LoginFormState extends State<LoginForm> {
borderRadius: BorderRadius.circular(5.0),
),
),
//style: const TextStyle(color: Colors.black),
),
),
const SizedBox(height: 15),
......@@ -223,7 +229,7 @@ class LoginFormState extends State<LoginForm> {
height: 50,
child: TextFormField(
cursorColor: const Color.fromARGB(255, 125, 50, 253),
style: Constants.fontStyle,
style: Constants.LoginfontStyle,
controller: _pass,
obscureText: true,
decoration: InputDecoration(
......@@ -297,7 +303,8 @@ class LoginFormState extends State<LoginForm> {
});
login(_email.text, _pass.text);
} else {
Constants.dialogMessage(context, 'Login', 'Check your internetconnection');
Constants.dialogMessage(
context, 'Login', 'Check your internetconnection');
}
}
},
......@@ -305,10 +312,12 @@ class LoginFormState extends State<LoginForm> {
backgroundColor: MaterialStateProperty.all<Color>(
const Color.fromARGB(255, 62, 43, 75)),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
//side: BorderSide(color: Colors.red)
))),
)
)
),
child: const Text(
'LOGIN',
style: Constants.fontStyle,
......
......@@ -79,7 +79,7 @@ class _VideoPlayerScreenState extends State<MyHomePage> {
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(),
android: AndroidInAppWebViewOptions(
supportMultipleWindows: true,
supportMultipleWindows: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
......
......@@ -3,7 +3,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sms/flutter_sms.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart' show SharedPreferences;
import 'package:shared_preferences/shared_preferences.dart'
show SharedPreferences;
import 'package:storemonitor/Screens/Chatboat.dart';
import 'package:storemonitor/Screens/Constants.dart';
import 'package:storemonitor/Screens/LoginPage.dart';
import 'package:storemonitor/Services/RemoteData.dart';
......@@ -11,7 +13,8 @@ import 'package:url_launcher/url_launcher.dart';
class NavBar extends StatefulWidget {
final String message;
const NavBar({super.key, required this.message});
final String storeNames;
NavBar({super.key, required this.message, required this.storeNames});
@override
_NavBarState createState() => _NavBarState();
......@@ -21,6 +24,7 @@ class _NavBarState extends State<NavBar> {
String? name;
String? access;
var isMeeters = '';
List<String> names = [];
Future<void> _getSharedPreferencesValues() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
setState(() {
......@@ -34,44 +38,66 @@ class _NavBarState extends State<NavBar> {
super.initState();
_getSharedPreferencesValues();
isMeeters = widget.message;
names = widget.storeNames
.substring(1, widget.storeNames.length - 1) // Remove square brackets
.split(", ") // Split by comma and space
.map((store) => store.replaceAll(
RegExp(r'[^\w\s]+'), '')) // Remove non-alphanumeric characters
.toList();
if (kDebugMode) {
print(isMeeters);
}
if (kDebugMode) {
print(names);
}
}
// void makePhoneCall(String phoneNumber) async {
// //FlutterPhoneDirectCaller.callNumber(phoneNumber);
// //launchUrl("tel:+99364921507");
// // final Uri phoneUri = Uri(scheme: "tel", path: phoneNumber);
// // try {
// // if (await canLaunchUrl(phoneUri)) await canLaunchUrl(phoneUri);
// // } catch (error) {
// // throw ("Cannot dial");
// // }
// final url = Uri.parse('tel:$phoneNumber');
// if (await canLaunchUrl(url)) {
// await launchUrl(url);
// } else {
// throw 'Could not launch $url';
// }
// }
void makePhoneCall(String phoneNumber) async {
//FlutterPhoneDirectCaller.callNumber(phoneNumber);
//launchUrl("tel:+99364921507");
// final Uri phoneUri = Uri(scheme: "tel", path: phoneNumber);
// try {
// if (await canLaunchUrl(phoneUri)) await canLaunchUrl(phoneUri);
// } catch (error) {
// throw ("Cannot dial");
// }
final url = Uri.parse('tel:$phoneNumber');
if (await canLaunchUrl(url)) {
await launchUrl(url);
} else {
throw 'Could not launch $url';
}
final Uri launchUri = Uri(
scheme: 'tel',
path: phoneNumber,
);
if (!mounted) return; // Check if the widget is still mounted
await launchUrl(launchUri);
}
void requestPhoneCallPermission() async {
if (await Permission.phone.request().isGranted) {
if (!mounted) return; // Check if the widget is still mounted
PermissionStatus status = await Permission.phone.request();
if (kDebugMode) {
print('Status $status');
}
if (!mounted) return;
if (status.isGranted) {
makePhoneCall('8121007327');
} else {
// Permission is denied or permanently denied, show an explanation to the user
if (await Permission.phone.isPermanentlyDenied) {
if (status.isPermanentlyDenied) {
// Show a dialog explaining why the permission is required and how to enable it
openAppSettings();
} else {
// Permission is denied but not permanently, show a rationale to the user
if (!mounted) return; // Check if the widget is still mounted
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
const Text('Phone call permission is required to make calls.'),
content: const Text('Phone call permission is required to make calls.'),
action: SnackBarAction(
label: 'Grant',
onPressed: () {
......@@ -113,8 +139,8 @@ class _NavBarState extends State<NavBar> {
children: [
Image.asset(
'assets/images/my_profile.png',
width: 24,
height: 24,
width: 32,
height: 32,
),
const SizedBox(
width: 30,
......@@ -146,14 +172,32 @@ class _NavBarState extends State<NavBar> {
),
],
),
ListTile(
leading: Image.asset(
'assets/images/chat.png',
width: 32,
height: 32,
),
title: const Text(
'Bob',
style: Constants.headerlistitems,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SpeechSampleApp1(),
),
);
}),
const Divider(
height: 1,
),
ListTile(
leading: Image.asset(
'assets/images/command_center.png',
width: 24,
height: 24,
width: 32,
height: 32,
),
title: const Text(
'Command Center',
......@@ -167,17 +211,18 @@ class _NavBarState extends State<NavBar> {
ListTile(
leading: Image.asset(
'assets/images/support.png',
width: 24,
height: 24,
width: 32,
height: 32,
),
title: const Text(
'Support',
'Raise a ticket',
style: Constants.headerlistitems,
),
onTap: () => showDialog(
context: context,
builder: (BuildContext context) {
return CustomDialog1(message: isMeeters);
return CustomDialog1(
message: isMeeters, names: names.toString());
},
),
),
......@@ -187,8 +232,8 @@ class _NavBarState extends State<NavBar> {
ListTile(
leading: Image.asset(
'assets/images/change_password.png',
width: 24,
height: 24,
width: 32,
height: 32,
),
title: const Text(
'Change Password',
......@@ -212,8 +257,8 @@ class _NavBarState extends State<NavBar> {
ListTile(
leading: Image.asset(
'assets/images/logout.png',
width: 24,
height: 24,
width: 32,
height: 32,
),
title: const Text(
'Logout',
......@@ -301,10 +346,14 @@ class _CustomDialogState extends State<CustomDialog> {
@override
Widget build(BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), // Adjust the radius as needed
),
key: alertDialogKey,
title: const Text(
'Change Password',
style: Constants.fontStyle,
style: Constants.HeaderStyle,
textAlign: TextAlign.center,
),
content: Column(
mainAxisSize: MainAxisSize.min,
......@@ -501,13 +550,16 @@ class _CustomDialogState extends State<CustomDialog> {
class CustomDialog1 extends StatefulWidget {
final String message;
final String names;
const CustomDialog1({Key? key, required this.message}) : super(key: key);
const CustomDialog1({Key? key, required this.message, required this.names})
: super(key: key);
@override
_customdialog1state createState() => _customdialog1state();
String get getMessage => message;
//List<String> get getList => names;
}
class _customdialog1state extends State<CustomDialog1> {
......@@ -528,17 +580,8 @@ class _customdialog1state extends State<CustomDialog1> {
}
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
print(userId);
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
.toList();
print(storesList);
int index = storesList!.indexWhere((item) => item.contains(message));
setState(() {
selectedDropdownItem = storesList![index];
selectedDropdownItem = storesList![0];
//print(selectedDropdownItem);
//getData(selectedDropdownItem!);
});
......@@ -548,15 +591,26 @@ class _customdialog1state extends State<CustomDialog1> {
void initState() {
super.initState();
message = widget.message;
storesList = widget.names
.substring(1, widget.names.length - 1) // Remove square brackets
.split(", ") // Split by comma and space
.map((store) => store.replaceAll(
RegExp(r'[^\w\s]+'), '')) // Remove non-alphanumeric characters
.toList();
loadData(); // Call the loadData() function here
}
@override
Widget build(BuildContext context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), // Adjust the radius as needed
),
title: const Text(
'Support',
style: Constants.fontStyle,
'Raise A Ticket',
style: Constants.HeaderStyle,
textAlign: TextAlign.center,
),
//insetPadding: EdgeInsets.zero,
content: Column(
......@@ -601,7 +655,7 @@ class _customdialog1state extends State<CustomDialog1> {
controller: _textFieldController2,
//obscureText: true,
decoration: InputDecoration(
labelText: 'Name',
labelText: 'Your Name',
labelStyle: const TextStyle(
//fontWeight: FontWeight.bold,
fontSize: 14,
......@@ -693,7 +747,7 @@ class _customdialog1state extends State<CustomDialog1> {
//side: BorderSide(color: Colors.red)
))),
child: const Text(
'SUBMIT',
'Raise',
style: Constants.fontStyle,
),
),
......
......@@ -44,7 +44,7 @@ class _NotificationReport extends State<NotificationReport> {
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
//print(userId);
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
......@@ -249,6 +249,7 @@ class _NotificationReport extends State<NotificationReport> {
),
TextFormField(
controller: _dateTime1,
readOnly: true,
//onTap: () => print('Date Picker'),
decoration: InputDecoration(
contentPadding:
......
......@@ -20,6 +20,7 @@ class Review extends StatefulWidget {
//const Review({super.key});
final String message;
final String selecteddate;
const Review({super.key, required this.message, required this.selecteddate});
@override
......@@ -91,7 +92,7 @@ class _Review extends State<Review> {
Future<void> loadData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? userId = prefs.getString("stores_list");
String? userId = prefs.getString("storeName");
//print(userId);
storesList = (json.decode(userId!) as List<dynamic>)
.map((map) => map['name'] as String)
......@@ -217,10 +218,6 @@ class _Review extends State<Review> {
}
}
//ebe5f6
//f772d1
//c972f2
Color _buttonColor1 = const Color.fromARGB(255, 235, 229, 246);
Color _buttonColor2 = const Color.fromARGB(255, 235, 229, 246);
Color _buttonColor3 = const Color.fromARGB(255, 235, 229, 246);
......@@ -236,7 +233,6 @@ class _Review extends State<Review> {
carouselKey = UniqueKey();
});
getData(imp);
//Constants.showAlertDialog1(context);
setState(() {
black = Colors.white;
black1 = Colors.black;
......@@ -262,8 +258,6 @@ class _Review extends State<Review> {
carouselKey = UniqueKey();
});
getData(imp);
//carouselKey = UniqueKey();
//Constants.showAlertDialog1(context);
setState(() {
black = Colors.black;
black1 = Colors.white;
......@@ -471,6 +465,7 @@ class _Review extends State<Review> {
),
TextFormField(
controller: _dateTime,
readOnly: true,
//onTap: () => print('Date Picker'),
decoration: InputDecoration(
contentPadding:
......@@ -760,7 +755,6 @@ class _Review extends State<Review> {
} else {
isvisible = true;
}
return Padding(
padding: const EdgeInsets.all(15.0),
child: Card(
......@@ -1150,7 +1144,7 @@ class _Review extends State<Review> {
context)
.size
.width /
3.2,
3.5,
child:
const Center(
child:
......@@ -1221,7 +1215,7 @@ class _Review extends State<Review> {
context)
.size
.width /
1.3,
1.4,
child:
const Center(
child:
......@@ -1287,7 +1281,6 @@ class _Review extends State<Review> {
userId!,
feed,
comments);
// print('GetAction: $res');
if (res == 200) {
setState(() {
if (feed == 'yes' || feed == 'no' || feed == 'audit') {
......@@ -1296,20 +1289,18 @@ class _Review extends State<Review> {
}
Constants('Review', 'Sucess').showAlertDialog(context, false);
});
} else {
Constants('Review', res.toString()).showAlertDialog(context, false);
}
}
Future<void> shareImageWithText(String url, String textToShare) async {
final box = context.findRenderObject() as RenderBox?;
//print('inside share function');
final response = await get(Uri.parse(url));
//print('got response:$response');
//final bytes = response.bodyBytes;
final Directory temp = await getTemporaryDirectory();
final File imageFile = File('${temp.path}/ShareImage.jpg');
imageFile.writeAsBytesSync(response.bodyBytes);
if (Platform.isAndroid) {
await Share.shareXFiles([XFile('${temp.path}/ShareImage.jpg')],
text: textToShare,
//subject: 'Reason',
......@@ -1365,7 +1356,6 @@ class _Review extends State<Review> {
padding: EdgeInsets.only(left: 10),
child: Text('Submit'),
),
//child: const Text('Submit'),
),
],
);
......
......@@ -117,14 +117,15 @@ class _SignUpState extends State<SignUp> {
// width: 300,
// height: 400,
// ),
TextField(
TextFormField(
keyboardType: TextInputType.number,
controller: _email,
scrollPadding: const EdgeInsets.all(100.0),
//scrollPadding: const EdgeInsets.all(100.0),
decoration: const InputDecoration(
hintText: 'UserId',
border: OutlineInputBorder(),
),
style: const TextStyle(color: Colors.black),
),
const SizedBox(
height: 20,
......@@ -138,6 +139,7 @@ class _SignUpState extends State<SignUp> {
hintText: 'Password',
border: OutlineInputBorder(),
),
style: const TextStyle(color: Colors.black),
),
const SizedBox(
height: 30,
......
......@@ -44,7 +44,9 @@ class _SplashScreenState extends State<SplashScreen> {
message: 'success',
)));
} else {
//print('else condition :${isLoggedIn}');
if (kDebugMode) {
print('else condition : $isLoggedIn');
}
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => const LoginPage()),
......@@ -91,5 +93,5 @@ class _SplashScreenState extends State<SplashScreen> {
print(info.utsname.machine); // "iPhone15,2"
print(info.utsname.version); // "iPhone 14 Pro"
}
} */
}*/
}
import 'dart:convert';
import 'package:flutter/material.dart';
class StoreSelector extends StatefulWidget {
@override
_StoreSelectorState createState() => _StoreSelectorState();
}
class _StoreSelectorState extends State<StoreSelector> {
List<Store> stores = [];
List<String> regions = [];
List<String> storeNames = [];
String? selectedRegion;
String? selectedStore;
@override
void initState() {
super.initState();
fetchStores();
}
void fetchStores() {
const jsonData = '''
{
"STORES": [
{"region": "KARNATAKA", "storename": "KLM JAYANAGAR"},
{"region": "KARNATAKA", "storename": "KLM HSR"},
{"region": "ANDHRA PRADESH", "storename": "KLM GAJUWAKA"},
{"region": "TELANGANA", "storename": "KLM AMEERPET"},
{"region": "TELANGANA", "storename": "KLM DILSUKHNAGAR"},
{"region": "TELANGANA", "storename": "KLM KHAMMAM"},
{"region": "TELANGANA", "storename": "KLM AS RAO NAGAR"},
{"region": "TELANGANA", "storename": "KLM BODUPPAL"},
{"region": "ANDHRA PRADESH", "storename": "KLM BHIMAVARAM"},
{"region": "ANDHRA PRADESH", "storename": "KLM NELLORE"},
{"region": "ANDHRA PRADESH", "storename": "KLM VIZAG"},
{"region": "TELANGANA", "storename": "KLM VANASTHALIPURAM"},
{"region": "KARNATAKA", "storename": "KLM MARATHAHALLI"},
{"region": "TELANGANA", "storename": "KLM KUKATPALLY"},
{"region": "TELANGANA", "storename": "KLM PATNY"},
{"region": "TELANGANA", "storename": "KLM SUCHITRA"},
{"region": "TELANGANA", "storename": "MANDIR BANJARA HILLS"},
{"region": "TELANGANA", "storename": "KM-NEW-AMPT"},
{"region": "TELANGANA", "storename": "KM NEW PATNY"}
]
}
''';
final Map<String, dynamic> jsonResponse = json.decode(jsonData);
stores = (jsonResponse['STORES'] as List)
.map((data) => Store.fromJson(data))
.toList();
// Get unique regions
regions = stores.map((store) => store.region).toSet().toList();
setState(() {});
}
void updateStoreNames(String region) {
storeNames = stores
.where((store) => store.region == region)
.map((store) => store.storename)
.toList();
selectedStore = null; // Reset the selected store
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Store Selector'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DropdownButton<String>(
hint: Text('Select Region'),
value: selectedRegion,
isExpanded: true,
onChanged: (newValue) {
setState(() {
selectedRegion = newValue;
updateStoreNames(newValue!);
});
},
items: regions.map((region) {
return DropdownMenuItem<String>(
value: region,
child: Text(region),
);
}).toList(),
),
SizedBox(height: 20),
DropdownButton<String>(
hint: Text('Select Store'),
value: selectedStore,
isExpanded: true,
onChanged: (newValue) {
setState(() {
selectedStore = newValue;
});
},
items: storeNames.map((store) {
return DropdownMenuItem<String>(
value: store,
child: Text(store),
);
}).toList(),
),
],
),
),
);
}
}
class Store {
final String region;
final String storename;
Store({required this.region, required this.storename});
factory Store.fromJson(Map<String, dynamic> json) {
return Store(
region: json['region'],
storename: json['storename'],
);
}
}
\ No newline at end of file
......@@ -98,8 +98,8 @@ class _SurvellianceViewState extends State<SurvellianceView> {
initilize(videoUrl);
}
void getUpdate1(String Id, String comment) async {
final respon = await RemoteData().getUpdateIssueVideos1(Id, comment);
void getUpdate1(String id, String comment) async {
final respon = await RemoteData().getUpdateIssueVideos1(id, comment);
Map<String, dynamic> responseMap = jsonDecode(respon);
Navigator.of(context).pop();
hideKeyboard(context);
......@@ -136,28 +136,29 @@ class _SurvellianceViewState extends State<SurvellianceView> {
}
Future<void> shareImageWithText(String textToShare, String desc) async {
List<String> paths = [
textToShare
]; // If you're sharing text, you might not need this list
// List<String> paths = [
// textToShare
// ]; // If you're sharing text, you might not need this list
final box = context.findRenderObject() as RenderBox?;
if (Platform.isAndroid) {
print('Android Share +++++++++++++++++++$desc');
// await Share.shareFiles(
if (kDebugMode) {
print('Android Share +++++++++++++++++++$desc');
}
//await Share.shareFiles(
// paths,
// text: '$textToShare\n\n$desc', // Combine text and description
// subject: 'Your Subject Here',
// sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
// );
//);
await Share.share(
'$textToShare \n\n$desc',
subject: desc,
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
);
} else if (Platform.isIOS) {
print('iOS Share +++++++++++++++++++$textToShare');
if (kDebugMode) {
print('iOS Share +++++++++++++++++++$textToShare');
}
await Share.share(
'$textToShare \n\n$desc',
// subject: 'Reason',
......
......@@ -10,6 +10,8 @@ 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 '../Services/RemoteData.dart';
import 'Constants.dart';
//780103940
class SpeechSampleApp extends StatefulWidget {
const SpeechSampleApp({Key? key}) : super(key: key);
......@@ -20,6 +22,7 @@ class SpeechSampleApp extends StatefulWidget {
/// 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;
final bool _logEvents = false;
......@@ -38,6 +41,8 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
String _currentLocaleId = '';
SpeechToText speech = SpeechToText();
List<Data>? data = [];
String femalevoice = "cmn-CN-Standard-A";
String malevoice = "cmn-CN-Standard-B";
@override
void initState() {
......@@ -45,7 +50,9 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
if (Platform.isAndroid) {
checkAndRequestMicrophonePermission();
}
if (Platform.isIOS) {}
if (Platform.isIOS) {
// iOS needs to wait until the widget is shown before requesting permission
}
super.initState();
}
......@@ -68,12 +75,11 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
}
}
}
/// 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 {
......@@ -91,10 +97,10 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
_hasSpeech = hasSpeech;
});
} catch (e) {
setState(() {
lastError = 'Speech recognition failed: ${e.toString()}';
_hasSpeech = false;
});
setState(() {
lastError = 'Speech recognition failed: ${e.toString()}';
_hasSpeech = false;
});
}
}
......@@ -102,7 +108,27 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Speech to Text Example'),
leading: IconButton(
icon: Image.asset(
"assets/images/back_arrow.png",
width: 24,
height: 24,
color: Colors.white,
),
//color: Colors.white,
onPressed: () {
Navigator.pop(context);
data!.clear();
}),
title: const Text(
'Speech to Text / Text to Speech',
style: Constants.fontStyle,
),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: Constants.getReturn(),
),
),
),
body: Column(children: [
//const HeaderWidget(),
......@@ -203,19 +229,80 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
if (kDebugMode) {
print('Final Result: $lastWords');
}
String res = await RemoteData().getSpeechResponse(lastWords);
// Data dataInstance = Data(question: lastWords, answer: 'Hello This is Ramesh');
// await ftts.setLanguage("en-IN");
// await ftts.setSpeechRate(0.4); //speed of speech
// await ftts.setVolume(1.0); //volume of speech
// await ftts.setPitch(2.0); //pitc of sound
// List<dynamic> languages = await ftts.getLanguages;
// if (kDebugMode) {
// print(languages);
// }
//print(voices);
// print(reference);
//await ftts.setVoice(reference);
// var voice = await ftts.getDefaultVoice;
// print(voice);
//{locale: en-IN, quality: default, gender: male, name: Rishi, identifier: com.apple.voice.compact.en-IN.Rishi}
//await ftts.setVoice({"name": "en-in-x-ene-network", "locale": "en-IN"});
//play text to sp
// var result = await ftts.speak('Welcome to World ');
// if (kDebugMode) {
// print(result);
// }
// data!.add(dataInstance);
// List<dynamic> language = await ftts.getLanguages;
// if (kDebugMode) {
// print(language);
// } // In
// for (final languags in language) {
// if (kDebugMode) {
// print(languags);
// }
// }
String res = await RemoteData().getVoiceResponse(File(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");
//List<dynamic> output1 = jsonResponse['output1'];
if (kDebugMode) {
print('DataFetching $jsonResponse');
}
if (jsonResponse['output1'].isNotEmpty) {
//Map<String, dynamic> firstItem = output1[0];
String zoneValue = jsonResponse['output1'];
if (kDebugMode) {
print('DataFetching1 $zoneValue');
}
Data dataInstance =
Data(question: lastWords, answer: zoneValue, image: 'None');
await ftts.setLanguage("en-IN");
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');
List<dynamic> voices = await ftts.getVoices;
for (final voice in voices) {
if (kDebugMode) {
print(voice);
}
}
//Map<String, String> reference = {'setVoice': malevoice};
if (Platform.isIOS) {
await ftts.setVoice({"name": "Rishi", "locale": "en-IN"});
//await ftts.setIosAudioCategory(
//IosTextToSpeechAudioCategory.playAndRecord,
//[IosTextToSpeechAudioCategoryOptions.defaultToSpeaker],);
await ftts.setIosAudioCategory(
IosTextToSpeechAudioCategory.playback,
[IosTextToSpeechAudioCategoryOptions.allowBluetooth,
IosTextToSpeechAudioCategoryOptions.allowBluetoothA2DP,
IosTextToSpeechAudioCategoryOptions.mixWithOthers,
IosTextToSpeechAudioCategoryOptions.defaultToSpeaker],
IosTextToSpeechAudioMode.defaultMode);
} else {
await ftts.setVoice({"name": "en-in-x-ene-local", "locale": "en-IN"});
}
//await ftts.setVoice(reference);
//play text to sp
var result = await ftts.speak(zoneValue);
if (kDebugMode) {
......@@ -249,6 +336,8 @@ class _SpeechSampleAppState extends State<SpeechSampleApp> {
setState(() {
data = data;
});
lastWords = '';
setState(() {});
}
});
}
......@@ -333,6 +422,7 @@ class RecognitionResultsWidget extends StatelessWidget {
child: Text(
lastWords,
textAlign: TextAlign.start,
style: Constants.LoginfontStyle,
),
),
),
......@@ -416,13 +506,12 @@ class ErrorWidget extends StatelessWidget {
/// 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;
......@@ -431,6 +520,7 @@ class SpeechControlWidget extends StatelessWidget {
final void Function() stopListening;
final void Function() cancelListening;
static List<Data>? data1 = [];
final TextStyle _textFieldStyle = Constants.LoginbuttonsfontStyle;
//final TextEditingController _dateTime = TextEditingController();
......@@ -445,12 +535,12 @@ class SpeechControlWidget extends StatelessWidget {
height: MediaQuery.of(context).size.height * 0.80,
child: Container(
decoration: BoxDecoration(
color: const Color.fromARGB(255, 249, 248, 248),
color: const Color.fromARGB(255, 255, 255, 255),
border: Border.all(
style: BorderStyle.solid,
color: const Color.fromARGB(255, 164, 149, 120),
color: const Color.fromARGB(255, 255, 255, 255),
),
borderRadius: BorderRadius.circular(7),
borderRadius: BorderRadius.circular(0),
),
child: Column(
children: [
......@@ -458,41 +548,84 @@ class SpeechControlWidget extends StatelessWidget {
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),
//String answer = data1![index].answer;
Widget content = Text(
data1![index].answer,
style: Constants.LoginbuttonsfontStyle,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
maxLines: 20,
);
if (data1![index].image != 'None') {
Uint8List imageBytes =
base64Decode(data1![index].image);
content = Image.memory(
imageBytes,
fit: BoxFit.cover,
height: 100, // Adjust height as needed
width: 100, // Adjust width as needed
);
}
return Padding(
padding: const EdgeInsets.fromLTRB(15, 5, 15, 5),
child: SizedBox(
width: MediaQuery.of(context).size.width / 1,
// Add padding as needed
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
data1![index].question,
textAlign: TextAlign.left,
softWrap: true,
maxLines: 4,
Container(
decoration: BoxDecoration(
color: const Color.fromARGB(
255, 238, 177, 64),
borderRadius: BorderRadius.circular(
20), // Adjust the value as needed
),
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Text(
style: Constants.speeachfontStyle,
data1![index].question,
textAlign: TextAlign.right,
softWrap: true,
maxLines: 4,
),
),
),
],
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Text(
data1![index].answer,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.right,
maxLines: 4,
),
),
],
const SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
color: const Color.fromARGB(
255, 239, 242, 247),
borderRadius: BorderRadius.circular(
20), // Adjust the value as needed
),
// Set your desired background color here
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(child: content
// child: Text(
// style:
// Constants.LoginbuttonsfontStyle,
// data1![index].answer,
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// maxLines: 20,
// ),
),
],
),
),
],
),
......@@ -509,7 +642,9 @@ class SpeechControlWidget extends StatelessWidget {
// style: Constants.Titletextstyle,
// enabled: false,
readOnly: true,
controller: TextEditingController(text: total),
controller: TextEditingController(
text: total,
),
onTap: () {},
decoration: InputDecoration(
// border: Border.all(color: Colors.grey),
......@@ -524,12 +659,16 @@ class SpeechControlWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(2.0),
),
suffixIcon: IconButton(
icon: const Icon(Icons.mic),
icon: Icon(isListening ? Icons.mic : Icons.mic_none),
color: isListening ? Colors.green : Colors.grey,
onPressed: () {
startListening();
//widget.total
//total = '';
},
),
),
style: _textFieldStyle,
),
],
),
......@@ -550,20 +689,21 @@ class SpeechControlWidget extends StatelessWidget {
class Data {
String question = ''; // Use camelCase for variable names
String answer = ''; // Use camelCase for variable names
String image = '';
// Constructor
Data({required this.question, required this.answer});
Data({required this.question, required this.answer, required this.image});
// Named constructor for creating an instance from a Map
Data.fromMap(Map<String, dynamic> map)
: question = map['Question'] ?? '',
answer = map['Answer'] ?? '';
answer = map['Answer'] ?? '',
image = map['Image'] ?? '';
// Convert the object to a Map
Map<String, dynamic> toMap() {
return {
'Question': question,
'Answer': answer,
'Image': image,
};
}
}
......@@ -571,7 +711,6 @@ class Data {
class InitSpeechWidget extends StatelessWidget {
const InitSpeechWidget(this.hasSpeech, this.initSpeechState, {Key? key})
: super(key: key);
final bool hasSpeech;
final Future<void> Function() initSpeechState;
......@@ -582,7 +721,7 @@ class InitSpeechWidget extends StatelessWidget {
children: <Widget>[
TextButton(
onPressed: hasSpeech ? null : initSpeechState,
child: const Text('Initialize'),
child: const Text('Initialize ...'),
),
],
);
......
......@@ -6,7 +6,7 @@ import 'package:http/http.dart' as http;
class RemoteData {
String BaseUrl = 'http://vaman.plutokm.com/';
String LoginUrl = 'http://vaman.plutokm.com/login';
String LoginUrl = 'http://vaman.plutokm.com/login_test';
//String AlertSummary = 'http://vaman.plutokm.com/alert_summary_flutter';
String AlertSummary = 'http://vaman.plutokm.com/alert_summary_flutter';
String Review = 'http://vaman.plutokm.com/alerts_new';
......@@ -15,8 +15,8 @@ class RemoteData {
String UploadVideo = 'http://vaman.plutokm.com/registeration_video';
String feedback = 'http://vaman.plutokm.com/api/mx_feedback_new';
String AuditData = 'http://vaman.plutokm.com/audit_page';
//String AuditData = 'http://192.168.65.111:8088/audit_page';
//String AuditupdateData = 'http://192.168.65.111:8088/audit_update';
//String AuditData = 'http://192.168.65.111:8088/audit_page';
//String AuditupdateData = 'http://192.168.65.111:8088/audit_update';
String AuditupdateData = 'http://vaman.plutokm.com/audit_update';
String ChangePassword = 'http://vaman.plutokm.com/changePassword';
String FootFallVerify = 'http://vaman.plutokm.com/footfall_verify_flutter';
......@@ -26,9 +26,14 @@ class RemoteData {
String IssueVideos = 'http://vaman.plutokm.com/video_alert_page';
String UpdateIssueVideos = 'http://vaman.plutokm.com/update_video_alert';
String UpdateIssueVideos1 = 'http://vaman.plutokm.com/L2_update_video_alert';
String Insights = 'http://vaman.plutokm.com/get_insights';
String Type = "Content-Type";
String App_json = "application/json";
String speechtotext = 'http://192.168.65.148:5113/mobile_response/';
String speechtotext = 'http://192.168.65.112:5113/mobile_response2/';
String pendingAlerts = 'http://vaman.plutokm.com/pending_alerts';
String speechtotext1 = 'http://vaman.plutokm.com/llama_tool_1/';
String speechtotext2 = 'http://vaman.plutokm.com/llama_tool_2/';
String speechtotext3 = 'http://vaman.plutokm.com/llama_tool_3/';
// Stores List Request GET Method
// Login Request POST Method
......@@ -44,35 +49,106 @@ class RemoteData {
? 'IOS'
: 'Unknown',
};
if (kDebugMode) {
print(body);
}
var client = http.Client();
var res = await client.post(Uri.parse(LoginUrl),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
print(res.body);
return res.body;
} else {
throw Exception('Status code was wrong$res.statusCode');
}
}
Future<String> getSpeechResponse(String? text) async {
Future<String> getVoiceResponse(File text, String? userid) async {
var header = {Type: App_json};
var res = '';
var response = await http.post(
Uri.parse('$speechtotext$text'),
headers: header,
);
var url = '';
if (kDebugMode) {
print(userid);
}
if (text != null && userid != null) {
//url = '$speechtotext3$text';
url = 'http://vaman.plutokm.com/llama_tool_4';
if (kDebugMode) {
print(url);
}
try {
final request = http.MultipartRequest('POST', Uri.parse(url));
request.files
.add(await http.MultipartFile.fromPath('image', text.path));
//request.files.add(http.MultipartFile.fromString('body_image_path', image));
//request.fields['style_code'] = stylecode;
var response = await request.send();
var responseString = await response.stream.bytesToString();
if (kDebugMode) {
print('Response :$responseString');
}
res = responseString;
} catch (e) {
if (kDebugMode) {
print(e);
}
}
// var response = await http.post(
// Uri.parse(url),
// headers: header,
// );
// if (kDebugMode) {
// print(response.statusCode);
// }
// if (response.statusCode == 200) {
// res = response.body;
// if (kDebugMode) {
// print('Logout : $res');
// }
// }
}
return res;
}
Future<String> getSpeechResponse(String text, String? userid) async {
var header = {Type: App_json};
var res = '';
var url = '';
if (kDebugMode) {
print(response.statusCode);
print(userid);
}
if (response.statusCode == 200) {
res = response.body;
if (text.isNotEmpty && userid != null) {
if (userid == '1') {
url = '$speechtotext1$text';
if (kDebugMode) {
print(url);
}
} else if (userid == '2') {
url = '$speechtotext2$text';
if (kDebugMode) {
print(url);
}
} else {
url = '$speechtotext3$text';
//url = '$speechtotext3';
if (kDebugMode) {
print(url);
}
}
var response = await http.post(
Uri.parse(url),
headers: header,
);
if (kDebugMode) {
print('Logout : $res');
print(response.statusCode);
}
if (response.statusCode == 200) {
res = response.body;
if (kDebugMode) {
print('Logout : $res');
}
}
}
return res;
......@@ -87,67 +163,28 @@ class RemoteData {
'feedback': feed,
'comments': comments,
};
//print(body);
var client = http.Client();
var res = await client.post(Uri.parse(feedback),
headers: {Type: App_json}, body: json.encode(body));
// print(res.body);
// print(res.statusCode);
if (kDebugMode) {
print(res.body);
}
if (kDebugMode) {
print(res.statusCode);
}
if (res.statusCode == 200) {
//loginResponseFromJson(res as String);
return res.statusCode;
} else {
throw Exception('Status code was wrong$res.statusCode');
}
//return 200;
}
// Future<String?> uploadFileToS3(File filePath, String filename) async {
// String accessKey = 'AKIA2I2EIAE4UUMUSYOO';
// String secretKey = '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';
// //String filePath = "path/to/file.txt";
// String bucket = 'surveilancesystem';
// String region = 'ap-south-1';
// //String fileName = b(filePath!.path);
// //File file = new File(filePath);
// // my_image.jpg
// try {
// String? response = await AwsS3.uploadFile(
// accessKey: accessKey,
// secretKey: secretKey,
// file: filePath,
// bucket: bucket,
// region: region,
// //contentType: 'binary/octet-stream',
// //key: filename,
// filename: filename,
// acl: ACL.public_read_write,
// metadata: {'upload': "video"});
// //print("File uploaded successfully!");
// return response;
// } catch (e) {
// return e.toString();
// }
// return '';
// }
// //upload video file
// Future<void> uploadVideoToS3(File videoFile) async {
// final result = await AwsS3.uploadFile(
// accessKey: "AKxxxxxxxxxxxxx",
// secretKey: "xxxxxxxxxxxxxxxxxxxxxxxxxx",
// file: File("path_to_file"),
// bucket: "bucket_name",
// region: "us-east-2",
// metadata: {"test": "test"} // optional
// );
// if (result.isFailure) {
// throw Exception(result.errorMessage);
// }
// }
// }
Future<String?> empuploadVideo(
File imagepath, String filename, String storename) async {
try {
//final request = http.MultipartRequest( 'POST', Uri.parse('https://plutokm.com/grc_capture_image2.php?barcode=$barcode&boothno=$no&updatesiblings=$siblings'));
final request = http.MultipartRequest(
'Post', Uri.parse('http://192.168.65.111:8080/zoom'));
request.files
......@@ -157,8 +194,6 @@ class RemoteData {
request.fields['file'] = filename;
var response = await request.send();
var responseString = await response.stream.bytesToString();
//var res = response.body;
//print(response.);
if (response.statusCode == 200) {
return responseString;
} else {
......@@ -169,24 +204,68 @@ class RemoteData {
print("Error in upload video $e");
}
}
return null;
}
Future<String> getpendingAlerts(String store, String date) async {
Map<String, dynamic> body = {
'store': store,
'date': date,
};
print(body);
var client = http.Client();
var res = await client.post(Uri.parse(pendingAlerts),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
return res.body;
} else {
throw Exception('Status code was wrong$res.statusCode');
}
}
//Insights
Future<String> getInsights(String region, String store, String date) async {
Map<String, dynamic> body = {
'region': region,
'store': store,
'date': date,
'os': Platform.isAndroid
? 'Android'
: Platform.isIOS
? 'IOS'
: 'Unknown',
};
if (kDebugMode) {
print(body);
}
var client = http.Client();
var res = await client.post(Uri.parse(Insights),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
return res.body;
} else {
throw Exception('Status code was wrong$res.statusCode');
}
}
// Alert Summary Post Request
Future<String> geAlertSummary(String store, String date, String os) async {
//print(date);
Future<String> geAlertSummary(String store, String date) async {
Map<String, dynamic> body = {
'store': store,
'date': date,
'platform': os,
'platform': Platform.isAndroid
? 'Android'
: Platform.isIOS
? 'IOS'
: 'Unknown',
};
var client = http.Client();
var res = await client.post(Uri.parse(AlertSummary),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
//loginResponseFromJson(res as String);
return res.body;
} else {
throw Exception('Status code was wrong$res.statusCode');
......@@ -195,7 +274,6 @@ class RemoteData {
Future<http.Response?> getFootFallVerify(
String store, String hours, String selectdate) async {
//print(date);
Map<String, dynamic> body = {
'store': store,
'hours': hours,
......@@ -205,7 +283,6 @@ class RemoteData {
var res = await client.post(Uri.parse(FootFallVerify),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
//loginResponseFromJson(res as String);
if (kDebugMode) {
print(res.body);
}
......@@ -223,7 +300,6 @@ class RemoteData {
var client = http.Client();
var res = await client.post(Uri.parse(EmployeeStatus),
headers: {Type: App_json}, body: json.encode(body));
if (res.statusCode == 200) {
//loginResponseFromJson(res as String);
if (kDebugMode) {
......@@ -512,8 +588,8 @@ class RemoteData {
http.Response response,
) async {
// if (response.body!['auth'] == false) {
// LogoutDialog().logout();
// return null;
// LogoutDialog().logout();
// return null;
// }
switch (response.statusCode) {
......@@ -539,40 +615,35 @@ class RemoteData {
Future<String> getImgeUrl(String? path, String? filenamewithext) async {
// final s3Options = S3Service(
// accessKey: 'YOUR_ACCESS_KEY',
// secretKey: 'YOUR_SECRET_KEY',
// region: 'YOUR_REGION',
// accessKey: 'YOUR_ACCESS_KEY',
// secretKey: 'YOUR_SECRET_KEY',
// region: 'YOUR_REGION',
// );
// //var url = '';
// final s3 = Boto3(
// regionName: 'ap-south-1',
// accessKeyId: 'AKIA2I2EIAE4UUMUSYOO',
// secretAccessKey: '7ii8F5NReZQwNR0MURVzuHlZ2BL9oRSkvfgzTV1Y',
// ).client('s3');
// const bucketName = 'surveilancesystem';
// final objectKey = path;
// //var url = '';
// final s3 = Boto3(
// regionName: 'ap-south-1',
// accessKeyId: 'AKIA2I2EIAE4UUMUSYOO',
// secretAccessKey: '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',
// ).client('s3');
// const bucketName = 'surveilancesystem';
// final objectKey = path;
// File file = File(path!);
// http.Response s3ObjectUrl = await awsS3Client.getObject(filenamewithext!);
// print(s3ObjectUrl.statusCode);
// print(s3ObjectUrl.body);
// s3Client = S3Client(
// region: 'your-aws-region',
// accessKey: 'your-aws-access-key',
// secretKey: 'your-aws-secret-key',
// );
// s3Client = S3Client(
// region: 'your-aws-region',
// accessKey: 'your-aws-access-key',
// secretKey: 'your-aws-secret-key',
// );
// AwsS3PluginFlutter awsS3 = AwsS3PluginFlutter(
// awsFolderPath: path,
// fileNameWithExt: filenamewithext,
// region: Regions.AP_SOUTH_1,
// bucketName: 'surveilancesystem',
// AWSAccess: 'AKIA2I2EIAE4UUMUSYOO',
// AWSSecret: '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',
// );
// String presigned = await awsS3.getPreSignedURLOfFile;
// AWSSecret: '7ii8F5NReZQwNR0MURVzuHlZ2BL9oRSkvfgzTV1Y');
// String presigned = await awsS3.getPreSignedURLOfFile;
// final url = s3.generatePresignedUrl(
// 'getObject',
// Params: {
......@@ -581,7 +652,6 @@ class RemoteData {
// },
// Expires: 60 * 5, // 5 minutes
// );
return '';
}
......@@ -590,14 +660,12 @@ class RemoteData {
// Map<String, dynamic> body = {
// 'store': store,
// 'date': date,
// };
// };
// var request = http.Request(
// 'POST', Uri.parse('http://vaman.plutokm.com/regstatusreport'));
// request.body = json.encode({"STORE": "KLM AMEERPET"});
// request.headers.addAll(headers);
// http.StreamedResponse response = await request.send();
// if (response.statusCode == 200) {
// print(await response.stream.bytesToString());
// } else {
......
......@@ -5,15 +5,14 @@ import 'package:storemonitor/FirebaseApi.dart';
import 'Screens/SplashScreen.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isAndroid) {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await FirebaseApi().initNotifications();
} else {
}
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: SplashScreen(),
)
);
));
}
......@@ -7,12 +7,16 @@
#include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
#include <record_linux/record_linux_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) record_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
record_linux_plugin_register_with_registrar(record_linux_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
......
......@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
record_linux
url_launcher_linux
)
......
......@@ -5,28 +5,38 @@
import FlutterMacOS
import Foundation
import audio_session
import connectivity_macos
import file_selector_macos
import firebase_core
import firebase_messaging
import flutter_tts
import just_audio
import path_provider_foundation
import record_macos
import share_plus
import shared_preferences_foundation
import speech_to_text_macos
import sqflite
import text_to_speech_macos
import url_launcher_macos
import wakelock_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RecordMacosPlugin.register(with: registry.registrar(forPlugin: "RecordMacosPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SpeechToTextMacosPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextMacosPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
TextToSpeechMacOsPlugin.register(with: registry.registrar(forPlugin: "TextToSpeechMacOsPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
}
......@@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: _flutterfire_internals
sha256: "2d8e8e123ca3675625917f535fcc0d3a50092eef44334168f9b18adc050d4c6e"
sha256: "4eec93681221723a686ad580c2e7d960e1017cf1a4e0a263c2573c2c6b0bf5cd"
url: "https://pub.dev"
source: hosted
version: "1.3.6"
version: "1.3.25"
archive:
dependency: transitive
description:
......@@ -33,6 +33,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
audio_session:
dependency: transitive
description:
name: audio_session
sha256: a49af9981eec5d7cd73b37bacb6ee73f8143a6a9f9bd5b6021e6c346b9b6cf4e
url: "https://pub.dev"
source: hosted
version: "0.1.19"
boolean_selector:
dependency: transitive
description:
......@@ -41,6 +49,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
cached_network_image:
dependency: transitive
description:
name: cached_network_image
sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
carousel_slider:
dependency: "direct main"
description:
......@@ -229,55 +261,63 @@ packages:
dependency: "direct main"
description:
name: firebase_core
sha256: "675c209c94a1817649137cbd113fc4c9ae85e48d03dd578629abbec6d8a4d93d"
sha256: "53316975310c8af75a96e365f9fccb67d1c544ef0acdbf0d88bbe30eedd1c4f9"
url: "https://pub.dev"
source: hosted
version: "2.16.0"
version: "2.27.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: b63e3be6c96ef5c33bdec1aab23c91eb00696f6452f0519401d640938c94cba2
sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63
url: "https://pub.dev"
source: hosted
version: "4.8.0"
version: "5.0.0"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: e8c408923cd3a25bd342c576a114f2126769cd1a57106a4edeaa67ea4a84e962
sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492
url: "https://pub.dev"
source: hosted
version: "2.8.0"
version: "2.11.5"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
sha256: "4544524c22de3ffdc7e0ffaeeba212a04d09e76d0549ae6f42ce285d9d8f0513"
sha256: e41586e0fd04fe9a40424f8b0053d0832e6d04f49e020cdaf9919209a28497e9
url: "https://pub.dev"
source: hosted
version: "14.6.8"
version: "14.7.19"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
sha256: a6e1fae8242a14d5d8f5ab1cf94693511f06bab49ff1d46e3d83c0af3c4becb8
sha256: f7a9d74ff7fc588a924f6b2eaeaa148b0db521b13a9db55f6ad45864fa98c06e
url: "https://pub.dev"
source: hosted
version: "4.5.7"
version: "4.5.27"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
sha256: a9fe837dc2dcdd3e32e6109a6b0ce62592d7a44cb8f69cb5b73190865c5aa28e
sha256: fc21e771166860c55b103701c5ac7cdb2eec28897b97c42e6e5703cbedf9e02e
url: "https://pub.dev"
source: hosted
version: "3.5.7"
version: "3.6.8"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
flutter_inappwebview:
dependency: "direct main"
description:
......@@ -318,6 +358,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.3"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c
url: "https://pub.dev"
source: hosted
version: "2.0.9"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -327,15 +375,87 @@ packages:
dependency: "direct main"
description:
name: flutter_tts
sha256: cbb3fd43b946e62398560235469e6113e4fe26c40eab1b7cb5e7c417503fb3a8
sha256: aed2a00c48c43af043ed81145fd8503ddd793dafa7088ab137dbef81a703e53d
url: "https://pub.dev"
source: hosted
version: "3.8.5"
version: "4.0.2"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_widget_from_html:
dependency: "direct main"
description:
name: flutter_widget_from_html
sha256: "22c911b6ccf82b83e0c457d987bac4e703440fea0fc88dab24f4dfe995a5f33f"
url: "https://pub.dev"
source: hosted
version: "0.14.11"
flutter_widget_from_html_core:
dependency: transitive
description:
name: flutter_widget_from_html_core
sha256: cc1d9be3d187ce668ee02091cd5442dfb050cdaf98e0ab9a4d12ad008f966979
url: "https://pub.dev"
source: hosted
version: "0.14.12"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
sha256: "81b68579e23fcbcada2db3d50302813d2371664afe6165bc78148050ab94bf66"
url: "https://pub.dev"
source: hosted
version: "8.2.5"
fwfh_cached_network_image:
dependency: transitive
description:
name: fwfh_cached_network_image
sha256: "952aea958a5fda7d616cc297ba4bc08427e381459e75526fa375d6d8345630d3"
url: "https://pub.dev"
source: hosted
version: "0.14.2"
fwfh_chewie:
dependency: transitive
description:
name: fwfh_chewie
sha256: bbb036cd322ab77dc0edd34cbbf76181681f5e414987ece38745dc4f3d7408ed
url: "https://pub.dev"
source: hosted
version: "0.14.7"
fwfh_just_audio:
dependency: transitive
description:
name: fwfh_just_audio
sha256: "209cf9644599e37b0edb6961c4f30ce80d156f5a53a50355f75fb4a22f9fdb0a"
url: "https://pub.dev"
source: hosted
version: "0.14.3"
fwfh_svg:
dependency: transitive
description:
name: fwfh_svg
sha256: "3fd83926b7245d287f133a437ef430befd99d3b00ba8c600f26cc324af281f72"
url: "https://pub.dev"
source: hosted
version: "0.8.1"
fwfh_url_launcher:
dependency: transitive
description:
name: fwfh_url_launcher
sha256: "2a526c9819f74b4106ba2fba4dac79f0082deecd8d2c7011cd0471cb710e3eff"
url: "https://pub.dev"
source: hosted
version: "0.9.0+4"
fwfh_webview:
dependency: transitive
description:
name: fwfh_webview
sha256: b828bb5ddd4361a866cdb8f1b0de4f3348f332915ecf2f4215ba17e46c656adc
url: "https://pub.dev"
source: hosted
version: "0.14.8"
get:
dependency: "direct main"
description:
......@@ -472,6 +592,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.8.1"
just_audio:
dependency: transitive
description:
name: just_audio
sha256: b7cb6bbf3750caa924d03f432ba401ec300fd90936b3f73a9b33d58b1e96286b
url: "https://pub.dev"
source: hosted
version: "0.9.37"
just_audio_platform_interface:
dependency: transitive
description:
name: just_audio_platform_interface
sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1
url: "https://pub.dev"
source: hosted
version: "4.2.2"
just_audio_web:
dependency: transitive
description:
name: just_audio_web
sha256: d91a7dcc3e775b5bbc5123f82220f9b69a1cf7be4328cf49abf8a4952b3f2de4
url: "https://pub.dev"
source: hosted
version: "0.4.10"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
lints:
dependency: transitive
description:
......@@ -480,30 +648,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
logging:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.14.0"
mime:
dependency: transitive
description:
......@@ -520,14 +696,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
path:
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
path:
dependency: "direct main"
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.0.1"
path_provider:
dependency: "direct main"
description:
......@@ -652,10 +844,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.6"
version: "2.1.8"
pointycastle:
dependency: transitive
description:
......@@ -672,6 +864,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.5"
record:
dependency: "direct main"
description:
name: record
sha256: f703397f5a60d9b2b655b3acc94ba079b2d9a67dc0725bdb90ef2fee2441ebf7
url: "https://pub.dev"
source: hosted
version: "4.4.4"
record_linux:
dependency: transitive
description:
name: record_linux
sha256: "348db92c4ec1b67b1b85d791381c8c99d7c6908de141e7c9edc20dad399b15ce"
url: "https://pub.dev"
source: hosted
version: "0.4.1"
record_macos:
dependency: transitive
description:
name: record_macos
sha256: d1d0199d1395f05e218207e8cacd03eb9dc9e256ddfe2cfcbbb90e8edea06057
url: "https://pub.dev"
source: hosted
version: "0.2.2"
record_platform_interface:
dependency: transitive
description:
name: record_platform_interface
sha256: "7a2d4ce7ac3752505157e416e4e0d666a54b1d5d8601701b7e7e5e30bec181b4"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
record_web:
dependency: transitive
description:
name: record_web
sha256: "219ffb4ca59b4338117857db56d3ffadbde3169bcaf1136f5f4d4656f4a2372d"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
record_windows:
dependency: transitive
description:
name: record_windows
sha256: "42d545155a26b20d74f5107648dbb3382dbbc84dc3f1adc767040359e57a1345"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
rxdart:
dependency: transitive
description:
name: rxdart
sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
url: "https://pub.dev"
source: hosted
version: "0.27.7"
share_plus:
dependency: "direct main"
description:
......@@ -781,6 +1029,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
sqflite:
dependency: transitive
description:
name: sqflite
sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6
url: "https://pub.dev"
source: hosted
version: "2.3.2"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5"
url: "https://pub.dev"
source: hosted
version: "2.5.3"
stack_trace:
dependency: transitive
description:
......@@ -805,6 +1069,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
substring_highlight:
dependency: "direct main"
description:
name: substring_highlight
sha256: "96c61e8316098831f6bee87d2386617e4be6aaf87fbc89402dc049d371b67efb"
url: "https://pub.dev"
source: hosted
version: "1.0.33"
syncfusion_flutter_charts:
dependency: "direct main"
description:
......@@ -821,6 +1093,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "23.1.36"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
......@@ -833,10 +1113,50 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
url: "https://pub.dev"
source: hosted
version: "0.7.1"
text_to_speech:
dependency: "direct main"
description:
name: text_to_speech
sha256: f9adeb82bf0c912fd7f0ce656b1283e49b0869f9247bf865859dcf0186ed32f3
url: "https://pub.dev"
source: hosted
version: "0.2.3"
text_to_speech_macos:
dependency: transitive
description:
name: text_to_speech_macos
sha256: "11d1b7d4eff579743b04d371e86d17bebd599f7d998b9fa4cf07a5821cda3b6d"
url: "https://pub.dev"
source: hosted
version: "0.1.1"
text_to_speech_platform_interface:
dependency: transitive
description:
name: text_to_speech_platform_interface
sha256: "9d637f0ae36e296f42a0e555bd65ba4c64a28a7c26a2752fdae62f6d78b6c2d0"
url: "https://pub.dev"
source: hosted
version: "0.1.3"
text_to_speech_web:
dependency: transitive
description:
name: text_to_speech_web
sha256: "47d006c0a377c9eb3f6bcca4d92b3ece2c67f5eb31b9416727cc81b92c36d6d1"
url: "https://pub.dev"
source: hosted
version: "0.1.2"
toggle_switch:
dependency: "direct main"
description:
name: toggle_switch
sha256: dca04512d7c23ed320d6c5ede1211a404f177d54d353bf785b07d15546a86ce5
url: "https://pub.dev"
source: hosted
version: "0.6.1"
version: "2.3.0"
typed_data:
dependency: transitive
description:
......@@ -845,6 +1165,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
typewritertext:
dependency: "direct main"
description:
name: typewritertext
sha256: "918686ee3fe4717c65d76200bc2ee1531efd49e46cba22b02f7ca6f35084912f"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
url_launcher:
dependency: "direct main"
description:
......@@ -917,6 +1245,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.7"
vector_graphics:
dependency: transitive
description:
name: vector_graphics
sha256: "4ac59808bbfca6da38c99f415ff2d3a5d7ca0a6b4809c71d9cf30fba5daf9752"
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_graphics_codec:
dependency: transitive
description:
name: vector_graphics_codec
sha256: f3247e7ab0ec77dc759263e68394990edc608fb2b480b80db8aa86ed09279e33
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_graphics_compiler:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "18489bdd8850de3dd7ca8a34e0c446f719ec63e2bab2e7a8cc66a9028dd76c5a"
url: "https://pub.dev"
source: hosted
version: "1.1.10+1"
vector_math:
dependency: transitive
description:
......@@ -965,6 +1317,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "7475cb4dd713d57b6f7464c0e13f06da0d535d8b2067e188962a59bac2cf280b"
url: "https://pub.dev"
source: hosted
version: "14.2.2"
wakelock:
dependency: transitive
description:
......@@ -1078,5 +1438,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <4.0.0"
flutter: ">=3.13.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
......@@ -35,12 +35,22 @@ dependencies:
syncfusion_flutter_charts: ^21.1.41
permission_handler: ^10.4.3
chewie: ^1.5.0
fluttertoast: ^8.0.8
typewritertext: ^3.0.2
flutter_widget_from_html: ^0.14.11
#webfeed: ^0.7.0
video_player: ^2.7.0
firebase_messaging: ^14.6.8
firebase_core : ^2.16.0
speech_to_text: ^6.6.0
flutter_tts: ^3.5.1
substring_highlight: ^1.0.33
text_to_speech: ^0.2.3
flutter_tts : ^4.0.2
toggle_switch: ^2.3.0
record: ^4.4.1
path: ^1.8.0
#media_kit: ^0.0.8
#media_kit_video: ^0.0.1
#flutter_vlc_player: ^7.3.1
......@@ -106,6 +116,11 @@ flutter:
- assets/images/videos.png
- assets/images/weekly_report.png
- assets/images/menu.png
- assets/images/micicon.png
- assets/images/bg.png
- assets/images/stop.png
- assets/images/chat.png
- assets/images/mic.gif
fonts:
- family: Poppins
......
......@@ -10,6 +10,7 @@
#include <firebase_core/firebase_core_plugin_c_api.h>
#include <flutter_tts/flutter_tts_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <record_windows/record_windows_plugin_c_api.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>
......@@ -22,6 +23,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterTtsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
RecordWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("RecordWindowsPluginCApi"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
......
......@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
firebase_core
flutter_tts
permission_handler_windows
record_windows
share_plus
url_launcher_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