Add forgot password, reset password, and verify OTP providers and view models
- Implemented `ForgotPasswordViewModel`, `ResetPasswordViewModel`, and `VerifyOtpViewModel` for handling respective functionalities. - Created provider functions for lazy loading of these view models in the app. - Updated routing to utilize the new providers for managing state in the forgot password flow. - Refactored UI components to integrate with the new view models, ensuring proper state management and user feedback during operations.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../data/repositories/auth_repository.dart';
|
||||
import '../../view_models/forgot_password_view_model.dart';
|
||||
|
||||
/// Lazy ForgotPasswordViewModel provider
|
||||
Widget forgotPasswordProvider({required Widget child}) {
|
||||
return ChangeNotifierProvider(
|
||||
create:
|
||||
(context) => ForgotPasswordViewModel(
|
||||
authRepository: context.read<AuthRepository>(),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../data/repositories/auth_repository.dart';
|
||||
import '../../view_models/reset_password_view_model.dart';
|
||||
|
||||
/// Lazy ResetPasswordViewModel provider
|
||||
Widget resetPasswordProvider({required Widget child}) {
|
||||
return ChangeNotifierProvider(
|
||||
create:
|
||||
(context) => ResetPasswordViewModel(
|
||||
authRepository: context.read<AuthRepository>(),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../data/repositories/auth_repository.dart';
|
||||
import '../../view_models/verify_otp_view_model.dart';
|
||||
|
||||
/// Lazy VerifyOtpViewModel provider
|
||||
Widget verifyOtpProvider({required Widget child}) {
|
||||
return ChangeNotifierProvider(
|
||||
create:
|
||||
(context) =>
|
||||
VerifyOtpViewModel(authRepository: context.read<AuthRepository>()),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user