refactor(client): 库存域颜色迁移到 context.tokens
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/theme/context_tokens.dart';
|
||||
import '../../models/inventory.dart';
|
||||
import '../../models/warehouse.dart';
|
||||
import '../../core/config/app_constants.dart';
|
||||
@@ -70,7 +70,7 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('加载库存失败:$e'),
|
||||
backgroundColor: AppTheme.danger),
|
||||
backgroundColor: context.tokens.danger),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -107,9 +107,9 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
SnackBar(
|
||||
content: Text('盘点单已提交'),
|
||||
backgroundColor: AppTheme.success,
|
||||
backgroundColor: context.tokens.success,
|
||||
),
|
||||
);
|
||||
context.go('/inventory');
|
||||
@@ -119,7 +119,7 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('提交失败:$e'),
|
||||
backgroundColor: AppTheme.danger),
|
||||
backgroundColor: context.tokens.danger),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -138,13 +138,13 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
final asyncWarehouses = ref.watch(warehouseListProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppTheme.background,
|
||||
backgroundColor: context.tokens.bg,
|
||||
body: Column(
|
||||
children: [
|
||||
// Header
|
||||
Container(
|
||||
height: 52,
|
||||
color: AppTheme.surface,
|
||||
color: context.tokens.surface,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -191,11 +191,11 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
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,
|
||||
@@ -219,8 +219,8 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
loading: () =>
|
||||
const LinearProgressIndicator(),
|
||||
error: (e, _) => Text('$e',
|
||||
style: const TextStyle(
|
||||
color: AppTheme.danger,
|
||||
style: TextStyle(
|
||||
color: context.tokens.danger,
|
||||
fontSize: 12)),
|
||||
data: (warehouses) =>
|
||||
DropdownButtonFormField<Warehouse>(
|
||||
@@ -288,11 +288,11 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('盘点明细',
|
||||
Text('盘点明细',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme.primaryDark)),
|
||||
color: context.tokens.primaryDark)),
|
||||
const SizedBox(width: 12),
|
||||
if (_checkItems.isNotEmpty)
|
||||
Container(
|
||||
@@ -300,27 +300,27 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
AppTheme.accent.withOpacity(0.1),
|
||||
context.tokens.accent.withOpacity(0.1),
|
||||
borderRadius:
|
||||
BorderRadius.circular(3),
|
||||
),
|
||||
child: Text(
|
||||
'差异 ${_checkItems.where((i) => _getDiff(i) != 0).length} 项',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppTheme.accent),
|
||||
color: context.tokens.accent),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (_selectedWarehouse == null)
|
||||
const Center(
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(32),
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text('请先选择盘点仓库',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary)),
|
||||
color: context.tokens.muted)),
|
||||
),
|
||||
)
|
||||
else if (_loadingItems)
|
||||
@@ -331,12 +331,12 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
),
|
||||
)
|
||||
else if (_checkItems.isEmpty)
|
||||
const Center(
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(32),
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text('该仓库暂无库存记录',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary)),
|
||||
color: context.tokens.muted)),
|
||||
),
|
||||
)
|
||||
else
|
||||
@@ -371,12 +371,11 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
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(),
|
||||
),
|
||||
@@ -394,28 +393,28 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
_SummaryItem(
|
||||
label: '盘点商品',
|
||||
value: '${_checkItems.length}种',
|
||||
color: AppTheme.primary,
|
||||
color: context.tokens.primary,
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
_SummaryItem(
|
||||
label: '盘盈',
|
||||
value:
|
||||
'${_checkItems.where((i) => _getDiff(i) > 0).length}种',
|
||||
color: AppTheme.success,
|
||||
color: context.tokens.success,
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
_SummaryItem(
|
||||
label: '盘亏',
|
||||
value:
|
||||
'${_checkItems.where((i) => _getDiff(i) < 0).length}种',
|
||||
color: AppTheme.danger,
|
||||
color: context.tokens.danger,
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
_SummaryItem(
|
||||
label: '相符',
|
||||
value:
|
||||
'${_checkItems.where((i) => _getDiff(i) == 0).length}种',
|
||||
color: AppTheme.textSecondary,
|
||||
color: context.tokens.muted,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -443,8 +442,8 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: diff != 0
|
||||
? (diff > 0
|
||||
? AppTheme.success.withOpacity(0.04)
|
||||
: AppTheme.danger.withOpacity(0.04))
|
||||
? context.tokens.success.withOpacity(0.04)
|
||||
: context.tokens.danger.withOpacity(0.04))
|
||||
: (index.isEven ? Colors.white : const Color(0xFFFAFAFA)),
|
||||
),
|
||||
children: [
|
||||
@@ -452,17 +451,17 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
|
||||
child: Text('${index + 1}',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary)),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted)),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
|
||||
child: Text(inv.productCode.isEmpty ? '-' : inv.productCode,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
color: AppTheme.textSecondary)),
|
||||
color: context.tokens.muted)),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
@@ -503,8 +502,8 @@ class _InventoryCheckScreenState extends ConsumerState<InventoryCheckScreen> {
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: diff == 0
|
||||
? AppTheme.textSecondary
|
||||
: (diff > 0 ? AppTheme.success : AppTheme.danger),
|
||||
? context.tokens.muted
|
||||
: (diff > 0 ? context.tokens.success : context.tokens.danger),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -551,8 +550,8 @@ class _InfoField extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary)),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted)),
|
||||
const SizedBox(height: 6),
|
||||
child,
|
||||
],
|
||||
@@ -574,8 +573,8 @@ class _SummaryItem extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
Text(label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary)),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted)),
|
||||
const SizedBox(width: 4),
|
||||
Text(value,
|
||||
style: TextStyle(
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:go_router/go_router.dart';
|
||||
import '../../core/config/app_config.dart';
|
||||
import '../../core/config/app_constants.dart';
|
||||
import '../../core/responsive/responsive.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/theme/context_tokens.dart';
|
||||
import '../../models/inventory.dart';
|
||||
import '../../core/auth/auth_state.dart';
|
||||
import '../../widgets/write_guard.dart';
|
||||
@@ -94,14 +94,14 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
: item.remark,
|
||||
style: TextStyle(
|
||||
color: item.remark.isEmpty
|
||||
? AppTheme.textSecondary
|
||||
: AppTheme.textPrimary,
|
||||
? context.tokens.muted
|
||||
: context.tokens.text,
|
||||
),
|
||||
),
|
||||
if (editable) ...[
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.edit_outlined,
|
||||
size: 12, color: AppTheme.textSecondary),
|
||||
Icon(Icons.edit_outlined,
|
||||
size: 12, color: context.tokens.muted),
|
||||
],
|
||||
],
|
||||
);
|
||||
@@ -145,7 +145,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('保存失败:$e'), backgroundColor: AppTheme.danger),
|
||||
SnackBar(content: Text('保存失败:$e'), backgroundColor: context.tokens.danger),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -286,8 +286,8 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
return switch (key) {
|
||||
'code' => DataCell(Text(
|
||||
item.productCode.isEmpty ? '-' : item.productCode,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'monospace', fontSize: 12, color: AppTheme.textSecondary))),
|
||||
style: TextStyle(
|
||||
fontFamily: 'monospace', fontSize: 12, color: context.tokens.muted))),
|
||||
'name' => DataCell(item.productId != null
|
||||
? GestureDetector(
|
||||
onTap: () => context.push('/products/${item.productId}'),
|
||||
@@ -296,10 +296,10 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
child: Text(
|
||||
item.productName.isEmpty ? '-' : item.productName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppTheme.primary,
|
||||
style: TextStyle(
|
||||
color: context.tokens.primary,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppTheme.primary,
|
||||
decorationColor: context.tokens.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -314,14 +314,14 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
'price' => DataCell(Text(
|
||||
item.unitPrice != null ? '¥${item.unitPrice!.toStringAsFixed(2)}' : '待定价',
|
||||
style: item.unitPrice == null
|
||||
? const TextStyle(color: AppTheme.warning)
|
||||
? TextStyle(color: context.tokens.warn)
|
||||
: null)),
|
||||
'prodDate' => DataCell(Text(item.productionDate ?? '-')),
|
||||
'inTime' => DataCell(Text(
|
||||
item.createdAt != null && item.createdAt!.length >= 10
|
||||
? item.createdAt!.substring(0, 10)
|
||||
: '-',
|
||||
style: const TextStyle(fontSize: 12, color: AppTheme.textSecondary))),
|
||||
style: TextStyle(fontSize: 12, color: context.tokens.muted))),
|
||||
'supplier' => DataCell(Text(item.supplierName.isEmpty ? '-' : item.supplierName)),
|
||||
'remark' => DataCell(Tooltip(
|
||||
message: item.remark.isEmpty ? '' : item.remark,
|
||||
@@ -339,8 +339,8 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
'actions' => DataCell(item.productId != null
|
||||
? TextButton(
|
||||
onPressed: () => _printLabel(context, item),
|
||||
child: const Text('打标签',
|
||||
style: TextStyle(fontSize: 12, color: AppTheme.primary)),
|
||||
child: Text('打标签',
|
||||
style: TextStyle(fontSize: 12, color: context.tokens.primary)),
|
||||
)
|
||||
: const SizedBox()),
|
||||
_ => const DataCell(SizedBox()),
|
||||
@@ -400,15 +400,15 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: item.quantity == 0 ? AppTheme.danger : AppTheme.accent),
|
||||
color: item.quantity == 0 ? context.tokens.danger : context.tokens.accent),
|
||||
)),
|
||||
MobileCardField('安全库存', '${item.minStock}'),
|
||||
MobileCardField('缺口', null,
|
||||
valueWidget: Text(
|
||||
'${item.minStock! - item.quantity.toInt()}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppTheme.danger,
|
||||
color: context.tokens.danger,
|
||||
fontWeight: FontWeight.w600),
|
||||
)),
|
||||
],
|
||||
@@ -430,8 +430,8 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: log.direction == 'in'
|
||||
? AppTheme.success
|
||||
: AppTheme.danger),
|
||||
? context.tokens.success
|
||||
: context.tokens.danger),
|
||||
)),
|
||||
MobileCardField('变前', log.qtyBefore?.toStringAsFixed(0) ?? '-'),
|
||||
MobileCardField('变后', log.qtyAfter?.toStringAsFixed(0) ?? '-'),
|
||||
@@ -468,10 +468,10 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 40, color: AppTheme.textSecondary),
|
||||
Icon(Icons.error_outline, size: 40, color: context.tokens.muted),
|
||||
const SizedBox(height: 12),
|
||||
Text('加载失败:$e',
|
||||
style: const TextStyle(color: AppTheme.textSecondary),
|
||||
style: TextStyle(color: context.tokens.muted),
|
||||
textAlign: TextAlign.center),
|
||||
const SizedBox(height: 12),
|
||||
ElevatedButton(
|
||||
@@ -522,7 +522,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
value: '${result.total}',
|
||||
unit: '种',
|
||||
icon: Icons.inventory_2,
|
||||
color: AppTheme.primary,
|
||||
color: context.tokens.primary,
|
||||
width: w),
|
||||
const SizedBox(width: 12),
|
||||
_SummaryCard(
|
||||
@@ -530,7 +530,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
value: '$warningCount',
|
||||
unit: '种',
|
||||
icon: Icons.warning_amber,
|
||||
color: AppTheme.accent,
|
||||
color: context.tokens.accent,
|
||||
width: w),
|
||||
const SizedBox(width: 12),
|
||||
_SummaryCard(
|
||||
@@ -538,11 +538,11 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
value: '$emptyCount',
|
||||
unit: '种',
|
||||
icon: Icons.remove_shopping_cart,
|
||||
color: AppTheme.danger,
|
||||
color: context.tokens.danger,
|
||||
width: w),
|
||||
];
|
||||
return Container(
|
||||
color: AppTheme.background,
|
||||
color: context.tokens.bg,
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: context.isMobile
|
||||
? SingleChildScrollView(
|
||||
@@ -751,9 +751,9 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
? [
|
||||
DataRow(cells: [
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(Text('暂无库存数据',
|
||||
DataCell(Text('暂无库存数据',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary))),
|
||||
color: context.tokens.muted))),
|
||||
for (int i = 2; i < visibleCols.length; i++)
|
||||
const DataCell(SizedBox()),
|
||||
])
|
||||
@@ -763,11 +763,11 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
color: WidgetStateProperty.resolveWith(
|
||||
(states) {
|
||||
if (item.quantity == 0) {
|
||||
return AppTheme.danger.withValues(alpha: 0.04);
|
||||
return context.tokens.danger.withValues(alpha: 0.04);
|
||||
}
|
||||
if (item.minStock != null &&
|
||||
item.quantity < item.minStock!) {
|
||||
return AppTheme.accent.withValues(alpha: 0.04);
|
||||
return context.tokens.accent.withValues(alpha: 0.04);
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
@@ -792,10 +792,10 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 40, color: AppTheme.textSecondary),
|
||||
Icon(Icons.error_outline, size: 40, color: context.tokens.muted),
|
||||
const SizedBox(height: 12),
|
||||
Text('加载失败:$e',
|
||||
style: const TextStyle(color: AppTheme.textSecondary),
|
||||
style: TextStyle(color: context.tokens.muted),
|
||||
textAlign: TextAlign.center),
|
||||
const SizedBox(height: 12),
|
||||
ElevatedButton(
|
||||
@@ -816,13 +816,13 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
page: 1,
|
||||
toolbar: Row(
|
||||
children: [
|
||||
const Icon(Icons.warning_amber,
|
||||
color: AppTheme.accent, size: 18),
|
||||
Icon(Icons.warning_amber,
|
||||
color: context.tokens.accent, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'共 ${warnings.length} 个商品库存低于安全库存',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.accent),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.accent),
|
||||
),
|
||||
const Spacer(),
|
||||
OutlinedButton.icon(
|
||||
@@ -856,24 +856,24 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
],
|
||||
rows: warnings.isEmpty
|
||||
? [
|
||||
const DataRow(cells: [
|
||||
DataCell(SizedBox()),
|
||||
DataRow(cells: [
|
||||
const DataCell(SizedBox()),
|
||||
DataCell(Text('暂无预警商品',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary))),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
color: context.tokens.muted))),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
])
|
||||
]
|
||||
: warnings
|
||||
.map((item) => DataRow(
|
||||
color: WidgetStateProperty.all(
|
||||
item.quantity == 0
|
||||
? AppTheme.danger.withOpacity(0.05)
|
||||
: AppTheme.accent.withOpacity(0.04)),
|
||||
? context.tokens.danger.withOpacity(0.05)
|
||||
: context.tokens.accent.withOpacity(0.04)),
|
||||
cells: [
|
||||
DataCell(Text(
|
||||
item.productCode.isEmpty ? '-' : item.productCode,
|
||||
@@ -888,10 +888,10 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
child: Text(
|
||||
item.productName.isEmpty ? '-' : item.productName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppTheme.primary,
|
||||
style: TextStyle(
|
||||
color: context.tokens.primary,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppTheme.primary,
|
||||
decorationColor: context.tokens.primary,
|
||||
)),
|
||||
),
|
||||
)
|
||||
@@ -903,14 +903,14 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: item.quantity == 0
|
||||
? AppTheme.danger
|
||||
: AppTheme.accent),
|
||||
? context.tokens.danger
|
||||
: context.tokens.accent),
|
||||
)),
|
||||
DataCell(Text('${item.minStock}')),
|
||||
DataCell(Text(
|
||||
'${item.minStock! - item.quantity.toInt()}',
|
||||
style: const TextStyle(
|
||||
color: AppTheme.danger,
|
||||
style: TextStyle(
|
||||
color: context.tokens.danger,
|
||||
fontWeight: FontWeight.w600),
|
||||
)),
|
||||
DataCell(_InventoryStatusBadge(item)),
|
||||
@@ -930,10 +930,10 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 40, color: AppTheme.textSecondary),
|
||||
Icon(Icons.error_outline, size: 40, color: context.tokens.muted),
|
||||
const SizedBox(height: 12),
|
||||
Text('加载失败:$e',
|
||||
style: const TextStyle(color: AppTheme.textSecondary),
|
||||
style: TextStyle(color: context.tokens.muted),
|
||||
textAlign: TextAlign.center),
|
||||
const SizedBox(height: 12),
|
||||
ElevatedButton(
|
||||
@@ -956,7 +956,7 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
ref.read(inventoryLogProvider.notifier).setPageSize(s),
|
||||
toolbar: Row(
|
||||
children: [
|
||||
const Icon(Icons.history, color: AppTheme.primary, size: 18),
|
||||
Icon(Icons.history, color: context.tokens.primary, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
const Text('库存流水记录',
|
||||
style: TextStyle(
|
||||
@@ -995,17 +995,17 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
],
|
||||
rows: logs.isEmpty
|
||||
? [
|
||||
const DataRow(cells: [
|
||||
DataCell(SizedBox()),
|
||||
DataRow(cells: [
|
||||
const DataCell(SizedBox()),
|
||||
DataCell(Text('暂无流水记录',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary))),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
DataCell(SizedBox()),
|
||||
color: context.tokens.muted))),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
const DataCell(SizedBox()),
|
||||
])
|
||||
]
|
||||
: logs
|
||||
@@ -1022,22 +1022,22 @@ class _InventoryListScreenState extends ConsumerState<InventoryListScreen> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: log.direction == 'in'
|
||||
? AppTheme.success
|
||||
: AppTheme.danger),
|
||||
? context.tokens.success
|
||||
: context.tokens.danger),
|
||||
)),
|
||||
DataCell(Text(
|
||||
log.qtyBefore?.toStringAsFixed(0) ?? '-')),
|
||||
DataCell(Text(
|
||||
log.qtyAfter?.toStringAsFixed(0) ?? '-')),
|
||||
DataCell(Text(log.refType ?? '-',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppTheme.textSecondary))),
|
||||
color: context.tokens.muted))),
|
||||
DataCell(Text(
|
||||
log.createdAt?.substring(0, 19) ?? '-',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppTheme.textSecondary),
|
||||
color: context.tokens.muted),
|
||||
)),
|
||||
]))
|
||||
.toList(),
|
||||
@@ -1072,9 +1072,9 @@ class _SummaryCard extends StatelessWidget {
|
||||
height: 72,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.surface,
|
||||
color: context.tokens.surface,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(color: AppTheme.border, width: 0.5),
|
||||
border: Border.all(color: context.tokens.border, width: 0.5),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -1093,8 +1093,8 @@ class _SummaryCard extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(title,
|
||||
style: const TextStyle(
|
||||
fontSize: 12, color: AppTheme.textSecondary)),
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: context.tokens.muted)),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||
@@ -1108,9 +1108,9 @@ class _SummaryCard extends StatelessWidget {
|
||||
if (unit.isNotEmpty) ...[
|
||||
const SizedBox(width: 2),
|
||||
Text(unit,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppTheme.textSecondary)),
|
||||
color: context.tokens.muted)),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -1137,15 +1137,15 @@ class _InventoryStatusBadge extends StatelessWidget {
|
||||
if (item.quantity == 0) {
|
||||
status = '缺货';
|
||||
bg = const Color(0xFFFFEBEE);
|
||||
fg = AppTheme.danger;
|
||||
fg = context.tokens.danger;
|
||||
} else if (item.minStock != null && item.quantity < item.minStock!) {
|
||||
status = '库存不足';
|
||||
bg = const Color(0xFFFFF3E0);
|
||||
fg = AppTheme.accent;
|
||||
fg = context.tokens.accent;
|
||||
} else {
|
||||
status = '正常';
|
||||
bg = const Color(0xFFE8F5E9);
|
||||
fg = AppTheme.success;
|
||||
fg = context.tokens.success;
|
||||
}
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
@@ -1176,7 +1176,7 @@ class _DirectionBadge extends StatelessWidget {
|
||||
child: Text(
|
||||
isIn ? '入库' : '出库',
|
||||
style: TextStyle(
|
||||
color: isIn ? AppTheme.success : AppTheme.danger,
|
||||
color: isIn ? context.tokens.success : context.tokens.danger,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
@@ -1254,7 +1254,7 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
LinearProgressIndicator(
|
||||
value: state.uploadPercent / 100,
|
||||
backgroundColor: Colors.grey[200],
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppTheme.primary),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(context.tokens.primary),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text('${state.uploadPercent}%',
|
||||
@@ -1272,7 +1272,7 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
width: 16, height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppTheme.primary),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(context.tokens.primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
@@ -1284,7 +1284,7 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
LinearProgressIndicator(
|
||||
backgroundColor: Colors.grey[200],
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppTheme.primary),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(context.tokens.primary),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1298,7 +1298,7 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
Row(children: [
|
||||
Icon(
|
||||
allFailed ? Icons.warning_amber_rounded : Icons.check_circle,
|
||||
color: allFailed ? AppTheme.danger : AppTheme.success,
|
||||
color: allFailed ? context.tokens.danger : context.tokens.success,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -1314,13 +1314,13 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey[600])),
|
||||
if (state.errors.isNotEmpty)
|
||||
Text('失败:${state.errors.length} 行',
|
||||
style: TextStyle(fontSize: 13, color: AppTheme.danger)),
|
||||
style: TextStyle(fontSize: 13, color: context.tokens.danger)),
|
||||
if (state.errors.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
...state.errors.map((e) => Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(e,
|
||||
style: TextStyle(fontSize: 12, color: AppTheme.danger)),
|
||||
style: TextStyle(fontSize: 12, color: context.tokens.danger)),
|
||||
)),
|
||||
],
|
||||
],
|
||||
@@ -1330,12 +1330,12 @@ class _ImportProgressDialog extends StatelessWidget {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.error_outline, color: AppTheme.danger, size: 20),
|
||||
Icon(Icons.error_outline, color: context.tokens.danger, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'导入失败:${state.errorMsg}',
|
||||
style: TextStyle(fontSize: 13, color: AppTheme.danger),
|
||||
style: TextStyle(fontSize: 13, color: context.tokens.danger),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user