统一弹窗风格:Material Design 3 规范,消除颜色不一致

- 所有 AlertDialog 替换为 ModernDialog
- ConfirmDialog/AssetDialogs 去掉 GlassPanel,统一 surfaceContainer 背景
- 按钮统一 FilledButton + TextButton
- 修复 import 路径
This commit is contained in:
2026-04-16 11:47:17 +08:00
parent 491fcfdb5d
commit 1793fb727e
32 changed files with 75614 additions and 69129 deletions

View File

@@ -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 ? '買入' : '賣出'}'),
),
),
],

View File

@@ -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),
],
);
}
}