forked from baron/baron-sso
uf 액션 토스트 공통화 및 SnackBar 제거
This commit is contained in:
@@ -7,6 +7,7 @@ import '../../../../core/notifiers/auth_notifier.dart';
|
||||
import '../../../../core/i18n/locale_utils.dart';
|
||||
import '../../../../core/services/auth_token_store.dart';
|
||||
import '../../../../core/ui/layout_breakpoints.dart';
|
||||
import '../../../../core/ui/toast_service.dart';
|
||||
import '../../../../core/widgets/language_selector.dart';
|
||||
import '../../data/models/user_profile_model.dart';
|
||||
import '../../domain/notifiers/profile_notifier.dart';
|
||||
@@ -202,21 +203,15 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
_isVerifying = false;
|
||||
});
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(tr('msg.userfront.profile.phone.code_sent'))),
|
||||
);
|
||||
ToastService.info(tr('msg.userfront.profile.phone.code_sent'));
|
||||
}
|
||||
} catch (e) {
|
||||
setState(() => _isVerifying = false);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
tr(
|
||||
'msg.userfront.profile.phone.send_failed',
|
||||
params: {'error': e.toString()},
|
||||
),
|
||||
),
|
||||
ToastService.error(
|
||||
tr(
|
||||
'msg.userfront.profile.phone.send_failed',
|
||||
params: {'error': e.toString()},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -236,21 +231,15 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
_isVerifying = false;
|
||||
});
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(tr('msg.userfront.profile.phone.verified'))),
|
||||
);
|
||||
ToastService.success(tr('msg.userfront.profile.phone.verified'));
|
||||
}
|
||||
} catch (e) {
|
||||
setState(() => _isVerifying = false);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
tr(
|
||||
'msg.userfront.profile.phone.verify_failed',
|
||||
params: {'error': e.toString()},
|
||||
),
|
||||
),
|
||||
ToastService.error(
|
||||
tr(
|
||||
'msg.userfront.profile.phone.verify_failed',
|
||||
params: {'error': e.toString()},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -302,8 +291,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
_newPasswordController?.clear();
|
||||
_confirmPasswordController?.clear();
|
||||
setState(() {
|
||||
_passwordSuccess = tr('msg.userfront.profile.password.changed');
|
||||
_passwordSuccess = null;
|
||||
});
|
||||
ToastService.success(tr('msg.userfront.profile.password.changed'));
|
||||
} catch (e) {
|
||||
final message = e.toString().replaceFirst('Exception: ', '');
|
||||
setState(() {
|
||||
@@ -312,6 +302,12 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
params: {'error': message},
|
||||
);
|
||||
});
|
||||
ToastService.error(
|
||||
tr(
|
||||
'msg.userfront.profile.password.change_failed',
|
||||
params: {'error': message},
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isPasswordSaving = false);
|
||||
@@ -338,7 +334,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
_debugLog('save_skip', reason: 'saving_in_flight');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
setState(() {
|
||||
_fieldSaveError = null;
|
||||
});
|
||||
@@ -411,7 +407,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
setState(() {
|
||||
_isSavingField = true;
|
||||
});
|
||||
|
||||
|
||||
_debugLog('save_dispatch', field: currentField, changed: true);
|
||||
|
||||
try {
|
||||
@@ -431,9 +427,7 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
_editingField = null;
|
||||
});
|
||||
_debugLog('save_success', field: currentField);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(tr('msg.userfront.profile.update_success'))),
|
||||
);
|
||||
ToastService.success(tr('msg.userfront.profile.update_success'));
|
||||
}
|
||||
} catch (e) {
|
||||
_debugLog('save_failed', field: currentField, reason: e.toString());
|
||||
@@ -711,7 +705,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
const SizedBox(width: 8),
|
||||
OutlinedButton(
|
||||
key: Key('profile-$field-cancel-button'),
|
||||
onPressed: isUpdating || _isSavingField ? null : () => _cancelEditing(profile),
|
||||
onPressed: isUpdating || _isSavingField
|
||||
? null
|
||||
: () => _cancelEditing(profile),
|
||||
child: Text(tr('ui.common.cancel')),
|
||||
),
|
||||
],
|
||||
@@ -798,7 +794,9 @@ class _ProfilePageState extends ConsumerState<ProfilePage> {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
OutlinedButton(
|
||||
onPressed: isUpdating || _isSavingField ? null : () => _cancelEditing(profile),
|
||||
onPressed: isUpdating || _isSavingField
|
||||
? null
|
||||
: () => _cancelEditing(profile),
|
||||
child: Text(tr('ui.common.cancel')),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user