Browse Source

样式的切换与测试

liukai 4 months ago
parent
commit
30cacd1271

+ 26 - 9
app/lib/main.dart

@@ -1,13 +1,14 @@
 import 'package:cpt_main/router/component/main_service_provider.dart';
 import 'package:cs_resources/generated/l10n.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:cs_resources/theme/theme_notifier.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_localizations/flutter_localizations.dart';
+import 'package:hooks_riverpod/hooks_riverpod.dart';
 import 'package:initializer/app_initializer.dart';
 import 'package:plugin_basic/basic_export.dart';
 import 'package:plugin_basic/provider/app_config/app_config_service.dart';
-
-import 'package:cs_resources/local/theme/theme_config.dart';
 import 'package:plugin_basic/provider/global_provider_container.dart';
 import 'package:router/componentRouter/component_service_manager.dart';
 import 'package:cpt_profile/router/component/profile_service_provider.dart';
@@ -18,12 +19,11 @@ import 'package:widgets/dialog/custom_failure_widget.dart';
 import 'package:widgets/dialog/custom_success_widget.dart';
 import 'package:widgets/dialog/custom_loading_widget.dart';
 import 'package:widgets/widget_export.dart';
-
+import 'package:cs_resources/theme/theme_config.dart';
 import 'router/page/app_page_router.dart';
 import 'router/component/app_service_provider.dart';
 
 void main() async {
-
   //交给初始化构造器去统一初始化
   await AppInitializer.initializeRunalone();
 
@@ -37,10 +37,9 @@ void main() async {
     parent: globalContainer,
     child: MyApp(),
   ));
-
 }
 
-class MyApp extends StatelessWidget {
+class MyApp extends HookConsumerWidget {
   MyApp({Key? key}) : super(key: key) {
     /// 全局设置 EasyRefresh 的样式
     EasyRefresh.defaultHeaderBuilder = () => const ClassicHeader(
@@ -95,7 +94,9 @@ class MyApp extends StatelessWidget {
   }
 
   @override
-  Widget build(BuildContext context) {
+  Widget build(BuildContext context, WidgetRef ref) {
+    final themeMode = ref.watch(themeProvider);
+
     WidgetsBinding.instance.addPostFrameCallback((_) {
       AppConfigService.getInstance().initSize(context);
     });
@@ -110,16 +111,32 @@ class MyApp extends StatelessWidget {
         child: MaterialApp.router(
           title: 'PropertyManagementSystem',
           debugShowCheckedModeBanner: true,
+          // theme: ThemeData(
+          //   colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
+          //   useMaterial3: false,
+          // ),
+          // Theme.of(context)
+          //主题配置
           theme: ThemeData(
             colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
             useMaterial3: false,
-          ),
+          ).copyWith(extensions: [
+            AppColorsTheme.light(),
+          ]),
+          darkTheme: ThemeData(
+            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple, brightness: Brightness.dark),
+            useMaterial3: false,
+          ).copyWith(extensions: [
+            AppColorsTheme.dark(),
+          ]),
+          themeMode: themeMode == ThemeMode.system ? ThemeMode.system : themeMode,
+
           //国际化配置
           localizationsDelegates: const [
             S.delegate,
             GlobalMaterialLocalizations.delegate,
             GlobalCupertinoLocalizations.delegate,
-            GlobalWidgetsLocalizations.delegate
+            GlobalWidgetsLocalizations.delegate,
           ],
           //国际化英语为首选项
           supportedLocales: [const Locale('en', ''), ...S.delegate.supportedLocales],

+ 56 - 4
packages/cpt_main/lib/modules/visitor/page/visitor_page.dart

@@ -1,4 +1,6 @@
 import 'package:cpt_main/modules/visitor/vm/visitor_view_model.dart';
+import 'package:cs_resources/theme/app_colors_theme.dart';
+import 'package:cs_resources/theme/theme_notifier.dart';
 import 'package:flutter/material.dart';
 import 'package:auto_route/auto_route.dart';
 import 'package:hooks_riverpod/hooks_riverpod.dart';
@@ -19,6 +21,7 @@ class VisitorPage extends HookConsumerWidget {
 
     return Scaffold(
       appBar: AppBar(title: Text("Visitor")),
+      backgroundColor: context.appColors.backgroundDefault,
       body: Center(
         child: Column(
           children: [
@@ -30,7 +33,9 @@ class VisitorPage extends HookConsumerWidget {
                   onPressed: () {
                     _userService.setUserInfo("张三");
                   },
-                  child: Text('修改用户信息'),
+                  child: Text(
+                    '修改用户信息',
+                  ),
                 ),
               ],
             ).marginOnly(top: 10),
@@ -75,15 +80,15 @@ class VisitorPage extends HookConsumerWidget {
               children: [
                 ElevatedButton(
                   onPressed: () {},
-                  child: Text('相机拍照'),
+                  child: Text('相机'),
                 ),
                 ElevatedButton(
                   onPressed: () {},
-                  child: Text('相册选择'),
+                  child: Text('相册'),
                 ),
                 ElevatedButton(
                   onPressed: () {},
-                  child: Text('App动态权限申请'),
+                  child: Text('App动态权限'),
                 ),
               ],
             ).marginOnly(top: 10),
@@ -118,6 +123,53 @@ class VisitorPage extends HookConsumerWidget {
                 ),
               ],
             ).marginOnly(top: 10),
+            Row(
+              mainAxisAlignment: MainAxisAlignment.spaceAround,
+              children: [
+                ElevatedButton(
+                  onPressed: () {
+                    ref.read(themeProvider.notifier).toggleTheme();
+                  },
+                  child: Text('手动切换主题'),
+                  style: ButtonStyle(
+                    backgroundColor: WidgetStateProperty.all<Color>(context.appColors.btnBgDefault),
+                    // 设置按钮的背景颜色
+                    foregroundColor: WidgetStateProperty.all<Color>(Colors.white),
+                    // 设置按钮文字的颜色
+                    shadowColor: WidgetStateProperty.all<Color>(context.appColors.btnBgDefault),
+                    // 按钮阴影颜色
+                    elevation: WidgetStateProperty.all<double>(5),
+                    // 按钮阴影的高度
+                    shape: WidgetStateProperty.all<RoundedRectangleBorder>(
+                      RoundedRectangleBorder(
+                        borderRadius: BorderRadius.circular(30), // 圆角边框
+                      ),
+                    ),
+                  ),
+                ),
+                ElevatedButton(
+                  onPressed: () {
+                    ref.read(themeProvider.notifier).followSystemTheme();
+                  },
+                  child: Text('跟随系统主题'),
+                  style: ButtonStyle(
+                    backgroundColor: WidgetStateProperty.all<Color>(context.appColors.btnBgDefault),
+                    // 设置按钮的背景颜色
+                    foregroundColor: WidgetStateProperty.all<Color>(Colors.white),
+                    // 设置按钮文字的颜色
+                    shadowColor: WidgetStateProperty.all<Color>(context.appColors.btnBgDefault),
+                    // 按钮阴影颜色
+                    elevation: WidgetStateProperty.all<double>(5),
+                    // 按钮阴影的高度
+                    shape: WidgetStateProperty.all<RoundedRectangleBorder>(
+                      RoundedRectangleBorder(
+                        borderRadius: BorderRadius.circular(30), // 圆角边框
+                      ),
+                    ),
+                  ),
+                ),
+              ],
+            ).marginOnly(top: 10),
           ],
         ),
       ),

+ 0 - 258
packages/cs_resources/lib/local/language/en_US.dart

@@ -1,258 +0,0 @@
-const Map<String, String> en_US = {
-  'YY Employer': 'YY Employer',
-  'Please enter your password': 'Please enter your password',
-  'The login code cannot be empty!': 'The login code cannot be empty!',
-  'The password cannot be empty!': 'The password cannot be empty!',
-  'The new password cannot be empty!': 'The new password cannot be empty!',
-  'Log in': 'Log in',
-  'Password': 'Password',
-  'Email': 'Email',
-  'Name/Mobile': 'Name/Mobile',
-  'Check In': 'Check In',
-  'Check Out': 'Check Out',
-  'Job Date': 'Job Date',
-  'Start Time:': 'Start Time:',
-  'End Time:': 'End Time:',
-  'Start Time': 'Start Time',
-  'End Time': 'End Time',
-  'Name:': 'Name:',
-  'Reset': 'Reset',
-  'Start Date': 'Start Date',
-  'End Date': 'End Date',
-  'Cancel': 'Cancel',
-  'Confirm': 'Confirm',
-  'Sign Here': 'Sign Here',
-  'Clean': 'Clean',
-  'Vietnam': 'Vietnam',
-  'Sign in/Sign out': 'Sign in/Sign out',
-  'Admin': 'Admin',
-  'Don’t have an account?': 'Don’t have an account?',
-  'Sign up': 'Sign up',
-  'Confirm Password': 'Confirm Password',
-  'Please enter your email': 'Please enter your email',
-  'Please enter confirm password': 'Please enter confirm password',
-  'Submit': 'Submit',
-  'The email cannot be empty!': 'The email cannot be empty!',
-  'The confirm password cannot be empty!': 'The confirm password cannot be empty!',
-  'Please confirm your confirmed password!': 'Please confirm your confirmed password!',
-  'Reset Password': 'Reset Password',
-  'New Password': 'New Password',
-  'Please enter your new password': 'Please enter your new password',
-  'Labour Request': 'Labour Request',
-  'Job List': 'Job List',
-  'Sign in Sign out': 'Sign in Sign out',
-  'Devices': 'Devices',
-  'Labour Request Review': 'Labour Request Review',
-  'Attendance Review': 'Attendance Review',
-  'Default Job Title': 'Default Job Title',
-  'Report': 'Report',
-  'Confirmation': 'Confirmation',
-  'Notice': 'Notice',
-  'Are you sure you need to exit the system?': 'Are you sure you need to exit the system?',
-  'Are you sure you want to deactivate your account? You will not be able to login into the app once you proceed with the request.':
-      'Are you sure you want to deactivate your account? You will not be able to login into the app once you proceed with the request.',
-  'Welcome': 'Welcome',
-  'Switch Projects': 'Switch Projects',
-  'Account Deactivation': 'Account Deactivation',
-  'Logout': 'Logout',
-  'Old Password': 'Old Password',
-  'Settings': 'Settings',
-  'Title': 'Title',
-  'Create New Job Request': 'Create New Job Request',
-  'Outlet': 'Outlet',
-  'Status': 'Status',
-  'Filter': 'Filter',
-  'Edit': 'Edit',
-  'Recall': 'Recall',
-  'Detail': 'Detail',
-  'Outlet:': 'Outlet:',
-  'DateTime:': 'DateTime:',
-  'No. of Staff:': 'No. of Staff:',
-  'Status:': 'Status:',
-  'Publish Status:': 'Publish Status:',
-  'Created At:': 'Created At:',
-  'Published': 'Published',
-  'Unpublished': 'Unpublished',
-  'Choose Outlet': 'Choose Outlet',
-  'Choose Status': 'Choose Status',
-  'Choose Job Title': 'Choose Job Title',
-  'Job Title': 'Job Title',
-  'Job Start Time': 'Job Start Time',
-  'Job End Time': 'Job End Time',
-  'No. of Staff': 'No. of Staff',
-  'Enter No. of Staff': 'Enter No. of Staff',
-  'Choose Start Date': 'Choose Start Date',
-  'Choose End Date': 'Choose End Date',
-  'Add Labour Requisition': 'Add Labour Requisition',
-  'Edit Labour Requisition': 'Edit Labour Requisition',
-  'Labour Requisition': 'Labour Requisition',
-  'Message': 'Message',
-  'Are you sure you want to recall?': 'Are you sure you want to recall?',
-  'Workflow': 'Workflow',
-  'Remark:': 'Remark:',
-  'Audit Time:': 'Audit Time:',
-  'Operator:': 'Operator:',
-  'Designation:': 'Designation:',
-  'Type:': 'Type:',
-  'Node:': 'Node:',
-  'Approved': 'Approved',
-  'Pending': 'Pending',
-  'Rejected': 'Rejected',
-  'Completed': 'Completed',
-  'Active': 'Active',
-  'Cancelled': 'Cancelled',
-  'Revised': 'Revised',
-  'Job Detail': 'Job Detail',
-  'Add Staff': 'Add Staff',
-  'Remarks': 'Remarks',
-  'Applied At:': 'Applied At:',
-  'Total Rooms:': 'Total Rooms:',
-  'Total Hours:': 'Total Hours:',
-  '+/- Hours:': '+/- Hours:',
-  'Security Out:': 'Security Out:',
-  'Work Out:': 'Work Out:',
-  'Work In:': 'Work In:',
-  'Security In:': 'Security In:',
-  'Staff Name:': 'Staff Name:',
-  'Staff Name': 'Staff Name',
-  'Work Out': 'Work Out',
-  'Work In': 'Work In',
-  'Security In': 'Security In',
-  'Security Out': 'Security Out',
-  '+/- Hours': '+/- Hours',
-  'Total Rooms': 'Total Rooms',
-  'Operation Approve': 'Operation Approve',
-  'Batch Modify': 'Batch Modify',
-  'Please select the applied record': 'Please select the applied record',
-  'Are you sure you want to setting approved?': 'Are you sure you want to setting approved?',
-  'Attitude': 'Attitude',
-  'Performance': 'Performance',
-  'Experience': 'Experience',
-  'Grooming': 'Grooming',
-  'Enter...': 'Enter...',
-  'Please Enter Remark': 'Please Enter Remark',
-  'Choose Staff': 'Choose Staff',
-  'Reason': 'Reason',
-  'None': 'None',
-  'Forgot to clock in/out': 'Forgot to clock in/out',
-  'Technical issue': 'Technical issue',
-  'Others': 'Others',
-  'Staff Detail': 'Staff Detail',
-  'Staff Name/ID/Phone': 'Staff Name/ID/Phone',
-  'Select Country': 'Select Country',
-  'Browse jobs available in your selected country.': 'Browse jobs available in your selected country.',
-  'Next': 'Next',
-  'Singapore': 'Singapore',
-  'Revise List': 'Revise List',
-  'Device List': 'Device List',
-  'Device MAC:': 'Device MAC:',
-  'Device Alias:': 'Device Alias:',
-  'Location:': 'Location:',
-  'Alive State:': 'Alive State:',
-  'Offline': 'Offline',
-  'Online': 'Online',
-  'Sort': 'Sort',
-  'Template': 'Template',
-  'Updated At': 'Updated At',
-  'Add New': 'Add New',
-  'Template Setting': 'Template Setting',
-  'Enter Job Title': 'Enter Job Title',
-  'Template Name': 'Template Name',
-  'Contact': 'Contact',
-  'Note': 'Note',
-  'Delete': 'Delete',
-  'Are you sure you want to delete this job title?': 'Are you sure you want to delete this job title?',
-  'Are you sure you want to delete this job template?': 'Are you sure you want to delete this job template?',
-  'Age': 'Age',
-  'Gender': 'Gender',
-  'Preferred Language': 'Preferred Language',
-  'Food Hygiene Cert': 'Food Hygiene Cert',
-  'Yes': 'Yes',
-  'No': 'No',
-  'Description': 'Description',
-  'Contact No': 'Contact No',
-  'Create Template': 'Create Template',
-  'Edit Template': 'Edit Template',
-  'Both': 'Both',
-  'Male': 'Male',
-  'Female': 'Female',
-  'English': 'English',
-  'Chinese': 'Chinese',
-  'Malay': 'Malay',
-  'Tamil': 'Tamil',
-  'Hindi': 'Hindi',
-  'Select Job Title': 'Select Job Title',
-  'Select Job Start Time': 'Select Job Start Time',
-  'Select Job End Time': 'Select Job End Time',
-  'Enter No. of Staff of The Corresponding Gender': 'Enter No. of Staff of The Corresponding Gender',
-  'Select Date': 'Select Date',
-  'Date': 'Date',
-  'Job Time': 'Job Time',
-  'Repeat': 'Repeat',
-  'Repeat Start Time': 'Repeat Start Time',
-  'Repeat End Time': 'Repeat End Time',
-  'Gender Unlimited': 'Gender Unlimited',
-  'Gender Limited': 'Gender Limited',
-  'Needs Num': 'Needs Num',
-  'Request Type': 'Request Type',
-  'Remark': 'Remark',
-  'Are you sure you want to cancel this job?': 'Are you sure you want to cancel this job?',
-  'Are you sure you want to delete this job?': 'Are you sure you want to delete this job?',
-  'Are you sure you want to confirm this job?': 'Are you sure you want to confirm this job?',
-  'Create New Job': 'Create New Job',
-  'Search': 'Search',
-  'Send E-Attendance': 'Send E-Attendance',
-  'Nric': 'Nric',
-  'Name / Nric': 'Name / Nric',
-  'Add Staff - Choose Staff': 'Add Staff - Choose Staff',
-  'Are you sure you want to send the e-attendance to agency?': 'Are you sure you want to send the e-attendance to agency?',
-  'Work Clock In': 'Work Clock In',
-  'Work Clock Out': 'Work Clock Out',
-  'Security Clock In': 'Security Clock In',
-  'Security Clock Out': 'Security Clock Out',
-  'Applied': 'Applied',
-  'No Show': 'No Show',
-  'Modify': 'Modify',
-  'Subtract Hours': 'Subtract Hours',
-  'Hourly Rate': 'Hourly Rate',
-  'Reviews': 'Reviews',
-  'Mobile': 'Mobile',
-  'Staff Reviews': 'Staff Reviews',
-  'Revise Hours': 'Revise Hours',
-  'Are you sure you want to recall this revise?': 'Are you sure you want to recall this revise?',
-  'Are you sure you want to delete this revise?': 'Are you sure you want to delete this revise?',
-  'Logs': 'Logs',
-  'Date Time': 'Date Time',
-  'Action': 'Action',
-  'Content': 'Content',
-  'Revise': 'Revise',
-  'Add Revise': 'Add Revise',
-  'Edit Revise': 'Edit Revise',
-  'Incomplete': 'Incomplete',
-  'Completed + Incomplete': 'Completed + Incomplete',
-  'YY Casual Labour Report': 'YY Casual Labour Report',
-  'TotalAmt': 'TotalAmt',
-  'Hours': 'Hours',
-  'Monthly Staff Request Report': 'Monthly Staff Request Report',
-  'Finance Report': 'Finance Report',
-  'Created By': 'Created By',
-  'Language': 'Language',
-  'Korea': 'Korea',
-
-  //插件的国际化
-  'Pull to refresh': 'Pull to refresh',
-  'Release ready': 'Release ready',
-  'Refreshing...': 'Refreshing...',
-  'Succeeded': 'Succeeded',
-  'No more': 'No more',
-  'Failed': 'Failed',
-  'Last updated at %T': 'Last updated at %T',
-  'Pull to load': 'Pull to load',
-  'Network Load Error': 'Network Load Error',
-  'Loading...': 'Loading...',
-  'Data loading failed! Please refresh and try again': 'Data loading failed! Please refresh and try again',
-  'There is currently no content available': 'There is currently no content available',
-  'Click again and exit the app': 'Click again and exit the app',
-  'The login credential have expired, please log in again.': 'The login credentials have expired, please log in again.',
-  'Successful': 'Successful',
-};

+ 0 - 19
packages/cs_resources/lib/local/language/translation_service.dart

@@ -1,19 +0,0 @@
-// import 'package:flutter/material.dart';
-// import 'package:get/get.dart';
-// import 'en_US.dart';
-// import 'vi_VN.dart';
-// import 'zh_CN.dart';
-// import 'ko_KR.dart';
-//
-// class TranslationService extends Translations {
-//   static Locale? get locale => Get.deviceLocale;
-//   static const fallbackLocale = Locale('en', 'US');
-//
-//   @override
-//   Map<String, Map<String, String>> get keys => {
-//         'en_US': en_US,
-//         'zh_CN': zh_CN,
-//         'vi_VN': vi_VN,
-//         'ko_KR': ko_KR,
-//       };
-// }

+ 0 - 258
packages/cs_resources/lib/local/language/zh_CN.dart

@@ -1,258 +0,0 @@
-const Map<String, String> zh_CN = {
-  'YY Employer': 'YY Employer',
-  'Please enter your password': '请输入您的密码',
-  'The login code cannot be empty!': '登录账号不能为空!',
-  'The password cannot be empty!': '密码不能为空!',
-  'The new password cannot be empty!': '新密码不能为空!',
-  'Log in': '登录',
-  'Password': '密码',
-  'Email': '邮箱',
-  'Name/Mobile': '请输入姓名或电话',
-  'Check In': '签到',
-  'Check Out': '签出',
-  'Job Date': '工作日期',
-  'Start Time:': '开始时间:',
-  'End Time:': '结束时间:',
-  'Start Time': '开始时间',
-  'End Time': '结束时间',
-  'Name:': '姓名:',
-  'Reset': '重置',
-  'Start Date': '开始日期',
-  'End Date': '结束日期',
-  'Cancel': '取消',
-  'Confirm': '确认',
-  'Sign Here': '请在此签名',
-  'Clean': '清除',
-  'Vietnam': '越南',
-  'Sign in/Sign out': '签到/签出',
-  'Admin': '管理员',
-  'Don’t have an account?': '没有账号?',
-  'Sign up': '注册账号',
-  'Confirm Password': '确认密码',
-  'Please enter your email': '请输入您的邮箱',
-  'Please enter confirm password': '请输入确认密码',
-  'Submit': '提交',
-  'The email cannot be empty!': '邮箱不能为空!',
-  'The confirm password cannot be empty!': '确认密码不能为空!',
-  'Please confirm your confirmed password!': '请确认您的确认密码!',
-  'Reset Password': '重置密码',
-  'New Password': '新密码',
-  'Please enter your new password': '请输入您的新密码',
-  'Labour Request': '用工申请',
-  'Job List': '工作列表',
-  'Sign in Sign out': '签到与签出',
-  'Devices': '设备',
-  'Labour Request Review': '用工申请审核',
-  'Attendance Review': '考勤审核',
-  'Default Job Title': '用工申请模版',
-  'Report': '报表',
-  'Confirmation': '确认',
-  'Notice': '提示',
-  'Are you sure you need to exit the system?': '你是否确定要退出系统?',
-  'Are you sure you want to deactivate your account? You will not be able to login into the app once you proceed with the request.':
-  '你确定要停用你的帐户吗?一旦您继续请求,您将无法登录到该应用程序。',
-  'Welcome': '欢迎你',
-  'Switch Projects': '切换项目',
-  'Account Deactivation': '停用账户',
-  'Logout': '登出',
-  'Old Password': '旧密码',
-  'Settings': '设置',
-  'Title': '标题',
-  'Create New Job Request': '创建新的用工请求',
-  'Outlet': '部门',
-  'Status': '状态',
-  'Filter': '筛选',
-  'Edit': '编辑',
-  'Recall': '撤回',
-  'Detail': '详情',
-  'Outlet:': '部门:',
-  'DateTime:': '日期与时间:',
-  'No. of Staff:': '需要的人员数量:',
-  'Status:': '状态:',
-  'Publish Status:': '发布状态:',
-  'Created At:': '创建时间:',
-  'Published': '已发布',
-  'Unpublished': '未发布',
-  'Choose Outlet': '请选择部门',
-  'Choose Status': '请选择状态',
-  'Choose Job Title': '请选择工作标题',
-  'Job Title': '工作标题',
-  'Job Start Time': '工作开始时间',
-  'Job End Time': '工作结束时间',
-  'No. of Staff': '需要的人员数量',
-  'Enter No. of Staff': '请输入需要的人员数量',
-  'Choose Start Date': '请选择开始日期',
-  'Choose End Date': '请选择结束日期',
-  'Add Labour Requisition': '新增用工请求',
-  'Edit Labour Requisition': '编辑用工请求',
-  'Labour Requisition': '用工请求',
-  'Message': '通知',
-  'Are you sure you want to recall?': '你确定要撤回此用工请求吗?',
-  'Workflow': '审核流程',
-  'Remark:': '评价:',
-  'Audit Time:': '审核时间:',
-  'Operator:': '操作人员:',
-  'Designation:': '职位:',
-  'Type:': '类型:',
-  'Node:': '节点:',
-  'Approved': '已批准',
-  'Pending': '待处理',
-  'Rejected': '已拒绝',
-  'Completed': '已完成',
-  'Active': '可用',
-  'Cancelled': '已取消',
-  'Revised': '已修改',
-  'Job Detail': '工作详情',
-  'Add Staff': '添加员工',
-  'Remarks': '评论',
-  'Applied At:': '申请时间:',
-  'Total Rooms:': '总房间数:',
-  'Total Hours:': '总小时:',
-  '+/- Hours:': '加/减小时:',
-  'Security Out:': '门卫签出:',
-  'Work Out:': '工作地签出:',
-  'Work In:': '工作地签到:',
-  'Security In:': '门卫签到:',
-  'Staff Name:': '员工姓名:',
-  'Staff Name': '员工姓名',
-  'Work Out': '工作地签出',
-  'Work In': '工作地签到',
-  'Security In': '门卫签到',
-  'Security Out': '门卫签出',
-  '+/- Hours': '加/减小时',
-  'Total Rooms': '总房间数',
-  'Operation Approve': '操作批准',
-  'Batch Modify': '批量修改',
-  'Please select the applied record': '请选择申请记录',
-  'Are you sure you want to setting approved?': '你确定要设置为批准状态吗?',
-  'Attitude': '态度',
-  'Performance': '表现',
-  'Experience': '经验',
-  'Grooming': '着装',
-  'Enter...': '请输入...',
-  'Please Enter Remark': '请输入评论内容',
-  'Choose Staff': '选择员工',
-  'Reason': '理由',
-  'None': '无',
-  'Forgot to clock in/out': '忘记签到/签出',
-  'Technical issue': '技术问题',
-  'Others': '其他',
-  'Staff Detail': '员工详情',
-  'Staff Name/ID/Phone': '员工姓名/ID/电话号码',
-  'Select Country': '选择国家',
-  'Browse jobs available in your selected country.': '浏览所选国家/地区的可用工作',
-  'Next': '下一步',
-  'Singapore': '新加坡',
-  'Revise List': '修改列表',
-  'Device List': '设备列表',
-  'Device MAC:': '设备Mac地址:',
-  'Device Alias:': '设备别名:',
-  'Location:': '位置:',
-  'Alive State:': '在线状态:',
-  'Offline': '离线',
-  'Online': '在线',
-  'Sort': '排序',
-  'Template': '模板',
-  'Updated At': '更新时间',
-  'Add New': '新增',
-  'Template Setting': '模板设置',
-  'Enter Job Title': '请输入工作标题',
-  'Template Name': '模板名称',
-  'Contact': '联系人',
-  'Note': '注意事项',
-  'Delete': '删除',
-  'Are you sure you want to delete this job title?': '你确定要删除此工作标题吗?',
-  'Are you sure you want to delete this job template?': '你确定要删除此工作模板吗?',
-  'Age': '年龄',
-  'Gender': '性别',
-  'Preferred Language': '首选语言',
-  'Food Hygiene Cert': '食品卫生证书',
-  'Yes': '是',
-  'No': '否',
-  'Description': '详情',
-  'Contact No': '联系电话',
-  'Create Template': '创建模板',
-  'Edit Template': '编辑模板',
-  'Both': '全部',
-  'Male': '男',
-  'Female': '女',
-  'English': '英文',
-  'Chinese': '中文',
-  'Malay': '马来语',
-  'Tamil': '泰米尔语',
-  'Hindi': '印地语',
-  'Select Job Title': '请选择工作标题',
-  'Select Job Start Time': '请选择工作开始时间',
-  'Select Job End Time': '请选择工作结束时间',
-  'Enter No. of Staff of The Corresponding Gender': '输入需要对应性别的员工数量',
-  'Select Date': '选择日期',
-  'Date': '日期',
-  'Job Time': '工作时间',
-  'Repeat': '重复',
-  'Repeat Start Time': '重复的开始时间',
-  'Repeat End Time': '重复的结束时间',
-  'Gender Unlimited': '不限制性别',
-  'Gender Limited': '限制性别',
-  'Needs Num': '需要的数量',
-  'Request Type': '请求类型',
-  'Remark': '备注',
-  'Are you sure you want to cancel this job?': '你确定要取消此工作吗?',
-  'Are you sure you want to delete this job?': '你确定要删除此工作吗?',
-  'Are you sure you want to confirm this job?': '你确定要完成此工作吗?',
-  'Create New Job': '创建新工作',
-  'Search': '搜索',
-  'Send E-Attendance': '发送电子考勤',
-  'Nric': '身份证',
-  'Name / Nric': '姓名 / 身份证',
-  'Add Staff - Choose Staff': '添加员工 - 选择员工',
-  'Are you sure you want to send the e-attendance to agency?': '您确定要将电子考勤发送给代理商吗?',
-  'Work Clock In': '工作地签到',
-  'Work Clock Out': '工作地签出',
-  'Security Clock In': '门卫签到',
-  'Security Clock Out': '门卫签出',
-  'Applied': '已通过',
-  'No Show': '缺席',
-  'Modify': '修改',
-  'Subtract Hours': '扣除小时',
-  'Hourly Rate': '时薪',
-  'Reviews': '评价',
-  'Mobile': '电话',
-  'Staff Reviews': '员工评价',
-  'Revise Hours': '修改的小时',
-  'Are you sure you want to recall this revise?': '你确定要撤回此修改记录吗?',
-  'Are you sure you want to delete this revise?': '你确定要删除此修改记录吗?',
-  'Logs': '日志',
-  'Date Time': '日期时间',
-  'Action': '事件',
-  'Content': '内容',
-  'Revise': '修改',
-  'Add Revise': '添加修改',
-  'Edit Revise': '编辑修改',
-  'Incomplete': '未完成',
-  'Completed + Incomplete': '已完成 + 未完成',
-  'YY Casual Labour Report': 'YY用工报表',
-  'TotalAmt': '总金额',
-  'Hours': '小时',
-  'Monthly Staff Request Report': '月度员工请求报表',
-  'Finance Report': '财务报表',
-  'Created By': '创建者',
-  'Language': '语言',
-  'Korea': '韩国',
-
-  //插件的国际化
-  'Pull to refresh': '下拉刷新',
-  'Release ready': '释放刷新',
-  'Refreshing...': '刷新中...',
-  'Succeeded': '成功',
-  'No more': '没有更多了',
-  'Failed': '失败',
-  'Last updated at %T': '最近更新于 %T',
-  'Pull to load': '上拉加载',
-  'Network Load Error': '网络加载错误',
-  'Loading...': '加载中...',
-  'Data loading failed! Please refresh and try again': '数据加载失败!请刷新并重试',
-  'There is currently no content available': '当前没有可用数据',
-  'Click again and exit the app': '再次点击,退出应用',
-  'The login credential have expired, please log in again.': '您的登录凭证已过期,请重新登录。',
-  'Successful': '成功',
-};

+ 0 - 166
packages/cs_resources/lib/local/theme/theme_config.dart

@@ -1,166 +0,0 @@
-import 'package:flutter/cupertino.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-
-import '../../constants/color_constants.dart';
-
-class ThemeConfig {
-  static ThemeData createTheme({
-    required Brightness brightness,
-    required Color background,
-    required Color primaryText,
-    Color? secondaryText,
-    required Color accentColor,
-    Color? divider,
-    Color? buttonBackground,
-    required Color buttonText,
-    Color? cardBackground,
-    Color? disabled,
-    required Color error,
-  }) {
-    final baseTextTheme = brightness == Brightness.dark ? Typography.blackMountainView : Typography.whiteMountainView;
-
-    return ThemeData(
-      primaryColor: accentColor,
-      brightness: brightness,
-      canvasColor: background,
-      cardColor: background,
-      dividerColor: divider,
-      scaffoldBackgroundColor: background,
-      unselectedWidgetColor: hexToColor('#DADCDD'),
-      dividerTheme: DividerThemeData(
-        color: divider,
-        space: 1,
-        thickness: 1,
-      ),
-      cardTheme: CardTheme(
-        color: cardBackground,
-        margin: EdgeInsets.zero,
-        clipBehavior: Clip.antiAliasWithSaveLayer,
-      ),
-      textSelectionTheme: TextSelectionThemeData(
-        selectionColor: accentColor,
-        selectionHandleColor: accentColor,
-        cursorColor: accentColor,
-      ),
-      appBarTheme: AppBarTheme(
-        color: cardBackground,
-        titleTextStyle: TextStyle(
-          color: secondaryText,
-          fontSize: 18,
-        ),
-        iconTheme: IconThemeData(
-          color: secondaryText,
-        ),
-      ),
-      iconTheme: IconThemeData(
-        color: secondaryText,
-        size: 16.0,
-      ),
-      buttonTheme: ButtonThemeData(
-        textTheme: ButtonTextTheme.primary,
-        colorScheme: ColorScheme(
-          brightness: brightness,
-          primary: accentColor,
-          secondary: accentColor,
-          surface: background,
-          background: background,
-          error: error,
-          onPrimary: buttonText,
-          onSecondary: buttonText,
-          onSurface: buttonText,
-          onBackground: buttonText,
-          onError: buttonText,
-        ),
-        padding: const EdgeInsets.all(16.0),
-      ),
-      cupertinoOverrideTheme: CupertinoThemeData(
-        brightness: brightness,
-        primaryColor: accentColor,
-      ),
-      inputDecorationTheme: InputDecorationTheme(
-        errorStyle: TextStyle(color: error),
-        labelStyle: TextStyle(
-          fontFamily: 'Rubik',
-          fontWeight: FontWeight.w600,
-          fontSize: 16.0,
-          color: primaryText.withOpacity(0.5),
-        ),
-        hintStyle: TextStyle(
-          color: secondaryText,
-          fontSize: 13.0,
-          fontWeight: FontWeight.w300,
-        ),
-      ),
-    );
-  }
-
-  static ThemeData get lightTheme => createTheme(
-        brightness: Brightness.light,
-        background: ColorConstants.lightScaffoldBackgroundColor,
-        cardBackground: ColorConstants.secondaryAppColor,
-        primaryText: Colors.black,
-        secondaryText: Colors.black,
-        accentColor: ColorConstants.secondaryAppColor,
-        divider: ColorConstants.secondaryAppColor,
-        buttonBackground: Colors.black38,
-        buttonText: ColorConstants.secondaryAppColor,
-        disabled: ColorConstants.secondaryAppColor,
-        error: Colors.red,
-      );
-
-  static ThemeData get darkTheme => createTheme(
-        brightness: Brightness.dark,
-        background: ColorConstants.darkScaffoldBackgroundColor,
-        cardBackground: ColorConstants.secondaryDarkAppColor,
-        primaryText: Colors.white,
-        secondaryText: Colors.white,
-        accentColor: ColorConstants.secondaryDarkAppColor,
-        divider: Colors.black45,
-        buttonBackground: Colors.white,
-        buttonText: ColorConstants.secondaryDarkAppColor,
-        disabled: ColorConstants.secondaryDarkAppColor,
-        error: Colors.red,
-      );
-
-  //亮色模式模式下的状态栏与导航栏设置 (默认黑色状态栏文本,白色导航栏)
-  static SystemUiOverlayStyle get systemUiOverlayStyleLightThemeBlack {
-    return SystemUiOverlayStyle.light.copyWith(
-      statusBarColor: Colors.transparent,
-      //顶部导航栏的状态栏背景颜色
-      statusBarBrightness: Brightness.light,
-      //顶部状态栏颜色模式
-      statusBarIconBrightness: Brightness.dark,
-      //顶部状态栏Icon与文本颜色模式
-      systemNavigationBarDividerColor: Colors.transparent,
-      //底部导航栏分割线颜色
-      systemNavigationBarColor: Colors.white,
-      //底部导航栏背景颜色
-      systemNavigationBarIconBrightness: Brightness.dark, //底部导航栏三大金刚键的颜色模式
-    );
-  }
-
-  //亮色模式模式下的状态栏与导航栏设置 (设置白色状态栏文本,白色导航栏)
-  static SystemUiOverlayStyle get systemUiOverlayStyleLightThemeWhite {
-    return SystemUiOverlayStyle.light.copyWith(
-      statusBarColor: Colors.transparent,
-      statusBarBrightness: Brightness.dark,
-      statusBarIconBrightness: Brightness.light,
-      systemNavigationBarDividerColor: Colors.transparent,
-      systemNavigationBarColor: Colors.white,
-      systemNavigationBarIconBrightness: Brightness.dark,
-    );
-  }
-
-  //黑暗模式下,统一使用白色状态栏文本,黑色导航栏
-  static SystemUiOverlayStyle get systemUiOverlayStyleDarkTheme {
-    return SystemUiOverlayStyle.dark.copyWith(
-      statusBarColor: Colors.transparent,
-      statusBarBrightness: Brightness.dark,
-      statusBarIconBrightness: Brightness.light,
-    );
-  }
-
-  // ===================================== 切换样式 ↓ =====================================
-
-}

+ 68 - 0
packages/cs_resources/lib/theme/app_colors_theme.dart

@@ -0,0 +1,68 @@
+import 'package:flutter/material.dart';
+
+//定义扩展方便获取到颜色值
+extension ThemeDataExtension on ThemeData {
+  AppColorsTheme get appColors => extension<AppColorsTheme>()!;
+}
+
+extension AppColorsThemeExtensions on BuildContext {
+  AppColorsTheme get appColors => Theme.of(this).extension<AppColorsTheme>()!;
+}
+
+class AppColorsTheme extends ThemeExtension<AppColorsTheme> {
+  //亮色主题的自定义颜色值
+  static const _colorB0B0B0 = Color(0xFFB0B0B0);
+  static const _color6C6C6C = Color(0xFF6C6C6C);
+  static const _colorF9F9F9 = Color(0xffF9F9F9);
+
+  //暗色主题的一些自定义颜色值
+  static const _darkBlackBg = Color(0xFF0F0F0F);
+  static const _darkBlackItem = Color(0xFF1D1D1E);
+  static const _darkBlackItemLight = Color(0xFF3B3933);
+  static const _darkBlackItemLightMost = Color(0xFF5C5850);
+  static const _darkBlackItemDivider = Color(0xFF3B3B3F);
+
+  // 页面中真正使用到的颜色名称
+  final Color backgroundDefault; //动态颜色
+  final Color btnBgDefault;
+
+
+  // 私有的构造函数
+  const AppColorsTheme._internal({
+    required this.backgroundDefault,
+    required this.btnBgDefault,
+  });
+
+  // 浅色主题工厂方法
+  factory AppColorsTheme.light() {
+    return const AppColorsTheme._internal(
+      backgroundDefault: _colorF9F9F9,
+      btnBgDefault: Colors.deepPurple,
+    );
+  }
+
+  // 暗色主题工厂方法
+  factory AppColorsTheme.dark() {
+    return const AppColorsTheme._internal(
+      backgroundDefault: _darkBlackBg,
+      btnBgDefault: _darkBlackItem,
+    );
+  }
+
+  @override
+  ThemeExtension<AppColorsTheme> copyWith({bool? lightMode}) {
+    if (lightMode == null || lightMode == true) {
+      return AppColorsTheme.light();
+    }
+    return AppColorsTheme.dark();
+  }
+
+  @override
+  AppColorsTheme lerp(covariant ThemeExtension<AppColorsTheme>? other, double t) {
+    if (other is! AppColorsTheme) return this;
+    return AppColorsTheme._internal(
+      backgroundDefault: Color.lerp(backgroundDefault, other.backgroundDefault, t)!,
+      btnBgDefault: Color.lerp(btnBgDefault, other.btnBgDefault, t)!,
+    );
+  }
+}

+ 45 - 0
packages/cs_resources/lib/theme/theme_config.dart

@@ -0,0 +1,45 @@
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+
+class ThemeConfig {
+
+  //亮色模式模式下的状态栏与导航栏设置 (默认黑色状态栏文本,白色导航栏)
+  static SystemUiOverlayStyle get systemUiOverlayStyleLightThemeBlack {
+    return SystemUiOverlayStyle.light.copyWith(
+      statusBarColor: Colors.transparent,
+      //顶部导航栏的状态栏背景颜色
+      statusBarBrightness: Brightness.light,
+      //顶部状态栏颜色模式
+      statusBarIconBrightness: Brightness.dark,
+      //顶部状态栏Icon与文本颜色模式
+      systemNavigationBarDividerColor: Colors.transparent,
+      //底部导航栏分割线颜色
+      systemNavigationBarColor: Colors.white,
+      //底部导航栏背景颜色
+      systemNavigationBarIconBrightness: Brightness.dark, //底部导航栏三大金刚键的颜色模式
+    );
+  }
+
+  //亮色模式模式下的状态栏与导航栏设置 (设置白色状态栏文本,白色导航栏)
+  static SystemUiOverlayStyle get systemUiOverlayStyleLightThemeWhite {
+    return SystemUiOverlayStyle.light.copyWith(
+      statusBarColor: Colors.transparent,
+      statusBarBrightness: Brightness.dark,
+      statusBarIconBrightness: Brightness.light,
+      systemNavigationBarDividerColor: Colors.transparent,
+      systemNavigationBarColor: Colors.white,
+      systemNavigationBarIconBrightness: Brightness.dark,
+    );
+  }
+
+  //黑暗模式下,统一使用白色状态栏文本,黑色导航栏
+  static SystemUiOverlayStyle get systemUiOverlayStyleDarkTheme {
+    return SystemUiOverlayStyle.dark.copyWith(
+      statusBarColor: Colors.transparent,
+      statusBarBrightness: Brightness.dark,
+      statusBarIconBrightness: Brightness.light,
+    );
+  }
+
+}

+ 26 - 0
packages/cs_resources/lib/theme/theme_notifier.dart

@@ -0,0 +1,26 @@
+import 'package:flutter/material.dart';
+import 'package:riverpod/riverpod.dart';
+
+final themeProvider = StateNotifierProvider<ThemeNotifier, ThemeMode>((ref) {
+  return ThemeNotifier();
+});
+
+class ThemeNotifier extends StateNotifier<ThemeMode> {
+  //这里应该根据用户的SP配置来设置不同的主题,先偷个懒这里我先写死跟随系统的主题
+  ThemeNotifier() : super(ThemeMode.system);  //默认 system 主题
+
+  //手动切换主题
+  void toggleTheme() {
+    if (state == ThemeMode.light) {
+      state = ThemeMode.dark;
+    } else if (state == ThemeMode.dark) {
+      state = ThemeMode.light;
+    } else {
+      state = ThemeMode.light;
+    }
+  }
+  //跟随系统主题
+  void followSystemTheme() {
+    state = ThemeMode.system;
+  }
+}