diff --git a/making_school_asignment_app/android/app/src/main/AndroidManifest.xml b/making_school_asignment_app/android/app/src/main/AndroidManifest.xml index 77cfe6b..a54c890 100644 --- a/making_school_asignment_app/android/app/src/main/AndroidManifest.xml +++ b/making_school_asignment_app/android/app/src/main/AndroidManifest.xml @@ -2,7 +2,8 @@ + android:icon="@mipmap/ic_launcher" + android:enableOnBackInvokedCallback="true"> false false shortEdges - #eeeeee + #FFFFFF @drawable/android12splash - + + + + + + + + + + + + + + + + + + + + + + diff --git a/making_school_asignment_app/assets/images/splash2.png b/making_school_asignment_app/assets/images/splash2.png new file mode 100644 index 0000000..a346c46 Binary files /dev/null and b/making_school_asignment_app/assets/images/splash2.png differ diff --git a/making_school_asignment_app/flutter_native_splash.yaml b/making_school_asignment_app/flutter_native_splash.yaml index 3c1f8ff..ed05c25 100644 --- a/making_school_asignment_app/flutter_native_splash.yaml +++ b/making_school_asignment_app/flutter_native_splash.yaml @@ -5,11 +5,11 @@ flutter_native_splash: # 如需恢复默认的白屏,执行如下命令 # flutter pub run flutter_native_splash:remove # 设置闪屏页的默认态logo或背景图片路径 - color: "#eeeeee" + color: "##FFFFFF" image_ios: assets/images/splash_native.png background_image_android: assets/images/splash_native.png android_12: - image: assets/images/splash.png + image: assets/images/splash2.png android: true ios: true android_gravity: fill diff --git a/making_school_asignment_app/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png b/making_school_asignment_app/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png index db947d6..3107d37 100644 Binary files a/making_school_asignment_app/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png and b/making_school_asignment_app/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png differ diff --git a/making_school_asignment_app/lib/common/utils/app_upgrade/upgradeLogic.dart b/making_school_asignment_app/lib/common/utils/app_upgrade/upgradeLogic.dart index 00e8d15..67c450d 100644 --- a/making_school_asignment_app/lib/common/utils/app_upgrade/upgradeLogic.dart +++ b/making_school_asignment_app/lib/common/utils/app_upgrade/upgradeLogic.dart @@ -1,9 +1,12 @@ import 'dart:io'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/widgets.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/app_version.dart'; import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart'; +import 'package:making_school_asignment_app/common/utils/permission_describe_util.dart'; import 'package:package_info_plus/package_info_plus.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'UpdateDialog.dart'; import 'model/UpdateAppEvent.dart'; @@ -20,7 +23,21 @@ class UpgradeLogic extends GetxController with RequestToolMixin { // } void getAppUpgrade(BuildContext context) async { - // if (!const bool.fromEnvironment('dart.vm.product')) return; + if (!const bool.fromEnvironment('dart.vm.product')) return; + DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); + AndroidDeviceInfo androidInfo = await deviceInfoPlugin.androidInfo; + Permission storagePermission; + if (androidInfo.version.sdkInt >= 33) { + storagePermission = Permission.manageExternalStorage; + } else { + storagePermission = Permission.storage; + } + PermissionDescribeUtil.instance.toLaunchPermissionRequest( + context, + title: '储存权限请求', + describe: "为了提供更好的服务,需要获取到存储权限用于保存APP升级文件APK,进行升级", + permissions: [storagePermission], + ); try { showUpgrade.value = true; // if (['18888888888'].contains(user.loginName)) return; diff --git a/making_school_asignment_app/lib/common/utils/permission_describe_util.dart b/making_school_asignment_app/lib/common/utils/permission_describe_util.dart new file mode 100644 index 0000000..b619dcf --- /dev/null +++ b/making_school_asignment_app/lib/common/utils/permission_describe_util.dart @@ -0,0 +1,295 @@ +import 'dart:async'; + +import 'package:app_settings/app_settings.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; +import 'package:permission_handler/permission_handler.dart'; + +class PermissionDescribePage extends StatefulWidget { + final String title; + final String describe; + final List permissions; + + const PermissionDescribePage({required this.title, required this.describe, required this.permissions, super.key}); + + @override + State createState() => _PermissionDescribePageState(); +} + +class _PermissionDescribePageState extends State with WidgetsBindingObserver { + Timer? _timerPermission; + bool theOpenAppSettings = false; + int theExecutionFrequency = 0; + + @override + void initState() { + WidgetsBinding.instance.addObserver(this); + + Future.delayed(const Duration(seconds: 3), () { + getCheckPermission(context); + }); + super.initState(); + } + + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + print("-didChangeAppLifecycleState-" + state.toString()); + switch (state) { + case AppLifecycleState.inactive: // 处于这种状态的应用程序应该假设它们可能在任何时候暂停。 + break; + case AppLifecycleState.resumed: //从后台切换前台,界面可见 + if (theOpenAppSettings) { + getCheckPermission(context); + } + break; + case AppLifecycleState.paused: // 界面不可见,后台 + break; + case AppLifecycleState.detached: // APP结束时调用 + break; + case AppLifecycleState.hidden: + // TODO: Handle this case. + } + } + + @override + void dispose() { + _timerPermission?.cancel(); + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + void getCheckPermission(BuildContext context) async { + theOpenAppSettings = false; + theExecutionFrequency++; + + List permissions = []; // 普通拒绝 + List permanentRefusal = []; // 永久拒绝 + for (var i = 0; i < widget.permissions.length; i++) { + var p = widget.permissions[i]; + var status = await p.status; + var shouldShowRequestRationale = await p.shouldShowRequestRationale; + if (!status.isGranted) { + if (status.isDenied) { + if (shouldShowRequestRationale) { + /// 说明情况,再次發起权限请求(已经拒绝一次了) + await showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: quickText(widget.title, fontWeight: FontWeight.bold), + content: quickText(widget.describe, maxLines: 20), + actions: [ + ElevatedButton( + onPressed: () async => Navigator.of(context).pop(), + child: const Text('我已知晓'), + ) + ], + ); + }, + ); + } + permissions.add(p); + } else if (await status.isPermanentlyDenied) { + permanentRefusal.add(p); + } + } + } + + if (permissions.isNotEmpty) { + // 普通拒绝 + permanentRefusal.addAll(await getStoragePermission(context, permissions)); + } + + if (permanentRefusal.isNotEmpty) { + /// 被永久拒绝了 需要弹出对话框说明 使用户自行操作 + await showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: quickText(widget.describe, maxLines: 20), + title: quickText(widget.title, fontWeight: FontWeight.bold), + actions: [ + ElevatedButton( + onPressed: () async { + Navigator.of(context).pop(); + theOpenAppSettings = true; + await AppSettings.openAppSettings(asAnotherTask: true); + }, + child: const Text('前往APP权限设置'), + ) + ], + ); + }, + ); + } else { + Navigator.of(Get.context ?? context).pop(); + } + } + + /// 权限发起请求 + /// @param List permissions 权限集合 + Future> getStoragePermission(BuildContext context, List permissions, [int executionFrequency = 0]) async { + Map statusRes = await permissions.request(); + + List permanentRefusal = []; // 永久拒绝 + + List keys = statusRes.keys.toList(); + + for (var i = 0; i < keys.length; i++) { + Permission key = keys[i]; + PermissionStatus status = statusRes[key]!; + if (status.isPermanentlyDenied) { + /// 添加永久拒绝的权限集合 + permanentRefusal.add(key); + } else if (status.isDenied) { + /// 如果权限被永久拒绝,我们可能需要引导用户到应用设置中手动开启权限,显示一个对话框,解释为什么需要这个权限 + /// 应用之前已经请求过该权限,并且用户选择了“拒绝”,但没有选择“不再询问”(即没有永久拒绝)。 + /// 系统认为向用户显示一个权限请求的说明是合适的,以便用户理解为什么应用需要这个权限。 + if (await key.shouldShowRequestRationale) { + /// 说明情况,再次發起权限请求(已经拒绝一次了) + /// TODO 对话框 说明情况 再发发起请求 + await showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: quickText(widget.title, fontWeight: FontWeight.bold), + content: quickText(widget.describe, maxLines: 20), + actions: [ + ElevatedButton( + onPressed: () async => Navigator.of(context).pop(), + child: const Text('我已知晓'), + ) + ], + ); + }, + ); + } + if (permissions.length == 1 && key == permissions[0]) { + executionFrequency++; + } + if (executionFrequency <= 1) { + var res = await getStoragePermission(context, [key], executionFrequency); + permanentRefusal.addAll(res); + } else { + permanentRefusal.add(key); + } + + // break; + } + } + return permanentRefusal; + } + + @override + Widget build(BuildContext context) { + return PopScope( + canPop: false, + child: Container( + width: ScreenUtil().screenWidth, + height: ScreenUtil().screenHeight, + decoration: const BoxDecoration(color: Colors.transparent), + child: Column( + children: [ + SizedBox(height: ScreenUtil().screenHeight * 0.1), + Container( + width: ScreenUtil().screenWidth * 0.9, + padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10.r), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.5), // 阴影颜色 + spreadRadius: 2, // 水平和垂直方向上扩展范围 + blurRadius: 4, // 模糊半径 + offset: Offset(0, 3), // X 和 Y 的偏移量 + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + quickText(widget.title, size: 24.sp), + quickText(widget.describe, maxLines: 20), + ], + ), + ), + const Expanded(child: SizedBox()), + ], + ), + )); + } +} + +class PermissionDescribeUtil { + static PermissionDescribeUtil? _instance; + + PermissionDescribeUtil._internal(); + + static get instance { + return _instance ??= PermissionDescribeUtil._internal(); + } + + /// 发起权限请求 + void toLaunchPermissionRequest( + BuildContext context, { + required String title, + required String describe, + required List permissions, + }) async { + var isGranted = false; + for (var i = 0; i < permissions.length; i++) { + var p = permissions[i]; + if (!(await p.status.isGranted)) { + isGranted = true; + break; + } + } + if (isGranted) { + Navigator.of(Get.context ?? context).push(PageRouteBuilder( + opaque: false, + pageBuilder: (context, animation, secondaryAnimation) { + return PermissionDescribePage( + title: title, + describe: describe, + permissions: permissions, + ); + })); + } + + // await Navigator.of(context).push( + // transparentRoute( + // builder: (context) => PermissionDescribePage( + // title: title, + // describe: describe, + // permissions: permissions, + // ), + // ), + // ); + } +} + +// Route transparentRoute({ +// required WidgetBuilder builder, +// RouteSettings? settings, +// }) { +// return PageRouteBuilder( +// pageBuilder: ( +// BuildContext context, +// Animation animation, +// Animation secondaryAnimation, +// ) { +// return builder(context); +// }, +// transitionsBuilder: (_, Animation animation, Animation secondaryAnimation, Widget child) { +// return child; +// }, +// barrierDismissible: false, // 允许点击返回按钮关闭页面 +// // barrierColor: Colors.transparent, // 透明屏障颜色 +// ); +// } diff --git a/making_school_asignment_app/lib/main.dart b/making_school_asignment_app/lib/main.dart index f8e7a01..f9443b9 100644 --- a/making_school_asignment_app/lib/main.dart +++ b/making_school_asignment_app/lib/main.dart @@ -72,12 +72,22 @@ class MyApp extends StatelessWidget { useMaterial3: false, colorScheme: const ColorScheme.light( // 修改亮色主题的主题颜色 - primary: Color(0xFF8C68FF), + primary: Color(0xFF8C68FF), )), enableLog: true, logWriterCallback: (text, {bool isError = false}) { // isError ? LoggerUtils.e(text) : LoggerUtils.i(text); }, + routingCallback: (routing) { + String? currentRouter = routing?.current; + // print("当前路由:${currentRouter}"); + // if ([Routes.home, Routes.myInfo].contains(currentRouter)) { + // SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + // statusBarIconBrightness: Brightness.light, + // systemStatusBarContrastEnforced: false, + // )); + // } + }, // 这里是国际化支持,确保添加flutter_localizations依赖 supportedLocales: const [ Locale('zh', 'CN'), // 中文简体 diff --git a/making_school_asignment_app/lib/page/global_widget/start_page.dart b/making_school_asignment_app/lib/page/global_widget/start_page.dart index a04e750..9174776 100644 --- a/making_school_asignment_app/lib/page/global_widget/start_page.dart +++ b/making_school_asignment_app/lib/page/global_widget/start_page.dart @@ -1,25 +1,21 @@ import 'dart:async'; -import 'package:app_settings/app_settings.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_native_splash/flutter_native_splash.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:making_school_asignment_app/common/utils/app_upgrade/upgradeLogic.dart'; -import 'package:making_school_asignment_app/common/job/user_info.dart'; -import 'package:making_school_asignment_app/common/job/user_info_detail.dart'; -import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart'; -import 'package:making_school_asignment_app/common/store/user_store.dart'; -import 'package:making_school_asignment_app/common/utils/storage.dart'; -import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; -import 'package:making_school_asignment_app/page/home_page/children/my_info.dart'; -import 'package:making_school_asignment_app/page/home_page/home_logic.dart'; -import 'package:making_school_asignment_app/page/home_page/home_view.dart'; -import 'package:making_school_asignment_app/page/work_page/work_logic.dart'; -import 'package:making_school_asignment_app/page/work_page/work_view.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart'; -import 'package:permission_handler/permission_handler.dart'; +import 'package:making_school_asignment_app/common/job/user_info.dart'; +import 'package:making_school_asignment_app/common/utils/storage.dart'; +import 'package:making_school_asignment_app/common/store/user_store.dart'; +import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; +import 'package:making_school_asignment_app/page/home_page/home_view.dart'; +import 'package:making_school_asignment_app/page/home_page/home_logic.dart'; +import 'package:making_school_asignment_app/page/work_page/work_logic.dart'; +import 'package:making_school_asignment_app/common/job/user_info_detail.dart'; +import 'package:making_school_asignment_app/page/home_page/children/my_info.dart'; +import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart'; +import 'package:making_school_asignment_app/common/utils/app_upgrade/upgradeLogic.dart'; class StartPage extends StatefulWidget { const StartPage({super.key}); @@ -37,70 +33,16 @@ class _StartPageState extends State with RequestToolMixin { late final List _bodyList; - void getStoragePermission() async { - _timerPermission?.cancel(); - _timerPermission = null; - var status = await Permission.storage.request(); - if (status != PermissionStatus.granted) { - print(status); - if (status == PermissionStatus.denied) { - await showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return AlertDialog( - title: const Text("储存权限拒绝"), - content: const Text("为了提供更好的服务,需要获取到存储权限用于保存批阅笔记"), - actions: [ - ElevatedButton( - onPressed: () async { - await AppSettings.openAppSettings(asAnotherTask: true); - Navigator.of(context).pop(); - _timerPermission = Timer.periodic(const Duration(seconds: 30), (_) => getStoragePermission()); - }, - child: const Text('前往APP权限设置'), - ) - ], - ); - }, - ); - - return; - } - await showDialog( - context: context, - barrierDismissible: false, - builder: (BuildContext context) { - return AlertDialog( - title: Text("内存权限"), - content: Text("为了提供更好的服务,需要获取到存储权限用于保存批阅笔记"), - actions: [ - ElevatedButton( - onPressed: () async { - await Permission.storage.request(); - Navigator.of(context).pop(); - getStoragePermission(); - }, - child: Text('允许'), - ) - ], - ); - }, - ); - } - } - @override void initState() { super.initState(); Future.delayed(const Duration(seconds: 3), () => FlutterNativeSplash.remove()); - Future.delayed(const Duration(seconds: 4), () => getStoragePermission()); Get.put(HomeLogic()); Get.put(WorkLogic()); - - _bodyList = [const HomePage(), const WorkPage(), const MyInfo()]; + // const WorkPage(), + _bodyList = [const HomePage(), const MyInfo()]; // APP 启动后就直接更新 if (!_upgradeLogic.showUpgrade.value) _upgradeLogic.getAppUpgrade(context); _timer?.cancel(); @@ -148,7 +90,6 @@ class _StartPageState extends State with RequestToolMixin { @override Widget build(BuildContext context) { - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.dark)); return WillPopScope( child: Scaffold( body: PageView( @@ -156,27 +97,28 @@ class _StartPageState extends State with RequestToolMixin { physics: const BouncingScrollPhysics(), onPageChanged: (index) { _pageController._pageIndexState.pageIndex.value = index; - if (index == 2) { - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); - } else { - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.dark)); - } + // if (index == 2) { + // SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); + // } else { + // SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.dark)); + // } }, children: _bodyList, ), bottomNavigationBar: Obx(() { return BottomNavigationBar( + backgroundColor: Colors.white, items: [ BottomNavigationBarItem( label: '作业', icon: getItemIcon('assets/images/ic_home_normal.png'), activeIcon: getItemIcon('assets/images/ic_home_active.png'), ), - BottomNavigationBarItem( - label: '考试', - icon: getItemIcon('assets/images/ic_work_normal.png'), - activeIcon: getItemIcon('assets/images/ic_work_active.png'), - ), + // BottomNavigationBarItem( + // label: '考试', + // icon: getItemIcon('assets/images/ic_work_normal.png'), + // activeIcon: getItemIcon('assets/images/ic_work_active.png'), + // ), BottomNavigationBarItem( label: '我的', icon: getItemIcon('assets/images/ic_mine_normal.png'), diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart index 6d0c40e..b8dd1ca 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart @@ -1,3 +1,4 @@ +import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -5,11 +6,13 @@ import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart'; import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart'; +import 'package:making_school_asignment_app/common/utils/permission_describe_util.dart'; import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'original_manuscript_handwriting/answer_handwriting_view.dart'; @@ -24,9 +27,25 @@ class DropdownSwitchStudentsType extends StatefulWidget { } class _DropdownSwitchStudentsTypeState extends State { + final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin(); final logic = Get.find(); final sateData = Get.find().state.data; + @override + void initState() { + deviceInfoPlugin.androidInfo.then((androidInfo) { + Permission storagePermission = androidInfo.version.sdkInt >= 33 ? Permission.manageExternalStorage : Permission.storage; + PermissionDescribeUtil.instance.toLaunchPermissionRequest( + context, + title: '储存权限请求', + describe: "为了提供更好的服务,需要获取到存储权限用于保存批阅痕迹并上传", + permissions: [storagePermission], + ); + }); + + super.initState(); + } + @override Widget build(BuildContext context) { return Container( diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/index.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/index.dart index 85d1aaa..a2dd411 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/index.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/index.dart @@ -51,18 +51,12 @@ class _HomeworkReviewState extends State { child: Scaffold( appBar: AppBar( // titleSpacing: 0, - leading: IconButton( - icon: const Icon(Icons.arrow_back_ios), - onPressed: () => Get.back()), + leading: IconButton(icon: const Icon(Icons.arrow_back_ios), onPressed: () => Get.back()), iconTheme: const IconThemeData(color: Colors.black), title: quickText(sateData.param.value.homeworkName), backgroundColor: Colors.white, elevation: 0, - actions: [ - const FavoriteWidget(), - SizedBox(width: 5.w), - const ReturnToHomepage() - ], + actions: [const FavoriteWidget(), SizedBox(width: 5.w), const ReturnToHomepage()], ), body: SafeArea( child: Column( diff --git a/making_school_asignment_app/lib/page/home_page/children/my_info.dart b/making_school_asignment_app/lib/page/home_page/children/my_info.dart index 3309e06..1f4895e 100644 --- a/making_school_asignment_app/lib/page/home_page/children/my_info.dart +++ b/making_school_asignment_app/lib/page/home_page/children/my_info.dart @@ -19,6 +19,16 @@ class MyInfo extends StatefulWidget { class _MyInfoState extends State with AutomaticKeepAliveClientMixin { late Rx userInfo = UserStore.to.userDetailInfo; + @override + void initState() { + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + statusBarIconBrightness: Brightness.light, + statusBarColor: Colors.transparent, //状态栏背景颜色 + systemStatusBarContrastEnforced: false, + )); + super.initState(); + } + // 确认对话框 _showAlertDialog(context1) async { await showDialog( @@ -26,31 +36,27 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { barrierDismissible: false, context: context1, builder: (context) { - return AlertDialog( - title: quickText("提示信息"), - content: quickText("您确定要退出登录吗?"), - actions: [ - TextButton( - child: quickText("取消"), - onPressed: () { - Navigator.pop(context, 'Cancle'); - }, - ), - TextButton( - child: quickText("确定"), - onPressed: () async { - try { - UserStore.to.erase(); - await StorageService.to.erase(); - StorageService.to - .write(AppStorageKey.privacyAgreement.value, true); - Navigator.pop(context, "Ok"); - Get.offAllNamed(Routes.login); - } catch (e) { - print(e); - } - }) - ]); + return AlertDialog(title: quickText("提示信息"), content: quickText("您确定要退出登录吗?"), actions: [ + TextButton( + child: quickText("取消"), + onPressed: () { + Navigator.pop(context, 'Cancle'); + }, + ), + TextButton( + child: quickText("确定"), + onPressed: () async { + try { + UserStore.to.erase(); + await StorageService.to.erase(); + StorageService.to.write(AppStorageKey.privacyAgreement.value, true); + Navigator.pop(context, "Ok"); + Get.offAllNamed(Routes.login); + } catch (e) { + print(e); + } + }) + ]); }); } @@ -70,8 +76,7 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { fontSize: 13.sp, ); - return OrientationBuilder( - builder: (BuildContext context, Orientation orientation) { + return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { return Stack( children: [ SizedBox( @@ -103,7 +108,7 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { children: [ Container( height: 150.h, - padding: EdgeInsets.only(left: 20.r,right: 20.r), + padding: EdgeInsets.only(left: 20.r, right: 20.r), // alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.start, @@ -124,14 +129,13 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { margin: EdgeInsets.only(top: 0.h), child: Text( userInfo.value?.name ?? '请前往登录', - style: TextStyle( - fontSize: 16.sp, color: const Color(0xFF332A2A),fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 16.sp, color: const Color(0xFF332A2A), fontWeight: FontWeight.w500), ), ), ), const Spacer(), InkWell( - onTap: (){ + onTap: () { _showAlertDialog(context); }, child: Image.asset('assets/images/out_icon.png'), @@ -142,8 +146,7 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { SizedBox(height: 14.h), Container( margin: EdgeInsets.symmetric(vertical: 5.h, horizontal: 16.w), - padding: - EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), + padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.w)), @@ -159,17 +162,12 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text('账号', style: personalInfoTitleStly), - Text(userInfo.value?.name ?? '请前往登录', - style: personalInfoValStly) - ], + children: [Text('账号', style: personalInfoTitleStly), Text(userInfo.value?.name ?? '请前往登录', style: personalInfoValStly)], ), ), Container( margin: EdgeInsets.symmetric(vertical: 5.h, horizontal: 16.w), - padding: - EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), + padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.w)), @@ -183,19 +181,14 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ) ], ), - child:Row( + child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text('所在学校', style: personalInfoTitleStly), - Text(userInfo.value?.schoolName ?? '', - style: personalInfoValStly) - ], + children: [Text('所在学校', style: personalInfoTitleStly), Text(userInfo.value?.schoolName ?? '', style: personalInfoValStly)], ), ), Container( margin: EdgeInsets.symmetric(vertical: 5.h, horizontal: 16.w), - padding: - EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), + padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 16.w), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.w)), @@ -209,7 +202,7 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ) ], ), - child:InkWell( + child: InkWell( onTap: () { Get.toNamed(Routes.otherPage); }, @@ -226,8 +219,6 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ), ), ), - - ], ), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.dart b/making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.dart index cdfeffc..0b9a202 100644 --- a/making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.dart @@ -1,25 +1,15 @@ +import 'package:get/get.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:functional_widget_annotation/functional_widget_annotation.dart'; -import 'package:get/get.dart'; -import 'package:making_school_asignment_app/common/job/work_student.dart'; -import 'package:making_school_asignment_app/common/utils/enum_untils.dart'; -import 'package:making_school_asignment_app/common/utils/utils.dart'; -import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/annotate_list.dart'; -import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/task_list_item.dart'; -import 'package:making_school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart'; -import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'read_over_logic.dart'; class ReadOverPage extends StatefulWidget { - const ReadOverPage({Key? key}) : super(key: key); + const ReadOverPage({super.key}); @override State createState() => _ReadOverPageState(); @@ -29,6 +19,16 @@ class _ReadOverPageState extends State { final logic = Get.find(); final state = Get.find().state; + @override + void initState() { + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + statusBarColor: Colors.transparent, //状态栏背景颜色 + statusBarIconBrightness: Brightness.light, + systemStatusBarContrastEnforced: false, + )); + super.initState(); + } + @override Widget build(BuildContext context) { return AnnotatedRegion( diff --git a/making_school_asignment_app/lib/page/home_page/home_view.dart b/making_school_asignment_app/lib/page/home_page/home_view.dart index bdf4bb7..6d84b40 100644 --- a/making_school_asignment_app/lib/page/home_page/home_view.dart +++ b/making_school_asignment_app/lib/page/home_page/home_view.dart @@ -24,12 +24,9 @@ class HomePage extends StatefulWidget { State createState() => _HomePageState(); } -class _HomePageState extends State - with AutomaticKeepAliveClientMixin { +class _HomePageState extends State with AutomaticKeepAliveClientMixin { final logic = Get.find(); - final state = Get - .find() - .state; + final state = Get.find().state; @override bool get wantKeepAlive => true; @@ -38,7 +35,8 @@ class _HomePageState extends State void initState() { super.initState(); SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( - statusBarIconBrightness: Brightness.dark, + statusBarColor: Colors.transparent, //状态栏背景颜色 + statusBarIconBrightness: Brightness.light, systemStatusBarContrastEnforced: false, )); } @@ -54,19 +52,20 @@ class _HomePageState extends State return EasyRefresh( firstRefresh: false, taskIndependence: true, + enableControlFinishLoad: true, controller: logic.refreshController, header: MaterialHeader(), - footer: TaurusFooter(), + // footer: TaurusFooter(), onRefresh: () async { state.pageNumber = 1; return logic.getList(); }, - onLoad: () async { - if (state.workList.length < state.totalCount.value) { - state.pageNumber++; - return logic.getList(); - } - }, + // onLoad: () async { + // if (state.workList.length < state.totalCount.value) { + // state.pageNumber++; + // return logic.getList(); + // } + // }, child: Stack( children: [ Image.asset( @@ -78,10 +77,7 @@ class _HomePageState extends State margin: EdgeInsets.only(top: 300.h), padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20.r), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30.r), - topRight: Radius.circular(30.r))), + color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(30.r), topRight: Radius.circular(30.r))), child: Column( children: [ SizedBox( @@ -89,10 +85,7 @@ class _HomePageState extends State ), Text( '我的作业管理', - style: TextStyle( - fontSize: 20.sp, - color: const Color(0xFF676666), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 20.sp, color: const Color(0xFF676666), fontWeight: FontWeight.w600), ), SizedBox( height: 15.r, @@ -102,21 +95,19 @@ class _HomePageState extends State Expanded( child: Obx(() { return menuItem( - bgImg: 'assets/images/home_bg_01.png', - name: '作业批阅', - value: state.totalCount.value.toString(), - url: Routes.readOverPage); + bgImg: 'assets/images/home_bg_01.png', + name: '作业批阅', + value: state.totalCount.value.toString(), + url: Routes.readOverPage, + ); }), ), SizedBox( width: 20.r, ), Expanded( - child: menuItem( - bgImg: 'assets/images/home_bg_02.png', - name: '知识点点掌握', - url: Routes.studentHistoryWorkPage, - page: 'points'), + child: + menuItem(bgImg: 'assets/images/home_bg_02.png', name: '知识点点掌握', url: Routes.studentHistoryWorkPage, page: 'points'), ), ], ), @@ -126,20 +117,14 @@ class _HomePageState extends State Row( children: [ Expanded( - child: menuItem( - bgImg: 'assets/images/home_bg_03.png', - name: '学生历史作业', - url: Routes.studentHistoryWorkPage, - page: 'history'), + child: + menuItem(bgImg: 'assets/images/home_bg_03.png', name: '学生历史作业', url: Routes.studentHistoryWorkPage, page: 'history'), ), SizedBox( width: 20.r, ), Expanded( - child: menuItem( - bgImg: 'assets/images/home_bg_04.png', - name: '答题轨迹', - url: Routes.answerTrajectoryPage), + child: menuItem(bgImg: 'assets/images/home_bg_04.png', name: '答题轨迹', url: Routes.answerTrajectoryPage), ), ], ), @@ -149,14 +134,14 @@ class _HomePageState extends State Row( children: [ menuItem( - bgImg: 'assets/images/home_bg_05.png', - name: '优先批阅设定', + bgImg: 'assets/images/home_bg_05.png', + name: '优先批阅设定', url: Routes.studentHistoryWorkPage, - page: 'set',), + page: 'set', + ), SizedBox( width: 20.r, ), - ], ), SizedBox(height: 15.h), @@ -178,20 +163,18 @@ class _HomePageState extends State } } -Widget menuItem({required String bgImg, required String name, String? value,required String url,String? page}) { +Widget menuItem({required String bgImg, required String name, String? value, required String url, String? page}) { return InkWell( - onTap: (){ + onTap: () { Get.toNamed(url, arguments: {'page': page ?? ''}); }, child: Container( width: (Get.width - 60.r) / 2, height: (Get.width - 60.r) / 2 * 86 / 164, - padding: EdgeInsets.symmetric( - vertical: 15.r, horizontal: 15.r), + padding: EdgeInsets.symmetric(vertical: 15.r, horizontal: 15.r), decoration: BoxDecoration( image: DecorationImage( - image: AssetImage( - bgImg), + image: AssetImage(bgImg), fit: BoxFit.contain, ), ), @@ -199,33 +182,26 @@ Widget menuItem({required String bgImg, required String name, String? value,requ crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - crossAxisAlignment: CrossAxisAlignment - .center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( name, - style: TextStyle( - fontSize: 14.sp, - color: const Color(0xFF4F4F4F), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF4F4F4F), fontWeight: FontWeight.w600), ), - if(value != null && value != '') + if (value != null && value != '') Container( width: 18.r, height: 18.r, alignment: Alignment.center, decoration: BoxDecoration( color: const Color(0xFFFF6969), - borderRadius: BorderRadius.all( - Radius.circular(9.r)), + borderRadius: BorderRadius.all(Radius.circular(9.r)), ), child: Text( value!, - style: TextStyle(fontSize: 10.sp, - color: Colors.white, - fontWeight: FontWeight.w600),), + style: TextStyle(fontSize: 10.sp, color: Colors.white, fontWeight: FontWeight.w600), + ), ) ], ), @@ -252,10 +228,7 @@ class EntranceModel extends Object { String navigationUrl; String? page; - EntranceModel({required this.title, - required this.image, - required this.navigationUrl, - this.page}); + EntranceModel({required this.title, required this.image, required this.navigationUrl, this.page}); } @swidget @@ -264,8 +237,7 @@ Widget $termRow(BuildContext context, List items, int? data) { Widget childWidget; switch (leng) { case 1: - childWidget = - Row(children: [Expanded(child: $TermItem(items[0], data!))]); + childWidget = Row(children: [Expanded(child: $TermItem(items[0], data!))]); break; case 2: childWidget = Row(children: [ @@ -300,13 +272,11 @@ Widget $termRow(BuildContext context, List items, int? data) { childWidget = Container(); } - return Container( - padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget); + return Container(padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget); } @swidget -Widget $termItem(BuildContext context, EntranceModel e, int data, - {double? theHeight}) { +Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) { bool isJob = e.title == '作业批阅'; return Material( @@ -335,14 +305,10 @@ Widget $termItem(BuildContext context, EntranceModel e, int data, badgeStyle: badges.BadgeStyle( badgeColor: const Color.fromRGBO(255, 105, 105, 1), shape: badges.BadgeShape.square, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(10.r), - topRight: Radius.circular(8.5.r), - bottomRight: Radius.circular(8.5.r)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.r)), // borderSide: BorderSide(color: Colors.white, width: 2), elevation: 1, - padding: EdgeInsets.symmetric( - horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h), + padding: EdgeInsets.symmetric(horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h), ), position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r), child: Container( @@ -363,29 +329,21 @@ Widget $termItem(BuildContext context, EntranceModel e, int data, alignment: Alignment.center, child: isJob ? Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset(e.image, - height: 32.r, width: 32.r, fit: BoxFit.cover), - SizedBox(height: 6.r), - quickText(e.title, - size: 12.sp, - color: const Color.fromRGBO(79, 79, 79, 1), - fontWeight: FontWeight.w500), - ], - ) + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), + SizedBox(height: 6.r), + quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), + ], + ) : Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset(e.image, - height: 32.r, width: 32.r, fit: BoxFit.cover), - SizedBox(width: 6.r), - quickText(e.title, - size: 12.sp, - color: const Color.fromRGBO(79, 79, 79, 1), - fontWeight: FontWeight.w500), - ], - ), + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), + SizedBox(width: 6.r), + quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), + ], + ), ), )), ); diff --git a/making_school_asignment_app/lib/page/login_page/login_view.dart b/making_school_asignment_app/lib/page/login_page/login_view.dart index b97f160..e921349 100644 --- a/making_school_asignment_app/lib/page/login_page/login_view.dart +++ b/making_school_asignment_app/lib/page/login_page/login_view.dart @@ -25,8 +25,10 @@ class _LoginPageState extends State { @override void initState() { - SystemChrome.setSystemUIOverlayStyle( - const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); + SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( + statusBarIconBrightness: Brightness.light, + statusBarColor: Colors.transparent, //状态栏背景颜色 + )); Future.delayed(Duration.zero, () => upgradeLogic.getAppUpgrade(context)); Future.delayed(Duration.zero, () => sysProtocol(context)); super.initState(); @@ -40,8 +42,6 @@ class _LoginPageState extends State { @override Widget build(BuildContext context) { - SystemChrome.setSystemUIOverlayStyle( - const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); return GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { @@ -62,12 +62,18 @@ class _LoginPageState extends State { children: [ Positioned( top: 0, - left: 0, - child: Image.asset('assets/images/logo_banner.png',width: Get.width,fit: BoxFit.fill,)), + left: 0, + child: Image.asset( + 'assets/images/logo_banner.png', + width: Get.width, + fit: BoxFit.fill, + )), SingleChildScrollView( child: Column( children: [ - SizedBox(height: 130.r,), + SizedBox( + height: 130.r, + ), Container( width: 77.w, height: 77.w, @@ -75,17 +81,15 @@ class _LoginPageState extends State { child: SizedBox( height: 77.w, width: 77.w, - child: Image.asset('assets/images/login_logo_icon.png', - fit: BoxFit.cover), + child: Image.asset('assets/images/login_logo_icon.png', fit: BoxFit.cover), ), ), Container( margin: EdgeInsets.only(top: 90.r), - padding: EdgeInsets.only( - top: 50.h, bottom: 16.h, left: 40.w, right: 40.w), + padding: EdgeInsets.only(top: 50.h, bottom: 16.h, left: 40.w, right: 40.w), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only(topLeft: Radius.circular(30.r),topRight: Radius.circular(30.r)), + color: Colors.white, + borderRadius: BorderRadius.only(topLeft: Radius.circular(30.r), topRight: Radius.circular(30.r)), /*boxShadow: const [ BoxShadow( color: Color.fromRGBO(46, 91, 255, 0.1), @@ -97,13 +101,13 @@ class _LoginPageState extends State { ), child: Column(children: [ Container( - padding: EdgeInsets.symmetric(horizontal: 15.w,), + padding: EdgeInsets.symmetric( + horizontal: 15.w, + ), decoration: BoxDecoration( color: Colors.transparent, - border: Border.all( - width: 1.w, color: const Color(0xFF434343)), - borderRadius: - BorderRadius.all(Radius.circular(17.w)), + border: Border.all(width: 1.w, color: const Color(0xFF434343)), + borderRadius: BorderRadius.all(Radius.circular(17.w)), ), child: TextField( controller: state.userNameController, @@ -127,7 +131,7 @@ class _LoginPageState extends State { // labelText: "账号", labelStyle: TextStyle( fontSize: 14.sp, - color: const Color(0xFF434343), + color: const Color(0xFF434343), ), border: InputBorder.none, isDense: true, @@ -154,10 +158,8 @@ class _LoginPageState extends State { padding: EdgeInsets.symmetric(horizontal: 15.w), decoration: BoxDecoration( color: Colors.transparent, - border: Border.all( - width: 1.w, color: const Color(0xFF434343)), - borderRadius: - BorderRadius.all(Radius.circular(17.w)), + border: Border.all(width: 1.w, color: const Color(0xFF434343)), + borderRadius: BorderRadius.all(Radius.circular(17.w)), ), child: TextField( focusNode: state.pwdFocus, @@ -169,7 +171,7 @@ class _LoginPageState extends State { // textInputAction: state.isShowPwd.value?TextInputAction.go:TextInputAction.next, // onSubmitted: (val) => toLogin(), style: TextStyle( - color: const Color(0xFF434343), + color: const Color(0xFF434343), fontSize: 14.sp, ), decoration: InputDecoration( @@ -192,15 +194,12 @@ class _LoginPageState extends State { ), suffixIcon: InkWell( onTap: () { - state.isShowPwd.value = - !state.isShowPwd.value; + state.isShowPwd.value = !state.isShowPwd.value; }, child: Padding( padding: EdgeInsets.only(right: 5.r), child: Image.asset( - state.isShowPwd.value - ? 'assets/images/eye_default.png' - : 'assets/images/eye_active.png', + state.isShowPwd.value ? 'assets/images/eye_default.png' : 'assets/images/eye_active.png', width: 15.r, height: 15.r, ), @@ -208,7 +207,7 @@ class _LoginPageState extends State { ), hintStyle: TextStyle( fontSize: 14.sp, - color: const Color(0xFF434343), + color: const Color(0xFF434343), ), border: InputBorder.none, // labelText: "密码", @@ -236,34 +235,23 @@ class _LoginPageState extends State { child: Checkbox( // activeColor: Colors.transparent, //去掉勾选时背景颜色 - activeColor: - Theme.of(context).primaryColor, + activeColor: Theme.of(context).primaryColor, // checkColor: Colors.white, value: state.keepPwd.value, onChanged: (value) { // Get.focusScope?.nextFocus(); - FocusScope.of(context) - .requestFocus(state.pwdFocus); - FocusScope.of(context) - .requestFocus(state.theFocus); - state.keepPwd.value = - value ?? false; + FocusScope.of(context).requestFocus(state.pwdFocus); + FocusScope.of(context).requestFocus(state.theFocus); + state.keepPwd.value = value ?? false; }, - side: WidgetStateBorderSide - .resolveWith( + side: WidgetStateBorderSide.resolveWith( (Set states) { - if (states.contains( - WidgetState.selected)) { + if (states.contains(WidgetState.selected)) { //修改勾选时边框颜色为红色 - return BorderSide( - width: 1.5.r, - color: Theme.of(context) - .primaryColor); + return BorderSide(width: 1.5.r, color: Theme.of(context).primaryColor); } //修改默认时边框颜色为绿色 - return BorderSide( - width: 1.r, - color: const Color(0xFF434343)); + return BorderSide(width: 1.r, color: const Color(0xFF434343)); }, )), ); @@ -274,18 +262,15 @@ class _LoginPageState extends State { Utils.hideKeyboard(); Get.focusScope?.nextFocus(); Get.focusScope?.nextFocus(); - FocusScope.of(context) - .requestFocus(state.pwdFocus); - FocusScope.of(context) - .requestFocus(state.theFocus); - state.keepPwd.value = - !state.keepPwd.value; + FocusScope.of(context).requestFocus(state.pwdFocus); + FocusScope.of(context).requestFocus(state.theFocus); + state.keepPwd.value = !state.keepPwd.value; }, child: Text( '记住密码', style: TextStyle( fontSize: 12.sp, - color:const Color(0xFF434343), + color: const Color(0xFF434343), ), ), ), @@ -307,9 +292,7 @@ class _LoginPageState extends State { return Container( margin: EdgeInsets.symmetric(vertical: 10.h), decoration: BoxDecoration( - color: state.canLogin.value - ? const Color(0xFF8C68FF) - : const Color(0xFFdddddd), + color: state.canLogin.value ? const Color(0xFF8C68FF) : const Color(0xFFdddddd), /*boxShadow: [ BoxShadow( color: @@ -326,9 +309,7 @@ class _LoginPageState extends State { alignment: Alignment.center, width: double.infinity, height: 50.h, - child: Text('登 录', - style: TextStyle( - fontSize: 16.sp, color: Colors.white)), + child: Text('登 录', style: TextStyle(fontSize: 16.sp, color: Colors.white)), ); }), ), @@ -350,22 +331,16 @@ class _LoginPageState extends State { state.pwdFocus); FocusScope.of(context).requestFocus( state.theFocus);*/ - state.readAgreement.value = - value ?? false; + state.readAgreement.value = value ?? false; }, side: WidgetStateBorderSide.resolveWith( (Set states) { - if (states - .contains(WidgetState.selected)) { + if (states.contains(WidgetState.selected)) { //修改勾选时边框颜色为红色 - return BorderSide( - width: 1.5.r, - color: Theme.of(context) - .primaryColor); + return BorderSide(width: 1.5.r, color: Theme.of(context).primaryColor); } //修改默认时边框颜色为绿色 - return BorderSide( - width: 1.r, color: const Color(0xFF434343)); + return BorderSide(width: 1.r, color: const Color(0xFF434343)); }, ), ), @@ -374,9 +349,7 @@ class _LoginPageState extends State { ), InkWell( onTap: () { - Get.toNamed(Routes.agreementPage, arguments: { - "type": AGREEMENT_KEY.USER_AGREEMENT.name - }); + Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name}); }, child: quickText( '请仔细阅读', @@ -385,15 +358,11 @@ class _LoginPageState extends State { ), InkWell( onTap: () { - Get.toNamed(Routes.agreementPage, arguments: { - "type": AGREEMENT_KEY.USER_AGREEMENT.name - }); + Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name}); }, child: Text( '《用户协议》', - style: TextStyle( - fontSize: 12.r, - color: Theme.of(context).primaryColor), + style: TextStyle(fontSize: 12.r, color: Theme.of(context).primaryColor), ), ), ], diff --git a/making_school_asignment_app/lib/page/work_page/work_view.dart b/making_school_asignment_app/lib/page/work_page/work_view.dart index e0d343c..b218492 100644 --- a/making_school_asignment_app/lib/page/work_page/work_view.dart +++ b/making_school_asignment_app/lib/page/work_page/work_view.dart @@ -37,10 +37,6 @@ class _WorkPageState extends State with AutomaticKeepAliveClientMixin Widget build(BuildContext context) { super.build(context); - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( - statusBarIconBrightness: Brightness.dark, - systemStatusBarContrastEnforced: false, - )); return Scaffold( backgroundColor: const Color.fromRGBO(244, 244, 244, 1), body: OrientationBuilder( diff --git a/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift b/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift index 288265e..043340e 100644 --- a/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,6 +7,7 @@ import Foundation import auto_updater_macos import connectivity_plus +import device_info_plus import package_info_plus import path_provider_foundation import sqflite @@ -15,6 +16,7 @@ import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AutoUpdaterMacosPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterMacosPlugin")) ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/making_school_asignment_app/pubspec.yaml b/making_school_asignment_app/pubspec.yaml index 9f7f387..6a329f1 100644 --- a/making_school_asignment_app/pubspec.yaml +++ b/making_school_asignment_app/pubspec.yaml @@ -96,6 +96,8 @@ dependencies: flutter_native_splash: ^2.4.1 icons_launcher: ^2.1.7 app_settings: ^5.1.1 + device_info_plus: ^11.1.0 + dev_dependencies: diff --git a/making_school_asignment_app/web/index.html b/making_school_asignment_app/web/index.html index 81ed884..4e88d38 100644 --- a/making_school_asignment_app/web/index.html +++ b/making_school_asignment_app/web/index.html @@ -167,6 +167,20 @@ + + + + + + + + + + + + + + @@ -190,7 +204,7 @@ body { margin: 0; min-height: 100%; - background-color: #eeeeee; + background-color: #FFFFFF; background-size: 100% 100%; }