Enhance authentication flow and user role management
- Updated AuthViewModel to hydrate user data from storage on initialization. - Added method to AuthRepository for retrieving stored customer data. - Enhanced AuthService to save and retrieve customer data from SharedPreferences. - Refactored UI components to use context.watch for user role updates in MeetingTimeDialog, TenderDetailActions, and TendersPage. - Improved navigation logic in final completion pages to handle user interactions more effectively.
This commit is contained in:
@@ -157,11 +157,16 @@ List<SingleChildWidget> get services {
|
||||
List<SingleChildWidget> get authProvider {
|
||||
return [
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => AuthViewModel(authRepository: context.read()),
|
||||
create: (context) {
|
||||
final vm = AuthViewModel(authRepository: context.read());
|
||||
// Hydrate stored user/customer so userRole is available on hot reloads
|
||||
vm.hydrateFromStorage();
|
||||
return vm;
|
||||
},
|
||||
lazy: false, // Load immediately for auth state checks
|
||||
),
|
||||
|
||||
ChangeNotifierProvider(
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => FinalCompletionOfDocumentsViewModel(),
|
||||
lazy: false, // Load immediately for auth state checks
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user