## 样式主题重点优化 ### 颜色映射(注重主题一致性) - mutedForeground → onSurfaceVariant - border → outline - card → surfaceContainer - destructive → error - 保留所有 AppColorScheme 自定义颜色 ### 文本样式映射 - theme.textTheme.h1/muted/large → AppTextStyles.xxx(context) - 统一使用项目定义的文本样式系统 ### 组件替换(20个文件) - ShadApp → MaterialApp(移除 ShadThemeData) - ShadButton → ElevatedButton/OutlinedButton - ShadDialog → AlertDialog - ShadInputFormField → MaterialInput - ShadSelect → DropdownButtonFormField - ShadCard → Card - showShadDialog → showDialog ### 依赖变更 - 移除:shadcn_ui: ^0.52.1 - 添加:lucide_icons_flutter: ^2.0.0 ### 业务逻辑保护 ✅ 所有 onPressed/onChanged/validator 回调保持不变 ✅ 所有 controller/focusNode 数据绑定保持不变 ✅ 所有布局结构(Column/Row/Padding)保持不变 ✅ 仅替换 UI 组件层,业务逻辑完全保留
143 lines
3.7 KiB
Dart
143 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
import '../../../core/theme/app_spacing.dart';
|
|
|
|
/// 首頁快捷操作欄 - 充值/提現/劃轉/盈虧/賬單
|
|
class QuickActionsRow extends StatelessWidget {
|
|
const QuickActionsRow({
|
|
super.key,
|
|
this.onDeposit,
|
|
this.onWithdraw,
|
|
this.onTransfer,
|
|
this.onProfit,
|
|
this.onBills,
|
|
});
|
|
|
|
final VoidCallback? onDeposit;
|
|
final VoidCallback? onWithdraw;
|
|
final VoidCallback? onTransfer;
|
|
final VoidCallback? onProfit;
|
|
final VoidCallback? onBills;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
final isDark = colorScheme.brightness == Brightness.dark;
|
|
|
|
// Light: #FFFFFF, Dark: #0F172A
|
|
final containerBg = isDark
|
|
? const Color(0xFF0F172A)
|
|
: const Color(0xFFFFFFFF);
|
|
|
|
// Light: #E2E8F0, Dark: #1E293B
|
|
final borderColor = isDark
|
|
? const Color(0xFF1E293B)
|
|
: const Color(0xFFE2E8F0);
|
|
|
|
return Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: containerBg,
|
|
border: Border.all(
|
|
color: borderColor,
|
|
width: 1,
|
|
),
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
_ActionItem(
|
|
icon: LucideIcons.arrowUpRight,
|
|
label: '充值',
|
|
colorScheme: colorScheme,
|
|
onTap: onDeposit,
|
|
),
|
|
_ActionItem(
|
|
icon: LucideIcons.arrowDownLeft,
|
|
label: '提現',
|
|
colorScheme: colorScheme,
|
|
onTap: onWithdraw,
|
|
),
|
|
_ActionItem(
|
|
icon: LucideIcons.repeat,
|
|
label: '劃轉',
|
|
colorScheme: colorScheme,
|
|
onTap: onTransfer,
|
|
),
|
|
_ActionItem(
|
|
icon: LucideIcons.chartPie,
|
|
label: '盈虧',
|
|
colorScheme: colorScheme,
|
|
onTap: onProfit,
|
|
),
|
|
_ActionItem(
|
|
icon: LucideIcons.fileText,
|
|
label: '賬單',
|
|
colorScheme: colorScheme,
|
|
onTap: onBills,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _ActionItem extends StatelessWidget {
|
|
const _ActionItem({
|
|
required this.icon,
|
|
required this.label,
|
|
required this.colorScheme,
|
|
required this.onTap,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String label;
|
|
final ColorScheme colorScheme;
|
|
final VoidCallback? onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Light: #F3F4F6, Dark: #1E293B
|
|
final isDark = colorScheme.brightness == Brightness.dark;
|
|
final iconBgColor = isDark
|
|
? const Color(0xFF1E293B)
|
|
: const Color(0xFFF3F4F6);
|
|
|
|
// Light: #4B5563, Dark: 根據主題
|
|
final iconColor = isDark
|
|
? colorScheme.onSurfaceVariant
|
|
: const Color(0xFF4B5563);
|
|
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
behavior: HitTestBehavior.opaque,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: iconBgColor,
|
|
borderRadius: BorderRadius.circular(AppRadius.md),
|
|
),
|
|
alignment: Alignment.center,
|
|
child: Icon(
|
|
icon,
|
|
size: 18,
|
|
color: iconColor,
|
|
),
|
|
),
|
|
const SizedBox(height: AppSpacing.xs + 2),
|
|
Text(
|
|
label,
|
|
style: AppTextStyles.labelMedium(context),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|