refactor(client): 往来/设备/登录/关于颜色迁移到 context.tokens

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-25 00:20:11 +08:00
parent 8ef2424090
commit 6570ac792c
6 changed files with 99 additions and 97 deletions
+33 -33
View File
@@ -9,7 +9,7 @@ import 'package:url_launcher/url_launcher.dart';
import '../../core/auth/auth_state.dart';
import '../../core/config/app_config.dart';
import '../../core/config/app_constants.dart';
import '../../core/theme/app_theme.dart';
import '../../core/theme/context_tokens.dart';
import '../../core/storage/login_history.dart';
import '../../providers/connectivity_provider.dart';
import '../../repositories/auth_repository.dart';
@@ -111,7 +111,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
showDialog<void>(
context: context,
builder: (ctx) => AlertDialog(
icon: const Icon(Icons.lock_outline, color: AppTheme.danger),
icon: Icon(Icons.lock_outline, color: context.tokens.danger),
title: const Text('登录已失效'),
content: Text(msg),
actions: [
@@ -305,23 +305,23 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
width: double.infinity,
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: AppTheme.danger.withAlpha(15),
color: context.tokens.danger.withAlpha(15),
borderRadius: BorderRadius.circular(6),
border: Border.all(color: AppTheme.danger.withAlpha(80)),
border: Border.all(color: context.tokens.danger.withAlpha(80)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Icon(Icons.lock_clock_outlined,
color: AppTheme.danger, size: 18),
SizedBox(width: 8),
color: context.tokens.danger, size: 18),
const SizedBox(width: 8),
Expanded(
child: Text(
'授权已过期,账号已锁定',
style: TextStyle(
color: AppTheme.danger,
color: context.tokens.danger,
fontSize: 14,
fontWeight: FontWeight.w600),
),
@@ -329,10 +329,10 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
],
),
const SizedBox(height: 6),
const Text(
Text(
'当前门店授权已到期,暂时无法登录。请续费授权后重试,或联系客服协助开通。',
style: TextStyle(
color: AppTheme.textSecondary, fontSize: 13, height: 1.4),
color: context.tokens.muted, fontSize: 13, height: 1.4),
),
const SizedBox(height: 12),
Wrap(
@@ -344,7 +344,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
icon: const Icon(Icons.open_in_new, size: 16),
label: const Text('前往官网续费'),
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.danger,
backgroundColor: context.tokens.danger,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: 14, vertical: 10),
@@ -357,8 +357,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
icon: const Icon(Icons.support_agent_outlined, size: 16),
label: const Text('复制客服邮箱'),
style: OutlinedButton.styleFrom(
foregroundColor: AppTheme.danger,
side: BorderSide(color: AppTheme.danger.withAlpha(120)),
foregroundColor: context.tokens.danger,
side: BorderSide(color: context.tokens.danger.withAlpha(120)),
padding: const EdgeInsets.symmetric(
horizontal: 14, vertical: 10),
shape: RoundedRectangleBorder(
@@ -384,7 +384,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
}
});
return Scaffold(
backgroundColor: AppTheme.primaryDark,
backgroundColor: context.tokens.primaryDark,
body: Stack(
children: [
Positioned.fill(
@@ -419,7 +419,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: AppTheme.primary.withAlpha(102),
color: context.tokens.primary.withAlpha(102),
blurRadius: 12,
offset: const Offset(0, 4),
),
@@ -436,21 +436,21 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
),
),
const SizedBox(height: 20),
const Text(
Text(
'岩美酒库',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w700,
color: AppTheme.primaryDark,
color: context.tokens.primaryDark,
letterSpacing: 1,
),
),
const SizedBox(height: 6),
const Text(
Text(
'专业酒水仓储 · 进销存一体化管理',
style: TextStyle(
fontSize: 13,
color: AppTheme.textSecondary),
color: context.tokens.muted),
),
const SizedBox(height: 32),
@@ -470,7 +470,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
_hotelShowing
? Icons.arrow_drop_up
: Icons.arrow_drop_down,
color: AppTheme.textSecondary,
color: context.tokens.muted,
)
: null,
),
@@ -499,7 +499,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
_usernameShowing
? Icons.arrow_drop_up
: Icons.arrow_drop_down,
color: AppTheme.textSecondary,
color: context.tokens.muted,
)
: null,
),
@@ -583,21 +583,21 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 10),
decoration: BoxDecoration(
color: AppTheme.danger.withAlpha(15),
color: context.tokens.danger.withAlpha(15),
borderRadius: BorderRadius.circular(4),
border: Border.all(
color: AppTheme.danger.withAlpha(80)),
color: context.tokens.danger.withAlpha(80)),
),
child: Row(
children: [
const Icon(Icons.error_outline,
color: AppTheme.danger, size: 16),
Icon(Icons.error_outline,
color: context.tokens.danger, size: 16),
const SizedBox(width: 8),
Expanded(
child: Text(
_errorMessage!,
style: const TextStyle(
color: AppTheme.danger,
style: TextStyle(
color: context.tokens.danger,
fontSize: 13),
),
),
@@ -637,11 +637,11 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
Uri.parse('${AppConfig.publicBaseUrl}/register/'),
mode: LaunchMode.externalApplication,
),
child: const Text(
child: Text(
'还没有门店账号?前往官网注册',
style: TextStyle(
fontSize: 15,
color: AppTheme.textSecondary,
color: context.tokens.muted,
),
),
),
@@ -721,14 +721,14 @@ class _HistoryMenuItemState extends State<_HistoryMenuItem> {
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
child: Row(
children: [
const Icon(Icons.history,
size: 14, color: AppTheme.textSecondary),
Icon(Icons.history,
size: 14, color: context.tokens.muted),
const SizedBox(width: 8),
Text(
widget.value,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
color: AppTheme.textPrimary,
color: context.tokens.text,
),
),
],