feat(theme): 重构颜色系统为双主题设计并添加渐变组件
- 引入 "The Kinetic Vault"(深色)和 "The Ethereal Terminal"(浅色)双主题系统 - 重构颜色方案,使用层次化 surface 容器替代边框,遵循无边框设计规则 - 添加渐变预设(CTA、买入/卖出、资产卡片)和渐变按钮组件 - 更新圆角系统,明确按钮、卡片、输入框和标签的圆角规范 - 统一文本样式系统,使用 Space Grotesk(标题)和 Manrope(正文)字体 - 更新现有组件(AssetCard、CoinCard、TradeButton)以遵循新设计规范 - 添加向后兼容的已废弃常量,确保现有代码正常运行
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../../core/theme/app_color_scheme.dart';
|
||||
import '../../core/theme/app_spacing.dart';
|
||||
|
||||
/// 交易按钮组件 - 买入/卖出按钮
|
||||
///
|
||||
/// 设计规则:
|
||||
/// - 渐变按钮: 135度渐变
|
||||
/// - 圆角: xxl (24px / 1.5rem)
|
||||
/// - 买入: 翡翠绿渐变
|
||||
/// - 卖出: 红色渐变
|
||||
class TradeButton extends StatelessWidget {
|
||||
final bool isBuy;
|
||||
final String? coinCode;
|
||||
@@ -39,44 +45,57 @@ class TradeButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = isBuy ? AppColorScheme.up : AppColorScheme.down;
|
||||
final text = isBuy ? '买入${coinCode != null ? ' $coinCode' : ''}' : '卖出${coinCode != null ? ' $coinCode' : ''}';
|
||||
final icon = isBuy ? LucideIcons.arrowDownToLine : LucideIcons.arrowUpFromLine;
|
||||
final gradient = isBuy ? AppColorScheme.buyGradient : AppColorScheme.sellGradient;
|
||||
final text = isBuy
|
||||
? '买入${coinCode != null ? ' $coinCode' : ''}'
|
||||
: '卖出${coinCode != null ? ' $coinCode' : ''}';
|
||||
|
||||
final button = ShadButton(
|
||||
backgroundColor: color,
|
||||
onPressed: isLoading ? null : onPressed,
|
||||
child: Row(
|
||||
mainAxisSize: fullWidth ? MainAxisSize.max : MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (isLoading)
|
||||
const SizedBox.square(
|
||||
dimension: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
else
|
||||
Icon(icon, size: 18, color: Colors.white),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
return Container(
|
||||
width: fullWidth ? double.infinity : null,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
gradient: gradient,
|
||||
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
||||
),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: isLoading ? null : onPressed,
|
||||
borderRadius: BorderRadius.circular(AppRadius.xxl),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: fullWidth ? MainAxisSize.max : MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (isLoading)
|
||||
const SizedBox.square(
|
||||
dimension: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
else
|
||||
Icon(
|
||||
isBuy ? Icons.arrow_downward_rounded : Icons.arrow_upward_rounded,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (fullWidth) {
|
||||
return SizedBox(width: double.infinity, child: button);
|
||||
}
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +127,7 @@ class TradeButtonGroup extends StatelessWidget {
|
||||
isLoading: isBuyLoading,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: TradeButton.sell(
|
||||
coinCode: coinCode,
|
||||
|
||||
Reference in New Issue
Block a user