|
|
@ -10,53 +10,49 @@ class LoginView extends GetView<LoginController> { |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
// 使用浅色主题 |
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
return Theme( |
|
|
|
|
|
data: AppTheme.lightTheme, |
|
|
return Scaffold( |
|
|
child: Scaffold( |
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], |
|
|
body: SafeArea( |
|
|
body: SafeArea( |
|
|
child: Obx(() => controller.viewState == LoginViewState.welcome |
|
|
child: Obx(() => controller.viewState == LoginViewState.welcome |
|
|
? _buildWelcomeView() |
|
|
? _buildWelcomeView(isDarkMode) |
|
|
: _buildVerificationView(context)), |
|
|
: _buildVerificationView(context, isDarkMode)), |
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 欢迎页面 |
|
|
// 欢迎页面 |
|
|
Widget _buildWelcomeView() { |
|
|
Widget _buildWelcomeView(bool isDarkMode) { |
|
|
return Padding( |
|
|
return Padding( |
|
|
padding: EdgeInsets.all(24.w), |
|
|
padding: EdgeInsets.all(24.w), |
|
|
child: SingleChildScrollView( |
|
|
child: SingleChildScrollView( |
|
|
physics: const BouncingScrollPhysics(), |
|
|
physics: const BouncingScrollPhysics(), |
|
|
child: Column( |
|
|
child: Column( |
|
|
children: [ |
|
|
children: [ |
|
|
// 状态栏 |
|
|
|
|
|
_buildStatusBar(), |
|
|
|
|
|
|
|
|
|
|
|
// 应用标志和标题 |
|
|
// 应用标志和标题 |
|
|
SizedBox(height: 32.h), |
|
|
SizedBox(height: 32.h), |
|
|
_buildAppLogo(), |
|
|
_buildAppLogo(isDarkMode), |
|
|
|
|
|
|
|
|
// 欢迎文本 |
|
|
// 欢迎文本 |
|
|
SizedBox(height: 32.h), |
|
|
SizedBox(height: 32.h), |
|
|
_buildWelcomeText(), |
|
|
_buildWelcomeText(isDarkMode), |
|
|
|
|
|
|
|
|
// 输入框和继续按钮 |
|
|
// 输入框和继续按钮 |
|
|
SizedBox(height: 24.h), |
|
|
SizedBox(height: 24.h), |
|
|
_buildInputField(), |
|
|
_buildInputField(isDarkMode), |
|
|
SizedBox(height: 16.h), |
|
|
SizedBox(height: 16.h), |
|
|
_buildVerificationInputField(), |
|
|
_buildVerificationInputField(isDarkMode), |
|
|
SizedBox(height: 16.h), |
|
|
SizedBox(height: 16.h), |
|
|
_buildContinueButton(), |
|
|
_buildContinueButton(isDarkMode), |
|
|
|
|
|
|
|
|
// 社交媒体登录 |
|
|
// 社交媒体登录 |
|
|
SizedBox(height: 32.h), |
|
|
SizedBox(height: 32.h), |
|
|
_buildSocialLoginSection(), |
|
|
_buildSocialLoginSection(isDarkMode), |
|
|
|
|
|
|
|
|
// 用户协议 |
|
|
// 用户协议 |
|
|
SizedBox(height: 40.h), |
|
|
SizedBox(height: 40.h), |
|
|
_buildTermsAndPrivacy(), |
|
|
_buildTermsAndPrivacy(isDarkMode), |
|
|
SizedBox(height: 24.h), |
|
|
SizedBox(height: 24.h), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
@ -65,7 +61,7 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证码页面 |
|
|
// 验证码页面 |
|
|
Widget _buildVerificationView(BuildContext context) { |
|
|
Widget _buildVerificationView(BuildContext context, bool isDarkMode) { |
|
|
return Padding( |
|
|
return Padding( |
|
|
padding: EdgeInsets.all(24.w), |
|
|
padding: EdgeInsets.all(24.w), |
|
|
child: SingleChildScrollView( |
|
|
child: SingleChildScrollView( |
|
|
@ -74,27 +70,27 @@ class LoginView extends GetView<LoginController> { |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
// 返回按钮 |
|
|
// 返回按钮 |
|
|
_buildBackButton(), |
|
|
_buildBackButton(isDarkMode), |
|
|
|
|
|
|
|
|
// 验证码标题 |
|
|
// 验证码标题 |
|
|
SizedBox(height: 24.h), |
|
|
SizedBox(height: 24.h), |
|
|
_buildVerificationTitle(), |
|
|
_buildVerificationTitle(isDarkMode), |
|
|
|
|
|
|
|
|
// 验证码输入框 |
|
|
// 验证码输入框 |
|
|
SizedBox(height: 32.h), |
|
|
SizedBox(height: 32.h), |
|
|
_buildVerificationInputs(context), |
|
|
_buildVerificationInputs(context, isDarkMode), |
|
|
|
|
|
|
|
|
// 重新发送验证码 |
|
|
// 重新发送验证码 |
|
|
SizedBox(height: 16.h), |
|
|
SizedBox(height: 16.h), |
|
|
_buildResendButton(), |
|
|
_buildResendButton(isDarkMode), |
|
|
|
|
|
|
|
|
// 登录按钮 |
|
|
// 登录按钮 |
|
|
SizedBox(height: 32.h), |
|
|
SizedBox(height: 32.h), |
|
|
_buildLoginButton(), |
|
|
_buildLoginButton(isDarkMode), |
|
|
|
|
|
|
|
|
// 使用密码登录 |
|
|
// 使用密码登录 |
|
|
SizedBox(height: 16.h), |
|
|
SizedBox(height: 16.h), |
|
|
_buildUsePasswordButton(), |
|
|
_buildUsePasswordButton(isDarkMode), |
|
|
SizedBox(height: 24.h), |
|
|
SizedBox(height: 24.h), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
@ -102,33 +98,8 @@ class LoginView extends GetView<LoginController> { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 状态栏 |
|
|
|
|
|
Widget _buildStatusBar() { |
|
|
|
|
|
return Row( |
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Text( |
|
|
|
|
|
'9:41', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
color: Colors.black54, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
Row( |
|
|
|
|
|
children: [ |
|
|
|
|
|
Icon(Icons.signal_cellular_4_bar, size: 12.sp, color: Colors.black54), |
|
|
|
|
|
SizedBox(width: 4.w), |
|
|
|
|
|
Icon(Icons.wifi, size: 12.sp, color: Colors.black54), |
|
|
|
|
|
SizedBox(width: 4.w), |
|
|
|
|
|
Icon(Icons.battery_full, size: 12.sp, color: Colors.black54), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 应用标志和标题 |
|
|
// 应用标志和标题 |
|
|
Widget _buildAppLogo() { |
|
|
Widget _buildAppLogo(bool isDarkMode) { |
|
|
return Column( |
|
|
return Column( |
|
|
children: [ |
|
|
children: [ |
|
|
Container( |
|
|
Container( |
|
|
@ -161,7 +132,7 @@ class LoginView extends GetView<LoginController> { |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 24.sp, |
|
|
fontSize: 24.sp, |
|
|
fontWeight: FontWeight.bold, |
|
|
fontWeight: FontWeight.bold, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 8.h), |
|
|
SizedBox(height: 8.h), |
|
|
@ -169,7 +140,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'连接世界,超越声音', |
|
|
'连接世界,超越声音', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black54, |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.black54, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -177,7 +148,7 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 欢迎文本 |
|
|
// 欢迎文本 |
|
|
Widget _buildWelcomeText() { |
|
|
Widget _buildWelcomeText(bool isDarkMode) { |
|
|
return Column( |
|
|
return Column( |
|
|
children: [ |
|
|
children: [ |
|
|
Text( |
|
|
Text( |
|
|
@ -185,7 +156,7 @@ class LoginView extends GetView<LoginController> { |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 20.sp, |
|
|
fontSize: 20.sp, |
|
|
fontWeight: FontWeight.w600, |
|
|
fontWeight: FontWeight.w600, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 4.h), |
|
|
SizedBox(height: 4.h), |
|
|
@ -193,7 +164,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'请使用手机号或邮箱登录/注册', |
|
|
'请使用手机号或邮箱登录/注册', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black54, |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.black54, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -201,10 +172,10 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 输入框 |
|
|
// 输入框 |
|
|
Widget _buildInputField() { |
|
|
Widget _buildInputField(bool isDarkMode) { |
|
|
return Container( |
|
|
return Container( |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.grey.withOpacity(0.1), |
|
|
color: isDarkMode ? Colors.grey[900]!.withOpacity(0.4) : Colors.grey.withOpacity(0.1), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
), |
|
|
), |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
@ -213,7 +184,7 @@ class LoginView extends GetView<LoginController> { |
|
|
children: [ |
|
|
children: [ |
|
|
Icon( |
|
|
Icon( |
|
|
Icons.person_outline, |
|
|
Icons.person_outline, |
|
|
color: Colors.black54, |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.black54, |
|
|
size: 20.sp, |
|
|
size: 20.sp, |
|
|
), |
|
|
), |
|
|
SizedBox(width: 12.w), |
|
|
SizedBox(width: 12.w), |
|
|
@ -224,13 +195,15 @@ class LoginView extends GetView<LoginController> { |
|
|
hintText: '手机号码或邮箱', |
|
|
hintText: '手机号码或邮箱', |
|
|
hintStyle: TextStyle( |
|
|
hintStyle: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black38, |
|
|
color: isDarkMode ? Colors.grey[600] : Colors.black38, |
|
|
), |
|
|
), |
|
|
border: InputBorder.none, |
|
|
border: InputBorder.none, |
|
|
|
|
|
fillColor: Colors.transparent, |
|
|
|
|
|
filled: true, |
|
|
), |
|
|
), |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -241,10 +214,10 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证码输入框 |
|
|
// 验证码输入框 |
|
|
Widget _buildVerificationInputField() { |
|
|
Widget _buildVerificationInputField(bool isDarkMode) { |
|
|
return Container( |
|
|
return Container( |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.grey.withOpacity(0.1), |
|
|
color: isDarkMode ? Colors.grey[900]!.withOpacity(0.4) : Colors.grey.withOpacity(0.1), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
), |
|
|
), |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
@ -253,7 +226,7 @@ class LoginView extends GetView<LoginController> { |
|
|
children: [ |
|
|
children: [ |
|
|
Icon( |
|
|
Icon( |
|
|
Icons.lock_outline, |
|
|
Icons.lock_outline, |
|
|
color: Colors.black54, |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.black54, |
|
|
size: 20.sp, |
|
|
size: 20.sp, |
|
|
), |
|
|
), |
|
|
SizedBox(width: 12.w), |
|
|
SizedBox(width: 12.w), |
|
|
@ -266,14 +239,16 @@ class LoginView extends GetView<LoginController> { |
|
|
hintText: '验证码', |
|
|
hintText: '验证码', |
|
|
hintStyle: TextStyle( |
|
|
hintStyle: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black38, |
|
|
color: isDarkMode ? Colors.grey[600] : Colors.black38, |
|
|
), |
|
|
), |
|
|
border: InputBorder.none, |
|
|
border: InputBorder.none, |
|
|
counterText: '', |
|
|
counterText: '', |
|
|
|
|
|
fillColor: Colors.transparent, |
|
|
|
|
|
filled: true, |
|
|
), |
|
|
), |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -283,9 +258,9 @@ class LoginView extends GetView<LoginController> { |
|
|
: controller.getVerificationCode, |
|
|
: controller.getVerificationCode, |
|
|
style: TextButton.styleFrom( |
|
|
style: TextButton.styleFrom( |
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
|
foregroundColor: const Color(0xFF0066CC), |
|
|
foregroundColor: const Color(0xFF3B82F6), |
|
|
backgroundColor: Colors.transparent, |
|
|
backgroundColor: Colors.transparent, |
|
|
disabledForegroundColor: Colors.black38, |
|
|
disabledForegroundColor: isDarkMode ? Colors.grey[600] : Colors.grey[400], |
|
|
), |
|
|
), |
|
|
child: Text( |
|
|
child: Text( |
|
|
controller.countdownSeconds > 0 |
|
|
controller.countdownSeconds > 0 |
|
|
@ -304,34 +279,36 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 继续按钮 |
|
|
// 继续按钮 |
|
|
Widget _buildContinueButton() { |
|
|
Widget _buildContinueButton(bool isDarkMode) { |
|
|
return SizedBox( |
|
|
return SizedBox( |
|
|
width: double.infinity, |
|
|
width: double.infinity, |
|
|
child: Obx(() => ElevatedButton( |
|
|
child: Obx(() => ElevatedButton( |
|
|
onPressed: controller.isLoading ? null : controller.loginWithVerificationCode, |
|
|
onPressed: controller.isLoading ? null : () => controller.login(), |
|
|
style: ElevatedButton.styleFrom( |
|
|
style: ElevatedButton.styleFrom( |
|
|
backgroundColor: const Color(0xFF0066CC), |
|
|
backgroundColor: const Color(0xFF0066CC), |
|
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
|
foregroundColor: Colors.white, |
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 14.h), |
|
|
shape: RoundedRectangleBorder( |
|
|
shape: RoundedRectangleBorder( |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
), |
|
|
), |
|
|
elevation: 0, |
|
|
elevation: 0, |
|
|
|
|
|
disabledBackgroundColor: const Color(0xFF0066CC).withOpacity(0.7), |
|
|
|
|
|
disabledForegroundColor: Colors.white, |
|
|
), |
|
|
), |
|
|
child: controller.isLoading |
|
|
child: controller.isLoading |
|
|
? SizedBox( |
|
|
? SizedBox( |
|
|
width: 20.w, |
|
|
height: 20.h, |
|
|
height: 20.w, |
|
|
width: 20.h, |
|
|
child: const CircularProgressIndicator( |
|
|
child: CircularProgressIndicator( |
|
|
strokeWidth: 2, |
|
|
strokeWidth: 2.w, |
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white), |
|
|
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white), |
|
|
), |
|
|
), |
|
|
) |
|
|
) |
|
|
: Text( |
|
|
: Text( |
|
|
'登录', |
|
|
'继续', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 16.sp, |
|
|
fontSize: 16.sp, |
|
|
fontWeight: FontWeight.w500, |
|
|
fontWeight: FontWeight.w600, |
|
|
color: Colors.white, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
)), |
|
|
)), |
|
|
@ -339,32 +316,32 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 社交媒体登录部分 |
|
|
// 社交媒体登录部分 |
|
|
Widget _buildSocialLoginSection() { |
|
|
Widget _buildSocialLoginSection(bool isDarkMode) { |
|
|
return Column( |
|
|
return Column( |
|
|
children: [ |
|
|
children: [ |
|
|
Row( |
|
|
Row( |
|
|
children: [ |
|
|
children: [ |
|
|
Expanded(child: Divider(color: Colors.black12)), |
|
|
Expanded(child: Divider(color: isDarkMode ? Colors.grey[800] : Colors.grey[300])), |
|
|
Padding( |
|
|
Padding( |
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
|
child: Text( |
|
|
child: Text( |
|
|
'或使用以下方式登录', |
|
|
'或使用以下方式登录', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
color: Colors.black45, |
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[600], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Expanded(child: Divider(color: Colors.black12)), |
|
|
Expanded(child: Divider(color: isDarkMode ? Colors.grey[800] : Colors.grey[300])), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
SizedBox(height: 24.h), |
|
|
SizedBox(height: 24.h), |
|
|
Row( |
|
|
Row( |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
_buildSocialButton(FontAwesomeIcons.google, Colors.red), |
|
|
_buildSocialButton(FontAwesomeIcons.google, Colors.red, isDarkMode), |
|
|
SizedBox(width: 24.w), |
|
|
SizedBox(width: 24.w), |
|
|
_buildSocialButton(FontAwesomeIcons.weixin, Colors.green), |
|
|
_buildSocialButton(FontAwesomeIcons.weixin, Colors.green, isDarkMode), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -372,30 +349,41 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 社交媒体按钮 |
|
|
// 社交媒体按钮 |
|
|
Widget _buildSocialButton(IconData icon, Color color) { |
|
|
Widget _buildSocialButton(IconData icon, Color color, bool isDarkMode) { |
|
|
return Container( |
|
|
return Container( |
|
|
width: 48.w, |
|
|
width: 48.w, |
|
|
height: 48.w, |
|
|
height: 48.w, |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.grey.withOpacity(0.1), |
|
|
color: isDarkMode ? Colors.grey[800] : Colors.white, |
|
|
borderRadius: BorderRadius.circular(24.r), |
|
|
borderRadius: BorderRadius.circular(24.r), |
|
|
|
|
|
boxShadow: isDarkMode ? [] : [ |
|
|
|
|
|
BoxShadow( |
|
|
|
|
|
color: Colors.grey.withOpacity(0.2), |
|
|
|
|
|
blurRadius: 4, |
|
|
|
|
|
offset: const Offset(0, 2), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
), |
|
|
), |
|
|
child: IconButton( |
|
|
child: IconButton( |
|
|
icon: Icon(icon, color: color, size: 20.sp), |
|
|
icon: FaIcon( |
|
|
|
|
|
icon, |
|
|
|
|
|
color: color, |
|
|
|
|
|
size: 20.sp, |
|
|
|
|
|
), |
|
|
onPressed: () {}, |
|
|
onPressed: () {}, |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 用户协议和隐私政策 |
|
|
// 用户协议和隐私政策 |
|
|
Widget _buildTermsAndPrivacy() { |
|
|
Widget _buildTermsAndPrivacy(bool isDarkMode) { |
|
|
return Column( |
|
|
return Column( |
|
|
children: [ |
|
|
children: [ |
|
|
Text( |
|
|
Text( |
|
|
'登录/注册即表示你同意', |
|
|
'登录/注册即表示你同意', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
color: Colors.black45, |
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[600], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 4.h), |
|
|
SizedBox(height: 4.h), |
|
|
@ -408,7 +396,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'《用户协议》', |
|
|
'《用户协议》', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
color: const Color(0xFF0066CC), |
|
|
color: const Color(0xFF3B82F6), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -416,7 +404,7 @@ class LoginView extends GetView<LoginController> { |
|
|
' 和 ', |
|
|
' 和 ', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
color: Colors.black45, |
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[600], |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
GestureDetector( |
|
|
GestureDetector( |
|
|
@ -425,7 +413,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'《隐私政策》', |
|
|
'《隐私政策》', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 12.sp, |
|
|
fontSize: 12.sp, |
|
|
color: const Color(0xFF0066CC), |
|
|
color: const Color(0xFF3B82F6), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -436,23 +424,27 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 返回按钮 |
|
|
// 返回按钮 |
|
|
Widget _buildBackButton() { |
|
|
Widget _buildBackButton(bool isDarkMode) { |
|
|
return Container( |
|
|
return Container( |
|
|
width: 40.w, |
|
|
width: 40.w, |
|
|
height: 40.w, |
|
|
height: 40.w, |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.grey.withOpacity(0.1), |
|
|
color: isDarkMode ? Colors.grey[800] : Colors.grey.withOpacity(0.1), |
|
|
borderRadius: BorderRadius.circular(20.r), |
|
|
borderRadius: BorderRadius.circular(20.r), |
|
|
), |
|
|
), |
|
|
child: IconButton( |
|
|
child: IconButton( |
|
|
icon: Icon(Icons.arrow_back, color: Colors.black54, size: 20.sp), |
|
|
icon: Icon( |
|
|
onPressed: controller.showWelcomeView, |
|
|
Icons.arrow_back, |
|
|
|
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[600], |
|
|
|
|
|
size: 20.sp, |
|
|
|
|
|
), |
|
|
|
|
|
onPressed: () => controller.showWelcomeView(), |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证码标题 |
|
|
// 验证码标题 |
|
|
Widget _buildVerificationTitle() { |
|
|
Widget _buildVerificationTitle(bool isDarkMode) { |
|
|
return Column( |
|
|
return Column( |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
children: [ |
|
|
children: [ |
|
|
@ -461,7 +453,7 @@ class LoginView extends GetView<LoginController> { |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 20.sp, |
|
|
fontSize: 20.sp, |
|
|
fontWeight: FontWeight.w600, |
|
|
fontWeight: FontWeight.w600, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 8.h), |
|
|
SizedBox(height: 8.h), |
|
|
@ -469,7 +461,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'验证码已发送至 ${controller.displayContact}', |
|
|
'验证码已发送至 ${controller.displayContact}', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: Colors.black54, |
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[600], |
|
|
), |
|
|
), |
|
|
)), |
|
|
)), |
|
|
], |
|
|
], |
|
|
@ -477,23 +469,23 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 验证码输入框 |
|
|
// 验证码输入框 |
|
|
Widget _buildVerificationInputs(BuildContext context) { |
|
|
Widget _buildVerificationInputs(BuildContext context, bool isDarkMode) { |
|
|
return Row( |
|
|
return Row( |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
children: List.generate(4, (index) => _buildVerificationInput(index, context)), |
|
|
children: List.generate(4, (index) => _buildVerificationInput(index, context, isDarkMode)), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 单个验证码输入框 |
|
|
// 单个验证码输入框 |
|
|
Widget _buildVerificationInput(int index, BuildContext context) { |
|
|
Widget _buildVerificationInput(int index, BuildContext context, bool isDarkMode) { |
|
|
return Container( |
|
|
return Container( |
|
|
width: 60.w, |
|
|
width: 60.w, |
|
|
height: 60.w, |
|
|
height: 60.w, |
|
|
decoration: BoxDecoration( |
|
|
decoration: BoxDecoration( |
|
|
color: Colors.grey.withOpacity(0.1), |
|
|
color: isDarkMode ? Colors.grey[900]!.withOpacity(0.3) : Colors.grey.withOpacity(0.1), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
borderRadius: BorderRadius.circular(12.r), |
|
|
border: Border.all( |
|
|
border: Border.all( |
|
|
color: Colors.black12, |
|
|
color: isDarkMode ? Colors.grey[700]! : Colors.grey[300]!, |
|
|
width: 1, |
|
|
width: 1, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -508,14 +500,16 @@ class LoginView extends GetView<LoginController> { |
|
|
FocusScope.of(context).nextFocus(); |
|
|
FocusScope.of(context).nextFocus(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
decoration: const InputDecoration( |
|
|
decoration: InputDecoration( |
|
|
counterText: '', |
|
|
counterText: '', |
|
|
border: InputBorder.none, |
|
|
border: InputBorder.none, |
|
|
|
|
|
fillColor: Colors.transparent, |
|
|
|
|
|
filled: true, |
|
|
), |
|
|
), |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 24.sp, |
|
|
fontSize: 24.sp, |
|
|
fontWeight: FontWeight.w600, |
|
|
fontWeight: FontWeight.w600, |
|
|
color: Colors.black, |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -523,7 +517,7 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 重新发送验证码按钮 |
|
|
// 重新发送验证码按钮 |
|
|
Widget _buildResendButton() { |
|
|
Widget _buildResendButton(bool isDarkMode) { |
|
|
return Center( |
|
|
return Center( |
|
|
child: Obx(() => TextButton.icon( |
|
|
child: Obx(() => TextButton.icon( |
|
|
onPressed: controller.countdownSeconds > 0 |
|
|
onPressed: controller.countdownSeconds > 0 |
|
|
@ -533,8 +527,8 @@ class LoginView extends GetView<LoginController> { |
|
|
Icons.refresh, |
|
|
Icons.refresh, |
|
|
size: 14.sp, |
|
|
size: 14.sp, |
|
|
color: controller.countdownSeconds > 0 |
|
|
color: controller.countdownSeconds > 0 |
|
|
? Colors.black38 |
|
|
? (isDarkMode ? Colors.grey[600] : Colors.grey[500]) |
|
|
: const Color(0xFF0066CC), |
|
|
: const Color(0xFF3B82F6), |
|
|
), |
|
|
), |
|
|
label: Text( |
|
|
label: Text( |
|
|
controller.countdownSeconds > 0 |
|
|
controller.countdownSeconds > 0 |
|
|
@ -543,8 +537,8 @@ class LoginView extends GetView<LoginController> { |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: controller.countdownSeconds > 0 |
|
|
color: controller.countdownSeconds > 0 |
|
|
? Colors.black38 |
|
|
? (isDarkMode ? Colors.grey[600] : Colors.grey[500]) |
|
|
: const Color(0xFF0066CC), |
|
|
: const Color(0xFF3B82F6), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
)), |
|
|
)), |
|
|
@ -552,34 +546,36 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 登录按钮 |
|
|
// 登录按钮 |
|
|
Widget _buildLoginButton() { |
|
|
Widget _buildLoginButton(bool isDarkMode) { |
|
|
return SizedBox( |
|
|
return SizedBox( |
|
|
width: double.infinity, |
|
|
width: double.infinity, |
|
|
child: Obx(() => ElevatedButton( |
|
|
child: Obx(() => ElevatedButton( |
|
|
onPressed: controller.isLoading ? null : controller.login, |
|
|
onPressed: controller.isLoading ? null : controller.login, |
|
|
style: ElevatedButton.styleFrom( |
|
|
style: ElevatedButton.styleFrom( |
|
|
backgroundColor: const Color(0xFF0066CC), |
|
|
backgroundColor: const Color(0xFF3B82F6), |
|
|
padding: EdgeInsets.symmetric(vertical: 16.h), |
|
|
foregroundColor: Colors.white, |
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 14.h), |
|
|
shape: RoundedRectangleBorder( |
|
|
shape: RoundedRectangleBorder( |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
), |
|
|
), |
|
|
elevation: 0, |
|
|
elevation: 0, |
|
|
|
|
|
disabledBackgroundColor: const Color(0xFF3B82F6).withOpacity(0.7), |
|
|
|
|
|
disabledForegroundColor: Colors.white, |
|
|
), |
|
|
), |
|
|
child: controller.isLoading |
|
|
child: controller.isLoading |
|
|
? SizedBox( |
|
|
? SizedBox( |
|
|
width: 20.w, |
|
|
height: 20.h, |
|
|
height: 20.w, |
|
|
width: 20.h, |
|
|
child: const CircularProgressIndicator( |
|
|
child: CircularProgressIndicator( |
|
|
strokeWidth: 2, |
|
|
strokeWidth: 2.w, |
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white), |
|
|
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white), |
|
|
), |
|
|
), |
|
|
) |
|
|
) |
|
|
: Text( |
|
|
: Text( |
|
|
'登录', |
|
|
'登录', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 16.sp, |
|
|
fontSize: 16.sp, |
|
|
fontWeight: FontWeight.w500, |
|
|
fontWeight: FontWeight.w600, |
|
|
color: Colors.white, |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
)), |
|
|
)), |
|
|
@ -587,7 +583,7 @@ class LoginView extends GetView<LoginController> { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 使用密码登录按钮 |
|
|
// 使用密码登录按钮 |
|
|
Widget _buildUsePasswordButton() { |
|
|
Widget _buildUsePasswordButton(bool isDarkMode) { |
|
|
return Center( |
|
|
return Center( |
|
|
child: TextButton( |
|
|
child: TextButton( |
|
|
onPressed: controller.usePasswordLogin, |
|
|
onPressed: controller.usePasswordLogin, |
|
|
@ -595,7 +591,7 @@ class LoginView extends GetView<LoginController> { |
|
|
'使用密码登录', |
|
|
'使用密码登录', |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 14.sp, |
|
|
fontSize: 14.sp, |
|
|
color: const Color(0xFF0066CC), |
|
|
color: isDarkMode ? const Color(0xFF3B82F6) : const Color(0xFF3B82F6), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
|