You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
218 lines
8.1 KiB
218 lines
8.1 KiB
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../controller/mine/auth_controller.dart';
|
|
|
|
class RealNamePage extends StatelessWidget {
|
|
RealNamePage({super.key});
|
|
final AuthController controller = Get.put(AuthController());
|
|
// 是否同意协议
|
|
final agreeTerms = Rx<bool>(false);
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Color(0xffFFFFFF),
|
|
appBar: AppBar(
|
|
title: Text('实名认证', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
|
centerTitle: true,
|
|
leading: IconButton(
|
|
icon: Icon(Icons.arrow_back_ios, size: 24, color: Colors.grey,),
|
|
onPressed: () {
|
|
Get.back();
|
|
},
|
|
),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
height: 48,
|
|
decoration: BoxDecoration(color: Color(0xffE7E7E7)),
|
|
padding: const EdgeInsets.only(left: 16),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中
|
|
children: [
|
|
Text(
|
|
'*请填写本人实名信息',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 56, // 固定高度确保垂直居中
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey[400]!,
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中
|
|
children: [
|
|
// 左侧标签 - 固定宽度 + 垂直居中
|
|
Container(
|
|
width: 100,
|
|
alignment: Alignment.centerLeft,
|
|
padding: const EdgeInsets.only(left: 16),
|
|
child: Text(
|
|
'姓名:',
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 12),
|
|
|
|
// 输入框区域 - 使用Expanded填充剩余空间
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft, // 输入框内容垂直居中
|
|
child: TextField(
|
|
decoration: InputDecoration(
|
|
hintText: '请输入姓名',
|
|
hintStyle: TextStyle(color: Colors.grey[500]),
|
|
border: InputBorder.none, // 隐藏默认边框
|
|
contentPadding: EdgeInsets.zero, // 去除默认padding
|
|
isDense: true, // 紧凑模式
|
|
),
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
height: 1.2, // 控制文字垂直位置
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// SizedBox(height: 30),
|
|
Container(
|
|
height: 56, // 固定高度确保垂直居中
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey[400]!,
|
|
width: 0.5,
|
|
),
|
|
),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center, // 垂直居中
|
|
children: [
|
|
// 左侧标签 - 固定宽度 + 垂直居中
|
|
Container(
|
|
width: 100,
|
|
alignment: Alignment.centerLeft,
|
|
padding: const EdgeInsets.only(left: 16),
|
|
child: Text(
|
|
'身份证号:',
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 12),
|
|
|
|
// 输入框区域 - 使用Expanded填充剩余空间
|
|
Expanded(
|
|
child: Container(
|
|
alignment: Alignment.centerLeft, // 输入框内容垂直居中
|
|
child: TextField(
|
|
decoration: InputDecoration(
|
|
hintText: '请输入身份证号',
|
|
hintStyle: TextStyle(color: Colors.grey[500]),
|
|
border: InputBorder.none, // 隐藏默认边框
|
|
contentPadding: EdgeInsets.zero, // 去除默认padding
|
|
isDense: true, // 紧凑模式
|
|
),
|
|
style: TextStyle(
|
|
fontSize: 15,
|
|
height: 1.2, // 控制文字垂直位置
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 24),
|
|
// 协议同意复选框
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start, // 垂直居中
|
|
children: [
|
|
SizedBox(width: 8),
|
|
Obx(() => Checkbox(
|
|
value: agreeTerms.value,
|
|
onChanged: (value) {
|
|
agreeTerms.value = value ?? false;
|
|
},
|
|
activeColor: Color(0xff7562F9),
|
|
side: const BorderSide(color: Colors.grey),
|
|
shape: const CircleBorder(),
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
)),
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(maxWidth: 300), // 限制最大宽度
|
|
child: Text(
|
|
'前排吃瓜,这里的瓜包新鲜,这里的人士有料有梗有灼见~,这里的瓜包新鲜,这里的人士有料有梗有灼见~',
|
|
style: TextStyle( fontSize: 13, color: Colors.grey ),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 48),
|
|
Container(
|
|
padding: const EdgeInsets.only(left: 24, right: 24),
|
|
child: ElevatedButton(
|
|
onPressed: controller.isLoggingIn.value
|
|
? null
|
|
: () {
|
|
// 登录逻辑
|
|
if (!agreeTerms.value) {
|
|
SmartDialog.showToast('请同意用户协议和隐私政策');
|
|
return;
|
|
}
|
|
// 调用控制器的登录方法
|
|
controller.login();
|
|
},
|
|
style: ElevatedButton.styleFrom(
|
|
minimumSize: const Size(double.infinity, 50),
|
|
backgroundColor: agreeTerms.value ? const Color(0xff7562F9) : Colors.grey.shade300,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(25),
|
|
),
|
|
elevation: 0,
|
|
),
|
|
child: controller.isLoggingIn.value ? const SizedBox(
|
|
width: 20,
|
|
height: 20,
|
|
child: CircularProgressIndicator(
|
|
color: Colors.white,
|
|
strokeWidth: 1,
|
|
),
|
|
)
|
|
: const Text(
|
|
'立即认证',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|