统一弹窗风格:Material Design 3 规范,消除颜色不一致
- 所有 AlertDialog 替换为 ModernDialog - ConfirmDialog/AssetDialogs 去掉 GlassPanel,统一 surfaceContainer 背景 - 按钮统一 FilledButton + TextButton - 修复 import 路径
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user