From b347c82c70bd02dbf4a204119a1bddb8253817db Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Sat, 30 Sep 2023 15:41:17 +0300 Subject: Updated Views Changes to be committed: modified: lib/main.dart modified: lib/result_screen.dart --- lib/main.dart | 35 +++++++++++++---------------------- lib/result_screen.dart | 1 - 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 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( -- cgit v1.2.3