Refactor profile update logic and remove debug prints
This commit is contained in:
@@ -59,7 +59,8 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
|
||||
|
||||
// Listen for changes in display name
|
||||
_displayNameController.addListener(() {
|
||||
final newHasChanges = _displayNameController.text != (_currentUser?.displayName ?? '');
|
||||
final newHasChanges =
|
||||
_displayNameController.text != (_currentUser?.displayName ?? '');
|
||||
if (_hasChanges != newHasChanges) {
|
||||
setState(() => _hasChanges = newHasChanges);
|
||||
}
|
||||
@@ -148,9 +149,6 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
|
||||
}
|
||||
|
||||
Future<void> _updateProfile() async {
|
||||
print(
|
||||
'DEBUG: _updateProfile called with displayName: ${_displayNameController.text}',
|
||||
);
|
||||
if (_currentUser == null) {
|
||||
return;
|
||||
}
|
||||
@@ -183,7 +181,6 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} catch (e) {
|
||||
print('DEBUG: _updateProfile error: $e');
|
||||
if (mounted) {
|
||||
// Show error message
|
||||
ScaffoldMessenger.of(
|
||||
@@ -651,7 +648,9 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
|
||||
child: SizedBox(
|
||||
width: 144,
|
||||
child: ModernGlassButton(
|
||||
onPressed: _isLoading || !_hasChanges ? null : () => _updateProfile(),
|
||||
onPressed: () {
|
||||
if (!_isLoading && _hasChanges) _updateProfile();
|
||||
},
|
||||
isLoading: _isLoading,
|
||||
child: _isLoading
|
||||
? const SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user