From 6bed1fdb37d47bb98d8b5279922e736ed439df7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B1=8C=E6=9D=82?= <1147192855@qq.com> Date: Tue, 3 Sep 2024 13:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/page/home_page/children/my_info.dart | 85 +++++++++----- .../login_page/children/sys_protocol.dart | 57 +++++++--- .../lib/page/login_page/login_view.dart | 107 ++++++++++++------ 3 files changed, 171 insertions(+), 78 deletions(-) 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 714ba66..01fbeb5 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 @@ -26,27 +26,31 @@ 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(); - var msg = await StorageService.to.erase(); - print(msg); - 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); + } + }) + ]); }); } @@ -66,7 +70,8 @@ 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( @@ -123,7 +128,8 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { margin: EdgeInsets.only(top: 0.h), child: Text( userInfo.value?.name ?? '请前往登录', - style: TextStyle(fontSize: 13.sp, color: Colors.white), + style: TextStyle( + fontSize: 13.sp, color: Colors.white), ), ), ), @@ -138,8 +144,10 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ), SizedBox(height: 14.h), Container( - margin: EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w), - padding: EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w), + margin: + EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w), + padding: + EdgeInsets.symmetric(vertical: 22.h, horizontal: 16.w), height: 180.h, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.w)), @@ -158,7 +166,11 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { children: [ 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( height: 1.w, @@ -166,7 +178,11 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Text('所在学校', style: personalInfoTitleStly), Text(userInfo.value?.schoolName ?? '', style: personalInfoValStly)], + children: [ + Text('所在学校', style: personalInfoTitleStly), + Text(userInfo.value?.schoolName ?? '', + style: personalInfoValStly) + ], ), /* Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -200,7 +216,9 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { ) ], ),*/ - Container(height: 1.w, color: const Color.fromRGBO(240, 243, 255, 1)), + Container( + height: 1.w, + color: const Color.fromRGBO(240, 243, 255, 1)), Padding( padding: EdgeInsets.only(top: 10.h), child: InkWell( @@ -241,7 +259,8 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { color: Colors.white, boxShadow: [ BoxShadow( - color: const Color.fromRGBO(46, 91, 255, 0.2), + color: + const Color.fromRGBO(46, 91, 255, 0.2), offset: Offset(2.w, 2.h), //阴影y轴偏移量 blurRadius: 14, //阴影模糊程度 spreadRadius: 0.5, //阴影扩散程度 @@ -255,14 +274,18 @@ class _MyInfoState extends State with AutomaticKeepAliveClientMixin { Icon( Icons.exit_to_app_outlined, size: 13.sp, - color: const Color.fromRGBO(148, 163, 182, 1), + color: + const Color.fromRGBO(148, 163, 182, 1), ), Container( width: 6.w, ), Text( '退出登录', - style: TextStyle(color: const Color.fromRGBO(148, 163, 182, 1), fontSize: 13.sp), + style: TextStyle( + color: const Color.fromRGBO( + 148, 163, 182, 1), + fontSize: 13.sp), ), ], ), diff --git a/making_school_asignment_app/lib/page/login_page/children/sys_protocol.dart b/making_school_asignment_app/lib/page/login_page/children/sys_protocol.dart index 8602e9f..e79b358 100644 --- a/making_school_asignment_app/lib/page/login_page/children/sys_protocol.dart +++ b/making_school_asignment_app/lib/page/login_page/children/sys_protocol.dart @@ -27,7 +27,10 @@ class Protocol extends Dialog { ), child: Column( children: [ - quickText('用户协议与隐私政策', size: 15.sp, color: const Color.fromRGBO(37, 37, 37, 1), fontWeight: FontWeight.bold), + quickText('用户协议与隐私政策', + size: 15.sp, + color: const Color.fromRGBO(37, 37, 37, 1), + fontWeight: FontWeight.bold), Expanded( child: ListView( physics: const BouncingScrollPhysics(), @@ -35,15 +38,22 @@ class Protocol extends Dialog { children: [ Text.rich(TextSpan(children: [ TextSpan( - text: '感谢您选择点智学APP ! 我们非常重视您的个人信息和隐私保护。为了更好地保障您的个人权益,在您使用我们的产品前,请务必审慎阅读', - style: TextStyle(fontSize: 13.sp, color: Color.fromRGBO(51, 51, 51, 1)), + text: + '感谢您选择点智学APP ! 我们非常重视您的个人信息和隐私保护。为了更好地保障您的个人权益,在您使用我们的产品前,请务必审慎阅读', + style: TextStyle( + fontSize: 13.sp, + color: const Color.fromRGBO(51, 51, 51, 1)), ), TextSpan( text: '《隐私政策》', - style: TextStyle(fontSize: 13.sp, color: Color.fromRGBO(233, 85, 119, 1)), + style: TextStyle( + fontSize: 13.sp, + color: Theme.of(context).primaryColor), recognizer: TapGestureRecognizer() ..onTap = () async { - Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.PRIVACY_GREEMENT.name}); + Get.toNamed(Routes.agreementPage, arguments: { + "type": AGREEMENT_KEY.PRIVACY_GREEMENT.name + }); // RouterManager.router.navigateTo( // context, // '${RouterManager.agreementPath}?type=${AGREEMENT_KEY.PRIVACY_GREEMENT.name}', @@ -53,14 +63,20 @@ class Protocol extends Dialog { ), TextSpan( text: '和', - style: TextStyle(fontSize: 13.sp, color: Color.fromRGBO(51, 51, 51, 1)), + style: TextStyle( + fontSize: 13.sp, + color: Color.fromRGBO(51, 51, 51, 1)), ), TextSpan( text: '《用户协议》', - style: TextStyle(fontSize: 13.sp, color: Color.fromRGBO(233, 85, 119, 1)), + style: TextStyle( + fontSize: 13.sp, + color: Theme.of(context).primaryColor), recognizer: TapGestureRecognizer() ..onTap = () async { - Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name}); + Get.toNamed(Routes.agreementPage, arguments: { + "type": AGREEMENT_KEY.USER_AGREEMENT.name + }); // RouterManager.router.navigateTo( // context, // '${RouterManager.agreementPath}?type=${AGREEMENT_KEY.USER_AGREEMENT.name}', @@ -71,7 +87,9 @@ class Protocol extends Dialog { TextSpan( text: '内的所有条款,尤其是:1.我们对您的个人信息的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;2.约定我们的限制责任、免责条款;3.其他以颜色或加粗进行标识的重要条款。如您对以上协议有任何疑问,可通过发邮件至yuanxuanjiaoyu@gmail.com与我们联系。您点击"同意并继续”的行为即表示您已阅读完毕并同意以上协议的全部内容。如您同意以上协议内容,请点击"同意并继续”,开始使用我们的产品和服务!', - style: TextStyle(fontSize: 13.sp, color: const Color.fromRGBO(51, 51, 51, 1)), + style: TextStyle( + fontSize: 13.sp, + color: const Color.fromRGBO(51, 51, 51, 1)), ), ])), ], @@ -90,8 +108,12 @@ class Protocol extends Dialog { padding: EdgeInsets.only(top: 15.h), decoration: BoxDecoration( border: Border( - top: BorderSide(width: 0.5.r, color: const Color.fromRGBO(238, 238, 238, 1)), - right: BorderSide(width: 0.5.r, color: const Color.fromRGBO(238, 238, 238, 1)), + top: BorderSide( + width: 0.5.r, + color: const Color.fromRGBO(238, 238, 238, 1)), + right: BorderSide( + width: 0.5.r, + color: const Color.fromRGBO(238, 238, 238, 1)), ), ), child: quickText('退出APP', size: 14.sp), @@ -101,7 +123,8 @@ class Protocol extends Dialog { Expanded( child: InkWell( onTap: () { - StorageService.to.write(AppStorageKey.privacyAgreement.value, true); + StorageService.to + .write(AppStorageKey.privacyAgreement.value, true); Navigator.of(context).pop(true); }, child: Container( @@ -109,10 +132,13 @@ class Protocol extends Dialog { padding: EdgeInsets.only(top: 15.h), decoration: BoxDecoration( border: Border( - top: BorderSide(width: 0.5.r, color: Color.fromRGBO(238, 238, 238, 1)), + top: BorderSide( + width: 0.5.r, + color: const Color.fromRGBO(238, 238, 238, 1)), ), ), - child: quickText('同意并继续', color: Color.fromRGBO(206, 97, 126, 1), size: 14.sp), + child: quickText('同意并继续', + color: Theme.of(context).primaryColor, size: 14.sp), ), ), ) @@ -127,7 +153,8 @@ class Protocol extends Dialog { /// 系统协议 Future sysProtocol(BuildContext context) async { - bool? sysProtocol = StorageService.to.hasData(AppStorageKey.privacyAgreement.value); + bool? sysProtocol = + StorageService.to.hasData(AppStorageKey.privacyAgreement.value); if (!sysProtocol) { return showDialog( 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 b31f904..9206e0a 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,7 +25,8 @@ class _LoginPageState extends State { @override void initState() { - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); + SystemChrome.setSystemUIOverlayStyle( + const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); Future.delayed(Duration.zero, () => upgradeLogic.getAppUpgrade(context)); Future.delayed(Duration.zero, () => sysProtocol(context)); super.initState(); @@ -39,7 +40,8 @@ class _LoginPageState extends State { @override Widget build(BuildContext context) { - SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); + SystemChrome.setSystemUIOverlayStyle( + const SystemUiOverlayStyle(statusBarIconBrightness: Brightness.light)); return GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { @@ -76,12 +78,15 @@ class _LoginPageState extends State { child: SizedBox( height: 86.w, width: 86.w, - child: Image.asset('assets/images/login_logo.png', fit: BoxFit.cover), + child: Image.asset('assets/images/login_logo.png', + fit: BoxFit.cover), ), ), Container( - margin: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.h), - padding: EdgeInsets.only(top: 34.h, bottom: 16.h, left: 22.w, right: 22.w), + margin: EdgeInsets.symmetric( + horizontal: 32.w, vertical: 24.h), + padding: EdgeInsets.only( + top: 34.h, bottom: 16.h, left: 22.w, right: 22.w), color: Colors.transparent, /* decoration: BoxDecoration( color: Colors.transparent, @@ -101,8 +106,10 @@ class _LoginPageState extends State { padding: EdgeInsets.symmetric(horizontal: 20.h), decoration: BoxDecoration( color: Colors.transparent, - border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)), - borderRadius: BorderRadius.all(Radius.circular(17.w)), + border: Border.all( + width: 1.w, color: const Color(0xFFFFFFFF)), + borderRadius: + BorderRadius.all(Radius.circular(17.w)), ), child: TextField( controller: state.userNameController, @@ -153,8 +160,10 @@ class _LoginPageState extends State { padding: EdgeInsets.symmetric(horizontal: 20.h), decoration: BoxDecoration( color: Colors.transparent, - border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)), - borderRadius: BorderRadius.all(Radius.circular(17.w)), + border: Border.all( + width: 1.w, color: const Color(0xFFFFFFFF)), + borderRadius: + BorderRadius.all(Radius.circular(17.w)), ), child: TextField( focusNode: state.pwdFocus, @@ -189,12 +198,15 @@ 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, ), @@ -230,23 +242,34 @@ 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.5.r, color: Colors.white); + return BorderSide( + width: 1.5.r, + color: Colors.white); }, )), ); @@ -257,9 +280,12 @@ 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( '记住密码', @@ -287,10 +313,13 @@ class _LoginPageState extends State { return Container( margin: EdgeInsets.symmetric(vertical: 10.h), decoration: BoxDecoration( - color: state.canLogin.value ? const Color(0xFF4CC793) : const Color(0xFFdddddd), + color: state.canLogin.value + ? const Color(0xFF4CC793) + : const Color(0xFFdddddd), boxShadow: [ BoxShadow( - color: const Color.fromRGBO(76, 199, 147, 0.5), + color: + const Color.fromRGBO(76, 199, 147, 0.5), offset: Offset(6.w, 10.h), //阴影y轴偏移量 blurRadius: 14, //阴影模糊程度 spreadRadius: 0.5, //阴影扩散程度 @@ -303,7 +332,9 @@ 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)), ); }), ), @@ -325,16 +356,22 @@ 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.5.r, color: Colors.white); + return BorderSide( + width: 1.5.r, color: Colors.white); }, ), ), @@ -343,7 +380,9 @@ 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( '请仔细阅读', @@ -352,11 +391,15 @@ 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: Colors.deepOrangeAccent), + style: TextStyle( + fontSize: 12.r, + color: Theme.of(context).primaryColor), ), ), ],