and so on

This commit is contained in:
2026-08-18 08:52:33 +08:00
parent 87609c7dc4
commit ab75e8c5b0
56 changed files with 1816 additions and 1146 deletions

View File

@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
import 'package:maibu_satabot_v2/core/di/injection.dart';
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
import 'package:maibu_satabot_v2/features/devices/presentation/bloc/devices_cubit.dart';
import '../../../../core/router/route_paths.dart';
@@ -33,9 +34,9 @@ class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: context.appColors.pageBackground,
// 保持 AppBar 简洁或直接去掉
appBar: AppBar(backgroundColor: Colors.white, elevation: 0),
appBar: AppBar(backgroundColor: context.appColors.pageBackground, elevation: 0),
body: BlocListener<LoginCubit, LoginState>(
listener: (context, state) {
debugPrint('🔍 [LOGIN] 登录状态变化: $state');
@@ -81,7 +82,7 @@ class _LoginPageState extends State<LoginPage> {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 10,
color: Colors.grey.shade600,
color: context.appColors.textTertiary,
height: 1.3,
),
),
@@ -91,12 +92,12 @@ class _LoginPageState extends State<LoginPage> {
),
const SizedBox(height: 16),
const Text(
Text(
"账号登录v1.1.5",
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: Colors.brown),
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: context.appColors.textPrimary),
),
const SizedBox(height: 8),
const Text("请填写以下信息以验证身份", style: TextStyle(fontSize: 15, color: Colors.grey)),
Text("请填写以下信息以验证身份", style: TextStyle(fontSize: 15, color: context.appColors.textTertiary)),
const SizedBox(height: 24),
// 表单区域
@@ -104,7 +105,8 @@ class _LoginPageState extends State<LoginPage> {
_buildInputLabel("账号"),
TextField(
controller: _userCtrl,
cursorColor: Colors.black,
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
cursorColor: context.appColors.textPrimary,
decoration: _inputDecoration(hint: "请输入用户名"),
),
@@ -115,11 +117,12 @@ class _LoginPageState extends State<LoginPage> {
TextField(
controller: _pwdCtrl,
obscureText: _obscurePwd,
cursorColor: Colors.black,
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
cursorColor: context.appColors.textPrimary,
decoration: _inputDecoration(
hint: "请输入密码",
suffixIcon: IconButton(
icon: Icon(_obscurePwd ? Icons.visibility_off_outlined : Icons.visibility_outlined, color: Colors.grey, size: 20),
icon: Icon(_obscurePwd ? Icons.visibility_off_outlined : Icons.visibility_outlined, color: context.appColors.textTertiary, size: 20),
onPressed: () => setState(() => _obscurePwd = !_obscurePwd),
),
),
@@ -165,9 +168,9 @@ class _LoginPageState extends State<LoginPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
Text(
"没有账号吗?",
style: TextStyle(fontSize: 14, color: Colors.grey),
style: TextStyle(fontSize: 14, color: context.appColors.textTertiary),
),
InkWell(
onTap: () {
@@ -182,7 +185,7 @@ class _LoginPageState extends State<LoginPage> {
"立即注册",
style: TextStyle(
fontSize: 14,
color: Colors.black,
color: context.appColors.textPrimary,
fontWeight: FontWeight.bold,
),
),
@@ -218,7 +221,7 @@ class _LoginPageState extends State<LoginPage> {
Widget _buildInputLabel(String label) {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(label, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w600)),
child: Text(label, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: context.appColors.textSecondary)),
);
}
@@ -226,17 +229,17 @@ class _LoginPageState extends State<LoginPage> {
InputDecoration _inputDecoration({required String hint, Widget? suffixIcon}) {
return InputDecoration(
hintText: hint,
hintStyle: TextStyle(color: Colors.grey.shade400, fontSize: 14),
hintStyle: TextStyle(color: context.appColors.textTertiary, fontSize: 14),
filled: true,
fillColor: Colors.grey.shade50,
fillColor: context.appColors.fillBackground,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: Colors.grey.shade200),
borderSide: BorderSide(color: context.appColors.divider),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: const BorderSide(color: Colors.black, width: 1),
borderSide: BorderSide(color: context.appColors.primary, width: 1),
),
suffixIcon: suffixIcon,
);
@@ -252,7 +255,9 @@ class _LoginPageState extends State<LoginPage> {
width: 24,
child: Checkbox(
value: _isAgreed,
activeColor: Colors.black,
activeColor: context.appColors.primary,
checkColor: Colors.white,
side: BorderSide(color: context.appColors.divider),
onChanged: (val) => setState(() => _isAgreed = val!),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)),
),
@@ -261,9 +266,9 @@ class _LoginPageState extends State<LoginPage> {
Expanded(
child: Wrap(
children: [
const Text("我已阅读并同意 ", style: TextStyle(fontSize: 13, color: Colors.grey)),
Text("我已阅读并同意 ", style: TextStyle(fontSize: 13, color: context.appColors.textTertiary)),
_protocolText("《用户协议》", () => _showProtocolDetail("用户协议")),
const Text(" 和 ", style: TextStyle(fontSize: 13, color: Colors.grey)),
Text(" 和 ", style: TextStyle(fontSize: 13, color: context.appColors.textTertiary)),
_protocolText("《隐私政策》", () => _showProtocolDetail("隐私政策")),
],
),
@@ -277,7 +282,7 @@ class _LoginPageState extends State<LoginPage> {
onTap: onTap,
child: Text(
text,
style: const TextStyle(fontSize: 13, color: Colors.black, fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 13, color: context.appColors.textPrimary, fontWeight: FontWeight.bold),
),
);
}
@@ -286,18 +291,18 @@ class _LoginPageState extends State<LoginPage> {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.white,
backgroundColor: context.appColors.cardBackground,
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
builder: (context) => Container(
padding: const EdgeInsets.all(24),
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
children: [
Text(title, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
const Divider(height: 32),
Text(title, style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: context.appColors.textPrimary)),
Divider(height: 32, color: context.appColors.divider),
Expanded(
child: SingleChildScrollView(
child: Text("此处放置您的${title}详细内容...\n" * 20, style: const TextStyle(color: Colors.black87, height: 1.5)),
child: Text("此处放置您的${title}详细内容...\n" * 20, style: TextStyle(color: context.appColors.textSecondary, height: 1.5)),
),
),
const SizedBox(height: 16),

View File

@@ -2,6 +2,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/router/route_paths.dart';
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
class RegisterPage extends StatefulWidget {
const RegisterPage({super.key});
@@ -29,12 +30,12 @@ class _RegisterPageState extends State<RegisterPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: context.appColors.pageBackground,
appBar: AppBar(
backgroundColor: Colors.white,
backgroundColor: context.appColors.pageBackground,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
icon: Icon(Icons.arrow_back, color: context.appColors.textPrimary),
onPressed: () => context.go(RoutePaths.login),
),
),
@@ -44,25 +45,26 @@ class _RegisterPageState extends State<RegisterPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 40),
const Text(
Text(
"账号注册",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.black,
color: context.appColors.textPrimary,
),
),
const SizedBox(height: 12),
const Text(
Text(
"请填写以下信息完成注册",
style: TextStyle(fontSize: 15, color: Colors.grey),
style: TextStyle(fontSize: 15, color: context.appColors.textTertiary),
),
const SizedBox(height: 40),
_buildInputLabel("用户名"),
TextField(
controller: _userCtrl,
cursorColor: Colors.black,
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
cursorColor: context.appColors.textPrimary,
decoration: _inputDecoration(hint: "请设置用户名"),
),
@@ -72,7 +74,8 @@ class _RegisterPageState extends State<RegisterPage> {
TextField(
controller: _pwdCtrl,
obscureText: _obscurePwd,
cursorColor: Colors.black,
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
cursorColor: context.appColors.textPrimary,
decoration: _inputDecoration(
hint: "请设置密码",
suffixIcon: IconButton(
@@ -80,7 +83,7 @@ class _RegisterPageState extends State<RegisterPage> {
_obscurePwd
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
color: Colors.grey,
color: context.appColors.textTertiary,
size: 20,
),
onPressed: () => setState(() => _obscurePwd = !_obscurePwd),
@@ -94,7 +97,8 @@ class _RegisterPageState extends State<RegisterPage> {
TextField(
controller: _confirmPwdCtrl,
obscureText: _obscureConfirmPwd,
cursorColor: Colors.black,
style: TextStyle(fontSize: 14, color: context.appColors.textPrimary),
cursorColor: context.appColors.textPrimary,
decoration: _inputDecoration(
hint: "请再次输入密码",
suffixIcon: IconButton(
@@ -102,7 +106,7 @@ class _RegisterPageState extends State<RegisterPage> {
_obscureConfirmPwd
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
color: Colors.grey,
color: context.appColors.textTertiary,
size: 20,
),
onPressed: () => setState(
@@ -132,17 +136,17 @@ class _RegisterPageState extends State<RegisterPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
Text(
"已有账号?",
style: TextStyle(fontSize: 14, color: Colors.grey),
style: TextStyle(fontSize: 14, color: context.appColors.textTertiary),
),
GestureDetector(
onTap: () => context.go(RoutePaths.login),
child: const Text(
child: Text(
"立即登录",
style: TextStyle(
fontSize: 14,
color: Colors.black,
color: context.appColors.textPrimary,
fontWeight: FontWeight.bold,
),
),
@@ -183,9 +187,10 @@ class _RegisterPageState extends State<RegisterPage> {
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
label,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: context.appColors.textSecondary,
),
),
);
@@ -194,17 +199,17 @@ class _RegisterPageState extends State<RegisterPage> {
InputDecoration _inputDecoration({required String hint, Widget? suffixIcon}) {
return InputDecoration(
hintText: hint,
hintStyle: TextStyle(color: Colors.grey.shade400, fontSize: 14),
hintStyle: TextStyle(color: context.appColors.textTertiary, fontSize: 14),
filled: true,
fillColor: Colors.grey.shade50,
fillColor: context.appColors.fillBackground,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(color: Colors.grey.shade200),
borderSide: BorderSide(color: context.appColors.divider),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: const BorderSide(color: Colors.black, width: 1),
borderSide: BorderSide(color: context.appColors.primary, width: 1),
),
suffixIcon: suffixIcon,
);
@@ -219,7 +224,9 @@ class _RegisterPageState extends State<RegisterPage> {
width: 24,
child: Checkbox(
value: _isAgreed,
activeColor: Colors.black,
activeColor: context.appColors.primary,
checkColor: Colors.white,
side: BorderSide(color: context.appColors.divider),
onChanged: (val) => setState(() => _isAgreed = val!),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4),
@@ -230,12 +237,12 @@ class _RegisterPageState extends State<RegisterPage> {
Expanded(
child: Wrap(
children: [
const Text(
Text(
"我已阅读并同意 ",
style: TextStyle(fontSize: 13, color: Colors.grey),
style: TextStyle(fontSize: 13, color: context.appColors.textTertiary),
),
_protocolText("《用户协议》", () => _showProtocolDetail("用户协议")),
const Text(" 和 ", style: TextStyle(fontSize: 13, color: Colors.grey)),
Text(" 和 ", style: TextStyle(fontSize: 13, color: context.appColors.textTertiary)),
_protocolText("《隐私政策》", () => _showProtocolDetail("隐私政策")),
],
),
@@ -249,9 +256,9 @@ class _RegisterPageState extends State<RegisterPage> {
onTap: onTap,
child: Text(
text,
style: const TextStyle(
style: TextStyle(
fontSize: 13,
color: Colors.black,
color: context.appColors.textPrimary,
fontWeight: FontWeight.bold,
),
),
@@ -262,7 +269,7 @@ class _RegisterPageState extends State<RegisterPage> {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.white,
backgroundColor: context.appColors.cardBackground,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
@@ -273,14 +280,14 @@ class _RegisterPageState extends State<RegisterPage> {
children: [
Text(
title,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: context.appColors.textPrimary),
),
const Divider(height: 32),
Divider(height: 32, color: context.appColors.divider),
Expanded(
child: SingleChildScrollView(
child: Text(
"此处放置您的${title}详细内容...\n" * 20,
style: const TextStyle(color: Colors.black87, height: 1.5),
style: TextStyle(color: context.appColors.textSecondary, height: 1.5),
),
),
),