|
|
|
|
@ -5,13 +5,13 @@ import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/forget_password_module/models/general_response_model.dart';
|
|
|
|
|
import 'package:test_sa/new_views/forget_password_module/models/update_password.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/new_views/forget_password_module/models/general_response_model.dart';
|
|
|
|
|
import 'package:test_sa/new_views/forget_password_module/models/update_password.dart';
|
|
|
|
|
import 'package:test_sa/new_views/pages/login_page.dart';
|
|
|
|
|
|
|
|
|
|
import '../../controllers/providers/api/user_provider.dart';
|
|
|
|
|
import '../../controllers/validator/validator.dart';
|
|
|
|
|
|
|
|
|
|
@ -26,8 +26,8 @@ class ResetPasswordView extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
UserProvider _userProvider;
|
|
|
|
|
bool _passwordVisible =false;
|
|
|
|
|
bool _confirmPasswordVisible =false;
|
|
|
|
|
bool _passwordVisible = false;
|
|
|
|
|
bool _confirmPasswordVisible = false;
|
|
|
|
|
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
|
|
|
|
|
@ -44,11 +44,9 @@ class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
context.translation.resetPassword.heading2(context).custom(color: AppColor.neutral80, fontWeight: FontWeight.w500),
|
|
|
|
|
8.height,
|
|
|
|
|
context.translation.pleaseEnterTheNewPassword.bodyText2(context).custom(color: AppColor.white20, fontWeight: FontWeight.w500),
|
|
|
|
|
|
|
|
|
|
32.height,
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
initialValue: _userProvider.newPassword,
|
|
|
|
|
@ -59,9 +57,7 @@ class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
// Based on passwordVisible state choose the icon
|
|
|
|
|
_passwordVisible
|
|
|
|
|
? Icons.visibility
|
|
|
|
|
: Icons.visibility_off,
|
|
|
|
|
_passwordVisible ? Icons.visibility : Icons.visibility_off,
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
@ -92,9 +88,7 @@ class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
// Based on passwordVisible state choose the icon
|
|
|
|
|
_confirmPasswordVisible
|
|
|
|
|
? Icons.visibility
|
|
|
|
|
: Icons.visibility_off,
|
|
|
|
|
_confirmPasswordVisible ? Icons.visibility : Icons.visibility_off,
|
|
|
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral20,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
@ -110,7 +104,6 @@ class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).center.expanded,
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(start: 16, end: 16, bottom: 24, top: 24),
|
|
|
|
|
),
|
|
|
|
|
@ -127,8 +120,8 @@ class _ResetPasswordViewState extends State<ResetPasswordView> {
|
|
|
|
|
password: _userProvider.newPassword, confirmPassword: _userProvider.confirmPassword, userId: _userProvider.verifyOtpModel.userId, token: _userProvider.verifyOtpModel.token);
|
|
|
|
|
GeneralResponseModel generalResponseModel = await _userProvider.updateNewPassword(context: context, updatePasswordModel: updatePasswordModel);
|
|
|
|
|
if (generalResponseModel.isSuccess) {
|
|
|
|
|
_userProvider.newPassword='';
|
|
|
|
|
_userProvider.confirmPassword='';
|
|
|
|
|
_userProvider.newPassword = '';
|
|
|
|
|
_userProvider.confirmPassword = '';
|
|
|
|
|
Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|