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