更新用户模块
This commit is contained in:
@@ -23,7 +23,7 @@ class LoginModel {
|
||||
|
||||
String? account = '17649984946'; //账户
|
||||
// String? account = '13953240733'; //账户
|
||||
String? password = 'wyf123..'; //密码
|
||||
String? password = '123wyf..'; //密码
|
||||
// String? account = '15255134931'; //账户
|
||||
// String? password = 'mht123,.'; //密码
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
part 'update_password_controller.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class UpdatePasswordModel {
|
||||
String? phone; //手机号
|
||||
String? code; //验证码
|
||||
String? pd; //密码
|
||||
String? confirm; //验证密码
|
||||
bool? pdshow = true; //是否显示密码
|
||||
bool? cpdshow = true; //是否显示密码
|
||||
|
||||
UpdatePasswordModel();
|
||||
static UpdatePasswordModel fromJson(Map<String, dynamic> json) =>
|
||||
_$UpdatePasswordModelFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$UpdatePasswordModelToJson(this);
|
||||
}
|
||||
|
||||
class UpdatePasswordController extends GetControllerEx<UpdatePasswordModel> {
|
||||
UpdatePasswordController() {
|
||||
attr = GetModel(UpdatePasswordModel()).obs;
|
||||
}
|
||||
|
||||
UserInfoController userInfoController = Get.find();
|
||||
|
||||
//确认验证码
|
||||
Future<String> resetPassword(BuildContext context) async {
|
||||
String message = "";
|
||||
if (model.phone == null || model.phone!.isEmpty) {
|
||||
message = "请输入手机号".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
|
||||
message = '请输入正确的手机号'.tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (model.code == null || model.code!.isEmpty) {
|
||||
message = "请输入验证码".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (model.pd == null || model.pd!.isEmpty) {
|
||||
message = "请输入密码".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
String passwordMsg = "密码格式提示".tr;
|
||||
bool hasUppercase = model.pd!.contains(RegExp(r'[A-Z]'));
|
||||
bool hasDigit = model.pd!.contains(RegExp(r'[0-9]'));
|
||||
bool hasSpecialCharacters =
|
||||
model.pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
|
||||
bool hasLetter = model.pd!.contains(RegExp(r'[a-zA-Z]'));
|
||||
|
||||
if (model.pd!.length < 8) {
|
||||
message = passwordMsg;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
|
||||
if (!hasLetter || !hasDigit) {
|
||||
message = passwordMsg;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
|
||||
if (!(hasSpecialCharacters || hasUppercase)) {
|
||||
message = passwordMsg;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (model.confirm == null || model.confirm!.isEmpty) {
|
||||
message = "请输入确认密码".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (model.pd != model.confirm) {
|
||||
message = "两次密码不一致".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.user_changePassword;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
final user = userInfoController.model.user!;
|
||||
var data = {
|
||||
"userName": user.email ?? user.phone,
|
||||
"password": model.pd,
|
||||
"verify": model.code
|
||||
};
|
||||
await requestWithLog(
|
||||
logTitle: "修改密码",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context, text: "操作成功".tr);
|
||||
},
|
||||
onFailure: (res) {
|
||||
message = res.msg!;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
return message;
|
||||
}
|
||||
|
||||
//获取验证码
|
||||
Future<String> getCode(BuildContext context) async {
|
||||
String message = "";
|
||||
if (model.phone == null || model.phone!.isEmpty) {
|
||||
message = "请输入手机号".tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
|
||||
message = '请输入正确的手机号'.tr;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
return message;
|
||||
}
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.send_code;
|
||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||
var data = {"userName": model.phone, "type": 3};
|
||||
await requestWithLog(
|
||||
data: data,
|
||||
logTitle: "发送验证码",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context, text: "发送验证码成功".tr);
|
||||
},
|
||||
onFailure: (res) {
|
||||
message = res.msg!;
|
||||
TopSlideNotification.show(context,
|
||||
text: message, textColor: themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'update_password_controller.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
UpdatePasswordModel _$UpdatePasswordModelFromJson(Map<String, dynamic> json) =>
|
||||
UpdatePasswordModel()
|
||||
..phone = json['phone'] as String?
|
||||
..code = json['code'] as String?
|
||||
..pd = json['pd'] as String?
|
||||
..confirm = json['confirm'] as String?
|
||||
..pdshow = json['pdshow'] as bool?
|
||||
..cpdshow = json['cpdshow'] as bool?;
|
||||
|
||||
Map<String, dynamic> _$UpdatePasswordModelToJson(
|
||||
UpdatePasswordModel instance) =>
|
||||
<String, dynamic>{
|
||||
'phone': instance.phone,
|
||||
'code': instance.code,
|
||||
'pd': instance.pd,
|
||||
'confirm': instance.confirm,
|
||||
'pdshow': instance.pdshow,
|
||||
'cpdshow': instance.cpdshow,
|
||||
};
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/find_password_controller.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
|
||||
@@ -290,40 +293,49 @@ class FindPasswordPage extends GetView<FindPasswordController> {
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
// if (countdownController
|
||||
// .countdown.value !=
|
||||
// 0) {
|
||||
// return;
|
||||
// }
|
||||
// if (CommonVariables
|
||||
// .isNetWorkOn ==
|
||||
// false) {
|
||||
// showToast(
|
||||
// "网络未连接,请开启设备网络后重试");
|
||||
// return;
|
||||
// }
|
||||
// String msg =
|
||||
// await controller
|
||||
// .getCode(context);
|
||||
// if (msg.isNotEmpty) {
|
||||
// return;
|
||||
// }
|
||||
// countdownController
|
||||
// .countdown
|
||||
// .value ==
|
||||
// 0
|
||||
// ? countdownController
|
||||
// .startCountdown(
|
||||
// AppConstants
|
||||
// .code_time)
|
||||
// : null;
|
||||
if (countdownController
|
||||
.countdown
|
||||
.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
if (CommonVariables
|
||||
.isNetWorkOn ==
|
||||
false) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text:
|
||||
"网络未连接,请开启设备网络后重试"
|
||||
.tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9);
|
||||
return;
|
||||
}
|
||||
String msg =
|
||||
await controller
|
||||
.getCode(
|
||||
context);
|
||||
if (msg.isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? countdownController
|
||||
.startCountdown(
|
||||
AppConstants
|
||||
.code_time)
|
||||
: null;
|
||||
},
|
||||
child: Text(
|
||||
countdownController
|
||||
.countdown
|
||||
.value ==
|
||||
0
|
||||
? '获取验证码'
|
||||
? '获取验证码'.tr
|
||||
: '${countdownController.countdown.value}' +
|
||||
'秒'.tr,
|
||||
style: TextStyle(
|
||||
@@ -566,19 +578,21 @@ class FindPasswordPage extends GetView<FindPasswordController> {
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection:
|
||||
GradientDirection.vertical,
|
||||
onTap: () {
|
||||
// if (CommonVariables.isNetWorkOn ==
|
||||
// false) {
|
||||
// showToast("网络未连接,请开启设备网络后重试");
|
||||
// return;
|
||||
// }
|
||||
// String msg = await controller
|
||||
// .confirmCode(context);
|
||||
// if (msg.isEmpty) {
|
||||
// // Get.toNamed("/userInfoPage");
|
||||
// // Get.toNamed("/resetPasswordPage");
|
||||
// Get.toNamed("/loginPage");
|
||||
// }
|
||||
onTap: () async {
|
||||
if (CommonVariables.isNetWorkOn ==
|
||||
false) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "网络未连接,请开启设备网络后重试".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
String msg = await controller
|
||||
.confirmCode(context);
|
||||
if (msg.isEmpty) {
|
||||
Get.toNamed("/loginPage");
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
|
||||
@@ -1308,7 +1308,10 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
null;
|
||||
loginController.model.phone = null;
|
||||
loginController.model.code = null;
|
||||
|
||||
MHTRegisterController
|
||||
registerController = Get.find();
|
||||
registerController
|
||||
.model.register_agree = false;
|
||||
Get.offAndToNamed(
|
||||
"/mianPageBottomChange");
|
||||
}
|
||||
|
||||
973
lib/pages/mh_page/user/page/update_password_page.dart
Normal file
973
lib/pages/mh_page/user/page/update_password_page.dart
Normal file
@@ -0,0 +1,973 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:vbvs_app/common/color/appColors.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/appFontsize.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/register_controller.dart';
|
||||
import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/user/controller/update_password_controller.dart';
|
||||
|
||||
class UpdatePasswordPage extends GetView<UpdatePasswordController> {
|
||||
BoxConstraints? bodysize;
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
UpdatePasswordPage() {
|
||||
controller.model.pdshow = true;
|
||||
controller.model.cpdshow = true;
|
||||
|
||||
// 获取登录用户手机号,设置到 model 中
|
||||
UserInfoController userInfoController = Get.find();
|
||||
controller.model.phone = userInfoController.model.user!.phone;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(builder: (context, cc) {
|
||||
bodysize = cc;
|
||||
return GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/images/new_background.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
// key: scaffoldKey,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
// backgroundColor: Colors.transparent,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme:
|
||||
IconThemeData(color: themeController.currentColor.sc3),
|
||||
titleSpacing: 0,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'修改密码'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
height: bodysize!.maxHeight * 1,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
height: bodysize!.maxHeight * 1,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
15, 13, 15, 0),
|
||||
child: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 346,
|
||||
minHeight: 162,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: stringToColor("#003058"),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
22, 20, 17, 21),
|
||||
child: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
// height: 31, // 设置高度为 31
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 158
|
||||
.rpx, // 设置最小宽度为 100
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
-1, 0),
|
||||
child: Text(
|
||||
'输入手机号码'.tr,
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Colors.white,
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(
|
||||
context)
|
||||
.width,
|
||||
height:
|
||||
40, // 这个高度可以移除,或调整为 31
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Color(0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
child: TextFormField(
|
||||
readOnly: true, // 设置为只读
|
||||
initialValue: controller
|
||||
.model
|
||||
.phone!, // 设置初始值
|
||||
onChanged: (value) {
|
||||
controller.model
|
||||
.phone = value;
|
||||
},
|
||||
obscureText: false,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
labelStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
errorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
contentPadding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(8,
|
||||
0, 0, 8),
|
||||
),
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor
|
||||
.sc4,
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 13)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// height: 31, // 设置高度为 31
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 158
|
||||
.rpx, // 设置最小宽度为 100
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
-1, 0),
|
||||
child: Text(
|
||||
'输入验证码',
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Colors.white,
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(
|
||||
context)
|
||||
.width,
|
||||
height:
|
||||
40, // 这里也设置为31,保持一致
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
Color(0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(8),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
0, 0),
|
||||
child: Container(
|
||||
width: MediaQuery
|
||||
.sizeOf(
|
||||
context)
|
||||
.width,
|
||||
height:
|
||||
31, // 这里的高度也设置为31
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: Color(
|
||||
0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
12),
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
0, 0),
|
||||
child:
|
||||
TextFormField(
|
||||
onChanged:
|
||||
(value) {
|
||||
controller
|
||||
.model
|
||||
.code =
|
||||
value;
|
||||
},
|
||||
obscureText:
|
||||
false,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
labelStyle: FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintText:
|
||||
'请输验证码',
|
||||
hintStyle: FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor
|
||||
.sc4,
|
||||
fontSize:
|
||||
AppFontsize.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
InputBorder
|
||||
.none,
|
||||
focusedBorder:
|
||||
InputBorder
|
||||
.none,
|
||||
errorBorder:
|
||||
InputBorder
|
||||
.none,
|
||||
focusedErrorBorder:
|
||||
InputBorder
|
||||
.none,
|
||||
contentPadding:
|
||||
EdgeInsetsDirectional.fromSTEB(
|
||||
8,
|
||||
0,
|
||||
0,
|
||||
12),
|
||||
),
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
0.25, 0),
|
||||
child: Container(
|
||||
width: 1.rpx,
|
||||
height: 15,
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: Color(
|
||||
0xFFD3D3D3),
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
1, 0),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
0,
|
||||
0,
|
||||
5,
|
||||
0),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(
|
||||
context)
|
||||
.width *
|
||||
0.157,
|
||||
height:
|
||||
31, // 这里的高度也设置为31
|
||||
constraints:
|
||||
BoxConstraints(
|
||||
minWidth: 80,
|
||||
minHeight: 30,
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
0, 0),
|
||||
child:
|
||||
Obx(() {
|
||||
final CountdownController
|
||||
countdownController =
|
||||
Get.find<
|
||||
CountdownController>();
|
||||
return InkWell(
|
||||
onTap:
|
||||
() async {
|
||||
if (countdownController.countdown.value !=
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
String
|
||||
msg =
|
||||
await controller.getCode(context);
|
||||
if (msg
|
||||
.isNotEmpty) {
|
||||
return;
|
||||
}
|
||||
if (countdownController.countdown.value ==
|
||||
0) {
|
||||
countdownController
|
||||
.startCountdown(AppConstants.code_time);
|
||||
}
|
||||
},
|
||||
child:
|
||||
Text(
|
||||
countdownController.countdown.value ==
|
||||
0
|
||||
? '获取验证码'
|
||||
: '${countdownController.countdown.value}秒',
|
||||
style:
|
||||
TextStyle(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color:
|
||||
Color(0xFF333333),
|
||||
fontSize:
|
||||
AppFontsize.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 13)),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth:
|
||||
158.rpx, // 设置最小宽度为 100
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
-1, 0),
|
||||
child: Text(
|
||||
'输入新密码',
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(
|
||||
context)
|
||||
.width,
|
||||
height: 40, // 设置高度为31
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
child: Obx(() {
|
||||
return TextFormField(
|
||||
onChanged: (value) {
|
||||
controller.model.pd =
|
||||
value;
|
||||
},
|
||||
obscureText: controller
|
||||
.model
|
||||
.pdshow!, // 根据 pdshow 控制是否隐藏密码
|
||||
decoration:
|
||||
InputDecoration(
|
||||
hintText: "请输入新密码".tr,
|
||||
labelStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor
|
||||
.sc4,
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
errorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
contentPadding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
8,
|
||||
8,
|
||||
0,
|
||||
0), // 调整底部填充
|
||||
suffixIcon:
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
controller.model
|
||||
.pdshow!
|
||||
? Icons
|
||||
.visibility_off
|
||||
: Icons
|
||||
.visibility,
|
||||
color: Color(
|
||||
0xFF333333),
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () {
|
||||
controller.model
|
||||
.pdshow =
|
||||
!controller
|
||||
.model
|
||||
.pdshow!;
|
||||
controller
|
||||
.updateAll();
|
||||
},
|
||||
),
|
||||
),
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: Color(
|
||||
0xFF333333),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 13)),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth:
|
||||
158.rpx, // 设置最小宽度为 100
|
||||
),
|
||||
child: Align(
|
||||
alignment:
|
||||
AlignmentDirectional(
|
||||
-1, 0),
|
||||
child: Text(
|
||||
'确认新密码',
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: Colors.white,
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(
|
||||
context)
|
||||
.width,
|
||||
height: 40, // 设置高度为31
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFF3F5F6),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
child: Obx(() {
|
||||
return TextFormField(
|
||||
onChanged: (value) {
|
||||
controller.model
|
||||
.confirm = value;
|
||||
},
|
||||
obscureText: controller
|
||||
.model
|
||||
.cpdshow!, // 根据 cpdshow 控制是否隐藏密码
|
||||
decoration:
|
||||
InputDecoration(
|
||||
hintText:
|
||||
"请输入确认密码".tr,
|
||||
labelStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
hintStyle:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.labelMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: themeController
|
||||
.currentColor
|
||||
.sc4,
|
||||
fontSize:
|
||||
AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing:
|
||||
0,
|
||||
),
|
||||
enabledBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: Color(
|
||||
0x00000000),
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
errorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(
|
||||
color: FlutterFlowTheme
|
||||
.of(context)
|
||||
.error,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
8),
|
||||
),
|
||||
contentPadding:
|
||||
EdgeInsetsDirectional
|
||||
.fromSTEB(
|
||||
8,
|
||||
6,
|
||||
0,
|
||||
0), // 调整底部填充以适应新的高度
|
||||
suffixIcon:
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
controller.model
|
||||
.cpdshow!
|
||||
? Icons
|
||||
.visibility_off
|
||||
: Icons
|
||||
.visibility,
|
||||
color: Color(
|
||||
0xFF333333),
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () {
|
||||
// 切换 cpdshow 状态
|
||||
controller.model
|
||||
.cpdshow =
|
||||
!controller
|
||||
.model
|
||||
.cpdshow!;
|
||||
controller
|
||||
.updateAll();
|
||||
},
|
||||
),
|
||||
),
|
||||
style: FlutterFlowTheme
|
||||
.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
'Readex Pro',
|
||||
color: Color(
|
||||
0xFF333333),
|
||||
fontSize: AppFontsize
|
||||
.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(width: 13)),
|
||||
),
|
||||
].divide(SizedBox(height: 14)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
15, 0, 15, AppConstants.page_button_bottom_padding),
|
||||
child: Container(
|
||||
width: bodysize!.maxWidth,
|
||||
height: bodysize!.maxHeight * 0.056,
|
||||
child: CustomCard(
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
borderRadius: 8,
|
||||
onTap: () async {
|
||||
String msg =
|
||||
await controller.resetPassword(context);
|
||||
if (msg.isEmpty) {
|
||||
// 清空登录状态
|
||||
RegisterController registerController =
|
||||
Get.find();
|
||||
registerController.model.register_agree = false;
|
||||
|
||||
LoginController loginController = Get.find();
|
||||
UserInfoController userInfoController =
|
||||
Get.find<UserInfoController>();
|
||||
final box = GetStorage();
|
||||
box.remove('user');
|
||||
box.remove('token');
|
||||
userInfoController.model.token = null;
|
||||
userInfoController.model.user = null;
|
||||
userInfoController.model.login = 0;
|
||||
userInfoController.model.message = 0;
|
||||
loginController.model.account = null;
|
||||
loginController.model.password = null;
|
||||
loginController.model.phone = null;
|
||||
loginController.model.code = null;
|
||||
GlobalController globalController =
|
||||
Get.find<GlobalController>();
|
||||
globalController.resetParmAll();
|
||||
Get.offAllNamed("/loginPage");
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3")
|
||||
], // 单色背景
|
||||
child: Center(
|
||||
child: Text(
|
||||
'确定'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: stringToColor("#003058"),
|
||||
fontSize: AppFontsize.normal_text_size,
|
||||
letterSpacing: 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user