From 560a823ae27f910a3b42fed5144670d40ac044f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Fri, 12 Dec 2025 15:53:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=9D=92=E5=B0=91=E5=B9=B4?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=BA=A4=E4=BA=92=EF=BC=8C=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E6=B3=A8=E9=94=80=E8=B4=A6=E5=8F=B7=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/global.dart | 2 + .../mine/deactivate_controller.dart | 27 ++ .../mine/teenager_mode_controller.dart | 12 + .../mine/teenager_mode_open_controller.dart | 55 ++++ lib/main.dart | 2 + lib/pages/setting/deactivate_page.dart | 261 +++++++++++------- lib/pages/setting/setting_page.dart | 10 + .../setting/teenager_mode_open_page.dart | 139 ++++++---- lib/pages/setting/teenager_mode_page.dart | 232 +++++++++------- 9 files changed, 482 insertions(+), 258 deletions(-) create mode 100644 lib/controller/mine/deactivate_controller.dart create mode 100644 lib/controller/mine/teenager_mode_controller.dart create mode 100644 lib/controller/mine/teenager_mode_open_controller.dart diff --git a/lib/controller/global.dart b/lib/controller/global.dart index 727e706..046dc0c 100644 --- a/lib/controller/global.dart +++ b/lib/controller/global.dart @@ -17,6 +17,8 @@ class GlobalData { bool isLogout = false;//是否已经退出登录 + bool teenagerMode = false; //青少年模式 + void logout() { isLogout = true; userId = null; diff --git a/lib/controller/mine/deactivate_controller.dart b/lib/controller/mine/deactivate_controller.dart new file mode 100644 index 0000000..e5b3142 --- /dev/null +++ b/lib/controller/mine/deactivate_controller.dart @@ -0,0 +1,27 @@ +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/controller/message/conversation_controller.dart'; +import 'package:dating_touchme_app/im/im_manager.dart'; +import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; + +class DeactivateController extends GetxController { + + + final storage = GetStorage(); + + final s = "".obs; + + void logout() async { + // 先退出 IM 登录 + await IMManager.instance.logout(); + // 清除会话列表和用户信息缓存 + if (Get.isRegistered()) { + final conversationController = Get.find(); + conversationController.clearConversations(); + } + // 清除本地存储 + storage.erase(); + // 清除全局数据 + GlobalData().logout(); + } +} \ No newline at end of file diff --git a/lib/controller/mine/teenager_mode_controller.dart b/lib/controller/mine/teenager_mode_controller.dart new file mode 100644 index 0000000..941ec17 --- /dev/null +++ b/lib/controller/mine/teenager_mode_controller.dart @@ -0,0 +1,12 @@ +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:get/get.dart'; + +class TeenagerModeController extends GetxController { + final teenageMode = false.obs; + + @override + void onInit() { + super.onInit(); + teenageMode.value = GlobalData().teenagerMode; + } +} \ No newline at end of file diff --git a/lib/controller/mine/teenager_mode_open_controller.dart b/lib/controller/mine/teenager_mode_open_controller.dart new file mode 100644 index 0000000..9edebbb --- /dev/null +++ b/lib/controller/mine/teenager_mode_open_controller.dart @@ -0,0 +1,55 @@ +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; + +class TeenagerModeOpenController extends GetxController { + final password = "".obs; + final confirmPassword = "".obs; + final nowPassword = "".obs; + final passwordController = TextEditingController().obs; + final teenageMode = false.obs; + + final storage = GetStorage(); + + @override + void onInit() { + super.onInit(); + nowPassword.value = storage.read('teenagerPassword') ?? ""; + teenageMode.value = GlobalData().teenagerMode; + } + + openTeenagerMode() async { + if(password.value != confirmPassword.value){ + SmartDialog.showToast('密码不一致,请重新输入'); + password.value = ""; + confirmPassword.value = ""; + passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); + } else { + GlobalData().teenagerMode = true; + await storage.write('teenagerMode', true); + await storage.write('teenagerPassword', confirmPassword.value); + Get.back(); + } + } + + closeTeenagerMode() async { + if(password.value != nowPassword.value){ + SmartDialog.showToast('密码错误,请重新输入'); + password.value = ""; + passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); + } else { + GlobalData().teenagerMode = false; + await storage.write('teenagerMode', false); + await storage.write('teenagerPassword', ""); + Get.back(); + } + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index e67b7e7..8cb1fb8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -137,10 +137,12 @@ class _MyAppState extends State { // 判断token是否为空 final storage = GetStorage(); final userId = storage.read('userId'); + final teenagerMode = storage.read('teenagerMode') ?? false; // 如果token不为空,显示主页;如果token为空,显示登录页面 if (userId != null && userId.isNotEmpty) { GlobalData().userId = userId; + GlobalData().teenagerMode = teenagerMode; return MainPage(); } else { return LoginPage(); diff --git a/lib/pages/setting/deactivate_page.dart b/lib/pages/setting/deactivate_page.dart index 9f70839..7e470cc 100644 --- a/lib/pages/setting/deactivate_page.dart +++ b/lib/pages/setting/deactivate_page.dart @@ -1,119 +1,184 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/mine/deactivate_controller.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; +import 'package:dating_touchme_app/pages/mine/login_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:tdesign_flutter/tdesign_flutter.dart'; class DeactivatePage extends StatelessWidget { const DeactivatePage({super.key}); @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: ""), - body: Container( - padding: EdgeInsets.symmetric( - vertical: 52.w, - horizontal: 15.w - ), - child: Column( - children: [ - Text( - "账号注销安全提示", - style: TextStyle( - fontSize: 16.w, - fontWeight: FontWeight.w700 - ), + return GetX( + init: DeactivateController(), + builder: (controller){ + return Scaffold( + appBar: PageAppbar(title: "${controller.s.value}"), + body: Container( + padding: EdgeInsets.symmetric( + vertical: 52.w, + horizontal: 15.w ), - SizedBox(height: 35.w,), - Text( - "申请注销趣恋恋账号前,趣恋恋将进行以下验证,以保证你的账号安全、财产安全。", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500, - color: const Color.fromRGBO(144, 144, 144, 1) - ), - ), - SizedBox(height: 15.w,), - Container( - height: 104.w, - padding: EdgeInsets.symmetric( - vertical: 20.w, - horizontal: 17.w - ), - decoration: BoxDecoration( - color: const Color.fromRGBO(245, 245, 245, 1), - borderRadius: BorderRadius.all(Radius.circular(8.w)) - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - Assets.imagesSuccessIcon, - width: 15.w, - ), - SizedBox(width: 9.w,), - Text( - "账号处于安全状态", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(41, 186, 63, 1) - ), - ) - ], + child: Column( + children: [ + Text( + "账号注销安全提示", + style: TextStyle( + fontSize: 16.w, + fontWeight: FontWeight.w700 + ), + ), + SizedBox(height: 35.w,), + Text( + "申请注销趣恋恋账号前,趣恋恋将进行以下验证,以保证你的账号安全、财产安全。", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + SizedBox(height: 15.w,), + Container( + height: 104.w, + padding: EdgeInsets.symmetric( + vertical: 20.w, + horizontal: 17.w + ), + decoration: BoxDecoration( + color: const Color.fromRGBO(245, 245, 245, 1), + borderRadius: BorderRadius.all(Radius.circular(8.w)) ), - Row( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset( - Assets.imagesErrorIcon, - width: 15.w, + Row( + children: [ + Image.asset( + Assets.imagesSuccessIcon, + width: 15.w, + ), + SizedBox(width: 9.w,), + Text( + "账号处于安全状态", + style: TextStyle( + fontSize: 13.w, + color: const Color.fromRGBO(41, 186, 63, 1) + ), + ) + ], + ), + Row( + children: [ + Image.asset( + Assets.imagesErrorIcon, + width: 15.w, + ), + SizedBox(width: 9.w,), + Text( + "钱包余额未结清", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500 + ), + ) + ], ), - SizedBox(width: 9.w,), - Text( - "钱包余额未结清", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 - ), - ) ], ), - ], - ), - ), - Spacer(), - Container( - width: 350.w, - height: 45.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(45.w)), - gradient: LinearGradient( - begin: Alignment.centerLeft, // 90deg: 从左到右 - end: Alignment.centerRight, - colors: [ - Color.fromRGBO(131, 89, 255, 1), // 起点颜色 - Color.fromRGBO(77, 127, 231, 1), // 中间颜色 - Color.fromRGBO(61, 138, 224, 1), // 终点颜色 - ], - stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% ), - ), - child: Center( - child: Text( - "提交注销申请", - style: TextStyle( - fontSize: 18.w, - color: Colors.white, - fontWeight: FontWeight.w500 + Spacer(), + Container( + width: 350.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + ), ), - ), - ), - ) - ], - ), - ), + child: Center( + child: Text( + "提交注销申请", + style: TextStyle( + fontSize: 18.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ).onTap((){ + showGeneralDialog( + context: context, + pageBuilder: (BuildContext buildContext, Animation< + double> animation, + Animation secondaryAnimation) { + return TDAlertDialog( + title: '是否退出当前账号?', + buttonWidget: Container( + padding: EdgeInsetsGeometry.only(top: 16.w, + right: 30.w, + left: 30.w, + bottom: 32.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TDButton( + text: '取 消', + width: 120, + size: TDButtonSize.large, + type: TDButtonType.fill, + shape: TDButtonShape.round, + theme: TDButtonTheme.defaultTheme, + onTap: () { + Navigator.of(context).pop(); + }, + ), + TDButton( + text: '确 定', + width: 120, + size: TDButtonSize.large, + type: TDButtonType.fill, + shape: TDButtonShape.round, + theme: TDButtonTheme.danger, + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + ), + onTap: () { + controller.logout(); + Get.offAll(() => LoginPage()); + }, + ), + ], + ), + ) + ); + }, + ); + }) + ], + ), + ), + ); + }, ); } } diff --git a/lib/pages/setting/setting_page.dart b/lib/pages/setting/setting_page.dart index b996f87..b14e2d5 100644 --- a/lib/pages/setting/setting_page.dart +++ b/lib/pages/setting/setting_page.dart @@ -121,6 +121,16 @@ class SettingPage extends StatelessWidget { type: TDButtonType.fill, shape: TDButtonShape.round, theme: TDButtonTheme.danger, + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + ), onTap: () { controller.logout(); Get.offAll(() => LoginPage()); diff --git a/lib/pages/setting/teenager_mode_open_page.dart b/lib/pages/setting/teenager_mode_open_page.dart index ea8006b..587794d 100644 --- a/lib/pages/setting/teenager_mode_open_page.dart +++ b/lib/pages/setting/teenager_mode_open_page.dart @@ -1,4 +1,5 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/mine/teenager_mode_open_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -11,63 +12,95 @@ class TeenagerModeOpenPage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "开启未成年人模式"), - body: Container( - width: 375.w, - padding: EdgeInsets.only(top: 140.w), - child: Column( - children: [ - Text( - "设置密码", - style: TextStyle( - fontSize: 21.w, - fontWeight: FontWeight.w500 - ), - ), - SizedBox(height: 25.w,), - Pinput( - inputFormatters: [ - // 只允许 0-9 - FilteringTextInputFormatter.digitsOnly, - ], - onCompleted: (pin) => print(pin), - ), - Container( - margin: EdgeInsets.only(top: 60.w), - child: Container( - width: 350.w, - height: 45.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(45.w)), - gradient: LinearGradient( - begin: Alignment.centerLeft, // 90deg: 从左到右 - end: Alignment.centerRight, - colors: [ - Color.fromRGBO(131, 89, 255, 1), // 起点颜色 - Color.fromRGBO(77, 127, 231, 1), // 中间颜色 - Color.fromRGBO(61, 138, 224, 1), // 终点颜色 - ], - stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + return GetX( + init: TeenagerModeOpenController(), + builder: (controller) { + return Scaffold( + appBar: PageAppbar(title: controller.teenageMode.value ? "关闭未成年人模式" : "开启未成年人模式"), + body: Container( + width: 375.w, + padding: EdgeInsets.only(top: 140.w), + child: Column( + children: [ + if(controller.teenageMode.value) Text( + "输入当前密码", + style: TextStyle( + fontSize: 21.w, + fontWeight: FontWeight.w500 ), ), - child: Center( - child: Text( - "下一步", - style: TextStyle( - fontSize: 18.w, - color: Colors.white, - fontWeight: FontWeight.w500 - ), + if(!controller.teenageMode.value) Text( + controller.password.value == "" ? "设置密码" : "确认密码", + style: TextStyle( + fontSize: 21.w, + fontWeight: FontWeight.w500 ), ), - ).onTap((){ - Get.to(() => TeenagerModeOpenPage()); - }), - ) - ], - ), - ), + SizedBox(height: 25.w,), + Pinput( + controller: controller.passwordController.value, + inputFormatters: [ + // 只允许 0-9 + FilteringTextInputFormatter.digitsOnly, + ], + onCompleted: (pin) { + print(pin); + if(!controller.teenageMode.value){ + if(controller.password.value == ""){ + controller.password.value = pin; + controller.passwordController.value.value = TextEditingValue( + text: "", + selection: TextSelection.fromPosition(TextPosition(offset: 0)), + ); + } else { + controller.confirmPassword.value = pin; + } + } else { + controller.password.value = pin; + } + }, + ), + Container( + margin: EdgeInsets.only(top: 60.w), + child: Container( + width: 350.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% + ), + ), + child: Center( + child: Text( + controller.teenageMode.value ? "立即验证" : "下一步", + style: TextStyle( + fontSize: 18.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ).onTap((){ + if(!controller.teenageMode.value){ + controller.openTeenagerMode(); + } else { + controller.closeTeenagerMode(); + } + }), + ) + ], + ), + ), + ); + }, ); } } diff --git a/lib/pages/setting/teenager_mode_page.dart b/lib/pages/setting/teenager_mode_page.dart index 158a9bb..9aeb979 100644 --- a/lib/pages/setting/teenager_mode_page.dart +++ b/lib/pages/setting/teenager_mode_page.dart @@ -1,4 +1,6 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/controller/mine/teenager_mode_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/pages/setting/teenager_mode_open_page.dart'; @@ -11,121 +13,137 @@ class TeenagerModePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "", backgroundColor: const Color.fromRGBO(242, 241, 246, 1),), - backgroundColor: const Color.fromRGBO(242, 241, 246, 1), - body: Container( - width: 375.w, - padding: EdgeInsets.only( - top: 10.w - ), - child: Column( - children: [ - Image.asset( - Assets.imagesTeenagerBg, - width: 203.w, - height: 203.w, + return GetX( + init: TeenagerModeController(), + builder: (controller) { + return Scaffold( + appBar: PageAppbar(title: "", backgroundColor: const Color.fromRGBO(242, 241, 246, 1),), + backgroundColor: const Color.fromRGBO(242, 241, 246, 1), + body: Container( + width: 375.w, + padding: EdgeInsets.only( + top: 10.w ), - Text( - "未成年人模式未开启", - style: TextStyle( - fontSize: 21.w, - fontWeight: FontWeight.w500 - ), - ), - SizedBox(height: 25.w,), - Container( - padding: EdgeInsets.symmetric( - horizontal: 50.w - ), - child: Column( - children: [ - Row( - children: [ - Image.asset( - Assets.imagesTeenagerList, - width: 11.w, - ), - SizedBox(width: 6.w,), - Text( - "青少年模式中,无法进行充值、购买等操作", - style: TextStyle( - fontSize: 13.w - ), - ) - ], + child: Column( + children: [ + Image.asset( + Assets.imagesTeenagerBg, + width: 203.w, + height: 203.w, + ), + Text( + controller.teenageMode.value ? "未成年人模式已开启" : "未成年人模式未开启", + style: TextStyle( + fontSize: 21.w, + fontWeight: FontWeight.w500 ), - SizedBox(height: 14.w,), - Row( - children: [ - Image.asset( - Assets.imagesTeenagerList, - width: 11.w, - ), - SizedBox(width: 6.w,), - Text( - "无法进行连麦、直播等操作", - style: TextStyle( - fontSize: 13.w + ), + if(controller.teenageMode.value) Text( + "开启状态下,无法查看内容", + style: TextStyle( + fontSize: 13.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + if(!controller.teenageMode.value) ...[ + SizedBox(height: 25.w,), + Container( + padding: EdgeInsets.symmetric( + horizontal: 50.w + ), + child: Column( + children: [ + Row( + children: [ + Image.asset( + Assets.imagesTeenagerList, + width: 11.w, + ), + SizedBox(width: 6.w,), + Text( + "青少年模式中,无法进行充值、购买等操作", + style: TextStyle( + fontSize: 13.w + ), + ) + ], + ), + SizedBox(height: 14.w,), + Row( + children: [ + Image.asset( + Assets.imagesTeenagerList, + width: 11.w, + ), + SizedBox(width: 6.w,), + Text( + "无法进行连麦、直播等操作", + style: TextStyle( + fontSize: 13.w + ), + ) + ], + ), + SizedBox(height: 14.w,), + Row( + children: [ + Image.asset( + Assets.imagesTeenagerList, + width: 11.w, + ), + SizedBox(width: 6.w,), + Text( + "无法使用推荐发消息等功能", + style: TextStyle( + fontSize: 13.w + ), + ) + ], ), - ) - ], + ], + ), ), - SizedBox(height: 14.w,), - Row( - children: [ - Image.asset( - Assets.imagesTeenagerList, - width: 11.w, + ], + Spacer(), + Container( + margin: EdgeInsets.only(bottom: 30.w), + child: Container( + width: 350.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + gradient: LinearGradient( + begin: Alignment.centerLeft, // 90deg: 从左到右 + end: Alignment.centerRight, + colors: [ + Color.fromRGBO(131, 89, 255, 1), // 起点颜色 + Color.fromRGBO(77, 127, 231, 1), // 中间颜色 + Color.fromRGBO(61, 138, 224, 1), // 终点颜色 + ], + stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% ), - SizedBox(width: 6.w,), - Text( - "无法使用推荐发消息等功能", + ), + child: Center( + child: Text( + controller.teenageMode.value ? "关闭未成年人模式" : "开启未成年人模式", style: TextStyle( - fontSize: 13.w + fontSize: 18.w, + color: Colors.white, + fontWeight: FontWeight.w500 ), - ) - ], - ), - ], - ), - ), - Spacer(), - Container( - margin: EdgeInsets.only(bottom: 30.w), - child: Container( - width: 350.w, - height: 45.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(45.w)), - gradient: LinearGradient( - begin: Alignment.centerLeft, // 90deg: 从左到右 - end: Alignment.centerRight, - colors: [ - Color.fromRGBO(131, 89, 255, 1), // 起点颜色 - Color.fromRGBO(77, 127, 231, 1), // 中间颜色 - Color.fromRGBO(61, 138, 224, 1), // 终点颜色 - ], - stops: [0.0, 0.7753, 1.0], // 对应 0%、77.53%、100% - ), - ), - child: Center( - child: Text( - "开启未成年人模式", - style: TextStyle( - fontSize: 18.w, - color: Colors.white, - fontWeight: FontWeight.w500 + ), ), - ), - ), - ).onTap((){ - Get.to(() => TeenagerModeOpenPage()); - }), - ) - ], - ), - ), + ).onTap((){ + Get.to(() => TeenagerModeOpenPage())?.then((e){ + controller.teenageMode.value = GlobalData().teenagerMode; + }); + }), + ) + ], + ), + ), + ); + }, ); } }