统一弹窗风格:Material Design 3 规范,消除颜色不一致
- 所有 AlertDialog 替换为 ModernDialog - ConfirmDialog/AssetDialogs 去掉 GlassPanel,统一 surfaceContainer 背景 - 按钮统一 FilledButton + TextButton - 修复 import 路径
This commit is contained in:
@@ -9,8 +9,7 @@ import '../../../../core/theme/app_color_scheme.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/utils/toast_utils.dart';
|
||||
import '../../../../providers/asset_provider.dart';
|
||||
import '../../../components/glass_panel.dart';
|
||||
import '../../../components/neon_glow.dart';
|
||||
|
||||
import '../../../shared/ui_constants.dart';
|
||||
|
||||
// ============================================
|
||||
@@ -135,10 +134,13 @@ void showDepositDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
),
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -198,19 +200,17 @@ void showDepositDialog(BuildContext context) {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '取消',
|
||||
type: NeonButtonType.outline,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 48,
|
||||
showGlow: false,
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '下一步',
|
||||
type: NeonButtonType.primary,
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
Navigator.of(ctx).pop();
|
||||
@@ -226,8 +226,10 @@ void showDepositDialog(BuildContext context) {
|
||||
}
|
||||
}
|
||||
},
|
||||
height: 48,
|
||||
showGlow: true,
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
),
|
||||
child: const Text('下一步'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -250,18 +252,21 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
),
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: Icons.check_circle,
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: context.appColors.up,
|
||||
size: 24,
|
||||
),
|
||||
@@ -316,19 +321,17 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '稍後確認',
|
||||
type: NeonButtonType.outline,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('稍後確認'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '已打款',
|
||||
type: NeonButtonType.primary,
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(ctx).pop();
|
||||
final response = await context.read<AssetProvider>().confirmPay(orderNo);
|
||||
@@ -340,8 +343,10 @@ void showDepositResultDialog(BuildContext context, Map<String, dynamic> data) {
|
||||
);
|
||||
}
|
||||
},
|
||||
height: 44,
|
||||
showGlow: true,
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('已打款'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -386,10 +391,13 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
),
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -562,19 +570,17 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '取消',
|
||||
type: NeonButtonType.outline,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '提交',
|
||||
type: NeonButtonType.primary,
|
||||
child: FilledButton(
|
||||
onPressed: () async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
Navigator.of(ctx).pop();
|
||||
@@ -595,8 +601,10 @@ void showWithdrawDialog(BuildContext context, String? balance) {
|
||||
}
|
||||
}
|
||||
},
|
||||
height: 44,
|
||||
showGlow: true,
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('提交'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -628,10 +636,13 @@ void showResultDialog(BuildContext context, String title, String? message) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
),
|
||||
backgroundColor: colorScheme.surfaceContainer,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -654,12 +665,12 @@ void showResultDialog(BuildContext context, String title, String? message) {
|
||||
const SizedBox(height: AppSpacing.lg),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: NeonButton(
|
||||
text: '確定',
|
||||
type: NeonButtonType.primary,
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
style: FilledButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/utils/toast_utils.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import '../../components/material_input.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
|
||||
/// 充值页面
|
||||
class DepositPage extends StatefulWidget {
|
||||
@@ -88,22 +89,12 @@ class _DepositPageState extends State<DepositPage> {
|
||||
Future<void> _confirmPay() async {
|
||||
if (_orderNo == null) return;
|
||||
|
||||
final confirmed = await showDialog<bool>(
|
||||
final confirmed = await ModernDialog.confirm(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('確認已打款'),
|
||||
content: const Text('確認您已完成向指定地址的轉賬?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('確認'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '確認已打款',
|
||||
description: '確認您已完成向指定地址的轉賬?',
|
||||
confirmText: '確認',
|
||||
cancelText: '取消',
|
||||
);
|
||||
|
||||
if (confirmed != true || !mounted) return;
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../providers/auth_provider.dart';
|
||||
import '../../components/material_input.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
import '../main/main_page.dart';
|
||||
import 'register_page.dart';
|
||||
|
||||
@@ -296,18 +297,10 @@ class _LoginPageState extends State<LoginPage> {
|
||||
}
|
||||
|
||||
void _showErrorDialog(String message) {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('登錄失敗'),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '登錄失敗',
|
||||
description: message,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../../../providers/auth_provider.dart';
|
||||
import '../../components/glass_panel.dart';
|
||||
import '../../components/neon_glow.dart';
|
||||
import '../../components/material_input.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
import '../main/main_page.dart';
|
||||
|
||||
/// 註冊頁面(兩步註冊:賬號信息 + 身份證上傳)
|
||||
@@ -590,34 +591,18 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
MaterialPageRoute(builder: (_) => const MainPage()),
|
||||
);
|
||||
} else {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('註冊失敗'),
|
||||
content: Text(response.message ?? '請稍後重試'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '註冊失敗',
|
||||
description: response.message ?? '請稍後重試',
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('註冊失敗'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '註冊失敗',
|
||||
description: e.toString(),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import '../kyc_page.dart';
|
||||
import '../welfare_center_page.dart';
|
||||
import '../../../shared/modern_dialog.dart';
|
||||
import 'menu_group_container.dart';
|
||||
import 'menu_row.dart';
|
||||
import 'menu_trailing_widgets.dart';
|
||||
@@ -74,17 +75,10 @@ class MenuGroup1 extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _showKycStatusDialog(BuildContext context) {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('實名認證'),
|
||||
content: const Text('您的實名認證已通過'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '實名認證',
|
||||
description: '您的實名認證已通過',
|
||||
buttonText: '確定',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../../../core/theme/app_theme.dart';
|
||||
import '../../../providers/auth_provider.dart';
|
||||
import '../../components/glass_panel.dart';
|
||||
import '../../components/neon_glow.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
|
||||
/// KYC 實名認證頁面
|
||||
class KycPage extends StatefulWidget {
|
||||
@@ -431,61 +432,41 @@ class _KycPageState extends State<KycPage> {
|
||||
if (!mounted) return;
|
||||
|
||||
if (response.success) {
|
||||
showDialog(
|
||||
ModernDialog.show(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: Icons.check_circle,
|
||||
color: AppColorScheme.up,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
const Text('認證成功'),
|
||||
],
|
||||
),
|
||||
content: const Text('您的實名認證已通過,現在可以進行提現操作'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('確定'),
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
titleWidget: Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: Icons.check_circle,
|
||||
color: AppColorScheme.up,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
const Text('認證成功'),
|
||||
],
|
||||
),
|
||||
description: '您的實名認證已通過,現在可以進行提現操作',
|
||||
actions: [
|
||||
ModernDialogAction(
|
||||
label: '確定',
|
||||
isPrimary: true,
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('認證失敗'),
|
||||
content: Text(response.message ?? '請稍後重試'),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('確定'),
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '認證失敗',
|
||||
description: response.message ?? '請稍後重試',
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('認證失敗'),
|
||||
content: Text(e.toString()),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('確定'),
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '認證失敗',
|
||||
description: e.toString(),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
||||
import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../providers/auth_provider.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
import '../auth/login_page.dart';
|
||||
import 'components/avatar_circle.dart';
|
||||
import 'components/logout_button.dart';
|
||||
@@ -61,80 +62,60 @@ class _MinePageState extends State<MinePage>
|
||||
}
|
||||
|
||||
void _showComingSoon(String feature) {
|
||||
showDialog(
|
||||
ModernDialog.info(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('功能開發中'),
|
||||
content: Text('$feature功能正在開發中,敬請期待'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('知道了'),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '功能開發中',
|
||||
description: '$feature功能正在開發中,敬請期待',
|
||||
);
|
||||
}
|
||||
|
||||
void _showAboutDialog() {
|
||||
showDialog(
|
||||
ModernDialog.show(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
AvatarCircle(radius: 16, fontSize: 12),
|
||||
const SizedBox(width: 8),
|
||||
const Text('模擬所'),
|
||||
],
|
||||
),
|
||||
content: const Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('虛擬貨幣模擬交易平臺'),
|
||||
SizedBox(height: 8),
|
||||
Text('版本: 1.0.0'),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: const Text('確定'),
|
||||
),
|
||||
titleWidget: Row(
|
||||
children: [
|
||||
AvatarCircle(radius: 16, fontSize: 12),
|
||||
const SizedBox(width: 8),
|
||||
const Text('模擬所'),
|
||||
],
|
||||
),
|
||||
content: const Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('虛擬貨幣模擬交易平臺'),
|
||||
SizedBox(height: 8),
|
||||
Text('版本: 1.0.0'),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
ModernDialogAction(label: '確定', isPrimary: true),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _handleLogout(AuthProvider auth) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
ModernDialog.show(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('退出登錄'),
|
||||
content: const Text('確定要退出登錄嗎?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text('取消',
|
||||
style: TextStyle(color: colorScheme.onSurfaceVariant)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(ctx).pop();
|
||||
await auth.logout();
|
||||
if (ctx.mounted) {
|
||||
Navigator.of(ctx).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (_) => const LoginPage()),
|
||||
(route) => false,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text('退出', style: TextStyle(color: colorScheme.error)),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
title: '退出登錄',
|
||||
description: '確定要退出登錄嗎?',
|
||||
actions: [
|
||||
ModernDialogAction(label: '取消'),
|
||||
ModernDialogAction(
|
||||
label: '退出',
|
||||
isPrimary: true,
|
||||
isDestructive: true,
|
||||
onPressed: () async {
|
||||
await auth.logout();
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(builder: (_) => const LoginPage()),
|
||||
(route) => false,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import '../../../core/utils/toast_utils.dart';
|
||||
import '../../../core/event/app_event_bus.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import '../../../data/models/order_models.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
|
||||
/// 充提訂單頁面
|
||||
class FundOrdersPage extends StatefulWidget {
|
||||
@@ -502,28 +503,19 @@ class _FundOrdersPageState extends State<FundOrdersPage> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool?> showShadConfirmDialog({
|
||||
Future<bool> showShadConfirmDialog({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
required String description,
|
||||
bool destructive = false,
|
||||
}) {
|
||||
return showDialog<bool>(
|
||||
return ModernDialog.confirm(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(description),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('取消'),
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
),
|
||||
TextButton(
|
||||
child: Text(destructive ? '確定取消' : '確認'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
),
|
||||
],
|
||||
),
|
||||
title: title,
|
||||
description: description,
|
||||
confirmText: destructive ? '確定取消' : '確認',
|
||||
cancelText: '取消',
|
||||
isDestructive: destructive,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../core/theme/app_spacing.dart';
|
||||
import '../../../../core/theme/app_theme.dart';
|
||||
import '../../../../core/theme/app_theme_extension.dart';
|
||||
import '../../../components/glass_panel.dart';
|
||||
import '../../../components/neon_glow.dart';
|
||||
|
||||
/// 交易確認對話框
|
||||
///
|
||||
@@ -27,15 +25,19 @@ class ConfirmDialog extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final actionColor = isBuy
|
||||
? context.appColors.up
|
||||
: context.appColors.down;
|
||||
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: GlassPanel(
|
||||
borderRadius: BorderRadius.circular(AppRadius.lg),
|
||||
padding: EdgeInsets.all(AppSpacing.lg),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.xl),
|
||||
),
|
||||
backgroundColor: theme.colorScheme.surfaceContainer,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppSpacing.lg),
|
||||
constraints: const BoxConstraints(maxWidth: 400),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -59,22 +61,23 @@ class ConfirmDialog extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '取消',
|
||||
type: NeonButtonType.outline,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
height: 44,
|
||||
showGlow: false,
|
||||
style: TextButton.styleFrom(
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Expanded(
|
||||
child: NeonButton(
|
||||
text: '確認${isBuy ? '買入' : '賣出'}',
|
||||
type: isBuy ? NeonButtonType.tertiary : NeonButtonType.error,
|
||||
child: FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
height: 44,
|
||||
showGlow: true,
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: actionColor,
|
||||
minimumSize: const Size.fromHeight(44),
|
||||
),
|
||||
child: Text('確認${isBuy ? '買入' : '賣出'}'),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_theme_extension.dart';
|
||||
@@ -9,6 +8,7 @@ import '../../../providers/market_provider.dart';
|
||||
import '../../../providers/asset_provider.dart';
|
||||
import '../../../data/services/trade_service.dart';
|
||||
import '../../components/neon_glow.dart';
|
||||
import '../../shared/modern_dialog.dart';
|
||||
import 'components/coin_selector.dart';
|
||||
import 'components/price_card.dart';
|
||||
import 'components/placeholder_card.dart';
|
||||
@@ -283,30 +283,26 @@ class _TradePageState extends State<TradePage>
|
||||
}
|
||||
|
||||
void _showResultDialog(bool success, String title, String message) {
|
||||
showDialog(
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
ModernDialog.show(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: success ? Icons.check_circle : Icons.error,
|
||||
color: success
|
||||
? ctx.appColors.up
|
||||
: Theme.of(ctx).colorScheme.error,
|
||||
size: 24,
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Text(title),
|
||||
],
|
||||
),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('確定'),
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
titleWidget: Row(
|
||||
children: [
|
||||
NeonIcon(
|
||||
icon: success ? Icons.check_circle : Icons.error,
|
||||
color: success
|
||||
? context.appColors.up
|
||||
: colorScheme.error,
|
||||
size: 24,
|
||||
),
|
||||
SizedBox(width: AppSpacing.sm),
|
||||
Text(title),
|
||||
],
|
||||
),
|
||||
description: message,
|
||||
actions: [
|
||||
ModernDialogAction(label: '確定', isPrimary: true),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user