- 更新 trade_button.dart 使用新颜色系统 - 更新 coin_card.dart 使用新颜色系统 - 更新 asset_card.dart 使用新颜色系统 - 创建 modern_dialog.dart 现代弹窗模板 - 创建 modern_bottom_sheet.dart 现代底部抽屉模板 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
2.5 KiB
Dart
95 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:shadcn_ui/shadcn_ui.dart';
|
|
import '../../core/theme/app_color_scheme.dart';
|
|
|
|
/// 币种卡片组件 - 用于显示币种信息
|
|
class CoinCard extends StatelessWidget {
|
|
final String code;
|
|
final String name;
|
|
final String price;
|
|
final String change;
|
|
final bool isUp;
|
|
final String? icon;
|
|
final VoidCallback? onTap;
|
|
|
|
const CoinCard({
|
|
super.key,
|
|
required this.code,
|
|
required this.name,
|
|
required this.price,
|
|
required this.change,
|
|
this.isUp = true,
|
|
this.icon,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = ShadTheme.of(context);
|
|
|
|
return ShadCard(
|
|
padding: const EdgeInsets.all(16),
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
child: Row(
|
|
children: [
|
|
// 图标
|
|
Container(
|
|
width: 44,
|
|
height: 44,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
icon ?? code.substring(0, 1),
|
|
style: TextStyle(
|
|
fontSize: 20,
|
|
color: theme.colorScheme.primary,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
// 名称
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'$code/USDT',
|
|
style: theme.textTheme.large.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
name,
|
|
style: theme.textTheme.muted,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
// 涨跌幅
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: getChangeBackgroundColor(isUp),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Text(
|
|
change,
|
|
style: TextStyle(
|
|
color: getChangeColor(isUp),
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|