From c02c01b442e7c51a21ab2b7c986f4fc52adcbdd8 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 12 Mar 2025 15:09:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=89=AF=E5=B1=8F=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../facediscern/database/DatabaseHelper.java | 9 +---- .../pj_supermarket_cloud/MainActivity.kt | 2 -- lib/pages/setting/widgets/setting_face.dart | 13 ++++--- lib/sub_screen/common/index.dart | 9 +++++ lib/sub_screen/common/key/index.dart | 3 ++ lib/sub_screen/common/key/navigator_key.dart | 5 +++ lib/sub_screen/common/routers/index.dart | 3 ++ lib/sub_screen/common/routers/names.dart | 7 ++++ lib/sub_screen/common/utils/index.dart | 3 ++ .../common/utils/sub_page_tool.dart | 24 +++++++++++++ lib/sub_screen/common/values/constants.dart | 0 lib/sub_screen/common/values/index.dart | 3 ++ lib/sub_screen/page/index.dart | 4 +++ lib/sub_screen/page/sub_app.dart | 34 +++++++++++++++++++ lib/sub_screen/page/sub_product.dart | 15 ++++++++ 15 files changed, 117 insertions(+), 17 deletions(-) create mode 100644 lib/sub_screen/common/index.dart create mode 100644 lib/sub_screen/common/key/index.dart create mode 100644 lib/sub_screen/common/key/navigator_key.dart create mode 100644 lib/sub_screen/common/routers/index.dart create mode 100644 lib/sub_screen/common/routers/names.dart create mode 100644 lib/sub_screen/common/utils/index.dart create mode 100644 lib/sub_screen/common/utils/sub_page_tool.dart create mode 100644 lib/sub_screen/common/values/constants.dart create mode 100644 lib/sub_screen/common/values/index.dart create mode 100644 lib/sub_screen/page/index.dart create mode 100644 lib/sub_screen/page/sub_app.dart create mode 100644 lib/sub_screen/page/sub_product.dart diff --git a/android/app/src/main/java/io/flutter/plugins/facediscern/database/DatabaseHelper.java b/android/app/src/main/java/io/flutter/plugins/facediscern/database/DatabaseHelper.java index 25faf11..80762ee 100644 --- a/android/app/src/main/java/io/flutter/plugins/facediscern/database/DatabaseHelper.java +++ b/android/app/src/main/java/io/flutter/plugins/facediscern/database/DatabaseHelper.java @@ -16,14 +16,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; public DatabaseHelper(Context context) { - super(context, getCustomDatabasePath(context), null, DATABASE_VERSION); - } - - private static String getCustomDatabasePath(Context context) { - File documentsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS); - File dbDir = new File(documentsDir, "pj/database"); - if (!dbDir.exists()) dbDir.mkdirs(); - return new File(dbDir, DATABASE_NAME).getAbsolutePath(); + super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override diff --git a/android/app/src/main/kotlin/com/example/pj_supermarket_cloud/MainActivity.kt b/android/app/src/main/kotlin/com/example/pj_supermarket_cloud/MainActivity.kt index 4ca4f2e..6c2d09d 100644 --- a/android/app/src/main/kotlin/com/example/pj_supermarket_cloud/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/pj_supermarket_cloud/MainActivity.kt @@ -10,7 +10,5 @@ class MainActivity : FlutterActivity() { // 人脸识别插件 val flutterFaceDiscernPlugin = FlutterFaceDiscernPlugin() flutterEngine.plugins.add(flutterFaceDiscernPlugin) - - // 键盘全局键盘插件 } } diff --git a/lib/pages/setting/widgets/setting_face.dart b/lib/pages/setting/widgets/setting_face.dart index 48df20d..ee90c9c 100644 --- a/lib/pages/setting/widgets/setting_face.dart +++ b/lib/pages/setting/widgets/setting_face.dart @@ -77,11 +77,11 @@ class FaceManageController extends GetxController { Toast.error(msg: "请先绑定设备"); return; } - // final isActive = await AppFaceTool.isActiveSdk(); - // if (!isActive) { - // Toast.error(msg: "人脸sdk激活失败"); - // return; - // } + final isActive = await AppFaceTool.isActiveSdk(); + if (!isActive) { + Toast.error(msg: "人脸sdk激活失败"); + return; + } final isSure = await appMessageDialog( Get.context!, "是否同步所有人脸,这个过程可能比较长", @@ -121,8 +121,7 @@ class FaceManageController extends GetxController { try { final faceDao = appC.dataBase.getFaceDao; await faceDao.delAll(); - final bool = await AppFaceTool.removeFace(sampleId: "-1"); - logger.i(bool); + await AppFaceTool.removeFace(sampleId: "-1"); } finally { Future.delayed(const Duration(seconds: 1), () { getFaceList(); diff --git a/lib/sub_screen/common/index.dart b/lib/sub_screen/common/index.dart new file mode 100644 index 0000000..095647d --- /dev/null +++ b/lib/sub_screen/common/index.dart @@ -0,0 +1,9 @@ +library sub_common; + +export './key/index.dart'; + +export './routers/index.dart'; + +export './utils/index.dart'; + +export './values/constants.dart'; diff --git a/lib/sub_screen/common/key/index.dart b/lib/sub_screen/common/key/index.dart new file mode 100644 index 0000000..2a31b4d --- /dev/null +++ b/lib/sub_screen/common/key/index.dart @@ -0,0 +1,3 @@ +library sub_key; + +export './navigator_key.dart'; diff --git a/lib/sub_screen/common/key/navigator_key.dart b/lib/sub_screen/common/key/navigator_key.dart new file mode 100644 index 0000000..44e24b0 --- /dev/null +++ b/lib/sub_screen/common/key/navigator_key.dart @@ -0,0 +1,5 @@ +import 'package:flutter/cupertino.dart'; + +abstract class SubNavigatorKey { + static GlobalKey navigatorKey = GlobalKey(); +} diff --git a/lib/sub_screen/common/routers/index.dart b/lib/sub_screen/common/routers/index.dart new file mode 100644 index 0000000..af1bbc6 --- /dev/null +++ b/lib/sub_screen/common/routers/index.dart @@ -0,0 +1,3 @@ +library sub_router; + +export './names.dart'; diff --git a/lib/sub_screen/common/routers/names.dart b/lib/sub_screen/common/routers/names.dart new file mode 100644 index 0000000..992d59f --- /dev/null +++ b/lib/sub_screen/common/routers/names.dart @@ -0,0 +1,7 @@ +class SubRouteNames { + /// 商品页面 + static const subProduct = '/sub_product'; + + /// 首页 + static const root = '/'; +} diff --git a/lib/sub_screen/common/utils/index.dart b/lib/sub_screen/common/utils/index.dart new file mode 100644 index 0000000..e6859c3 --- /dev/null +++ b/lib/sub_screen/common/utils/index.dart @@ -0,0 +1,3 @@ +library sub_utils; + +export './sub_page_tool.dart'; diff --git a/lib/sub_screen/common/utils/sub_page_tool.dart b/lib/sub_screen/common/utils/sub_page_tool.dart new file mode 100644 index 0000000..192d406 --- /dev/null +++ b/lib/sub_screen/common/utils/sub_page_tool.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +import 'package:pj_supermarket_cloud/common/index.dart'; +import 'package:pj_supermarket_cloud/sub_screen/common/index.dart'; + +class SubPageToool { + void switchJump(SubScreenAction type) { + switch (type) { + case SubScreenAction.jumpSubPage: + SubNavigatorKey.navigatorKey.currentState?.pushNamedAndRemoveUntil( + SubRouteNames.subProduct, + (Route route) => false, + ); + break; + case SubScreenAction.jumpSubBack: + SubNavigatorKey.navigatorKey.currentState?.pushNamedAndRemoveUntil( + SubRouteNames.root, + (Route route) => false, + ); + break; + default: + } + } +} diff --git a/lib/sub_screen/common/values/constants.dart b/lib/sub_screen/common/values/constants.dart new file mode 100644 index 0000000..e69de29 diff --git a/lib/sub_screen/common/values/index.dart b/lib/sub_screen/common/values/index.dart new file mode 100644 index 0000000..3a02abd --- /dev/null +++ b/lib/sub_screen/common/values/index.dart @@ -0,0 +1,3 @@ +library sub_values; + +export './constants.dart'; diff --git a/lib/sub_screen/page/index.dart b/lib/sub_screen/page/index.dart new file mode 100644 index 0000000..34523a0 --- /dev/null +++ b/lib/sub_screen/page/index.dart @@ -0,0 +1,4 @@ +library sub_page; + +export './sub_app.dart'; +export './sub_product.dart'; diff --git a/lib/sub_screen/page/sub_app.dart b/lib/sub_screen/page/sub_app.dart new file mode 100644 index 0000000..3d420be --- /dev/null +++ b/lib/sub_screen/page/sub_app.dart @@ -0,0 +1,34 @@ +import 'package:ducafe_ui_core/ducafe_ui_core.dart'; +import 'package:flutter/material.dart'; +import 'package:forui/forui.dart'; + +import 'package:pj_supermarket_cloud/sub_screen/page/index.dart'; +import 'package:pj_supermarket_cloud/sub_screen/common/index.dart'; + +class SubAppPage extends StatefulWidget { + const SubAppPage({super.key}); + + @override + State createState() => _SubAppPageState(); +} + +class _SubAppPageState extends State { + @override + Widget build(BuildContext context) { + final theme = FTheme.of(context); + return MaterialApp( + navigatorKey: SubNavigatorKey.navigatorKey, + debugShowCheckedModeBanner: false, + routes: { + SubRouteNames.subProduct: (context) => const SubProductPage(), + }, + home: Scaffold( + backgroundColor: theme.colorScheme.background, + body: Text( + 'SubApp', + style: theme.typography.xl4, + ).center(), + ), + ); + } +} diff --git a/lib/sub_screen/page/sub_product.dart b/lib/sub_screen/page/sub_product.dart new file mode 100644 index 0000000..ca35239 --- /dev/null +++ b/lib/sub_screen/page/sub_product.dart @@ -0,0 +1,15 @@ +import 'package:flutter/widgets.dart'; + +class SubProductPage extends StatefulWidget { + const SubProductPage({super.key}); + + @override + State createState() => _SubProductPageState(); +} + +class _SubProductPageState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } +}