refactor(client): 设置/外壳颜色迁移到 context.tokens

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-25 00:10:15 +08:00
parent 9c2a73c4b6
commit 8ef2424090
2 changed files with 102 additions and 102 deletions
+20 -20
View File
@@ -10,7 +10,7 @@ import '../../widgets/write_guard.dart';
import '../../core/config/app_config.dart';
import '../../core/config/license_copy.dart';
import '../../core/responsive/responsive.dart';
import '../../core/theme/app_theme.dart';
import '../../core/theme/context_tokens.dart';
import '../../providers/connectivity_provider.dart';
import '../../providers/session_heartbeat.dart';
import '../../providers/shop_provider.dart';
@@ -54,11 +54,11 @@ class _AppShellState extends ConsumerState<AppShell> {
builder: (ctx) => PopScope(
canPop: false,
child: AlertDialog(
title: const Row(
title: Row(
children: [
Icon(Icons.system_update, color: AppTheme.primary),
SizedBox(width: 8),
Text('发现新版本'),
Icon(Icons.system_update, color: context.tokens.primary),
const SizedBox(width: 8),
const Text('发现新版本'),
],
),
content: Text('发现新版本 v${info.latestVersion},需更新后才能继续使用,'
@@ -94,7 +94,7 @@ class _AppShellState extends ConsumerState<AppShell> {
final logoUrl = shopAsync.valueOrNull?.logoUrl ?? '';
return Drawer(
child: Container(
color: AppTheme.primaryDark,
color: context.tokens.primaryDark,
child: SafeArea(
child: Column(
children: [
@@ -102,7 +102,7 @@ class _AppShellState extends ConsumerState<AppShell> {
Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(16, 20, 16, 16),
color: AppTheme.primary,
color: context.tokens.primary,
child: Row(
children: [
_ShopLogo(logoUrl: logoUrl, shopName: shopName, size: 40),
@@ -206,7 +206,7 @@ class _AppShellState extends ConsumerState<AppShell> {
// Top Bar(高度含状态栏内边距,蓝色铺满到屏幕顶,内容下移避开状态栏)
Container(
height: 56 + topInset,
color: AppTheme.primary,
color: context.tokens.primary,
padding: EdgeInsets.only(top: topInset, left: 8, right: 8),
child: Row(
children: [
@@ -296,7 +296,7 @@ class _AppShellState extends ConsumerState<AppShell> {
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
width: sidebarWidth,
color: AppTheme.primaryDark,
color: context.tokens.primaryDark,
child: Column(
children: [
Expanded(
@@ -457,7 +457,7 @@ class _AppShellState extends ConsumerState<AppShell> {
if (!isOnline)
Container(
width: double.infinity,
color: AppTheme.danger,
color: context.tokens.danger,
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 6),
child: const Row(
@@ -493,7 +493,7 @@ class _AppShellState extends ConsumerState<AppShell> {
height: 28,
color: isOnline
? const Color(0xFF37474F)
: AppTheme.danger,
: context.tokens.danger,
padding:
const EdgeInsets.symmetric(horizontal: 12),
child: Row(
@@ -596,7 +596,7 @@ class _AppShellState extends ConsumerState<AppShell> {
void _showLicenseExpiryDialog(BuildContext ctx, LicenseInfo lic) {
final (title, body) = LicenseCopy.dialog(lic);
final Color titleColor =
lic.phase == 'grace' ? Colors.orange[800]! : AppTheme.danger;
lic.phase == 'grace' ? Colors.orange[800]! : ctx.tokens.danger;
showDialog(
context: ctx,
barrierDismissible: true,
@@ -651,7 +651,7 @@ class _SidebarItem extends StatelessWidget {
return SizedBox(
height: 48,
child: Material(
color: isActive ? AppTheme.primary.withAlpha(76) : Colors.transparent,
color: isActive ? context.tokens.primary.withAlpha(76) : Colors.transparent,
child: InkWell(
onTap: onTap,
hoverColor: Colors.white.withAlpha(13),
@@ -824,9 +824,9 @@ void _showShopPanel(BuildContext context, AuthUser u,
// Header
Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
decoration: const BoxDecoration(
color: AppTheme.primary,
borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
decoration: BoxDecoration(
color: context.tokens.primary,
borderRadius: const BorderRadius.vertical(top: Radius.circular(10)),
),
child: Row(
children: [
@@ -974,19 +974,19 @@ class _InfoRow extends StatelessWidget {
Widget build(BuildContext context) {
return Row(
children: [
Icon(icon, size: 16, color: AppTheme.textSecondary),
Icon(icon, size: 16, color: context.tokens.muted),
const SizedBox(width: 10),
SizedBox(
width: 72,
child: Text(label,
style:
const TextStyle(fontSize: 13, color: AppTheme.textSecondary)),
TextStyle(fontSize: 13, color: context.tokens.muted)),
),
Expanded(
child: Text(value,
style: const TextStyle(
style: TextStyle(
fontSize: 13,
color: AppTheme.textPrimary,
color: context.tokens.text,
fontWeight: FontWeight.w500)),
),
],