分区相关
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:cc_ui_kit/cc_ui_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/router/route_paths.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
@@ -29,6 +30,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: context.appColors.pageBackground,
|
||||
appBar: AppBar(
|
||||
@@ -46,7 +48,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
children: [
|
||||
const SizedBox(height: 40),
|
||||
Text(
|
||||
"账号注册",
|
||||
l10n.translate('register.title'),
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -55,29 +57,31 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"请填写以下信息完成注册",
|
||||
l10n.translate('register.subtitle'),
|
||||
style: TextStyle(fontSize: 15, color: context.appColors.textTertiary),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
|
||||
_buildInputLabel("用户名"),
|
||||
_buildInputLabel(l10n.translate('register.username')),
|
||||
TextField(
|
||||
controller: _userCtrl,
|
||||
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
|
||||
cursorColor: context.appColors.textPrimary,
|
||||
decoration: _inputDecoration(hint: "请设置用户名"),
|
||||
decoration: _inputDecoration(
|
||||
hint: l10n.translate('register.username_hint'),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildInputLabel("密码"),
|
||||
_buildInputLabel(l10n.translate('register.password')),
|
||||
TextField(
|
||||
controller: _pwdCtrl,
|
||||
obscureText: _obscurePwd,
|
||||
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
|
||||
cursorColor: context.appColors.textPrimary,
|
||||
decoration: _inputDecoration(
|
||||
hint: "请设置密码",
|
||||
hint: l10n.translate('register.password_hint'),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscurePwd
|
||||
@@ -93,14 +97,14 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_buildInputLabel("确认密码"),
|
||||
_buildInputLabel(l10n.translate('register.confirm_password')),
|
||||
TextField(
|
||||
controller: _confirmPwdCtrl,
|
||||
obscureText: _obscureConfirmPwd,
|
||||
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
|
||||
cursorColor: context.appColors.textPrimary,
|
||||
decoration: _inputDecoration(
|
||||
hint: "请再次输入密码",
|
||||
hint: l10n.translate('register.confirm_password_hint'),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscureConfirmPwd
|
||||
@@ -126,7 +130,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
width: double.infinity,
|
||||
child: CCPrimaryButton(
|
||||
onPressed: _isAgreed ? _handleRegister : null,
|
||||
text: '注 册',
|
||||
text: l10n.translate('register.submit'),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -137,13 +141,13 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"已有账号?",
|
||||
l10n.translate('register.has_account'),
|
||||
style: TextStyle(fontSize: 14, color: context.appColors.textTertiary),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => context.go(RoutePaths.login),
|
||||
child: Text(
|
||||
"立即登录",
|
||||
l10n.translate('register.login_now'),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: context.appColors.textPrimary,
|
||||
@@ -163,22 +167,23 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
}
|
||||
|
||||
void _handleRegister() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
if (_userCtrl.text.isEmpty || _pwdCtrl.text.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('请填写完整信息')),
|
||||
SnackBar(content: Text(l10n.translate('register.incomplete'))),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_pwdCtrl.text != _confirmPwdCtrl.text) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('两次输入的密码不一致')),
|
||||
SnackBar(content: Text(l10n.translate('register.password_mismatch'))),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('注册功能开发中...')),
|
||||
SnackBar(content: Text(l10n.translate('register.developing'))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -216,6 +221,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
}
|
||||
|
||||
Widget _buildProtocolSection() {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@@ -238,12 +244,21 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
child: Wrap(
|
||||
children: [
|
||||
Text(
|
||||
"我已阅读并同意 ",
|
||||
l10n.translate('login.agree_prefix'),
|
||||
style: TextStyle(fontSize: 13, color: context.appColors.textTertiary),
|
||||
),
|
||||
_protocolText("《用户协议》", () => _showProtocolDetail("用户协议")),
|
||||
Text(" 和 ", style: TextStyle(fontSize: 13, color: context.appColors.textTertiary)),
|
||||
_protocolText("《隐私政策》", () => _showProtocolDetail("隐私政策")),
|
||||
_protocolText(
|
||||
l10n.translate('login.user_agreement_link'),
|
||||
() => _showProtocolDetail(l10n.translate('my.user_agreement')),
|
||||
),
|
||||
Text(
|
||||
l10n.translate('login.agree_and'),
|
||||
style: TextStyle(fontSize: 13, color: context.appColors.textTertiary),
|
||||
),
|
||||
_protocolText(
|
||||
l10n.translate('login.privacy_policy_link'),
|
||||
() => _showProtocolDetail(l10n.translate('my.privacy_policy')),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -266,6 +281,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
}
|
||||
|
||||
void _showProtocolDetail(String title) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
@@ -286,7 +302,8 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
"此处放置您的${title}详细内容...\n" * 20,
|
||||
'${l10n.translate('login.protocol_detail_text').replaceAll('%s', title)}\n' *
|
||||
20,
|
||||
style: TextStyle(color: context.appColors.textSecondary, height: 1.5),
|
||||
),
|
||||
),
|
||||
@@ -296,7 +313,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
width: double.infinity,
|
||||
child: CCPrimaryButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
text: "我已了解",
|
||||
text: l10n.translate('login.understood'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user