From 6f9253e0219007e890f45e8a5ab4c7fe4fb90350 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Wed, 24 Jun 2026 23:36:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(client):=20=E5=85=A5=E5=BA=93=E5=9F=9F?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=BF=81=E7=A7=BB=E5=88=B0=20context.tokens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- .../stock_in/stock_in_form_screen.dart | 104 +++++++-------- .../stock_in/stock_in_list_screen.dart | 118 +++++++++--------- 2 files changed, 111 insertions(+), 111 deletions(-) diff --git a/client/lib/screens/stock_in/stock_in_form_screen.dart b/client/lib/screens/stock_in/stock_in_form_screen.dart index 8e798c7..e5064a8 100644 --- a/client/lib/screens/stock_in/stock_in_form_screen.dart +++ b/client/lib/screens/stock_in/stock_in_form_screen.dart @@ -3,7 +3,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../core/responsive/responsive.dart'; import 'package:go_router/go_router.dart'; -import '../../core/theme/app_theme.dart'; +import '../../core/theme/context_tokens.dart'; import '../../core/auth/auth_state.dart'; import '../../core/utils/date_util.dart'; import '../../widgets/order_print_preview_dialog.dart'; @@ -165,7 +165,7 @@ class _StockInFormScreenState extends ConsumerState { } catch (e) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('加载失败:$e'), backgroundColor: AppTheme.danger), + SnackBar(content: Text('加载失败:$e'), backgroundColor: context.tokens.danger), ); } } finally { @@ -234,15 +234,15 @@ class _StockInFormScreenState extends ConsumerState { if (!asDraft && !_formKey.currentState!.validate()) return; if (_warehouseId == null) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('请选择入库仓库'), backgroundColor: AppTheme.danger), + SnackBar( + content: const Text('请选择入库仓库'), backgroundColor: context.tokens.danger), ); return; } if (_items.isEmpty) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('请添加商品明细'), backgroundColor: AppTheme.danger), + SnackBar( + content: const Text('请添加商品明细'), backgroundColor: context.tokens.danger), ); return; } @@ -252,7 +252,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${invalidQtyIndex + 1} 行数量必须大于 0'), - backgroundColor: AppTheme.danger, + backgroundColor: context.tokens.danger, ), ); return; @@ -261,8 +261,8 @@ class _StockInFormScreenState extends ConsumerState { if (!asDraft) { if (_partnerId == null) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('请选择供应商'), backgroundColor: AppTheme.danger), + SnackBar( + content: const Text('请选择供应商'), backgroundColor: context.tokens.danger), ); return; } @@ -272,7 +272,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${i + 1} 行请选择商品名称'), - backgroundColor: AppTheme.danger), + backgroundColor: context.tokens.danger), ); return; } @@ -280,7 +280,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${i + 1} 行请选择系列'), - backgroundColor: AppTheme.danger), + backgroundColor: context.tokens.danger), ); return; } @@ -288,7 +288,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${i + 1} 行请选择规格'), - backgroundColor: AppTheme.danger), + backgroundColor: context.tokens.danger), ); return; } @@ -296,7 +296,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${i + 1} 行请填写生产日期'), - backgroundColor: AppTheme.danger), + backgroundColor: context.tokens.danger), ); return; } @@ -304,7 +304,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text('第 ${i + 1} 行请填写批次号'), - backgroundColor: AppTheme.danger), + backgroundColor: context.tokens.danger), ); return; } @@ -324,8 +324,8 @@ class _StockInFormScreenState extends ConsumerState { for (final item in _items) { if (optName(nameOpts, item.selectedNameId).isEmpty) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('请选择商品名称'), backgroundColor: AppTheme.danger), + SnackBar( + content: const Text('请选择商品名称'), backgroundColor: context.tokens.danger), ); setState(() => _submitting = false); return; @@ -371,7 +371,7 @@ class _StockInFormScreenState extends ConsumerState { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(asDraft ? '已保存为草稿' : '入库单已提交审核'), - backgroundColor: AppTheme.success, + backgroundColor: context.tokens.success, ), ); context.go('/stock-in'); @@ -379,7 +379,7 @@ class _StockInFormScreenState extends ConsumerState { } catch (e) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('操作失败:$e'), backgroundColor: AppTheme.danger), + SnackBar(content: Text('操作失败:$e'), backgroundColor: context.tokens.danger), ); } } finally { @@ -422,7 +422,7 @@ class _StockInFormScreenState extends ConsumerState { ), TextButton( onPressed: () => Navigator.of(ctx).pop('discard'), - child: const Text('放弃', style: TextStyle(color: AppTheme.danger)), + child: Text('放弃', style: TextStyle(color: context.tokens.danger)), ), ElevatedButton( onPressed: () => Navigator.of(ctx).pop('draft'), @@ -452,12 +452,12 @@ class _StockInFormScreenState extends ConsumerState { if (!didPop) _handleExit(); }, child: Scaffold( - backgroundColor: AppTheme.background, + backgroundColor: context.tokens.bg, body: Column( children: [ Container( height: 52, - color: AppTheme.surface, + color: context.tokens.surface, padding: const EdgeInsets.symmetric(horizontal: 16), child: Row( children: [ @@ -559,11 +559,11 @@ class _StockInFormScreenState extends ConsumerState { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text('基本信息', + Text('基本信息', style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, - color: AppTheme.primaryDark)), + color: context.tokens.primaryDark)), const SizedBox(height: 16), Wrap( spacing: 16, @@ -681,11 +681,11 @@ class _StockInFormScreenState extends ConsumerState { children: [ Row( children: [ - const Text('商品明细', + Text('商品明细', style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, - color: AppTheme.primaryDark)), + color: context.tokens.primaryDark)), const Spacer(), ElevatedButton.icon( onPressed: _addItem, @@ -731,10 +731,10 @@ class _StockInFormScreenState extends ConsumerState { fontWeight: FontWeight.w500)), Text( '¥${_totalAmount.toStringAsFixed(2)}', - style: const TextStyle( + style: TextStyle( fontSize: 18, fontWeight: FontWeight.w700, - color: AppTheme.danger), + color: context.tokens.danger), ), ], ), @@ -978,10 +978,10 @@ class _StockInFormScreenState extends ConsumerState { Widget th(String s) => Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10), child: Text(s, - style: const TextStyle( + style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, - color: AppTheme.primaryDark)), + color: context.tokens.primaryDark)), ); return Container( color: const Color(0xFFF0F4FF), @@ -1029,7 +1029,7 @@ class _StockInFormScreenState extends ConsumerState { Row(crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( width: 36, - child: tc('${index + 1}', color: AppTheme.textSecondary)), + child: tc('${index + 1}', color: context.tokens.muted)), Expanded( flex: 18, child: Padding( @@ -1078,8 +1078,8 @@ class _StockInFormScreenState extends ConsumerState { item.expanded ? Icons.expand_less : Icons.expand_more, size: 18, color: hasOptional - ? AppTheme.primary - : AppTheme.textSecondary, + ? context.tokens.primary + : context.tokens.muted, ), onPressed: () => setState(() => item.expanded = !item.expanded), @@ -1092,8 +1092,8 @@ class _StockInFormScreenState extends ConsumerState { SizedBox( width: 44, child: IconButton( - icon: const Icon(Icons.delete_outline, - size: 18, color: AppTheme.danger), + icon: Icon(Icons.delete_outline, + size: 18, color: context.tokens.danger), onPressed: _items.length > 1 ? () => _removeItem(index) : null, tooltip: '删除', @@ -1114,18 +1114,18 @@ class _StockInFormScreenState extends ConsumerState { // ── 可折叠选填区(桌面) ────────────────────────────────────────────────── Widget _buildOptionalSection(_ItemRow item) { return Container( - decoration: const BoxDecoration( - color: Color(0xFFF0F6FF), - border: Border(left: BorderSide(color: AppTheme.primary, width: 3)), + decoration: BoxDecoration( + color: const Color(0xFFF0F6FF), + border: Border(left: BorderSide(color: context.tokens.primary, width: 3)), ), padding: const EdgeInsets.fromLTRB(16, 10, 16, 14), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text('选填信息', + Text('选填信息', style: TextStyle( fontSize: 12, - color: AppTheme.textSecondary, + color: context.tokens.muted, fontWeight: FontWeight.w500)), const SizedBox(height: 10), Wrap( @@ -1158,7 +1158,7 @@ class _StockInFormScreenState extends ConsumerState { title: Text('商品 ${index + 1}'), trailing: IconButton( icon: - const Icon(Icons.delete_outline, size: 20, color: AppTheme.danger), + Icon(Icons.delete_outline, size: 20, color: context.tokens.danger), onPressed: _items.length > 1 ? () => _removeItem(index) : null, tooltip: '删除', visualDensity: VisualDensity.compact, @@ -1181,7 +1181,7 @@ class _StockInFormScreenState extends ConsumerState { style: TextButton.styleFrom( padding: EdgeInsets.zero, minimumSize: const Size(0, 32), - foregroundColor: AppTheme.textSecondary, + foregroundColor: context.tokens.muted, ), )), if (item.expanded) @@ -1199,10 +1199,10 @@ class _StockInFormScreenState extends ConsumerState { Widget _buildInventoryCell(int? productId) { if (productId == null) { - return const Padding( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12), child: Text('-', - style: TextStyle(color: AppTheme.textSecondary, fontSize: 13)), + style: TextStyle(color: context.tokens.muted, fontSize: 13)), ); } final qty = _inventoryMap[productId]; @@ -1210,10 +1210,10 @@ class _StockInFormScreenState extends ConsumerState { ? qty.toStringAsFixed(0) : (_warehouseId == null ? '选仓库后显示' : '-'); final color = qty == null - ? AppTheme.textSecondary + ? context.tokens.muted : qty <= 0 - ? AppTheme.danger - : AppTheme.primary; + ? context.tokens.danger + : context.tokens.primary; return Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12), child: Text(text, @@ -1271,7 +1271,7 @@ class _OptionalField extends StatelessWidget { children: [ Text(label, style: - const TextStyle(fontSize: 12, color: AppTheme.textSecondary)), + TextStyle(fontSize: 12, color: context.tokens.muted)), const SizedBox(height: 4), child, ], @@ -1307,11 +1307,11 @@ class _FormField extends StatelessWidget { Row( children: [ if (required) - const Text('*', - style: TextStyle(color: AppTheme.danger, fontSize: 13)), + Text('*', + style: TextStyle(color: context.tokens.danger, fontSize: 13)), Text(label, - style: const TextStyle( - fontSize: 13, color: AppTheme.textSecondary)), + style: TextStyle( + fontSize: 13, color: context.tokens.muted)), ], ), const SizedBox(height: 6), diff --git a/client/lib/screens/stock_in/stock_in_list_screen.dart b/client/lib/screens/stock_in/stock_in_list_screen.dart index 32b7793..416b34f 100644 --- a/client/lib/screens/stock_in/stock_in_list_screen.dart +++ b/client/lib/screens/stock_in/stock_in_list_screen.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import '../../core/responsive/responsive.dart'; -import '../../core/theme/app_theme.dart'; +import '../../core/theme/context_tokens.dart'; import '../../models/stock_in.dart'; import '../../providers/stock_in_provider.dart'; import '../../repositories/stock_in_repository.dart'; @@ -154,10 +154,10 @@ class _StockInListScreenState extends ConsumerState { 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: () => @@ -273,8 +273,8 @@ class _StockInListScreenState extends ConsumerState { return DataCell(GestureDetector( onTap: () => _showDetail(context, o.id), child: Text(o.orderNo, - style: const TextStyle( - color: AppTheme.primary, + style: TextStyle( + color: context.tokens.primary, fontFamily: 'monospace', fontSize: 12, decoration: TextDecoration.underline)), @@ -320,8 +320,8 @@ class _StockInListScreenState extends ConsumerState { cells: List.generate( visibleCols.length, (i) => i == 0 - ? const DataCell(Text('暂无入库单', - style: TextStyle(color: AppTheme.textSecondary))) + ? DataCell(Text('暂无入库单', + style: TextStyle(color: context.tokens.muted))) : const DataCell(SizedBox()), ), ), @@ -562,8 +562,8 @@ class _StockInListScreenState extends ConsumerState { ), ); }, - child: const Text('打标签', - style: TextStyle(fontSize: 12, color: AppTheme.primary)), + child: Text('打标签', + style: TextStyle(fontSize: 12, color: context.tokens.primary)), ), ], onSettle: () => _confirmSettle(context, o.id, 'stock_in'), @@ -643,7 +643,7 @@ class _StockInListScreenState extends ConsumerState { TextButton(onPressed: () => Navigator.pop(ctx, false), child: const Text('取消')), TextButton( onPressed: () => Navigator.pop(ctx, true), - child: const Text('确认结清', style: TextStyle(color: AppTheme.accent)), + child: Text('确认结清', style: TextStyle(color: context.tokens.accent)), ), ], ), @@ -653,13 +653,13 @@ class _StockInListScreenState extends ConsumerState { await ref.read(financeRepositoryProvider).closeByRef(refType, orderId); if (context.mounted) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('已结清'), backgroundColor: AppTheme.success), + SnackBar(content: const Text('已结清'), backgroundColor: context.tokens.success), ); } } catch (e) { if (context.mounted) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(e.toString()), backgroundColor: AppTheme.danger), + SnackBar(content: Text(e.toString()), backgroundColor: context.tokens.danger), ); } } @@ -678,7 +678,7 @@ class _StockInListScreenState extends ConsumerState { ElevatedButton( onPressed: () => Navigator.of(ctx).pop(true), style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.danger, + backgroundColor: context.tokens.danger, foregroundColor: Colors.white), child: const Text('删除'), ), @@ -689,14 +689,14 @@ class _StockInListScreenState extends ConsumerState { try { await ref.read(stockInListProvider.notifier).deleteOrder(o.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)); } } } @@ -724,15 +724,15 @@ class _StockInListScreenState extends ConsumerState { .read(stockInListProvider.notifier) .submitOrder(o.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)); } } } @@ -751,7 +751,7 @@ class _StockInListScreenState extends ConsumerState { ElevatedButton( onPressed: () => Navigator.of(ctx).pop(true), style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.success, + backgroundColor: context.tokens.success, foregroundColor: Colors.white), child: const Text('通过'), ), @@ -764,14 +764,14 @@ class _StockInListScreenState extends ConsumerState { .read(stockInListProvider.notifier) .approveOrder(o.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)); } } } @@ -790,7 +790,7 @@ class _StockInListScreenState extends ConsumerState { ElevatedButton( onPressed: () => Navigator.of(ctx).pop(true), style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.danger, + backgroundColor: context.tokens.danger, foregroundColor: Colors.white), child: const Text('拒绝'), ), @@ -801,14 +801,14 @@ class _StockInListScreenState extends ConsumerState { try { await ref.read(stockInListProvider.notifier).rejectOrder(o.id); if (mounted) { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('已拒绝'), backgroundColor: AppTheme.accent)); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: const Text('已拒绝'), backgroundColor: context.tokens.accent)); } } catch (e) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text('操作失败:$e'), - backgroundColor: AppTheme.danger)); + backgroundColor: context.tokens.danger)); } } } @@ -827,7 +827,7 @@ class _StockInListScreenState extends ConsumerState { ElevatedButton( onPressed: () => Navigator.of(ctx).pop(true), style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.accent, + backgroundColor: context.tokens.accent, foregroundColor: Colors.white), child: const Text('撤回'), ), @@ -838,14 +838,14 @@ class _StockInListScreenState extends ConsumerState { try { await ref.read(stockInListProvider.notifier).withdrawOrder(o.id); if (mounted) { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('已撤回为草稿'), backgroundColor: AppTheme.accent)); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: const Text('已撤回为草稿'), backgroundColor: context.tokens.accent)); } } catch (e) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text('撤回失败:$e'), - backgroundColor: AppTheme.danger)); + backgroundColor: context.tokens.danger)); } } } @@ -864,7 +864,7 @@ class _StockInListScreenState extends ConsumerState { ElevatedButton( onPressed: () => Navigator.of(ctx).pop(true), style: ElevatedButton.styleFrom( - backgroundColor: AppTheme.danger, foregroundColor: Colors.white), + backgroundColor: context.tokens.danger, foregroundColor: Colors.white), child: const Text('确认'), ), ], @@ -877,7 +877,7 @@ class _StockInListScreenState extends ConsumerState { } catch (e) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('加载明细失败:$e'), backgroundColor: AppTheme.danger)); + SnackBar(content: Text('加载明细失败:$e'), backgroundColor: context.tokens.danger)); } return; } @@ -1089,14 +1089,14 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> { return const Center(child: CircularProgressIndicator()); } if (snap.hasError) { - return const Center( + return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.cloud_off, size: 40, color: AppTheme.textSecondary), - SizedBox(height: 12), + Icon(Icons.cloud_off, size: 40, color: context.tokens.muted), + const SizedBox(height: 12), Text('暂无数据,网络不可用', - style: TextStyle(color: AppTheme.textSecondary)), + style: TextStyle(color: context.tokens.muted)), ], ), ); @@ -1134,15 +1134,15 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> { ], ), const SizedBox(height: 20), - const Text('商品明细', + Text('商品明细', style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, - color: AppTheme.primaryDark)), + color: context.tokens.primaryDark)), const SizedBox(height: 8), if (o.items.isEmpty) - const Text('无商品明细', - style: TextStyle(color: AppTheme.textSecondary)) + Text('无商品明细', + style: TextStyle(color: context.tokens.muted)) else if (context.isMobile) // 窄屏:每个商品渲染为卡片,字段竖排 Column( @@ -1186,7 +1186,7 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> { else // 宽屏:保持原有表格展示 Table( - border: TableBorder.all(color: AppTheme.border, width: 0.5), + border: TableBorder.all(color: context.tokens.border, width: 0.5), columnWidths: const { 0: FixedColumnWidth(36), 1: FlexColumnWidth(1.2), @@ -1207,10 +1207,10 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> { padding: const EdgeInsets.symmetric( horizontal: 8, vertical: 10), child: Text(h, - style: const TextStyle( + style: TextStyle( fontSize: 13, fontWeight: FontWeight.w600, - color: AppTheme.primaryDark)), + color: context.tokens.primaryDark)), )) .toList(), ), @@ -1278,9 +1278,9 @@ class _StockInDetailDialogState extends ConsumerState<_StockInDetailDialog> { ), ), const SizedBox(height: 4), - const Text( + Text( '该单含「待定价」明细:价格确定后补填真实进价,将自动回填库存成本、已出库成本快照与应付差额(不影响售价/应收)。', - style: TextStyle(fontSize: 12, color: AppTheme.textSecondary), + style: TextStyle(fontSize: 12, color: context.tokens.muted), ), ], ], @@ -1316,8 +1316,8 @@ class _InfoField extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(label, - style: const TextStyle( - fontSize: 12, color: AppTheme.textSecondary)), + style: TextStyle( + fontSize: 12, color: context.tokens.muted)), const SizedBox(height: 2), Text(value, style: const TextStyle( @@ -1356,22 +1356,22 @@ class _StatusFilterDropdown extends StatelessWidget { height: 36, padding: const EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( - border: Border.all(color: AppTheme.border), + border: Border.all(color: context.tokens.border), borderRadius: BorderRadius.circular(4), - color: AppTheme.surface, + color: context.tokens.surface, ), child: DropdownButtonHideUnderline( child: DropdownButton( value: value.isEmpty ? '' : value, - items: [ - const DropdownMenuItem(value: '', child: Text('全部状态', style: TextStyle(fontSize: 13))), - const DropdownMenuItem(value: 'draft', child: Text('草稿', style: TextStyle(fontSize: 13))), - const DropdownMenuItem(value: 'pending', child: Text('待审核', style: TextStyle(fontSize: 13))), - const DropdownMenuItem(value: 'approved', child: Text('已审核', style: TextStyle(fontSize: 13))), - const DropdownMenuItem(value: 'rejected', child: Text('已拒绝', style: TextStyle(fontSize: 13))), + items: const [ + DropdownMenuItem(value: '', child: Text('全部状态', style: TextStyle(fontSize: 13))), + DropdownMenuItem(value: 'draft', child: Text('草稿', style: TextStyle(fontSize: 13))), + DropdownMenuItem(value: 'pending', child: Text('待审核', style: TextStyle(fontSize: 13))), + DropdownMenuItem(value: 'approved', child: Text('已审核', style: TextStyle(fontSize: 13))), + DropdownMenuItem(value: 'rejected', child: Text('已拒绝', style: TextStyle(fontSize: 13))), ], onChanged: onChanged, - style: const TextStyle(fontSize: 13, color: AppTheme.textPrimary), + style: TextStyle(fontSize: 13, color: context.tokens.text), ), ), );