fix(auth): 登录异常改为居中吐司

This commit is contained in:
Zhou Weidong committed 2026-10-22 09:57:57 +08:00
1 parent 11e37a92b5
commit d076c57283
16 files changed
+341 -175

No files matched your search

+2 -6
View File
@@ -12,7 +12,7 @@ import '../../core/platform/keyboard_inset.dart';
import '../../core/theme/app_colors.dart';
import '../../core/theme/app_dimens.dart';
import '../../core/theme/app_theme.dart';
import '../../core/widgets/centered_error_dialog.dart';
import '../../core/widgets/centered_toast.dart';
import '../../core/widgets/subpage_header.dart';
import '../../l10n/app_localizations.dart';
import 'auth_logic.dart';
@@ -251,11 +251,7 @@ class _AuthPageState extends State<AuthPage> {
if (mounted) setState(() => _logic.busy = false);
}
if (!mounted || failureMessage == null) return;
await showCenteredErrorDialog(
context,
title: _logic.signUpMode ? l10n.authRegisterFailed : l10n.authLoginFailed,
message: failureMessage,
);
showCenteredToast(context, failureMessage);
}
@override
+3 -12
View File
@@ -11,7 +11,7 @@ import '../../core/data/services/auth_controller.dart';
import '../../core/platform/haptics.dart';
import '../../core/platform/keyboard_inset.dart';
import '../../core/theme/app_colors.dart';
import '../../core/widgets/centered_error_dialog.dart';
import '../../core/widgets/centered_toast.dart';
import '../../l10n/app_localizations.dart';
const double _fieldHeight = 52;
@@ -187,7 +187,7 @@ class _PhoneAuthSheetState extends State<PhoneAuthSheet> {
if (mounted) setState(() => _sending = false);
}
if (mounted && failureMessage != null) {
await _showFailure(failureMessage);
showCenteredToast(context, failureMessage);
}
}
@@ -235,19 +235,10 @@ class _PhoneAuthSheetState extends State<PhoneAuthSheet> {
if (mounted) setState(() => _submitting = false);
}
if (mounted && failureMessage != null) {
await _showFailure(failureMessage);
showCenteredToast(context, failureMessage);
}
}
Future<void> _showFailure(String message) {
final l10n = AppLocalizations.of(context)!;
return showCenteredErrorDialog(
context,
title: _signUp ? l10n.authRegisterFailed : l10n.authLoginFailed,
message: message,
);
}
void _switchMode() {
setState(() {
_signUp = !_signUp;