diff --git a/lib/pages/user/confirm_new_password_page.dart b/lib/pages/user/confirm_new_password_page.dart index de15915..a0273b4 100644 --- a/lib/pages/user/confirm_new_password_page.dart +++ b/lib/pages/user/confirm_new_password_page.dart @@ -1,12 +1,8 @@ import 'package:car_provider_app/api/client/user_api_client.dart'; -import 'package:car_provider_app/api/shared_prefrence.dart'; import 'package:car_provider_app/classes/utils.dart'; import 'package:car_provider_app/config/routes.dart'; import 'package:car_provider_app/models/user/confirm_password.dart'; -import 'package:car_provider_app/models/user/forget_password_otp_compare.dart'; -import 'package:car_provider_app/models/user/forget_password_otp_request.dart'; -import 'package:car_provider_app/pages/user/vertify_password_page.dart'; import 'package:car_provider_app/utils/navigator.dart'; import 'package:car_provider_app/utils/utils.dart'; import 'package:car_provider_app/widgets/app_bar.dart'; @@ -38,73 +34,52 @@ class _ConfirmNewPasswordPageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: appBar(title: "Forget Password"), - body: Container( - width: double.infinity, - height: double.infinity, - padding: EdgeInsets.all(40), - child: Column( - children: [ - "New Password".toText24(), - 12.height, - TextFormField( - decoration: InputDecoration( - hintText: "Enter New Password", - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), + body: SingleChildScrollView( + child: Container( + // width: double.infinity, + // height: double.infinity, + padding: EdgeInsets.all(40), + child: Column( + children: [ + "New Password".toText24(), + 12.height, + TextFormField( + decoration: InputDecoration( + hintText: "Enter New Password", + hintStyle: TextStyle(color: Colors.grey), + border: OutlineInputBorder( + borderRadius: const BorderRadius.all( + const Radius.circular(5.0), + ), ), ), + obscureText: true, + onChanged: (v) => newPassword = v, ), - obscureText: true, - onChanged: (v) => newPassword = v, - ), - 12.height, - TextFormField( - decoration: InputDecoration( - hintText: "Confirm Password", - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), + 12.height, + TextFormField( + decoration: InputDecoration( + hintText: "Confirm Password", + hintStyle: TextStyle(color: Colors.grey), + border: OutlineInputBorder( + borderRadius: const BorderRadius.all( + const Radius.circular(5.0), + ), ), ), + obscureText: true, + onChanged: (v) => confirmPassword = v, + ), + 40.height, + ShowFillButton( + title: "Confirm", + width: double.infinity, + onPressed: () { + if (validation()) confirmPasswordOTP(context); + }, ), - obscureText: true, - onChanged: (v) => confirmPassword = v, - ), - // TxtField( - // hint: "Inter New Password", - // value: newPassword, - // isPasswordEnabled: true, - // maxLines: 1, - // onChanged: (v) { - // newPassword = v; - // }, - // ), - // 12.height, - // TxtField( - // hint: "Confirm New Password", - // value: newPassword, - // isPasswordEnabled: true, - // maxLines: 1, - // onChanged: (v) { - // newPassword = newPassword; - // }, - // ), - 40.height, - ShowFillButton( - title: "Confirm", - width: double.infinity, - onPressed: () { - if(newPassword == confirmPassword ){ - confirmPasswordOTP(context);} - else{ - Utils.showToast("Confirmation password does not match the entered password"); - } - }, - ), - ], + ], + ), ), ), ); @@ -122,4 +97,13 @@ class _ConfirmNewPasswordPageState extends State { Utils.showToast(data.message ?? ""); } } + + bool validation() { + bool isValid = true; + if (newPassword != confirmPassword) { + Utils.showToast("Confirmation password does not match the entered password"); + isValid = false; + } + return isValid; + } }