refactor(client): widgets 颜色迁移到 context.tokens
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../core/theme/app_theme.dart';
|
||||
import '../core/theme/context_tokens.dart';
|
||||
import 'write_guard.dart';
|
||||
|
||||
/// 入/出库单行内操作按钮,列表表格与移动端卡片、入库与出库两屏共用。
|
||||
@@ -12,6 +12,7 @@ import 'write_guard.dart';
|
||||
/// - [afterPrint]:紧随「打印」之后的附加按钮(入库的「打标签」;出库传空)。
|
||||
/// - 各 `on*` 回调由调用方绑定到对应单据的确认/跳转逻辑。
|
||||
List<Widget> buildOrderRowActions({
|
||||
required BuildContext context,
|
||||
required bool readonly,
|
||||
required String status,
|
||||
required int orderId,
|
||||
@@ -56,32 +57,32 @@ List<Widget> buildOrderRowActions({
|
||||
),
|
||||
);
|
||||
return [
|
||||
btn('详情', AppTheme.primary, onDetail),
|
||||
btn('打印', AppTheme.primary, onPrint),
|
||||
btn('详情', context.tokens.primary, onDetail),
|
||||
btn('打印', context.tokens.primary, onPrint),
|
||||
...afterPrint,
|
||||
if (!readonly && status == 'approved')
|
||||
WriteGuard(child: btn('结清', AppTheme.accent, onSettle)),
|
||||
WriteGuard(child: btn('结清', context.tokens.accent, onSettle)),
|
||||
// 退单(已审核单退货):红色实心按钮突出(与原型一致),按权限显示
|
||||
if (!readonly && status == 'approved' && canReturn)
|
||||
WriteGuard(
|
||||
child: filledBtn('退单', AppTheme.danger, onReturn,
|
||||
child: filledBtn('退单', context.tokens.danger, onReturn,
|
||||
key: Key('btn_return_$orderId'))),
|
||||
if (!readonly && status == 'draft') ...[
|
||||
WriteGuard(child: btn('修改', AppTheme.primary, onEdit)),
|
||||
WriteGuard(child: btn('删除', AppTheme.danger, onDelete)),
|
||||
WriteGuard(child: btn('提交', AppTheme.primary, onSubmit)),
|
||||
WriteGuard(child: btn('修改', context.tokens.primary, onEdit)),
|
||||
WriteGuard(child: btn('删除', context.tokens.danger, onDelete)),
|
||||
WriteGuard(child: btn('提交', context.tokens.primary, onSubmit)),
|
||||
],
|
||||
if (!readonly && status == 'pending') ...[
|
||||
WriteGuard(
|
||||
child: btn('通过', AppTheme.success, onApprove,
|
||||
child: btn('通过', context.tokens.success, onApprove,
|
||||
key: Key('btn_approve_$orderId'))),
|
||||
WriteGuard(
|
||||
child: btn('拒绝', AppTheme.danger, onReject,
|
||||
child: btn('拒绝', context.tokens.danger, onReject,
|
||||
key: Key('btn_reject_$orderId'))),
|
||||
// 撤回(审核中→草稿):管理员/超管任意单、操作员本人单可见,用 warn 样式
|
||||
if (canWithdraw)
|
||||
WriteGuard(
|
||||
child: btn('撤回', AppTheme.warning, onWithdraw,
|
||||
child: btn('撤回', context.tokens.warn, onWithdraw,
|
||||
key: Key('btn_withdraw_$orderId'))),
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user