refactor: 重构弹窗组件支持自定义图标组件
This commit is contained in:
+2
-2
@@ -79,5 +79,5 @@ ERYAO_CORS__ALLOW_ORIGINS=["http://localhost", "http://localhost:3000"]
|
|||||||
############
|
############
|
||||||
# Test相关
|
# Test相关
|
||||||
############
|
############
|
||||||
ERYAO_TEST__EMAIL=8613812345678
|
ERYAO_TEST__EMAIL=test@example.com
|
||||||
ERYAO_TEST__PASSWORD=Test@123456
|
ERYAO_TEST__CODE=123456
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ Do not place backend/frontend implementation details here.
|
|||||||
|
|
||||||
When viewing data in the database, use `supabase mcp` tools (`supabase_execute_sql`, `supabase_list_tables`, etc.) instead of direct queries or other methods.
|
When viewing data in the database, use `supabase mcp` tools (`supabase_execute_sql`, `supabase_list_tables`, etc.) instead of direct queries or other methods.
|
||||||
|
|
||||||
|
## Image Handling
|
||||||
|
|
||||||
|
When reading images, use `understand_image` tool instead of `Read` tool, especially when the model supports multimodal capabilities. Only use `Read` tool for non-image files.
|
||||||
|
|
||||||
## Mobile Automation
|
## Mobile Automation
|
||||||
|
|
||||||
Use Midscene Skills for mobile UI automation.
|
Use Midscene Skills for mobile UI automation.
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
@@ -12,6 +12,7 @@ import '../../../settings/presentation/utils/legal_document_assets.dart';
|
|||||||
import '../../../../l10n/app_localizations.dart';
|
import '../../../../l10n/app_localizations.dart';
|
||||||
import '../../../../shared/theme/design_tokens.dart';
|
import '../../../../shared/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||||
|
import '../../../../shared/widgets/gua_icon.dart';
|
||||||
import '../../../../shared/widgets/toast/toast.dart';
|
import '../../../../shared/widgets/toast/toast.dart';
|
||||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||||
|
|
||||||
@@ -193,7 +194,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
return AppModalDialog(
|
return AppModalDialog(
|
||||||
title: title,
|
title: title,
|
||||||
message: content,
|
message: content,
|
||||||
icon: Icons.description_outlined,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: AppLocalizations.of(dialogContext)!.dialogConfirm,
|
label: AppLocalizations.of(dialogContext)!.dialogConfirm,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:vibration/vibration.dart';
|
|||||||
import '../../../../l10n/app_localizations.dart';
|
import '../../../../l10n/app_localizations.dart';
|
||||||
import '../../../../shared/theme/design_tokens.dart';
|
import '../../../../shared/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||||
|
import '../../../../shared/widgets/gua_icon.dart';
|
||||||
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
||||||
import '../../../../shared/widgets/divination/divination_terms.dart';
|
import '../../../../shared/widgets/divination/divination_terms.dart';
|
||||||
import '../../../../shared/widgets/divination/yao_legend.dart';
|
import '../../../../shared/widgets/divination/yao_legend.dart';
|
||||||
@@ -253,7 +254,7 @@ class _AutoDivinationScreenState extends State<AutoDivinationScreen>
|
|||||||
points.runCost,
|
points.runCost,
|
||||||
points.availableBalance,
|
points.availableBalance,
|
||||||
),
|
),
|
||||||
icon: Icons.auto_awesome_rounded,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: l10n.cancel,
|
label: l10n.cancel,
|
||||||
@@ -290,12 +291,11 @@ class _AutoDivinationScreenState extends State<AutoDivinationScreen>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (!mounted) {
|
if (mounted) {
|
||||||
return;
|
setState(() {
|
||||||
|
_submitting = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
setState(() {
|
|
||||||
_submitting = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import '../../../../data/network/api_client.dart';
|
|||||||
import '../../../../l10n/app_localizations.dart';
|
import '../../../../l10n/app_localizations.dart';
|
||||||
import '../../../../shared/theme/design_tokens.dart';
|
import '../../../../shared/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||||
|
import '../../../../shared/widgets/gua_icon.dart';
|
||||||
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
||||||
import '../../../../shared/widgets/toast/toast.dart';
|
import '../../../../shared/widgets/toast/toast.dart';
|
||||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||||
@@ -385,7 +386,7 @@ Future<void> _showMethodTip(BuildContext context, AppLocalizations l10n) {
|
|||||||
title: l10n.divinationMethodTipTitle,
|
title: l10n.divinationMethodTipTitle,
|
||||||
message:
|
message:
|
||||||
'${l10n.divinationMethodTipAuto}\n\n${l10n.divinationMethodTipManual}\n\n${l10n.divinationMethodTipRecommend}',
|
'${l10n.divinationMethodTipAuto}\n\n${l10n.divinationMethodTipManual}\n\n${l10n.divinationMethodTipRecommend}',
|
||||||
icon: Icons.lightbulb_outline_rounded,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: l10n.divinationIAcknowledge,
|
label: l10n.divinationIAcknowledge,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:intl/intl.dart';
|
|||||||
import '../../../../l10n/app_localizations.dart';
|
import '../../../../l10n/app_localizations.dart';
|
||||||
import '../../../../shared/theme/design_tokens.dart';
|
import '../../../../shared/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||||
|
import '../../../../shared/widgets/gua_icon.dart';
|
||||||
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
import '../../../../shared/widgets/divination/divination_shared_widgets.dart';
|
||||||
import '../../../../shared/widgets/divination/divination_terms.dart';
|
import '../../../../shared/widgets/divination/divination_terms.dart';
|
||||||
import '../../../../shared/widgets/divination/yao_legend.dart';
|
import '../../../../shared/widgets/divination/yao_legend.dart';
|
||||||
@@ -166,7 +167,7 @@ class _ManualDivinationScreenState extends State<ManualDivinationScreen>
|
|||||||
return AppModalDialog(
|
return AppModalDialog(
|
||||||
title: l10n.manualYaoTipTitle,
|
title: l10n.manualYaoTipTitle,
|
||||||
message: l10n.manualYaoTipContent,
|
message: l10n.manualYaoTipContent,
|
||||||
icon: Icons.info_outline_rounded,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: l10n.divinationIAcknowledge,
|
label: l10n.divinationIAcknowledge,
|
||||||
@@ -210,7 +211,7 @@ class _ManualDivinationScreenState extends State<ManualDivinationScreen>
|
|||||||
points.runCost,
|
points.runCost,
|
||||||
points.availableBalance,
|
points.availableBalance,
|
||||||
),
|
),
|
||||||
icon: Icons.auto_awesome_rounded,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: l10n.cancel,
|
label: l10n.cancel,
|
||||||
@@ -247,12 +248,11 @@ class _ManualDivinationScreenState extends State<ManualDivinationScreen>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
if (!mounted) {
|
if (mounted) {
|
||||||
return;
|
setState(() {
|
||||||
|
_submitting = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
setState(() {
|
|
||||||
_submitting = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -506,18 +506,19 @@ class _YaoSelectionCard extends StatelessWidget {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 120,
|
height: 120,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
errorBuilder: (_, __, ___) => Container(
|
errorBuilder: (context, error, stackTrace) =>
|
||||||
height: 120,
|
Container(
|
||||||
color: colors.errorContainer,
|
height: 120,
|
||||||
child: Center(
|
color: colors.errorContainer,
|
||||||
child: Text(
|
child: Center(
|
||||||
l10n.divinationClose,
|
child: Text(
|
||||||
style: TextStyle(
|
l10n.divinationClose,
|
||||||
color: colors.onErrorContainer,
|
style: TextStyle(
|
||||||
|
color: colors.onErrorContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: AppSpacing.xs),
|
const SizedBox(height: AppSpacing.xs),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import '../../../../l10n/app_localizations.dart';
|
|||||||
import '../../../../core/logging/logger.dart';
|
import '../../../../core/logging/logger.dart';
|
||||||
import '../../../../shared/theme/design_tokens.dart';
|
import '../../../../shared/theme/design_tokens.dart';
|
||||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||||
|
import '../../../../shared/widgets/gua_icon.dart';
|
||||||
import '../../../../shared/widgets/toast/toast.dart';
|
import '../../../../shared/widgets/toast/toast.dart';
|
||||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||||
import '../../data/models/profile_settings.dart';
|
import '../../data/models/profile_settings.dart';
|
||||||
@@ -40,7 +41,6 @@ class SettingsScreen extends StatefulWidget {
|
|||||||
class _SettingsScreenState extends State<SettingsScreen> {
|
class _SettingsScreenState extends State<SettingsScreen> {
|
||||||
final Logger _logger = getLogger('features.settings.settings_screen');
|
final Logger _logger = getLogger('features.settings.settings_screen');
|
||||||
late ProfileSettingsV1 _settings;
|
late ProfileSettingsV1 _settings;
|
||||||
bool _isLoggingOut = false;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -114,7 +114,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: AppSpacing.xl),
|
const SizedBox(height: AppSpacing.xl),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: _isLoggingOut ? null : _confirmLogout,
|
onPressed: _confirmLogout,
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: colors.error,
|
backgroundColor: colors.error,
|
||||||
@@ -208,7 +208,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
return AppModalDialog(
|
return AppModalDialog(
|
||||||
title: l10n.settingsLogoutDialogTitle,
|
title: l10n.settingsLogoutDialogTitle,
|
||||||
message: l10n.settingsLogoutDialogBody,
|
message: l10n.settingsLogoutDialogBody,
|
||||||
icon: Icons.logout_rounded,
|
iconWidget: const GuaIcon(),
|
||||||
actions: [
|
actions: [
|
||||||
AppModalDialogAction(
|
AppModalDialogAction(
|
||||||
label: l10n.settingsCancel,
|
label: l10n.settingsCancel,
|
||||||
@@ -228,21 +228,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
await widget.onLogout();
|
||||||
_isLoggingOut = true;
|
if (!mounted) {
|
||||||
});
|
return;
|
||||||
try {
|
|
||||||
await widget.onLogout();
|
|
||||||
if (!mounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
|
||||||
} finally {
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_isLoggingOut = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,13 @@ class AppModalDialog extends StatelessWidget {
|
|||||||
required this.message,
|
required this.message,
|
||||||
required this.actions,
|
required this.actions,
|
||||||
this.icon,
|
this.icon,
|
||||||
|
this.iconWidget,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String message;
|
final String message;
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
|
final Widget? iconWidget;
|
||||||
final List<AppModalDialogAction> actions;
|
final List<AppModalDialogAction> actions;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -59,9 +61,9 @@ class AppModalDialog extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
if (icon != null)
|
if (iconWidget != null || icon != null)
|
||||||
Container(
|
Container(
|
||||||
width: 36,
|
width: 36,
|
||||||
height: 36,
|
height: 36,
|
||||||
@@ -70,9 +72,12 @@ class AppModalDialog extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||||
),
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Icon(icon, color: colors.primary, size: 20),
|
child:
|
||||||
|
iconWidget ??
|
||||||
|
Icon(icon, color: colors.primary, size: 20),
|
||||||
),
|
),
|
||||||
if (icon != null) const SizedBox(width: AppSpacing.sm),
|
if (iconWidget != null || icon != null)
|
||||||
|
const SizedBox(width: AppSpacing.sm),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class GuaIcon extends StatelessWidget {
|
||||||
|
const GuaIcon({super.key, this.color, this.size = 20});
|
||||||
|
|
||||||
|
final Color? color;
|
||||||
|
final double size;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final effectiveColor =
|
||||||
|
color ?? Theme.of(context).colorScheme.onPrimaryContainer;
|
||||||
|
return Text(
|
||||||
|
'爻',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: size * 0.85,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: effectiveColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user