Commit fea8186b by Ramesh Babu Puvvadi

added

parent 879a993a
...@@ -11,6 +11,8 @@ PODS: ...@@ -11,6 +11,8 @@ PODS:
- shared_preferences_foundation (0.0.1): - shared_preferences_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- sms_autofill (0.0.1):
- Flutter
- TensorFlowLiteC (2.12.0): - TensorFlowLiteC (2.12.0):
- TensorFlowLiteC/Core (= 2.12.0) - TensorFlowLiteC/Core (= 2.12.0)
- TensorFlowLiteC/Core (2.12.0) - TensorFlowLiteC/Core (2.12.0)
...@@ -40,6 +42,7 @@ DEPENDENCIES: ...@@ -40,6 +42,7 @@ DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sms_autofill (from `.symlinks/plugins/sms_autofill/ios`)
- tflite_flutter (from `.symlinks/plugins/tflite_flutter/ios`) - tflite_flutter (from `.symlinks/plugins/tflite_flutter/ios`)
SPEC REPOS: SPEC REPOS:
...@@ -59,6 +62,8 @@ EXTERNAL SOURCES: ...@@ -59,6 +62,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
shared_preferences_foundation: shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin" :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sms_autofill:
:path: ".symlinks/plugins/sms_autofill/ios"
tflite_flutter: tflite_flutter:
:path: ".symlinks/plugins/tflite_flutter/ios" :path: ".symlinks/plugins/tflite_flutter/ios"
...@@ -69,6 +74,7 @@ SPEC CHECKSUMS: ...@@ -69,6 +74,7 @@ SPEC CHECKSUMS:
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sms_autofill: c461043483362c3f1709ee76eaae6eb570b31686
TensorFlowLiteC: 20785a69299185a379ba9852b6625f00afd7984a TensorFlowLiteC: 20785a69299185a379ba9852b6625f00afd7984a
TensorFlowLiteSwift: 3a4928286e9e35bdd3e17970f48e53c80d25e793 TensorFlowLiteSwift: 3a4928286e9e35bdd3e17970f48e53c80d25e793
tflite_flutter: 9433d086a3060431bbc9f3c7c20d017db0e72d08 tflite_flutter: 9433d086a3060431bbc9f3c7c20d017db0e72d08
......
...@@ -46,40 +46,6 @@ class _Identifystylecode extends State<Identifystylecode> { ...@@ -46,40 +46,6 @@ class _Identifystylecode extends State<Identifystylecode> {
CameraController? controller; CameraController? controller;
String? _base64Image; String? _base64Image;
// void getImage(File? imagefile) {
// // Reading image bytes from file
// final imageData = File(imagefile!.path).readAsBytesSync();
// // Decoding image
// final image = img.decodeImage(imageData);
// // Resizing image fpr model, [300, 300]
// final imageInput = img.copyResize(
// image!,
// width: 300,
// height: 300,
// );
// if (kDebugMode) {
// print(imageInput);
// }
// // Creating matrix representation, [300, 300, 3]
// final imageMatrix = List.generate(
// imageInput.height,
// (y) => List.generate(
// imageInput.width,
// (x) {
// final pixel = imageInput.getPixel(x, y);
// final r = img.getRed(pixel);
// final g = img.getGreen(pixel);
// final b = img.getBlue(pixel);
// return [r, g, b];
// },
// ),
// );
// embedding = imageMatrix;
// if (kDebugMode) {
// print(imageMatrix);
// }
// }
Future<void> initializeCamera() async { Future<void> initializeCamera() async {
final cameras = await availableCameras(); final cameras = await availableCameras();
final frontCamera = cameras.firstWhere( final frontCamera = cameras.firstWhere(
...@@ -96,8 +62,7 @@ class _Identifystylecode extends State<Identifystylecode> { ...@@ -96,8 +62,7 @@ class _Identifystylecode extends State<Identifystylecode> {
Future<void> _navigateToCameraScreen() async { Future<void> _navigateToCameraScreen() async {
try { try {
final imageFile1 = await Navigator.push<File>( final imageFile1 = await Navigator.push<File>(context, MaterialPageRoute(builder: (context) => CameraScreen()));
context, MaterialPageRoute(builder: (context) => CameraScreen()));
if (imageFile1 != null) { if (imageFile1 != null) {
imagefile = imageFile1; imagefile = imageFile1;
final bytes = await imageFile1.readAsBytes(); final bytes = await imageFile1.readAsBytes();
...@@ -156,23 +121,7 @@ class _Identifystylecode extends State<Identifystylecode> { ...@@ -156,23 +121,7 @@ class _Identifystylecode extends State<Identifystylecode> {
); );
} }
// Future<void> _getImageFromCamera() async {
// try {
// final pickedFile = await _picker.pickImage(source: ImageSource.camera);
// //Navigator.of(context).pop();
// if (pickedFile != null) {
// setState(() {
// imagefile = File(pickedFile.path);
// isVisible = true;
// isData = false;
// });
// } else {
// print("No image picked");
// }
// } catch (e) {
// print("Error while picking image from camera: $e");
// }
// }
Future<void> _getImageFromGallery(BuildContext context) async { Future<void> _getImageFromGallery(BuildContext context) async {
image = await _picker.pickImage(source: ImageSource.gallery); image = await _picker.pickImage(source: ImageSource.gallery);
...@@ -196,22 +145,7 @@ class _Identifystylecode extends State<Identifystylecode> { ...@@ -196,22 +145,7 @@ class _Identifystylecode extends State<Identifystylecode> {
//loadModel(); //loadModel();
} }
// Future<void> loadModel() async {
// String? modelPath = 'assets/images/model.tflite';
// if (kDebugMode) {
// print('Loading interpreter options...');
// }
// final interpreterOptions = InterpreterOptions();
// if (Platform.isAndroid) {
// interpreterOptions.addDelegate(XNNPackDelegate());
// }
// if (Platform.isIOS) {
// interpreterOptions.addDelegate(GpuDelegate());
// }
// if (kDebugMode) {
// print('Loading interpreter...');
// }
// }
@override @override
void dispose() { void dispose() {
...@@ -665,26 +599,6 @@ class _Identifystylecode extends State<Identifystylecode> { ...@@ -665,26 +599,6 @@ class _Identifystylecode extends State<Identifystylecode> {
), ),
), ),
), ),
// child: SizedBox(
// width: MediaQuery.of(context).size.width * 0.88,
// height: MediaQuery.of(context).size.height * 0.50,
// child: imagefile != null
// ? Image.file(
// imagefile!,
// fit: BoxFit.cover,
// )
// : Center(
// child: Image.asset(
// 'assets/images/camera.png',
// width:
// MediaQuery.of(context).size.width *
// 0.50, // Adjusted width
// height:
// MediaQuery.of(context).size.height *
// 0.35, // Adjusted height
// ),
// ),
// ),
), ),
], ],
), ),
......
import 'package:flutter/material.dart';
import 'package:sms_autofill/sms_autofill.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
String _code="";
String signature = "{{ app signature }}";
@override
void initState() {
super.initState();
}
@override
void dispose() {
SmsAutoFill().unregisterListener();
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const PhoneFieldHint(),
const Spacer(),
PinFieldAutoFill(
decoration: UnderlineDecoration(
textStyle: const TextStyle(fontSize: 20, color: Colors.black),
colorBuilder: FixedColorBuilder(Colors.black.withOpacity(0.3)),
),
currentCode: _code,
onCodeSubmitted: (code) {},
onCodeChanged: (code) {
if (code!.length == 6) {
FocusScope.of(context).requestFocus(FocusNode());
}
},
),
const Spacer(),
TextFieldPinAutoFill(
currentCode: _code,
),
const Spacer(),
ElevatedButton(
child: const Text('Listen for sms code'),
onPressed: () async {
await SmsAutoFill().listenForCode();
},
),
ElevatedButton(
child: const Text('Set code to 123456'),
onPressed: () async {
setState(() {
_code = '123456';
});
},
),
const SizedBox(height: 8.0),
const Divider(height: 1.0),
const SizedBox(height: 4.0),
Text("App Signature : $signature"),
const SizedBox(height: 4.0),
ElevatedButton(
child: const Text('Get app signature'),
onPressed: () async {
signature = await SmsAutoFill().getAppSignature;
setState(() {});
},
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => CodeAutoFillTestPage()));
},
child: const Text("Test CodeAutoFill mixin"),
)
],
),
),
),
);
}
}
class CodeAutoFillTestPage extends StatefulWidget {
const CodeAutoFillTestPage({Key? key}) : super(key: key);
@override
State<CodeAutoFillTestPage> createState() => _CodeAutoFillTestPageState();
}
class _CodeAutoFillTestPageState extends State<CodeAutoFillTestPage> with CodeAutoFill {
String? appSignature;
String? otpCode;
@override
void codeUpdated() {
setState(() {
otpCode = code!;
});
}
@override
void initState() {
super.initState();
listenForCode();
SmsAutoFill().getAppSignature.then((signature) {
setState(() {
appSignature = signature;
});
});
}
@override
void dispose() {
super.dispose();
cancel();
}
@override
Widget build(BuildContext context) {
const textStyle = TextStyle(fontSize: 18);
return Scaffold(
appBar: AppBar(
title: const Text("Listening for code"),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(32, 32, 32, 0),
child: Text(
"This is the current app signature: $appSignature",
),
),
const Spacer(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Builder(
builder: (_) {
if (otpCode == null) {
return const Text("Listening for code...", style: textStyle);
}
return Text("Code Received: $otpCode", style: textStyle);
},
),
),
const Spacer(),
],
),
);
}
}
\ No newline at end of file
...@@ -408,6 +408,14 @@ packages: ...@@ -408,6 +408,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
pin_input_text_field:
dependency: transitive
description:
name: pin_input_text_field
sha256: "8d6fc670aa673a4df5976086f0e8039972a5b2bcb783c8db8dd3b9b4b072ca90"
url: "https://pub.dev"
source: hosted
version: "4.5.1"
platform: platform:
dependency: transitive dependency: transitive
description: description:
...@@ -493,6 +501,14 @@ packages: ...@@ -493,6 +501,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
sms_autofill:
dependency: "direct main"
description:
name: sms_autofill
sha256: a851630775fa11ca985d85d8c4e51573c26d9647ab35de151748eb733d4893e8
url: "https://pub.dev"
source: hosted
version: "2.4.0"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
......
...@@ -37,10 +37,13 @@ dependencies: ...@@ -37,10 +37,13 @@ dependencies:
connectivity: ^3.0.6 connectivity: ^3.0.6
crypto: ^3.0.3 crypto: ^3.0.3
shared_preferences: ^2.0.17 shared_preferences: ^2.0.17
sms_autofill: ^2.4.0
camera: ^0.11.0+1 camera: ^0.11.0+1
tflite_flutter: ^0.10.4 tflite_flutter: ^0.10.4
#image: ^3.0.1 #image: ^3.0.1
gif_view: ^0.3.1 gif_view: ^0.3.1
#flutter_inappwebview: ^5.7.2+3 #flutter_inappwebview: ^5.7.2+3
dev_dependencies: dev_dependencies:
......
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