111
This commit is contained in:
@@ -3,10 +3,10 @@ import '../../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
|
||||
/// 金额输入框组件(含超额提示)
|
||||
/// 金額輸入框組件(含超額提示)
|
||||
///
|
||||
/// 设计稿:bg-tertiary,圆角md,高48。
|
||||
/// 输入金额超过可用 USDT 余额时显示警告提示。
|
||||
/// 設計稿:bg-tertiary,圓角md,高48。
|
||||
/// 輸入金額超過可用 USDT 餘額時顯示警告提示。
|
||||
class AmountInput extends StatefulWidget {
|
||||
final TextEditingController amountController;
|
||||
final String maxAmount;
|
||||
@@ -63,7 +63,7 @@ class _AmountInputState extends State<AmountInput> {
|
||||
Container(
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest.withOpacity(0.5), // 调整透明度
|
||||
color: colorScheme.surfaceContainerHighest.withOpacity(0.5), // 調整透明度
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
),
|
||||
child: TextField(
|
||||
@@ -74,7 +74,7 @@ class _AmountInputState extends State<AmountInput> {
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: '请输入金额',
|
||||
hintText: '請輸入金額',
|
||||
hintStyle: AppTextStyles.numberMedium(context).copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
color: colorScheme.onSurfaceVariant.withOpacity(0.5),
|
||||
@@ -94,7 +94,7 @@ class _AmountInputState extends State<AmountInput> {
|
||||
Icon(Icons.error_outline, size: 13, color: warningColor),
|
||||
SizedBox(width: AppSpacing.xs),
|
||||
Text(
|
||||
'超出可用USDT余额',
|
||||
'超出可用USDT餘額',
|
||||
style: AppTextStyles.bodySmall(context).copyWith(
|
||||
color: warningColor,
|
||||
),
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
|
||||
/// 币种头像组件
|
||||
/// 幣種頭像組件
|
||||
///
|
||||
/// 显示币种图标或首字母的圆形头像,带主题色边框和背景。
|
||||
/// 顯示幣種圖標或首字母的圓形頭像,帶主題色邊框和背景。
|
||||
class CoinAvatar extends StatelessWidget {
|
||||
final String? icon;
|
||||
const CoinAvatar({super.key, this.icon});
|
||||
|
||||
@@ -6,9 +6,9 @@ import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../data/models/coin.dart';
|
||||
import 'coin_avatar.dart';
|
||||
|
||||
/// 币种选择器组件
|
||||
/// 幣種選擇器組件
|
||||
///
|
||||
/// 显示当前选中的币种交易对,点击弹出底部弹窗选择币种。
|
||||
/// 顯示當前選中的幣種交易對,點擊彈出底部彈窗選擇幣種。
|
||||
class CoinSelector extends StatelessWidget {
|
||||
final Coin? selectedCoin;
|
||||
final List<Coin> coins;
|
||||
@@ -38,7 +38,7 @@ class CoinSelector extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// 币种信息:交易对 + 名称
|
||||
// 幣種信息:交易對 + 名稱
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -46,19 +46,19 @@ class CoinSelector extends StatelessWidget {
|
||||
Text(
|
||||
selectedCoin != null
|
||||
? '${selectedCoin!.code}/USDT'
|
||||
: '选择币种',
|
||||
: '選擇幣種',
|
||||
style: AppTextStyles.headlineLarge(context),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
selectedCoin?.name ?? '点击选择交易对',
|
||||
selectedCoin?.name ?? '點擊選擇交易對',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 下拉箭头
|
||||
// 下拉箭頭
|
||||
Icon(LucideIcons.chevronDown,
|
||||
size: 16, color: context.colors.onSurfaceVariant),
|
||||
],
|
||||
@@ -83,7 +83,7 @@ class CoinSelector extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 拖动指示器
|
||||
// 拖動指示器
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: AppSpacing.sm),
|
||||
width: 40,
|
||||
@@ -93,13 +93,13 @@ class CoinSelector extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
),
|
||||
// 标题栏
|
||||
// 標題欄
|
||||
Padding(
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('选择币种',
|
||||
Text('選擇幣種',
|
||||
style: AppTextStyles.headlineLarge(context)),
|
||||
GestureDetector(
|
||||
onTap: () => Navigator.of(ctx).pop(),
|
||||
@@ -110,7 +110,7 @@ class CoinSelector extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Divider(height: 1, color: ctx.colors.outlineVariant.withValues(alpha: 0.2)),
|
||||
// 币种列表
|
||||
// 幣種列表
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.symmetric(vertical: AppSpacing.sm),
|
||||
@@ -150,7 +150,7 @@ class CoinSelector extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 第一行:币种代码 + USDT + 价格 + 涨跌幅
|
||||
// 第一行:幣種代碼 + USDT + 價格 + 漲跌幅
|
||||
Row(
|
||||
children: [
|
||||
Text(coin.code,
|
||||
@@ -164,7 +164,7 @@ class CoinSelector extends StatelessWidget {
|
||||
Text('\$${coin.formattedPrice}',
|
||||
style: AppTextStyles.numberMedium(context)),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
// 涨跌幅徽章
|
||||
// 漲跌幅徽章
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
@@ -185,7 +185,7 @@ class CoinSelector extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SizedBox(height: 3),
|
||||
// 第二行:币种名称
|
||||
// 第二行:幣種名稱
|
||||
Text(coin.name,
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
|
||||
@@ -5,10 +5,10 @@ import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../components/glass_panel.dart';
|
||||
import '../../../components/neon_glow.dart';
|
||||
|
||||
/// 交易确认对话框
|
||||
/// 交易確認對話框
|
||||
///
|
||||
/// 显示交易详情(交易对、委托价格、交易金额、交易数量),
|
||||
/// 用户确认后执行交易。
|
||||
/// 顯示交易詳情(交易對、委託價格、交易金額、交易數量),
|
||||
/// 用戶確認後執行交易。
|
||||
class ConfirmDialog extends StatelessWidget {
|
||||
final bool isBuy;
|
||||
final String coinCode;
|
||||
@@ -42,19 +42,19 @@ class ConfirmDialog extends StatelessWidget {
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'确认${isBuy ? '买入' : '卖出'}',
|
||||
'確認${isBuy ? '買入' : '賣出'}',
|
||||
style: AppTextStyles.headlineLarge(context),
|
||||
),
|
||||
),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
_dialogRow(context, '交易对', '$coinCode/USDT'),
|
||||
_dialogRow(context, '交易對', '$coinCode/USDT'),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
_dialogRow(context, '委托价格', '$price USDT'),
|
||||
_dialogRow(context, '委託價格', '$price USDT'),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
_dialogRow(context, '交易金额', '$amount USDT',
|
||||
_dialogRow(context, '交易金額', '$amount USDT',
|
||||
valueColor: actionColor),
|
||||
SizedBox(height: AppSpacing.sm),
|
||||
_dialogRow(context, '交易数量', '$quantity $coinCode'),
|
||||
_dialogRow(context, '交易數量', '$quantity $coinCode'),
|
||||
SizedBox(height: AppSpacing.lg),
|
||||
Row(
|
||||
children: [
|
||||
@@ -70,7 +70,7 @@ class ConfirmDialog extends StatelessWidget {
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '确认${isBuy ? '买入' : '卖出'}',
|
||||
text: '確認${isBuy ? '買入' : '賣出'}',
|
||||
type: isBuy ? NeonButtonType.tertiary : NeonButtonType.error,
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
height: 44,
|
||||
|
||||
@@ -3,9 +3,9 @@ import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
|
||||
/// 占位卡片组件
|
||||
/// 佔位卡片組件
|
||||
///
|
||||
/// 当未选择币种时显示的占位提示卡片。
|
||||
/// 當未選擇幣種時顯示的佔位提示卡片。
|
||||
class PlaceholderCard extends StatelessWidget {
|
||||
final String message;
|
||||
const PlaceholderCard({
|
||||
|
||||
@@ -4,10 +4,10 @@ import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../data/models/coin.dart';
|
||||
|
||||
/// 价格卡片组件
|
||||
/// 價格卡片組件
|
||||
///
|
||||
/// 显示当前币种价格和 24h 涨跌幅。
|
||||
/// 布局:大号价格(32px bold) + 涨跌幅徽章(圆角sm,涨绿背景) + "24h 变化" 副标题。
|
||||
/// 顯示當前幣種價格和 24h 漲跌幅。
|
||||
/// 佈局:大號價格(32px bold) + 漲跌幅徽章(圓角sm,漲綠背景) + "24h 變化" 副標題。
|
||||
class PriceCard extends StatelessWidget {
|
||||
final Coin coin;
|
||||
const PriceCard({super.key, required this.coin});
|
||||
@@ -34,7 +34,7 @@ class PriceCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 价格行:大号价格 + 涨跌幅徽章
|
||||
// 價格行:大號價格 + 漲跌幅徽章
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
@@ -42,10 +42,10 @@ class PriceCard extends StatelessWidget {
|
||||
style: AppTextStyles.numberLarge(context).copyWith(fontSize: 32),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
// 涨跌幅徽章 - 圆角sm,涨绿背景
|
||||
// 漲跌幅徽章 - 圓角sm,漲綠背景
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, vertical: 4), // 调整 padding
|
||||
horizontal: 8, vertical: 4), // 調整 padding
|
||||
decoration: BoxDecoration(
|
||||
color: changeBgColor,
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
@@ -61,9 +61,9 @@ class PriceCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
// 副标题
|
||||
// 副標題
|
||||
Text(
|
||||
'24h 变化',
|
||||
'24h 變化',
|
||||
style: AppTextStyles.bodySmall(context),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,9 +3,9 @@ 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。
|
||||
/// CTA 買入/賣出按鈕。profit-green底 / sell-red底,圓角lg,高48,買入白字/賣出紅字16px bold。
|
||||
class TradeButton extends StatelessWidget {
|
||||
final bool isBuy;
|
||||
final String? coinCode;
|
||||
@@ -27,7 +27,7 @@ class TradeButton extends StatelessWidget {
|
||||
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));
|
||||
@@ -52,7 +52,7 @@ class TradeButton extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'${isBuy ? '买入' : '卖出'} ${coinCode ?? ""}',
|
||||
'${isBuy ? '買入' : '賣出'} ${coinCode ?? ""}',
|
||||
style: AppTextStyles.headlineLarge(context).copyWith(
|
||||
color: enabled
|
||||
? textColor
|
||||
|
||||
@@ -6,10 +6,10 @@ import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../../data/models/coin.dart';
|
||||
import 'amount_input.dart';
|
||||
|
||||
/// 交易表单卡片组件
|
||||
/// 交易表單卡片組件
|
||||
///
|
||||
/// 包含买入/卖出切换、金额输入、可用余额、快捷比例按钮、计算数量行。
|
||||
/// card背景 + 圆角lg + border + padding:20 + gap:16
|
||||
/// 包含買入/賣出切換、金額輸入、可用餘額、快捷比例按鈕、計算數量行。
|
||||
/// card背景 + 圓角lg + border + padding:20 + gap:16
|
||||
class TradeFormCard extends StatelessWidget {
|
||||
final int tradeType;
|
||||
final Coin? selectedCoin;
|
||||
@@ -43,7 +43,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
? context.appColors.up
|
||||
: context.appColors.down;
|
||||
|
||||
// 设计稿中 card 背景色
|
||||
// 設計稿中 card 背景色
|
||||
final cardBgColor = context.appColors.surfaceCard;
|
||||
|
||||
return Container(
|
||||
@@ -59,13 +59,13 @@ class TradeFormCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// ---- 买入/卖出切换 ----
|
||||
// 设计稿:ClipRRect + 圆角md,两等宽按钮
|
||||
// ---- 買入/賣出切換 ----
|
||||
// 設計稿:ClipRRect + 圓角md,兩等寬按鈕
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
child: Row(
|
||||
children: [
|
||||
// 买入按钮
|
||||
// 買入按鈕
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => onTradeTypeChanged(0),
|
||||
@@ -84,7 +84,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'买入',
|
||||
'買入',
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
color: isBuy
|
||||
? Colors.white
|
||||
@@ -95,7 +95,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
// 卖出按钮
|
||||
// 賣出按鈕
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => onTradeTypeChanged(1),
|
||||
@@ -114,7 +114,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'卖出',
|
||||
'賣出',
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
color: !isBuy
|
||||
? Colors.white
|
||||
@@ -130,11 +130,11 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md + AppSpacing.sm),
|
||||
|
||||
// ---- 交易金额 label 行 ----
|
||||
// ---- 交易金額 label 行 ----
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('交易金额',
|
||||
Text('交易金額',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
)),
|
||||
@@ -144,7 +144,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
|
||||
// ---- 金额输入框 ----
|
||||
// ---- 金額輸入框 ----
|
||||
AmountInput(
|
||||
amountController: amountController,
|
||||
maxAmount: maxAmount,
|
||||
@@ -154,7 +154,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
|
||||
// ---- 可用余额 ----
|
||||
// ---- 可用餘額 ----
|
||||
Text(
|
||||
isBuy
|
||||
? '可用: $availableUsdt USDT'
|
||||
@@ -165,8 +165,8 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md),
|
||||
|
||||
// ---- 快捷比例按钮 25% 50% 75% 100% ----
|
||||
// 设计稿:gap:8,圆角sm,bg-tertiary,高32
|
||||
// ---- 快捷比例按鈕 25% 50% 75% 100% ----
|
||||
// 設計稿:gap:8,圓角sm,bg-tertiary,高32
|
||||
Row(
|
||||
children: [
|
||||
_buildPctButton(context, '25%', 0.25),
|
||||
@@ -180,11 +180,11 @@ class TradeFormCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: AppSpacing.md + AppSpacing.sm),
|
||||
|
||||
// ---- 计算数量行 ----
|
||||
// ---- 計算數量行 ----
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('交易数量',
|
||||
Text('交易數量',
|
||||
style: AppTextStyles.bodyMedium(context).copyWith(
|
||||
color: context.colors.onSurfaceVariant,
|
||||
)),
|
||||
@@ -199,7 +199,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 百分比按钮 - 设计稿:圆角sm,bg-tertiary,高32
|
||||
/// 百分比按鈕 - 設計稿:圓角sm,bg-tertiary,高32
|
||||
Widget _buildPctButton(BuildContext context, String label, double pct) {
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
@@ -207,7 +207,7 @@ class TradeFormCard extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: context.colors.surfaceContainerHighest.withOpacity(0.5), // 更柔和的颜色
|
||||
color: context.colors.surfaceContainerHighest.withOpacity(0.5), // 更柔和的顏色
|
||||
borderRadius: BorderRadius.circular(AppRadius.sm),
|
||||
),
|
||||
child: Center(
|
||||
|
||||
Reference in New Issue
Block a user