180 lines
6.5 KiB
Dart
180 lines
6.5 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:shared_preferences/shared_preferences.dart';
|
||
|
||
import '../../../apis/app.dart';
|
||
import '../../../components/appbar.dart';
|
||
|
||
class CheckAuthenticationPage extends StatefulWidget {
|
||
const CheckAuthenticationPage({super.key});
|
||
|
||
@override
|
||
State<CheckAuthenticationPage> createState() => _CheckAuthenticationPageState();
|
||
}
|
||
|
||
class _CheckAuthenticationPageState extends State<CheckAuthenticationPage> {
|
||
@override
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Scaffold(
|
||
resizeToAvoidBottomInset: false, // 解决点击输入框弹出键盘导致底部像素溢出的问题
|
||
appBar: const CustomAppBar(title: '身份验证'),
|
||
body: Container(
|
||
width: MediaQuery.of(context).size.width,
|
||
height: MediaQuery.of(context).size.height,
|
||
decoration: const BoxDecoration(
|
||
// color: Color(0xff0C0C16),
|
||
image: DecorationImage(
|
||
image: AssetImage('images/pwd_bg.png'),
|
||
fit: BoxFit.fill,
|
||
),
|
||
),
|
||
child:
|
||
Center(
|
||
child: Column(
|
||
mainAxisAlignment: MainAxisAlignment.start,
|
||
children: [
|
||
const SizedBox(height: 100), // 添加间隔
|
||
// 第一行:Token 图标
|
||
Image.asset('images/token.png', width: 69, height: 82), // 根据需要调整宽高
|
||
|
||
const SizedBox(height: 20), // 添加间隔
|
||
|
||
// 第二行:身份验证文本
|
||
const Text(
|
||
'身份验证',
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 24,
|
||
fontWeight: FontWeight.bold,
|
||
),
|
||
),
|
||
|
||
const SizedBox(height: 20), // 添加间隔
|
||
|
||
// 第三行:描述文本
|
||
const Padding(
|
||
padding: EdgeInsets.symmetric(horizontal: 20), // 设置左右边距
|
||
child: Text(
|
||
'为了保护你的账号安全,我们需要验证你的身份,验证通过后即可修改密码。',
|
||
textAlign: TextAlign.center,
|
||
style: TextStyle(
|
||
color: Color(0xffD6D7DC),
|
||
fontSize: 16,
|
||
),
|
||
),
|
||
),
|
||
|
||
const SizedBox(height: 40), // 添加间隔
|
||
|
||
GestureDetector(
|
||
onTap: () async {
|
||
// 获取本地手机号
|
||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||
var storedPhone = prefs.getString('phone') ?? '';
|
||
userApi.getSendCode(storedPhone).then((result) {
|
||
if (result['code'] == 200) {
|
||
print("验证码发送成功");
|
||
|
||
Navigator.pushNamed(context, '/login-code', arguments: { "phone": storedPhone,"key":"resetCode"},);
|
||
} else {
|
||
print("发送失败");
|
||
}
|
||
});
|
||
|
||
},
|
||
child: Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(8),
|
||
gradient: LinearGradient(
|
||
colors: [
|
||
const Color(0xFF80DAA4).withOpacity(0.2),
|
||
const Color(0xFF79DDED).withOpacity(0.2)
|
||
],
|
||
),
|
||
border: Border.all(color: const Color(0xff73cfcf), width: 1),
|
||
),
|
||
padding: const EdgeInsets.all(16),
|
||
child: const Row(
|
||
children: [
|
||
Icon(
|
||
Icons.phone_android,
|
||
color: Colors.white,
|
||
),
|
||
SizedBox(width: 16),
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text('手机号码验证',
|
||
style:
|
||
TextStyle(fontSize: 16, color: Colors.white)),
|
||
SizedBox(height: 10,),
|
||
Text('发送验证码到你的手机',
|
||
style: TextStyle(
|
||
fontSize: 14,
|
||
color: Color.fromRGBO(255, 255, 255, 0.5))),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
|
||
),
|
||
const SizedBox(height:20),
|
||
GestureDetector(
|
||
onTap: () async {
|
||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||
var storedPhone = prefs.getString('phone') ?? '';
|
||
// Navigator.pushNamed();
|
||
Navigator.pushNamed(context, '/reset-pwd', arguments: {"phone": storedPhone,'key': 'reset'});
|
||
},
|
||
child: Padding(
|
||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||
child: Container(
|
||
decoration: BoxDecoration(
|
||
borderRadius: BorderRadius.circular(8),
|
||
gradient: LinearGradient(
|
||
colors: [
|
||
const Color(0xFF80DAA4).withOpacity(0.2),
|
||
const Color(0xFF79DDED).withOpacity(0.2)
|
||
],
|
||
),
|
||
border: Border.all(color: const Color(0xff73cfcf), width: 1),
|
||
),
|
||
padding: const EdgeInsets.all(16),
|
||
child: const Row(
|
||
children: [
|
||
Icon(
|
||
Icons.lock,
|
||
color: Colors.white,
|
||
),
|
||
SizedBox(width: 16),
|
||
Column(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
children: [
|
||
Text('原密码验证',
|
||
style:
|
||
TextStyle(fontSize: 16, color: Colors.white)),
|
||
SizedBox(height: 10,),
|
||
Text('填写原密码进行验证',
|
||
style: TextStyle(
|
||
fontSize: 14,
|
||
color: Color.fromRGBO(255, 255, 255, 0.5))),
|
||
],
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|