liuyuqi-dellpc 2 years ago
parent
commit
26faa0a577
3 changed files with 23 additions and 15 deletions
  1. 1 0
      .gitignore
  2. 15 8
      lib/screen/home/home.dart
  3. 7 7
      pubspec.lock

+ 1 - 0
.gitignore

@@ -42,3 +42,4 @@ app.*.map.json
 /android/app/debug
 /android/app/profile
 /android/app/release
+0/0.tflite

+ 15 - 8
lib/screen/home/home.dart

@@ -6,6 +6,9 @@ import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart
 import 'package:internal/common/camera.dart';
 import 'package:internal/common/transform.dart';
 
+/// Description: Home Page
+/// Time       : 04/12/2023 Wednesday
+/// Author     : liuyuqi.gov@msn.cn
 class HomeScreen extends StatefulWidget {
   const HomeScreen({Key? key}) : super(key: key);
 
@@ -13,8 +16,11 @@ class HomeScreen extends StatefulWidget {
   State<HomeScreen> createState() => _HomeScreenState();
 }
 
+/// Description: Home Page State
 class _HomeScreenState extends State<HomeScreen> {
+
   CameraController? _cameraController;
+  /// 检测器
   final ObjectDetector _objectDetector = ObjectDetector(
     options: LocalObjectDetectorOptions(
       mode: DetectionMode.stream,
@@ -34,10 +40,13 @@ class _HomeScreenState extends State<HomeScreen> {
   String message = "";
   FlutterTts tts = FlutterTts();
 
+  /// 初始化状态
   @override
   void initState() {
     super.initState();
+
     tts.awaitSpeakCompletion(true);
+    /// 检测可用相机
     availableCameras().then((cameras) {
       CameraDescription cameraDescription = cameras[0];
       _cameraController = CameraController(cameraDescription, ResolutionPreset.high, enableAudio: false);
@@ -47,7 +56,7 @@ class _HomeScreenState extends State<HomeScreen> {
       });
     });
   }
-
+  /// 回调函数
   Future<void> onImage(InputImage inputImage) async {
     if (!_canRender) return;
     _canRender = false;
@@ -89,7 +98,7 @@ class _HomeScreenState extends State<HomeScreen> {
     }
     return false;
   }
-
+  /// 检测指示
   Future<void> shouldGUIDELINE(InputImage inputImage) async {
     final list = await _objectDetector.processImage(inputImage);
     Size? size = _cameraPreviewKey.currentContext?.size;
@@ -118,6 +127,7 @@ class _HomeScreenState extends State<HomeScreen> {
     setState(() {});
   }
 
+  /// 执行指示
   Future<void> execGUIDELINE(Size size) async {
     final Rect rect = _data[0];
     if (rect.center.dx < size.width / 2) {
@@ -143,12 +153,9 @@ class _HomeScreenState extends State<HomeScreen> {
   @override
   Widget build(BuildContext context) {
     final xx = DateTime.now().millisecondsSinceEpoch;
-    // print(xx);
-    //1676810520479
-    //1676810187000
-    if (xx >= 1676961078000) {
-      Navigator.of(context).pop();
-    }
+    // if (xx >= 1676961078000) {
+    //   Navigator.of(context).pop();
+    // }
     return Scaffold(
       appBar: AppBar(
         title: const Text("SWIM"),

+ 7 - 7
pubspec.lock

@@ -180,10 +180,10 @@ packages:
     dependency: transitive
     description:
       name: matcher
-      sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
+      sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.12.13"
+    version: "0.12.14"
   material_color_utilities:
     dependency: transitive
     description:
@@ -204,10 +204,10 @@ packages:
     dependency: transitive
     description:
       name: path
-      sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
+      sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "1.8.2"
+    version: "1.8.3"
   plugin_platform_interface:
     dependency: transitive
     description:
@@ -281,10 +281,10 @@ packages:
     dependency: transitive
     description:
       name: test_api
-      sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
+      sha256: c9282698e2982b6c3817037554e52f99d4daba493e8028f8112a83d68ccd0b12
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "0.4.16"
+    version: "0.4.17"
   vector_math:
     dependency: transitive
     description:
@@ -294,5 +294,5 @@ packages:
     source: hosted
     version: "2.1.4"
 sdks:
-  dart: ">=2.19.2 <3.0.0"
+  dart: ">=2.19.2 <4.0.0"
   flutter: ">=3.0.0"