summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-09-30 15:41:17 +0300
committerxAlpharax <42233094+xAlpharax@users.noreply.github.com>2023-09-30 15:41:17 +0300
commitb347c82c70bd02dbf4a204119a1bddb8253817db (patch)
tree3c06a8bd4a8932f12e13a55ece631c8fa7a57acd
parentf1ff95e5c77d32b123bc2cd7e45eb5a686f99f29 (diff)
Updated Views
Changes to be committed: modified: lib/main.dart modified: lib/result_screen.dart
-rw-r--r--lib/main.dart35
-rw-r--r--lib/result_screen.dart1
2 files changed, 13 insertions, 23 deletions
diff --git a/lib/main.dart b/lib/main.dart
index a8f0620..46d76b8 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -7,7 +7,7 @@ import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart
import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter_vision/flutter_vision.dart';
import 'package:image_picker/image_picker.dart';
-import 'package:yolo/result_screen.dart';
+// import 'package:yolo/result_screen.dart';
import 'package:flutter/material.dart';
import 'dart:typed_data';
@@ -236,31 +236,22 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
final navigator = Navigator.of(context);
- try {
- final pictureFile = await _cameraController!.takePicture();
+ final pictureFile = await _cameraController!.takePicture();
- final file = File(pictureFile.path);
+ final file = File(pictureFile.path);
- final inputImage = InputImage.fromFile(file);
- final recognizedText = await textRecognizer.processImage(inputImage);
+ final inputImage = InputImage.fromFile(file);
+ final recognizedText = await textRecognizer.processImage(inputImage);
- speak(recognizedText.text);
+ speak(recognizedText.text);
- await navigator.push(
- MaterialPageRoute(
- builder: (BuildContext context) =>
- //ResultScreen(text: recognizedText.text)
- YoloVideo(vision: vision)
- ),
- );
- } catch (e) {
- // ignore: use_build_context_synchronously
- ScaffoldMessenger.of(context).showSnackBar(
- const SnackBar(
- content: Text('An error occurred when scanning text'),
- ),
- );
- }
+ await navigator.push(
+ MaterialPageRoute(
+ builder: (BuildContext context) =>
+ //ResultScreen(text: recognizedText.text)
+ YoloVideo(vision: vision)
+ ),
+ );
}
}
diff --git a/lib/result_screen.dart b/lib/result_screen.dart
index d5a64ea..261d23f 100644
--- a/lib/result_screen.dart
+++ b/lib/result_screen.dart
@@ -8,7 +8,6 @@ class ResultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
- //backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Result'),
),
body: Container(