Refactor: Change profile tab cancel actions to reset form state instead of navigating, and adjust agent availability UI.
This commit is contained in:
@@ -3,7 +3,6 @@ import 'dart:io';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||
import 'package:real_estate_mobile/core/utils/image_url_resolver.dart';
|
||||
@@ -261,7 +260,7 @@ class _ProfileSettingsTabState extends ConsumerState<ProfileSettingsTab> {
|
||||
const SizedBox(height: 30),
|
||||
ProfileActionButtons(
|
||||
onSave: _saveProfileSettings,
|
||||
onCancel: () => context.go('/home'),
|
||||
onCancel: _resetForm,
|
||||
isSaving: profileState.isSaving,
|
||||
),
|
||||
],
|
||||
@@ -337,6 +336,16 @@ class _ProfileSettingsTabState extends ConsumerState<ProfileSettingsTab> {
|
||||
if (mounted) _showSnackBar('Avatar deleted');
|
||||
}
|
||||
|
||||
void _resetForm() {
|
||||
_controllersInitialized = false;
|
||||
_localAvatarFile = null;
|
||||
final profileState = ref.read(profileProvider);
|
||||
if (profileState.profile.isNotEmpty) {
|
||||
_initControllersFromProfile(profileState);
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void _saveProfileSettings() {
|
||||
final profileState = ref.read(profileProvider);
|
||||
final isAgent = profileState.isAgent;
|
||||
|
||||
Reference in New Issue
Block a user