2026-04-05 22:38:56 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import '../../../../core/theme/app_spacing.dart';
|
2026-04-05 23:37:27 +08:00
|
|
|
import '../../../../core/theme/app_theme.dart';
|
2026-04-06 01:58:08 +08:00
|
|
|
import '../../../../core/theme/app_theme_extension.dart';
|
2026-04-05 22:38:56 +08:00
|
|
|
import '../../../components/glass_panel.dart';
|
|
|
|
|
import '../../../components/neon_glow.dart';
|
|
|
|
|
|
|
|
|
|
/// 交易确认对话框
|
|
|
|
|
///
|
|
|
|
|
/// 显示交易详情(交易对、委托价格、交易金额、交易数量),
|
|
|
|
|
/// 用户确认后执行交易。
|
|
|
|
|
class ConfirmDialog extends StatelessWidget {
|
|
|
|
|
final bool isBuy;
|
|
|
|
|
final String coinCode;
|
|
|
|
|
final String price;
|
|
|
|
|
final String quantity;
|
|
|
|
|
final String amount;
|
|
|
|
|
|
|
|
|
|
const ConfirmDialog({
|
|
|
|
|
super.key,
|
|
|
|
|
required this.isBuy,
|
|
|
|
|
required this.coinCode,
|
|
|
|
|
required this.price,
|
|
|
|
|
required this.quantity,
|
|
|
|
|
required this.amount,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final actionColor = isBuy
|
2026-04-06 01:58:08 +08:00
|
|
|
? context.appColors.up
|
|
|
|
|
: context.appColors.down;
|
2026-04-05 22:38:56 +08:00
|
|
|
|
|
|
|
|
return Dialog(
|
2026-04-06 03:15:32 +08:00
|
|
|
backgroundColor: Colors.transparent,
|
2026-04-05 22:38:56 +08:00
|
|
|
child: GlassPanel(
|
|
|
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
|
|
|
padding: EdgeInsets.all(AppSpacing.lg),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
'确认${isBuy ? '买入' : '卖出'}',
|
2026-04-05 23:37:27 +08:00
|
|
|
style: AppTextStyles.headlineLarge(context),
|
2026-04-05 22:38:56 +08:00
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: AppSpacing.lg),
|
2026-04-06 01:58:08 +08:00
|
|
|
_dialogRow(context, '交易对', '$coinCode/USDT'),
|
2026-04-05 22:38:56 +08:00
|
|
|
SizedBox(height: AppSpacing.sm),
|
2026-04-06 01:58:08 +08:00
|
|
|
_dialogRow(context, '委托价格', '$price USDT'),
|
2026-04-05 22:38:56 +08:00
|
|
|
SizedBox(height: AppSpacing.sm),
|
2026-04-06 01:58:08 +08:00
|
|
|
_dialogRow(context, '交易金额', '$amount USDT',
|
2026-04-05 22:38:56 +08:00
|
|
|
valueColor: actionColor),
|
|
|
|
|
SizedBox(height: AppSpacing.sm),
|
2026-04-06 01:58:08 +08:00
|
|
|
_dialogRow(context, '交易数量', '$quantity $coinCode'),
|
2026-04-05 22:38:56 +08:00
|
|
|
SizedBox(height: AppSpacing.lg),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: NeonButton(
|
|
|
|
|
text: '取消',
|
|
|
|
|
type: NeonButtonType.outline,
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(false),
|
|
|
|
|
height: 44,
|
|
|
|
|
showGlow: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: AppSpacing.sm),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: NeonButton(
|
|
|
|
|
text: '确认${isBuy ? '买入' : '卖出'}',
|
|
|
|
|
type: isBuy ? NeonButtonType.tertiary : NeonButtonType.error,
|
|
|
|
|
onPressed: () => Navigator.of(context).pop(true),
|
|
|
|
|
height: 44,
|
|
|
|
|
showGlow: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-06 01:58:08 +08:00
|
|
|
Widget _dialogRow(BuildContext context, String label, String value,
|
2026-04-05 22:38:56 +08:00
|
|
|
{Color? valueColor}) {
|
|
|
|
|
return Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(label,
|
2026-04-05 23:37:27 +08:00
|
|
|
style: AppTextStyles.headlineMedium(context).copyWith(
|
|
|
|
|
fontWeight: FontWeight.w400,
|
2026-04-06 01:58:08 +08:00
|
|
|
color: context.colors.onSurfaceVariant,
|
2026-04-05 22:38:56 +08:00
|
|
|
)),
|
|
|
|
|
Text(value,
|
2026-04-05 23:37:27 +08:00
|
|
|
style: AppTextStyles.numberMedium(context).copyWith(
|
2026-04-06 01:58:08 +08:00
|
|
|
color: valueColor ?? context.colors.onSurface,
|
2026-04-05 22:38:56 +08:00
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|