重整多余的UI组件和未定功能的逻辑链路的修正
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/components/app_logo.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/locale_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/components/language_selection_dialog.dart';
|
||||
@@ -14,9 +15,9 @@ import '../bloc/login_state.dart';
|
||||
///
|
||||
/// 说明:
|
||||
/// - 视觉:背景纵向浅蓝渐变、主按钮横向蓝色渐变胶囊、顶部 logo + 语言胶囊、
|
||||
/// 中部机器人 Hero 卡片、白色表单卡片内含「登录 / 注册」分段 Tab。
|
||||
/// 中部机器人 Hero 卡片、白色登录表单卡片。
|
||||
/// - 逻辑:完全复用现有 [LoginCubit](账号密码登录,sourceType=2),未改动数据层。
|
||||
/// - 「注册」暂不支持:点击注册 Tab 仅弹出胶囊提示,不跳转。
|
||||
/// - 上架版暂时隐藏注册入口。
|
||||
/// - 旧登录页 login_page.dart 原样保留,路由默认指向本页。
|
||||
class LoginPageV2 extends StatefulWidget {
|
||||
const LoginPageV2({super.key});
|
||||
@@ -104,6 +105,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: _bgTop,
|
||||
body: DecoratedBox(
|
||||
@@ -174,9 +176,9 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'欢迎使用飒沓机器人',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('login.welcome_title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _navy,
|
||||
@@ -184,9 +186,9 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'统一管理您的机器人设备',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
l10n.translate('login.welcome_subtitle'),
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: _grayText,
|
||||
),
|
||||
@@ -206,12 +208,12 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
animation: _interval(0.26, 0.63),
|
||||
child: _buildFormCard(),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 帮助与客服
|
||||
_Entrance(
|
||||
animation: _interval(0.40, 0.75),
|
||||
child: Center(child: _buildHelpRow()),
|
||||
),
|
||||
// 暂时隐藏登录页的帮助与客服入口。
|
||||
// const SizedBox(height: 12),
|
||||
// _Entrance(
|
||||
// animation: _interval(0.40, 0.75),
|
||||
// child: Center(child: _buildHelpRow()),
|
||||
// ),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
@@ -239,14 +241,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
// 中文用国内版 logo,英文用英文专版 logo(随语言切换实时更新)
|
||||
locale.languageCode == 'zh'
|
||||
? 'assets/images/logo_sata.png'
|
||||
: 'assets/images/logo_stata-en.png',
|
||||
height: 40,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const AppLogo(size: 40),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
@@ -294,7 +289,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/robot_logo_login.png',
|
||||
'assets/images/img.png',
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
// 底部渐变遮罩,衬托文字
|
||||
@@ -310,12 +305,12 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
),
|
||||
),
|
||||
),
|
||||
const Positioned(
|
||||
Positioned(
|
||||
left: 12,
|
||||
bottom: 8,
|
||||
child: Text(
|
||||
'SMART ROBOTICS · CONNECTED',
|
||||
style: TextStyle(
|
||||
AppLocalizations.of(context).translate('login.hero_caption'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 11,
|
||||
letterSpacing: 1.5,
|
||||
@@ -331,6 +326,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
|
||||
// ===== 白色表单卡片 =====
|
||||
Widget _buildFormCard() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 18),
|
||||
@@ -351,21 +347,21 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
_buildSegmentTab(),
|
||||
const SizedBox(height: 14),
|
||||
// 账号
|
||||
_buildFieldLabel('账号'),
|
||||
_buildFieldLabel(l10n.translate('login.username')),
|
||||
const SizedBox(height: 6),
|
||||
_buildTextField(
|
||||
controller: _userCtrl,
|
||||
icon: Icons.person_outline,
|
||||
hint: AppLocalizations.of(context).translate('login.username_hint'),
|
||||
hint: l10n.translate('login.username_hint'),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 密码
|
||||
_buildFieldLabel('密码'),
|
||||
_buildFieldLabel(l10n.translate('login.password')),
|
||||
const SizedBox(height: 6),
|
||||
_buildTextField(
|
||||
controller: _pwdCtrl,
|
||||
icon: Icons.lock_outline,
|
||||
hint: AppLocalizations.of(context).translate('login.password_hint'),
|
||||
hint: l10n.translate('login.password_hint'),
|
||||
obscureText: _obscurePwd,
|
||||
suffix: IconButton(
|
||||
icon: Icon(
|
||||
@@ -380,6 +376,8 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildProtocolSection(),
|
||||
// 注册入口隐藏时同时隐藏注册专用协议提示。
|
||||
/*
|
||||
const SizedBox(height: 4),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 32),
|
||||
@@ -388,6 +386,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
style: const TextStyle(fontSize: 12, color: _grayText),
|
||||
),
|
||||
),
|
||||
*/
|
||||
const SizedBox(height: 14),
|
||||
// 登录按钮
|
||||
BlocBuilder<LoginCubit, LoginState>(
|
||||
@@ -427,8 +426,13 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: _buildTabItem(0, '登录')),
|
||||
Expanded(child: _buildTabItem(1, '注册')),
|
||||
Expanded(
|
||||
child: _buildTabItem(
|
||||
0,
|
||||
AppLocalizations.of(context).translate('login.title'),
|
||||
),
|
||||
),
|
||||
// Expanded(child: _buildTabItem(1, '注册')),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -571,6 +575,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Widget _buildHelpRow() {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -587,6 +592,7 @@ class _LoginPageV2State extends State<LoginPageV2>
|
||||
],
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
void _showProtocolDetail(String title) {
|
||||
showModalBottomSheet(
|
||||
@@ -659,6 +665,7 @@ class _GradientButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final enabled = !isLoading;
|
||||
return Opacity(
|
||||
opacity: enabled ? 1 : 0.7,
|
||||
@@ -693,15 +700,18 @@ class _GradientButton extends StatelessWidget {
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
: const Row(
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.arrow_forward_rounded,
|
||||
size: 20, color: Colors.white),
|
||||
SizedBox(width: 8),
|
||||
const Icon(
|
||||
Icons.arrow_forward_rounded,
|
||||
size: 20,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'登录',
|
||||
style: TextStyle(
|
||||
l10n.translate('login.login_button'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:maibu_satabot_v2/features/auth/presentation/pages/login_page_v2.
|
||||
// 旧登录页保留备用:如需回退,将下方 LoginPageV2 换回 LoginPage 并恢复对应 import。
|
||||
// import 'package:maibu_satabot_v2/features/auth/presentation/pages/login_page.dart';
|
||||
|
||||
import '../pages/register_page.dart';
|
||||
// import '../pages/register_page.dart';
|
||||
import '../pages/splash_page.dart';
|
||||
|
||||
class AuthRoutes {
|
||||
@@ -20,7 +20,9 @@ class AuthRoutes {
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutePaths.register,
|
||||
builder: (context, state) => const RegisterPage(),
|
||||
// 上架版关闭注册,旧链接跳转到登录页。
|
||||
// builder: (context, state) => const RegisterPage(),
|
||||
redirect: (context, state) => RoutePaths.login,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user