From ad77e16085e42d41dce1d74fb0ec75f3e883ebac 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 17:40:27 +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 --- .../setting/teenager_mode_open_page.dart | 148 +++++++++--------- 1 file changed, 75 insertions(+), 73 deletions(-) diff --git a/lib/pages/setting/teenager_mode_open_page.dart b/lib/pages/setting/teenager_mode_open_page.dart index 587794d..de484dd 100644 --- a/lib/pages/setting/teenager_mode_open_page.dart +++ b/lib/pages/setting/teenager_mode_open_page.dart @@ -17,86 +17,88 @@ class TeenagerModeOpenPage extends StatelessWidget { 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 + body: SingleChildScrollView( + child: 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 + ), ), - ), - if(!controller.teenageMode.value) Text( - controller.password.value == "" ? "设置密码" : "确认密码", - style: TextStyle( - fontSize: 21.w, - fontWeight: FontWeight.w500 + if(!controller.teenageMode.value) Text( + controller.password.value == "" ? "设置密码" : "确认密码", + style: TextStyle( + fontSize: 21.w, + fontWeight: FontWeight.w500 + ), ), - ), - 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)), - ); + 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.confirmPassword.value = pin; + controller.password.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% + }, + ), + 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 + 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(); - } - }), - ) - ], + ).onTap((){ + if(!controller.teenageMode.value){ + controller.openTeenagerMode(); + } else { + controller.closeTeenagerMode(); + } + }), + ) + ], + ), ), ), );