更新登录布局

This commit is contained in:
wyf
2025-06-07 18:00:29 +08:00
parent 48b3b06f17
commit 71a4504f78
17 changed files with 2651 additions and 108 deletions

View File

@@ -0,0 +1,189 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:fluwx/fluwx.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart';
part 'mht_login_controller.g.dart';
@JsonSerializable()
class LoginModel {
//版本id
int? loginStyle = 1; //1.密码登录 2.短信登录
String? account = '17649984946'; //账户
// String? account = '13953240733'; //账户
String? password = 'wyf123,.'; //密码
// String? account = '15255134931'; //账户
// String? password = 'mht123,.'; //密码
// String? account = '18607922869'; //账户
// String? password = '373068'; //密码
// String? account = ''; //账户
// String? password = ''; //密码
String? phone; //手机号
String? code; //验证码
String? register_code;
bool? showPd = true;
int? forceLogin = 0;
bool? isIos; //是否为ios设备
bool? isWeChatNotInstalled; //是否安装微信
LoginModel();
static LoginModel fromJson(Map<String, dynamic> json) =>
_$LoginModelFromJson(json);
Map<String, dynamic> toJson() => _$LoginModelToJson(this);
}
class MHTLoginController extends GetControllerEx<LoginModel> {
// 初始化实例
final Fluwx fluwx = Fluwx();
// 微信监听返回值
FluwxCancelable? fluwxCancelable;
MHTLoginController() {
attr = GetModel(LoginModel()).obs;
}
MHTRegisterController registerController = Get.find();
//登录
Future<String> login(BuildContext context) async {
String message = '';
String account = '';
String password = '';
if (model.loginStyle == null) {
message = '请选择登录方式'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.loginStyle == 1) {
//账号登录
if (model.account == null || model.account!.isEmpty) {
message = '账户不能为空'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.password == null || model.password!.isEmpty) {
message = '密码不能为空'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
account = model.account!;
password = model.password!;
}
if (model.loginStyle == 2) {
//账号登录
if (model.phone == null || model.phone!.isEmpty) {
message = '请输入手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.code == null || model.code!.isEmpty) {
message = '验证码不能为空'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
account = model.phone!;
password = model.code!;
}
if (registerController.model.register_agree == null ||
registerController.model.register_agree != true) {
message = "需要同意协议".tr;
showToast(message);
return message;
}
model.forceLogin = 0;
return message;
}
Future<String> getCode(BuildContext context) async {
String message = "";
if (registerController.model.register_agree == null ||
registerController.model.register_agree != true) {
message = "需要同意协议".tr;
showToast(message);
return message;
}
if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr;
showToast(message);
return message;
}
if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr;
showToast(message);
return message;
}
return '';
}
//微信登录
Future<void> wxLoginSendAuth() async {
/*
1、目前移动应用上微信登录只提供原生的登录方式需要用户安装微信客户端才能配合使用。
2、对于Android应用建议总是显示微信登录按钮当用户手机没有安装微信客户端时请引导用户下载安装微信客户端。
3、对于iOS应用考虑到iOS应用商店审核指南中的相关规定建议开发者接入微信登录时先检测用户手机是否已安装微信客户端
使用sdk中isWXAppInstalled函数 ),对未安装的用户隐藏微信登录按钮,只提供其他登录方式(比如手机号注册登录、游客登录等)
*/
if (isAndroid) {
bool isWeChatInstalled = await fluwx.isWeChatInstalled;
debugPrint('is wechat installed: $isWeChatInstalled');
if (!isWeChatInstalled) {
showToast("请先安装微信APP再使用微信登录");
return;
}
}
fluwx
.authBy(
which: NormalAuth(
scope: 'snsapi_userinfo',
state: 'wechat_sdk_zhmht_wxlogin',
))
.then((data) {
//返回true表示成功或者false表示失败这边没有意义从login_controller页面构造函数监听中去处理
debugPrint('msg:$data');
});
}
//退出登录
Future<void> logout() async {
// await repository.logout();
}
loginByWechatCode(String code) async {
// return await repository.loginByWechatCode(code);
}
//注销账号
deletedAccount() async {
// return await repository.deletedAccount();
}
}

View File

@@ -0,0 +1,33 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'mht_login_controller.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LoginModel _$LoginModelFromJson(Map<String, dynamic> json) => LoginModel()
..loginStyle = (json['loginStyle'] as num?)?.toInt()
..account = json['account'] as String?
..password = json['password'] as String?
..phone = json['phone'] as String?
..code = json['code'] as String?
..register_code = json['register_code'] as String?
..showPd = json['showPd'] as bool?
..forceLogin = (json['forceLogin'] as num?)?.toInt()
..isIos = json['isIos'] as bool?
..isWeChatNotInstalled = json['isWeChatNotInstalled'] as bool?;
Map<String, dynamic> _$LoginModelToJson(LoginModel instance) =>
<String, dynamic>{
'loginStyle': instance.loginStyle,
'account': instance.account,
'password': instance.password,
'phone': instance.phone,
'code': instance.code,
'register_code': instance.register_code,
'showPd': instance.showPd,
'forceLogin': instance.forceLogin,
'isIos': instance.isIos,
'isWeChatNotInstalled': instance.isWeChatNotInstalled,
};

View File

@@ -0,0 +1,131 @@
import 'package:ef/ef.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
part 'mht_register_controller.g.dart';
@JsonSerializable()
class RegisterModel {
String? register_phone; //注册手机号
String? register_pd; //注册密码
String? register_confirm_pd; //注册确认密码
String? register_code; //注册验证码
bool? register_agree = false; //注册协议
bool? save_password = false; //记住密码
bool? pdshow = true; //是否显示密码
bool? cpdshow = true; //是否显示密码
RegisterModel();
static RegisterModel fromJson(Map<String, dynamic> json) =>
_$RegisterModelFromJson(json);
Map<String, dynamic> toJson() => _$RegisterModelToJson(this);
}
class MHTRegisterController extends GetControllerEx<RegisterModel> {
MHTRegisterController() {
attr = GetModel(RegisterModel()).obs;
}
Future<String> registerUser(BuildContext context) async {
String message = "";
if (model.register_phone == null || model.register_phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!MyUtils.isValidPhoneNumber(model.register_phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.register_pd == null || model.register_pd!.isEmpty) {
message = "请输入密码".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
String passwordMsg = "密码格式提示".tr;
bool hasUppercase = model.register_pd!.contains(RegExp(r'[A-Z]'));
bool hasDigit = model.register_pd!.contains(RegExp(r'[0-9]'));
bool hasSpecialCharacters =
model.register_pd!.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
bool hasLetter = model.register_pd!.contains(RegExp(r'[a-zA-Z]'));
if (model.register_pd!.length < 8) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!hasLetter || !hasDigit) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!(hasSpecialCharacters || hasUppercase)) {
message = passwordMsg;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.register_confirm_pd == null ||
model.register_confirm_pd!.isEmpty) {
message = "请输入确认密码".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.register_pd != model.register_confirm_pd) {
message = "两次密码不一致".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.register_code == null || model.register_code!.isEmpty) {
message = "请输入验证码".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (model.register_agree == null || model.register_agree != true) {
message = "需要同意协议".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
// message = await repository.createUser(
// model.register_pd!, model.register_phone!, model.register_code!);
// if (message.isNotEmpty) {
// showToast(message);
// return message;
// }
return "";
}
Future<String> getCode(BuildContext context) async {
String message = "";
if (model.register_phone == null || model.register_phone!.isEmpty) {
message = "请输入手机号".tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
if (!MyUtils.isValidPhoneNumber(model.register_phone!)) {
message = '请输入正确的手机号'.tr;
TopSlideNotification.show(context,
text: message, textColor: stringToColor("#FF7159"));
return message;
}
return '';
}
}

View File

@@ -0,0 +1,28 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'mht_register_controller.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
RegisterModel _$RegisterModelFromJson(Map<String, dynamic> json) =>
RegisterModel()
..register_phone = json['register_phone'] as String?
..register_pd = json['register_pd'] as String?
..register_confirm_pd = json['register_confirm_pd'] as String?
..register_code = json['register_code'] as String?
..register_agree = json['register_agree'] as bool?
..pdshow = json['pdshow'] as bool?
..cpdshow = json['cpdshow'] as bool?;
Map<String, dynamic> _$RegisterModelToJson(RegisterModel instance) =>
<String, dynamic>{
'register_phone': instance.register_phone,
'register_pd': instance.register_pd,
'register_confirm_pd': instance.register_confirm_pd,
'register_code': instance.register_code,
'register_agree': instance.register_agree,
'pdshow': instance.pdshow,
'cpdshow': instance.cpdshow,
};

View File

@@ -0,0 +1,627 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.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/mh_controller/find_password_controller.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
class FindPasswordPage extends GetView<FindPasswordController> {
final scaffoldKey = GlobalKey<ScaffoldState>();
BoxConstraints? bodysize;
final ScrollController _scrollController = ScrollController();
final FocusNode _focusNode1 = FocusNode();
final FocusNode _focusNode2 = FocusNode();
FindPasswordPage() {
controller.model.pdshow = true;
controller.model.cpdshow = true;
_focusNode1.addListener(() {
if (_focusNode1.hasFocus) {
MyUtils.scrollToFocusedInput(_focusNode1, _scrollController);
}
});
_focusNode2.addListener(() {
if (_focusNode2.hasFocus) {
MyUtils.scrollToFocusedInput(_focusNode2, _scrollController);
}
});
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
// key: scaffoldKey,
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'找回密码'.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
actions: [],
centerTitle: false,
),
body: SingleChildScrollView(
controller: _scrollController,
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
98.rpx, 0, 98.rpx, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.886,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
decoration: BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 184.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: TextFormField(
// focusNode: _focusNode1,
onChanged: (value) {
controller.model.phone = value;
},
// autofocus: true,
obscureText: false,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入手机号'.tr,
hintStyle: FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(20.rpx, 0, 0,
0.rpx),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Stack(
children: [
Align(
alignment:
AlignmentDirectional(0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(
0, 0),
child: TextFormField(
// autofocus: true,
// focusNode: _focusNode2,
onChanged: (value) {
controller.model.code =
value;
},
obscureText: false,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize:
20.rpx,
letterSpacing:
0,
),
hintText: '请输验证码'.tr,
hintStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color: Color(
0xFF929699),
fontSize:
26.rpx,
letterSpacing:
0,
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
errorBorder:
InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(20.rpx,
0, 0, 0.rpx),
),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
),
),
),
),
Align(
alignment: AlignmentDirectional(
0.4, 0.1),
child: Container(
width: 1.rpx,
height: 38.rpx,
decoration: BoxDecoration(
color:
stringToColor("#929699"),
),
),
),
Align(
alignment:
AlignmentDirectional(1.2, 0),
child: Container(
width:
bodysize!.maxWidth * 0.157,
height:
bodysize!.maxHeight * 0.014,
constraints: BoxConstraints(
minWidth: 118,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Align(
alignment:
AlignmentDirectional(
0, 0),
child: Obx(() {
final CountdownController
countdownController =
Get.find<
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;
},
child: Text(
countdownController
.countdown
.value ==
0
? '获取验证码'
: '${countdownController.countdown.value}' +
''.tr,
style: TextStyle(
color:
Color(0xFF333333),
fontSize: 20.rpx,
letterSpacing: 0,
),
),
);
}),
),
),
),
],
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: Obx(() {
return TextFormField(
// autofocus: true,
// focusNode: _focusNode1,
onChanged: (value) {
controller.model.pd = value;
},
// obscureText: true,
obscureText:
controller.model.pdshow!,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入新密码'.tr,
hintStyle: FlutterFlowTheme
.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color:
Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
10, 26.rpx, 0, 0),
suffixIcon: IconButton(
icon: Icon(
// 根据 pdshow 控制图标
controller.model.pdshow!
? Icons.visibility_off
: Icons.visibility,
color: Color(0xFF333333),
size: 16,
),
onPressed: () {
// 切换 pdshow 状态
controller.model.pdshow =
!controller
.model.pdshow!;
controller.updateAll();
},
),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
);
}),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: Obx(() {
return TextFormField(
// autofocus: true,
// focusNode: _focusNode2,
onChanged: (value) {
controller.model.confirm =
value;
},
// obscureText: true,
obscureText:
controller.model.cpdshow!,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '确认新密码',
hintStyle: FlutterFlowTheme
.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color:
Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
10, 26.rpx, 0, 0),
suffixIcon: IconButton(
icon: Icon(
// 根据 pdshow 控制图标
controller.model.cpdshow!
? Icons.visibility_off
: Icons.visibility,
color: Color(0xFF333333),
size: 16,
),
onPressed: () {
// 切换 pdshow 状态
controller.model.cpdshow =
!controller
.model.cpdshow!;
controller.updateAll();
},
),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
);
}),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
42.rpx, 38.rpx, 42.rpx, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.022,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.022,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 58.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.056,
decoration: BoxDecoration(),
child: CustomCard(
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");
// }
},
colors: const [
Color(0xFFFCFCFC),
Color(0xFFF8FAF9),
Color(0XFFECF6F3),
Color(0XFFD9F0E9),
Color(0xFFCEECE3)
],
child: Container(
width: double.infinity,
height: 90.rpx,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
16.rpx),
),
child: Text(
"提交",
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0XFF003058),
letterSpacing: 0,
fontSize: 26.rpx,
),
),
),
)),
),
],
),
),
),
),
),
],
),
),
)),
));
});
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,799 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.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/mh_controller/register_controller.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/pages/common/selectDialog.dart';
class RegisterPage extends GetView<RegisterController> {
final scaffoldKey = GlobalKey<ScaffoldState>();
BoxConstraints? bodysize;
final ScrollController _scrollController = ScrollController();
RegisterPage() {
controller.model.pdshow = true;
controller.model.cpdshow = true;
Get.put(RegisterController());
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) {
bodysize = cc;
return GestureDetector(
// onTap: () => FocusScope.of(context).unfocus(),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/new_background.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
// key: scaffoldKey,
appBar: AppBar(
backgroundColor: Colors.transparent,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'用户注册',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
actions: [],
centerTitle: false,
),
body: SingleChildScrollView(
controller: _scrollController,
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
// TitleComponentWidget(
// titleName: '用户注册',
// ),
Expanded(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
98.rpx, 0, 98.rpx, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.886,
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 184.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius: BorderRadius.circular(12),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: TextFormField(
// autofocus: true,
// focusNode: _focusNode1,
onChanged: (value) {
controller.model.register_phone =
value;
},
obscureText: false,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入手机号'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional.fromSTEB(
20.rpx, 0, 0, 10.rpx),
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius: BorderRadius.circular(12),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Obx(() {
return TextFormField(
// autofocus: true,
// focusNode: _focusNode2,
onChanged: (value) {
controller.model.register_pd =
value;
},
// obscureText: true,
obscureText:
controller.model.pdshow!,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入密码'.tr,
hintStyle: FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
10, 26.rpx, 0, 0),
suffixIcon: IconButton(
icon: Icon(
// 根据 pdshow 控制图标
controller.model.pdshow!
? Icons.visibility_off
: Icons.visibility,
color: Color(0xFF333333),
size: 16,
),
onPressed: () {
// 切换 pdshow 状态
controller.model.pdshow =
!controller
.model.pdshow!;
controller.updateAll();
},
),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
);
})),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.06,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius: BorderRadius.circular(12),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Obx(() {
return TextFormField(
// autofocus: true,
onChanged: (value) {
controller.model
.register_confirm_pd =
value;
},
// focusNode: _focusNode3,
// obscureText: true,
obscureText:
controller.model.cpdshow!,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入确认密码'.tr,
hintStyle: FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily: 'Readex Pro',
color: Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(
10, 26.rpx, 0, 0),
suffixIcon: IconButton(
icon: Icon(
// 根据 pdshow 控制图标
controller.model.pdshow!
? Icons.visibility_off
: Icons.visibility,
color: Color(0xFF333333),
size: 16,
),
onPressed: () {
// 切换 pdshow 状态
controller.model.cpdshow =
!controller
.model.cpdshow!;
controller.updateAll();
},
),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
);
})),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 32.rpx, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(),
child: Stack(
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Container(
width: bodysize!.maxWidth,
height: 92.rpx,
decoration: BoxDecoration(
color: Color(0xFFF3F5F6),
borderRadius:
BorderRadius.circular(12),
),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: TextFormField(
// autofocus: true,
onChanged: (value) {
controller.model
.register_code = value;
},
// focusNode: _focusNode4,
obscureText: false,
decoration: InputDecoration(
labelStyle:
FlutterFlowTheme.of(
context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
hintText: '请输入验证码',
hintStyle: FlutterFlowTheme
.of(context)
.labelMedium
.override(
fontFamily:
'Readex Pro',
color:
Color(0xFF929699),
fontSize: 26.rpx,
letterSpacing: 0,
),
enabledBorder:
InputBorder.none,
focusedBorder:
InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder:
InputBorder.none,
contentPadding:
EdgeInsetsDirectional
.fromSTEB(20.rpx, 0,
0, 0.rpx),
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
fontSize: 26.rpx,
letterSpacing: 0,
),
),
),
),
),
Align(
alignment:
AlignmentDirectional(0.4, 0.1),
child: Container(
width: 1.rpx,
height: 38.rpx,
decoration: BoxDecoration(
color: stringToColor("#929699"),
),
),
),
Align(
alignment:
AlignmentDirectional(1.2, 0),
child: Container(
width: bodysize!.maxWidth * 0.157,
height: bodysize!.maxHeight * 0.014,
constraints: BoxConstraints(
minWidth: 118,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Align(
alignment:
AlignmentDirectional(0, 0),
child: Obx(() {
final CountdownController
countdownController =
Get.find<
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;
},
child: Text(
countdownController
.countdown
.value ==
0
? '获取验证码'.tr
: '${countdownController.countdown.value}' +
''.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize: 20.rpx,
letterSpacing: 0,
),
),
);
}),
),
),
),
],
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 19, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.022,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.022,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Align(
alignment:
AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(0, 3, 0, 0),
child: Container(
width: 36,
height: 36,
decoration: BoxDecoration(),
child: Align(
alignment:
AlignmentDirectional(
0, 0),
child: Theme(
data: ThemeData(
checkboxTheme:
CheckboxThemeData(
visualDensity:
VisualDensity
.compact,
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap,
shape:
RoundedRectangleBorder(
borderRadius:
BorderRadius
.circular(
64),
),
),
unselectedWidgetColor:
Color(0xFFD3D3D3),
),
child: Obx(
() => Checkbox(
value: controller
.model
.register_agree ??
false,
onChanged:
(newValue) async {
controller.model
.register_agree =
newValue;
controller
.updateAll();
// 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取
// if (newValue ==
// true) {
// Deviceconfig
// .initPlatformState();
// }
},
side: BorderSide(
width: 1.5,
color: FlutterFlowTheme
.of(context)
.secondaryText,
),
activeColor:
const Color(
0xFF84F5FF),
checkColor:
Color(0xFF003058),
visualDensity:
VisualDensity(
horizontal:
-4.0,
vertical:
-4.0), // 变小
),
)),
),
),
),
),
Flexible(
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(0, 0, 0, 0),
child: Container(
width:
MediaQuery.sizeOf(context)
.width *
0.622,
height:
MediaQuery.sizeOf(context)
.height *
1,
constraints: BoxConstraints(
minWidth: 466,
minHeight: 30,
),
decoration: BoxDecoration(),
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(),
child: Row(
mainAxisSize:
MainAxisSize.max,
children: [
Align(
alignment:
AlignmentDirectional(
0, 0),
child: Text(
'我已阅读并同意'.tr,
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize: 12,
letterSpacing:
0,
),
),
),
Align(
alignment:
AlignmentDirectional(
0, 0),
child: InkWell(
onTap: () {
showCustomConfirmOfWebViewDialog(
context,
"用户协议",
"/#/pages/agreement/agreement?type=2&hideHead=true");
},
child: Text(
'《用户协议》'.tr,
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: stringToColor(
"FF9F66"),
fontSize: 12,
letterSpacing:
0,
),
),
),
),
Align(
alignment:
AlignmentDirectional(
0, 0),
child: Text(
''.tr,
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: Colors
.white,
fontSize: 12,
letterSpacing:
0,
),
),
),
Align(
alignment:
AlignmentDirectional(
0, 0),
child: InkWell(
onTap: () {
showCustomConfirmOfWebViewDialog(
context,
"隐私协议",
"/#/pages/agreement/agreement?type=1&hideHead=true");
},
child: Text(
'《隐私协议》'.tr,
style: FlutterFlowTheme
.of(context)
.bodyMedium
.override(
fontFamily:
'Readex Pro',
color: stringToColor(
"FF9F66"),
fontSize: 12,
letterSpacing:
0,
),
),
),
),
],
),
),
),
),
),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 29, 0, 0),
child: Container(
width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 0.056,
decoration: BoxDecoration(),
child: CustomCard(
borderRadius: 16.rpx,
gradientDirection:
GradientDirection.vertical,
onTap: () {
// if (CommonVariables.isNetWorkOn ==
// false) {
// showToast("网络未连接,请开启设备网络后重试");
// return;
// }
// String msg = await controller
// .registerUser(context);
// if (msg == null || msg.isEmpty) {
// Get.toNamed("/loginPage");
// }
},
colors: const [
Color(0xFFFCFCFC),
Color(0xFFF8FAF9),
Color(0XFFECF6F3),
Color(0XFFD9F0E9),
Color(0xFFCEECE3)
],
child: Container(
width: double.infinity,
height: 90.rpx,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(16.rpx),
),
child: Text(
"提交",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
stringToColor("#011D33"),
letterSpacing: 0,
fontSize: 30.rpx,
),
),
),
)),
),
],
),
),
),
),
),
],
),
),
)),
));
});
}
}