Files
monisuo/flutter_monisuo/lib/ui/pages/trade/components/trade_button.dart
sion 2bc6ff66e1 fix: 修复UI样式问题
- 首页:移除盈亏日历,福利中心卡片改为白色背景,查看按钮改为黄色
- 资产页面:余额卡片撑满宽度
- 底部导航栏:移除背景高亮,只保留图标和文字变化
- 行情页面:调整卡片文字大小和柱形图样式
- 交易页面:买入按钮白色文字,卖出按钮红色文字,优化输入框和百分比卡片样式,添加顶部间距
- 全局:移除渐变色,统一使用纯色背景
2026-04-06 11:21:10 +08:00

67 lines
2.1 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter/material.dart';
import '../../../../core/theme/app_color_scheme.dart';
import '../../../../core/theme/app_spacing.dart';
import '../../../../core/theme/app_theme.dart';
/// 交易按钮组件
///
/// CTA 买入/卖出按钮。profit-green底 / sell-red底圆角lg高48买入白字/卖出红字16px bold。
class TradeButton extends StatelessWidget {
final bool isBuy;
final String? coinCode;
final bool enabled;
final bool isLoading;
final VoidCallback onPressed;
const TradeButton({
super.key,
required this.isBuy,
required this.coinCode,
required this.enabled,
required this.isLoading,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
final fillColor =
isBuy ? AppColorScheme.buyButtonFill : AppColorScheme.sellButtonFill;
// 买入按钮文字为白色,卖出按钮文字为红色
final textColor = isBuy
? Colors.white
: (enabled ? AppColorScheme.sellButtonFill : colorScheme.onSurface.withOpacity(0.3));
return GestureDetector(
onTap: enabled ? onPressed : null,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
height: 48,
decoration: BoxDecoration(
color: enabled ? fillColor : colorScheme.onSurface.withOpacity(0.08),
borderRadius: BorderRadius.circular(AppRadius.lg),
),
child: Center(
child: isLoading
? SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: isBuy ? Colors.white : AppColorScheme.sellButtonFill,
),
)
: Text(
'${isBuy ? '买入' : '卖出'} ${coinCode ?? ""}',
style: AppTextStyles.headlineLarge(context).copyWith(
color: enabled
? textColor
: colorScheme.onSurface.withOpacity(0.3),
),
),
),
),
);
}
}