- Asset Card: padding 20px (was 24px) - 充值按钮: cornerRadius 6px, padding [5,10], icon 13px, text 12px - Quick Actions: 边框颜色 Light #E2E8F0, Dark #1E293B - Quick Action Icons: 背景色 Light #F3F4F6, Dark #1E293B - Quick Action Icons: 图标色 Light #4B5563 - cornerRadius: -lg (14px) for cards
135 lines
3.5 KiB
Dart
135 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.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.onBills,
|
|
});
|
|
|
|
final VoidCallback? onDeposit;
|
|
final VoidCallback? onWithdraw;
|
|
final VoidCallback? onTransfer;
|
|
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.symmetric(vertical: AppSpacing.md, horizontal: AppSpacing.sm),
|
|
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.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),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|