- Convert instance methods to static methods in AppColorScheme for getChangeColor and getChangeBackgroundColor - Update main.dart to use ShadThemeData with AppColorScheme color schemes instead of createLight/DarkShadTheme functions - Add app_theme.dart import to main.dart - Refactor asset_card.dart and coin_card.dart to call static methods via AppColorScheme class - Add app_spacing.dart import to action_buttons_row.dart - Replace SizedBox with proper spacing constants in action buttons row
108 lines
3.6 KiB
Dart
108 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../core/theme/app_color_scheme.dart';
|
|
import '../../../../core/theme/app_spacing.dart';
|
|
import '../../../../core/theme/app_theme.dart';
|
|
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 colorScheme = Theme.of(context).colorScheme;
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
final actionColor = isBuy
|
|
? AppColorScheme.getUpColor(isDark)
|
|
: AppColorScheme.getDownColor(isDark);
|
|
|
|
return Dialog(
|
|
backgroundColor: const Color(0x00000000),
|
|
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 ? '买入' : '卖出'}',
|
|
style: AppTextStyles.headlineLarge(context),
|
|
),
|
|
),
|
|
SizedBox(height: AppSpacing.lg),
|
|
_dialogRow(context, '交易对', '$coinCode/USDT', colorScheme),
|
|
SizedBox(height: AppSpacing.sm),
|
|
_dialogRow(context, '委托价格', '$price USDT', colorScheme),
|
|
SizedBox(height: AppSpacing.sm),
|
|
_dialogRow(context, '交易金额', '$amount USDT', colorScheme,
|
|
valueColor: actionColor),
|
|
SizedBox(height: AppSpacing.sm),
|
|
_dialogRow(context, '交易数量', '$quantity $coinCode', colorScheme),
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _dialogRow(BuildContext context, String label, String value, ColorScheme colorScheme,
|
|
{Color? valueColor}) {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(label,
|
|
style: AppTextStyles.headlineMedium(context).copyWith(
|
|
fontWeight: FontWeight.w400,
|
|
color: colorScheme.onSurfaceVariant,
|
|
)),
|
|
Text(value,
|
|
style: AppTextStyles.numberMedium(context).copyWith(
|
|
color: valueColor ?? colorScheme.onSurface,
|
|
)),
|
|
],
|
|
);
|
|
}
|
|
}
|