Merge branch 'fatima'

fatima
devmirza121 4 years ago
commit 3d5ba9d995

@ -1,4 +1,3 @@
import 'dart:convert';
PasswordOTPCompare otpCompareFromJson(String str) => PasswordOTPCompare.fromJson(json.decode(str));
@ -11,8 +10,7 @@ class PasswordOTPCompare {
int? messageStatus;
String? message;
PasswordOTPCompare(
{this.totalItemsCount, this.data, this.messageStatus, this.message});
PasswordOTPCompare({this.totalItemsCount, this.data, this.messageStatus, this.message});
PasswordOTPCompare.fromJson(Map<String, dynamic> json) {
totalItemsCount = json['totalItemsCount'];

@ -21,14 +21,18 @@ import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart';
class ConfirmNewPasswordPage extends StatelessWidget {
class ConfirmNewPasswordPage extends StatefulWidget {
String userToken;
ConfirmNewPasswordPage(this.userToken, {Key? key}) : super(key: key);
String newPassword = "";
@override
State<ConfirmNewPasswordPage> createState() => _ConfirmNewPasswordPageState();
}
// String userToken = "";
class _ConfirmNewPasswordPageState extends State<ConfirmNewPasswordPage> {
String newPassword = "";
String confirmPassword = '';
@override
Widget build(BuildContext context) {
@ -42,19 +46,62 @@ class ConfirmNewPasswordPage extends StatelessWidget {
children: [
"New Password".toText24(),
12.height,
TxtField(
hint: "Inter New Password",
value: newPassword,
onChanged: (v) {
newPassword = v;
},
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,
),
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,
),
// 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: () {
confirmPasswordOTP(context);
if(newPassword == confirmPassword ){
confirmPasswordOTP(context);}
else{
Utils.showToast("Confirmation password does not match the entered password");
}
},
),
],
@ -65,10 +112,11 @@ class ConfirmNewPasswordPage extends StatelessWidget {
Future<void> confirmPasswordOTP(BuildContext context) async {
Utils.showLoading(context);
Response res = await UserApiClent().ForgetPassword(userToken, newPassword);
Response res = await UserApiClent().ForgetPassword(widget.userToken, newPassword);
Utils.hideLoading(context);
ConfirmPassword data = ConfirmPassword.fromJson(jsonDecode(res.body));
if (data.messageStatus == 1) {
Utils.showToast("Password is Updated");
navigateWithName(context, AppRoutes.loginWithPassword);
} else {
Utils.showToast(data.message ?? "");

@ -22,13 +22,10 @@ import 'package:car_provider_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
import 'package:car_provider_app/models/user/user.dart';
import 'dart:convert';
import 'package:http/http.dart';
class ForgetPasswordPage extends StatelessWidget {
int otpType = 1;
String userName = "";
@ -121,7 +118,6 @@ class ForgetPasswordPage extends StatelessWidget {
}
Future<void> forgetPasswordOTP(BuildContext context) async {
Utils.showLoading(context);
Response response = await UserApiClent().ForgetPasswordOTPRequest(userName, otpType);
Utils.hideLoading(context);
@ -168,4 +164,3 @@ class ForgetPasswordPage extends StatelessWidget {
}
}
}

Loading…
Cancel
Save