fix: professional profile not loading or saving correctly
- Fix typo aditional_address -> additional_address in toDocument() and fromDocument() - Clear ProfessionalFormProvider before fetch in initState() so TextFormField initialValue always applies to fresh data - Add clear() to ProfessionalFormProvider; call it on logout to avoid leaking data between users Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
732da2e475
commit
b31ff13657
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:prosapp_web_app/models/usuario.dart';
|
||||
import 'package:prosapp_web_app/providers/professional_form_provider.dart';
|
||||
import 'package:prosapp_web_app/providers/professional_provider.dart';
|
||||
import 'package:prosapp_web_app/providers/services_provider.dart';
|
||||
import 'package:prosapp_web_app/router/router.dart';
|
||||
@@ -205,6 +206,7 @@ class AuthProvider extends ChangeNotifier {
|
||||
final ctx = NavigationService.navigatorKey.currentContext!;
|
||||
Provider.of<ServicesProvider>(ctx, listen: false).logout();
|
||||
Provider.of<ProfessionalProvider>(ctx, listen: false).logout();
|
||||
Provider.of<ProfessionalFormProvider>(ctx, listen: false).clear();
|
||||
|
||||
NavigationService.replaceTo(Flurorouter.phoneLoginRoute);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,11 @@ class ProfessionalFormProvider with ChangeNotifier {
|
||||
bool _validForm() => formKey.currentState!.validate();
|
||||
bool _validProfileForm() => profileFormKey.currentState!.validate();
|
||||
|
||||
void clear() {
|
||||
profesional = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setProfesional(Profesional p) {
|
||||
profesional = p;
|
||||
notifyListeners();
|
||||
|
||||
Reference in New Issue
Block a user