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
@@ -5,7 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../core/models/page_result.dart';
import '../../core/responsive/responsive.dart';
import '../../core/config/app_constants.dart';
import '../../core/theme/app_theme.dart';
import '../../core/theme/context_tokens.dart';
import '../../models/partner.dart';
import '../../providers/partner_provider.dart';
import '../../widgets/data_table_card.dart';
@@ -59,10 +59,10 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.cloud_off, size: 40, color: AppTheme.textSecondary),
Icon(Icons.cloud_off, size: 40, color: context.tokens.muted),
const SizedBox(height: 12),
const Text('暂无数据,网络不可用',
style: const TextStyle(color: AppTheme.textSecondary)),
Text('暂无数据,网络不可用',
style: TextStyle(color: context.tokens.muted)),
const SizedBox(height: 12),
ElevatedButton(
onPressed: () =>
@@ -102,10 +102,10 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.cloud_off, size: 40, color: AppTheme.textSecondary),
Icon(Icons.cloud_off, size: 40, color: context.tokens.muted),
const SizedBox(height: 12),
const Text('暂无数据,网络不可用',
style: const TextStyle(color: AppTheme.textSecondary)),
Text('暂无数据,网络不可用',
style: TextStyle(color: context.tokens.muted)),
const SizedBox(height: 12),
ElevatedButton(
onPressed: () =>
@@ -159,8 +159,8 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
style: TextStyle(
fontSize: 12,
color: p.status == 'enabled'
? AppTheme.success
: AppTheme.textSecondary,
? context.tokens.success
: context.tokens.muted,
),
),
fields: [
@@ -182,8 +182,8 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
child: TextButton(
key: Key('btn_delete_${p.id}'),
onPressed: () => onDelete(p),
child: const Text('删除',
style: TextStyle(fontSize: 13, color: AppTheme.danger)),
child: Text('删除',
style: TextStyle(fontSize: 13, color: context.tokens.danger)),
),
),
],
@@ -251,7 +251,7 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
const DataCell(SizedBox()),
DataCell(Text(isSupplier ? '暂无供应商' : '暂无客户',
style:
const TextStyle(color: AppTheme.textSecondary))),
TextStyle(color: context.tokens.muted))),
const DataCell(SizedBox()),
const DataCell(SizedBox()),
const DataCell(SizedBox()),
@@ -263,10 +263,10 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
.map((p) => DataRow(
cells: [
DataCell(Text(p.code ?? '-',
style: const TextStyle(
style: TextStyle(
fontFamily: 'monospace',
fontSize: 12,
color: AppTheme.textSecondary))),
color: context.tokens.muted))),
DataCell(SizedBox(
width: 180,
child: Text(p.name,
@@ -286,8 +286,8 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
style: TextStyle(
fontSize: 13,
color: p.status == 'enabled'
? AppTheme.success
: AppTheme.textSecondary,
? context.tokens.success
: context.tokens.muted,
),
)),
DataCell(Row(
@@ -307,10 +307,10 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
child: TextButton(
key: Key('btn_delete_${p.id}'),
onPressed: () => onDelete(p),
child: const Text('删除',
child: Text('删除',
style: TextStyle(
fontSize: 12,
color: AppTheme.danger)),
color: context.tokens.danger)),
),
),
],
@@ -354,7 +354,7 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
ElevatedButton(
onPressed: () => Navigator.of(ctx).pop(true),
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.danger,
backgroundColor: context.tokens.danger,
foregroundColor: Colors.white),
child: const Text('删除'),
),
@@ -373,15 +373,15 @@ class _PartnersScreenState extends ConsumerState<PartnersScreen> {
.deletePartner(partner.id);
}
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('删除成功'),
backgroundColor: AppTheme.success));
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: const Text('删除成功'),
backgroundColor: context.tokens.success));
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('删除失败:$e'),
backgroundColor: AppTheme.danger));
backgroundColor: context.tokens.danger));
}
}
}
@@ -466,7 +466,7 @@ class _PartnerFormDialogState extends ConsumerState<_PartnerFormDialog> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(widget.partner != null ? '更新成功' : '创建成功'),
backgroundColor: AppTheme.success,
backgroundColor: context.tokens.success,
),
);
}
@@ -475,7 +475,7 @@ class _PartnerFormDialogState extends ConsumerState<_PartnerFormDialog> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('保存失败:$e'),
backgroundColor: AppTheme.danger),
backgroundColor: context.tokens.danger),
);
}
} finally {