refactor(client): 出库域颜色迁移到 context.tokens
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import 'package:flutter/services.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 '../../core/auth/auth_state.dart';
|
||||
import '../../core/utils/date_util.dart';
|
||||
import '../../widgets/order_print_preview_dialog.dart';
|
||||
@@ -173,7 +173,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('加载失败:$e'), backgroundColor: AppTheme.danger),
|
||||
SnackBar(content: Text('加载失败:$e'), backgroundColor: context.tokens.danger),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -221,8 +221,8 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
Future<void> _addItem() async {
|
||||
if (_warehouseId == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('请先选择出库仓库'), backgroundColor: AppTheme.danger),
|
||||
SnackBar(
|
||||
content: const Text('请先选择出库仓库'), backgroundColor: context.tokens.danger),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -265,15 +265,15 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
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;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('第 ${invalidQtyIndex + 1} 行数量必须大于 0'),
|
||||
backgroundColor: AppTheme.danger,
|
||||
backgroundColor: context.tokens.danger,
|
||||
),
|
||||
);
|
||||
return;
|
||||
@@ -326,7 +326,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(asDraft ? '已保存为草稿' : '出库单已提交审核'),
|
||||
backgroundColor: AppTheme.success,
|
||||
backgroundColor: context.tokens.success,
|
||||
),
|
||||
);
|
||||
context.go('/stock-out');
|
||||
@@ -334,7 +334,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('操作失败:$e'), backgroundColor: AppTheme.danger),
|
||||
SnackBar(content: Text('操作失败:$e'), backgroundColor: context.tokens.danger),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -372,7 +372,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop('discard'),
|
||||
child: const Text('放弃', style: TextStyle(color: AppTheme.danger)),
|
||||
child: Text('放弃', style: TextStyle(color: ctx.tokens.danger)),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(ctx).pop('draft'),
|
||||
@@ -401,12 +401,12 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
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: [
|
||||
@@ -508,11 +508,11 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
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,
|
||||
@@ -628,11 +628,11 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
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,
|
||||
@@ -691,12 +691,12 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
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(),
|
||||
),
|
||||
@@ -705,12 +705,12 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
],
|
||||
),
|
||||
if (_items.isEmpty)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 24),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
child: Center(
|
||||
child: Text('暂无商品,点击"添加商品"从库存中选择',
|
||||
style: TextStyle(
|
||||
color: AppTheme.textSecondary,
|
||||
color: context.tokens.muted,
|
||||
fontSize: 13))),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
@@ -725,10 +725,10 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
fontWeight: FontWeight.w500)),
|
||||
Text(
|
||||
'¥${_totalAmount.toStringAsFixed(2)}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppTheme.danger),
|
||||
color: context.tokens.danger),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -763,11 +763,11 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
// 序号
|
||||
_cell(Text('${index + 1}',
|
||||
style:
|
||||
const TextStyle(fontSize: 13, color: AppTheme.textSecondary))),
|
||||
TextStyle(fontSize: 13, color: context.tokens.muted))),
|
||||
// 商品编码
|
||||
_cell(Text(item.productCode,
|
||||
style:
|
||||
const TextStyle(fontSize: 12, color: AppTheme.textSecondary))),
|
||||
TextStyle(fontSize: 12, color: context.tokens.muted))),
|
||||
// 商品名称
|
||||
_cell(Text(item.productName,
|
||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.w500),
|
||||
@@ -775,15 +775,15 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
// 系列
|
||||
_cell(Text(item.series,
|
||||
style:
|
||||
const TextStyle(fontSize: 12, color: AppTheme.textSecondary))),
|
||||
TextStyle(fontSize: 12, color: context.tokens.muted))),
|
||||
// 规格
|
||||
_cell(Text(item.spec,
|
||||
style:
|
||||
const TextStyle(fontSize: 12, color: AppTheme.textSecondary))),
|
||||
TextStyle(fontSize: 12, color: context.tokens.muted))),
|
||||
// 成本价
|
||||
_cell(Text(price > 0 ? '¥${price.toStringAsFixed(2)}' : '-',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary))),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted))),
|
||||
// 售价(可编辑)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4), child: _salePriceField(item)),
|
||||
@@ -796,8 +796,8 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
|
||||
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: () => _removeItem(index),
|
||||
tooltip: '删除',
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -854,7 +854,7 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
item.productCode.isNotEmpty ? Text('编码 ${item.productCode}') : null,
|
||||
trailing: IconButton(
|
||||
icon:
|
||||
const Icon(Icons.delete_outline, size: 20, color: AppTheme.danger),
|
||||
Icon(Icons.delete_outline, size: 20, color: context.tokens.danger),
|
||||
onPressed: () => _removeItem(index),
|
||||
tooltip: '删除',
|
||||
visualDensity: VisualDensity.compact,
|
||||
@@ -878,18 +878,18 @@ class _StockOutFormScreenState extends ConsumerState<StockOutFormScreen> {
|
||||
|
||||
Widget _buildInventoryCell(int? productId, [double? available]) {
|
||||
if (productId == null) {
|
||||
return _cell(const Text('-',
|
||||
style: TextStyle(color: AppTheme.textSecondary, fontSize: 13)));
|
||||
return _cell(Text('-',
|
||||
style: TextStyle(color: context.tokens.muted, fontSize: 13)));
|
||||
}
|
||||
final qty = available ?? _inventoryMap[productId];
|
||||
final text = qty != null
|
||||
? 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 _cell(Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 13, fontWeight: FontWeight.w700, color: color)));
|
||||
@@ -923,11 +923,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),
|
||||
@@ -1050,8 +1050,8 @@ class _InventoryPickerDialogState
|
||||
TextStyle(fontSize: 15, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(width: 8),
|
||||
Text('已选 ${_selected.length} 个',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary)),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted)),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
@@ -1109,9 +1109,9 @@ class _InventoryPickerDialogState
|
||||
// List
|
||||
Expanded(
|
||||
child: filtered.isEmpty
|
||||
? const Center(
|
||||
? Center(
|
||||
child: Text('没有匹配的商品',
|
||||
style: TextStyle(color: AppTheme.textSecondary)),
|
||||
style: TextStyle(color: context.tokens.muted)),
|
||||
)
|
||||
: ListView.separated(
|
||||
itemCount: filtered.length,
|
||||
@@ -1147,12 +1147,12 @@ class _InventoryPickerDialogState
|
||||
),
|
||||
),
|
||||
_dataCell(item.productCode, 110,
|
||||
color: AppTheme.textSecondary),
|
||||
color: context.tokens.muted),
|
||||
_dataCell(item.productName, 200, bold: true),
|
||||
_dataCell(item.series, 110,
|
||||
color: AppTheme.textSecondary),
|
||||
color: context.tokens.muted),
|
||||
_dataCell(item.spec, 130,
|
||||
color: AppTheme.textSecondary),
|
||||
color: context.tokens.muted),
|
||||
_dataCell(
|
||||
item.unitPrice != null
|
||||
? '¥${item.unitPrice!.toStringAsFixed(2)}'
|
||||
@@ -1163,8 +1163,8 @@ class _InventoryPickerDialogState
|
||||
item.availableQty.toStringAsFixed(0),
|
||||
90,
|
||||
color: item.availableQty <= 0
|
||||
? AppTheme.danger
|
||||
: AppTheme.primary,
|
||||
? context.tokens.danger
|
||||
: context.tokens.primary,
|
||||
bold: true,
|
||||
),
|
||||
],
|
||||
@@ -1196,8 +1196,8 @@ class _InventoryPickerDialogState
|
||||
// 库存总数汇总(无搜索=整仓总数,搜索时=匹配总数)
|
||||
Text(
|
||||
_loading ? '加载中…' : '共 $_total 项库存商品',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// 翻页
|
||||
@@ -1255,10 +1255,10 @@ class _InventoryPickerDialogState
|
||||
Widget _headerCell(String text, double width) => SizedBox(
|
||||
width: width,
|
||||
child: Text(text,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme.primaryDark)),
|
||||
color: context.tokens.primaryDark)),
|
||||
);
|
||||
|
||||
Widget _dataCell(String text, double width,
|
||||
|
||||
@@ -5,7 +5,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_out.dart';
|
||||
import '../../providers/stock_out_provider.dart';
|
||||
import '../../repositories/stock_out_repository.dart';
|
||||
@@ -157,10 +157,10 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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: () =>
|
||||
@@ -276,8 +276,8 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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)),
|
||||
@@ -329,8 +329,8 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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()),
|
||||
),
|
||||
),
|
||||
@@ -641,7 +641,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -651,13 +651,13 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -676,7 +676,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.danger,
|
||||
backgroundColor: context.tokens.danger,
|
||||
foregroundColor: Colors.white),
|
||||
child: const Text('删除'),
|
||||
),
|
||||
@@ -687,14 +687,14 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
try {
|
||||
await ref.read(stockOutListProvider.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,15 +723,15 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
.read(stockOutListProvider.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 _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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 _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
.read(stockOutListProvider.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,
|
||||
duration: const Duration(seconds: 5)));
|
||||
}
|
||||
}
|
||||
@@ -792,7 +792,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.danger,
|
||||
backgroundColor: context.tokens.danger,
|
||||
foregroundColor: Colors.white),
|
||||
child: const Text('拒绝'),
|
||||
),
|
||||
@@ -803,14 +803,14 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
try {
|
||||
await ref.read(stockOutListProvider.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -830,7 +830,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(true),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppTheme.accent,
|
||||
backgroundColor: context.tokens.accent,
|
||||
foregroundColor: Colors.white),
|
||||
child: const Text('撤回'),
|
||||
),
|
||||
@@ -841,14 +841,14 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
try {
|
||||
await ref.read(stockOutListProvider.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -867,7 +867,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
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('确认'),
|
||||
),
|
||||
],
|
||||
@@ -880,7 +880,7 @@ class _StockOutListScreenState extends ConsumerState<StockOutListScreen> {
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('加载明细失败:$e'), backgroundColor: AppTheme.danger));
|
||||
SnackBar(content: Text('加载明细失败:$e'), backgroundColor: context.tokens.danger));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1000,14 +1000,14 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
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)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -1044,18 +1044,18 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
],
|
||||
),
|
||||
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
|
||||
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),
|
||||
@@ -1075,10 +1075,10 @@ class _StockOutDetailDialogState extends ConsumerState<_StockOutDetailDialog> {
|
||||
.map((h) => Padding(
|
||||
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(),
|
||||
),
|
||||
@@ -1141,8 +1141,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(
|
||||
@@ -1181,9 +1181,9 @@ 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<String>(
|
||||
@@ -1196,7 +1196,7 @@ class _StatusFilterDropdown extends StatelessWidget {
|
||||
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),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user