|
|
@ -9,82 +9,85 @@ class LoginPage extends GetView<AuthController> { |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Scaffold( |
|
|
|
return Scaffold(body: SingleChildScrollView(child: _buildBackground())); |
|
|
|
body: Stack(children: [_buildBackground(), _buildLoginCard(controller)]), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget _buildBackground() { |
|
|
|
Widget _buildBackground() { |
|
|
|
return Stack( |
|
|
|
return Container( |
|
|
|
children: [ |
|
|
|
decoration: const BoxDecoration( |
|
|
|
Container( |
|
|
|
image: DecorationImage( |
|
|
|
decoration: const BoxDecoration( |
|
|
|
image: AssetImage('assets/images/background.png'), |
|
|
|
image: DecorationImage( |
|
|
|
// 使用 BoxFit.cover 确保图片填充整个容器,不留空白 |
|
|
|
image: AssetImage('assets/images/background.png'), |
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
alignment: Alignment.topCenter, |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Positioned( |
|
|
|
|
|
|
|
left: 28.5.w, |
|
|
|
|
|
|
|
top: 89.5.h, |
|
|
|
|
|
|
|
child: Image.asset( |
|
|
|
|
|
|
|
'assets/images/label.png', |
|
|
|
|
|
|
|
width: 171.5.w, |
|
|
|
|
|
|
|
height: 23.5.h, |
|
|
|
|
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
Positioned( |
|
|
|
), |
|
|
|
left: 28.5.w, |
|
|
|
child: Stack( |
|
|
|
top: 128.5.h, |
|
|
|
children: [ |
|
|
|
child: Image.asset( |
|
|
|
Column( |
|
|
|
'assets/images/label1.png', |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
width: 296.5.w, |
|
|
|
children: [ |
|
|
|
height: 35.5.h, |
|
|
|
SizedBox(height: 89.5.h), |
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
Padding( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(left: 28.5.w), |
|
|
|
|
|
|
|
child: Image.asset( |
|
|
|
|
|
|
|
'assets/images/label.png', |
|
|
|
|
|
|
|
width: 171.5.w, |
|
|
|
|
|
|
|
height: 23.5.h, |
|
|
|
|
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height: 15.5.h), |
|
|
|
|
|
|
|
Padding( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(left: 28.5.w), |
|
|
|
|
|
|
|
child: Image.asset( |
|
|
|
|
|
|
|
'assets/images/label1.png', |
|
|
|
|
|
|
|
width: 296.5.w, |
|
|
|
|
|
|
|
height: 35.5.h, |
|
|
|
|
|
|
|
fit: BoxFit.fitWidth, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height: 56.5.h), |
|
|
|
|
|
|
|
Center(child: _buildLoginCard(controller)), |
|
|
|
|
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 修改 _buildLoginCard 方法,它不再需要传入 TextEditingController |
|
|
|
// 修改 _buildLoginCard 方法,它不再需要传入 TextEditingController |
|
|
|
Widget _buildLoginCard(AuthController controller) { |
|
|
|
Widget _buildLoginCard(AuthController controller) { |
|
|
|
return Positioned( |
|
|
|
return Container( |
|
|
|
left: 20.5.w, |
|
|
|
width: 334.w, |
|
|
|
top: 220.5.h, |
|
|
|
height: 574.5.h, |
|
|
|
child: Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
width: 334.w, |
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6), |
|
|
|
height: 574.5.h, |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(23.5.r)), |
|
|
|
decoration: BoxDecoration( |
|
|
|
), |
|
|
|
color: const Color(0xFFFFFFFF).withOpacity(0.6), |
|
|
|
padding: EdgeInsets.all(24.w), |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(23.5.r)), |
|
|
|
child: Column( |
|
|
|
), |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
padding: EdgeInsets.all(24.w), |
|
|
|
children: [ |
|
|
|
child: Column( |
|
|
|
const SizedBox(height: 16), |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
// 直接使用控制器中的 TextEditingController |
|
|
|
children: [ |
|
|
|
_buildTextFieldSection( |
|
|
|
const SizedBox(height: 16), |
|
|
|
label: '账号', |
|
|
|
// 直接使用控制器中的 TextEditingController |
|
|
|
hintText: '请输入您的账号', |
|
|
|
_buildTextFieldSection( |
|
|
|
controller: controller.usernameController, |
|
|
|
label: '账号', |
|
|
|
), |
|
|
|
hintText: '请输入您的账号', |
|
|
|
const SizedBox(height: 22), |
|
|
|
controller: controller.usernameController, |
|
|
|
_buildTextFieldSection( |
|
|
|
), |
|
|
|
label: '密码', |
|
|
|
const SizedBox(height: 22), |
|
|
|
hintText: '请输入您的密码', |
|
|
|
_buildTextFieldSection( |
|
|
|
obscureText: true, |
|
|
|
label: '密码', |
|
|
|
controller: controller.passwordController, |
|
|
|
hintText: '请输入您的密码', |
|
|
|
), |
|
|
|
obscureText: true, |
|
|
|
const SizedBox(height: 9.5), |
|
|
|
controller: controller.passwordController, |
|
|
|
_buildRememberPasswordRow(controller), |
|
|
|
), |
|
|
|
const SizedBox(height: 138.5), |
|
|
|
const SizedBox(height: 9.5), |
|
|
|
_buildLoginButton(controller), |
|
|
|
_buildRememberPasswordRow(controller), |
|
|
|
], |
|
|
|
const SizedBox(height: 138.5), |
|
|
|
|
|
|
|
_buildLoginButton(controller), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|