Przeglądaj źródła

Update 删除串口配置菜单,在个人中心增加读卡器按钮

Yue 3 tygodni temu
rodzic
commit
ee2470ec9b

+ 25 - 0
UI/CF.APP/chicken_farm/lib/pages/home/_profile/win_card_reader_button.dart

@@ -0,0 +1,25 @@
+import 'package:chicken_farm/routes/app_routes.dart';
+import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
+
+class WinCardReaderButton extends StatelessWidget {
+  const WinCardReaderButton({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    return SizedBox(
+      width: double.infinity,
+      child: ElevatedButton.icon(
+        onPressed: () {
+          context.pushNamed(AppRouteNames.serialSetting);
+        },
+        icon: const Icon(Icons.keyboard),
+        label: const Text('读卡器配置'),
+        style: ElevatedButton.styleFrom(
+          padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 15),
+          textStyle: const TextStyle(fontSize: 16),
+        ),
+      ),
+    );
+  }
+}

+ 17 - 8
UI/CF.APP/chicken_farm/lib/pages/home/profile.dart

@@ -10,6 +10,7 @@ import 'package:chicken_farm/pages/home/_profile/clear_cache_button.dart';
 import 'package:chicken_farm/pages/home/_profile/config_button.dart';
 import 'package:chicken_farm/pages/home/_profile/dict_config_button.dart';
 import 'package:chicken_farm/pages/home/_profile/power_config_button.dart';
+import 'package:chicken_farm/pages/home/_profile/win_card_reader_button.dart';
 // import 'package:chicken_farm/pages/home/_profile/rfid_config_button.dart';
 // import 'package:chicken_farm/pages/home/_profile/scanner_light_button.dart';
 import 'package:chicken_farm/pages/home/_profile/logout_button.dart';
@@ -59,14 +60,16 @@ class ProfilePage extends ConsumerWidget {
       key: super.key,
       body: Padding(
         padding: const EdgeInsets.all(20),
-        child: Center(  // 添加居中组件
+        child: Center(
+          // 添加居中组件
           child: SingleChildScrollView(
             child: SizedBox(
-              width: Platform.isAndroid 
-                  ? MediaQuery.of(context).size.width * 0.8  // 使用屏幕宽度的80%
-                  : MediaQuery.of(context).size.width > 350 
-                      ? 350  // 限制最大宽度
-                      : MediaQuery.of(context).size.width,
+              width: Platform.isAndroid
+                  ? MediaQuery.of(context).size.width *
+                        0.8 // 使用屏幕宽度的80%
+                  : MediaQuery.of(context).size.width > 350
+                  ? 350 // 限制最大宽度
+                  : MediaQuery.of(context).size.width,
               child: Column(
                 crossAxisAlignment: CrossAxisAlignment.center,
                 mainAxisAlignment: MainAxisAlignment.center,
@@ -103,6 +106,12 @@ class ProfilePage extends ConsumerWidget {
                       const SizedBox(height: 20),
                       const ConfigButton(),
                       const SizedBox(height: 20),
+                      if (!AppConfig.isPda &&
+                          !AppConfig.isOffline &&
+                          Platform.isWindows) ...[
+                        const WinCardReaderButton(),
+                        const SizedBox(height: 20),
+                      ],
                       // const RfidConfigButton(),
                       // const SizedBox(height: 20),
                       // const ScannerLightButton(),
@@ -131,6 +140,6 @@ class ProfilePage extends ConsumerWidget {
 
     final deviceInfo = Platform.isAndroid ? "$deviceType$mode" : "WIN$mode";
 
-    return 'ChickenFarm $deviceInfo Powered by IWB ©2025 \nVersion: ${AppConfig.appVersion}';
+    return 'ChickenFarm $deviceInfo Powered by IWB ©2026 \nVersion: ${AppConfig.appVersion}';
   }
-}
+}

+ 8 - 8
UI/CF.APP/chicken_farm/lib/stores/menu_store.dart

@@ -77,14 +77,14 @@ class MenuStore {
       isPda: false,
       platform: 2,
     ),
-    MenuItem(
-      name: '串口配置',
-      routeName: AppRouteNames.serialSetting,
-      icon: Icons.settings_input_component,
-      permission: "",
-      isPda: false,
-      platform: 2,
-    ),
+    // MenuItem(
+    //   name: '串口配置',
+    //   routeName: AppRouteNames.serialSetting,
+    //   icon: Icons.settings_input_component,
+    //   permission: "",
+    //   isPda: false,
+    //   platform: 2,
+    // ),
   ];
 
   static List<MenuItem> getVisibleMenuItems(WidgetRef ref) {