Merge branch 'fatima'
# Conflicts: # lib/api/user_api_client.dart # lib/classes/consts.dartfatima
commit
c41710cd99
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
ConfirmPassword confirmPasswordFromJson(String str) => ConfirmPassword.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String confirmPasswordToJson(ConfirmPassword data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class ConfirmPassword {
|
||||||
|
dynamic totalItemsCount;
|
||||||
|
int? messageStatus;
|
||||||
|
String? message;
|
||||||
|
|
||||||
|
ConfirmPassword(
|
||||||
|
{this.totalItemsCount, this.messageStatus, this.message});
|
||||||
|
|
||||||
|
ConfirmPassword.fromJson(Map<String, dynamic> json) {
|
||||||
|
totalItemsCount = json['totalItemsCount'];
|
||||||
|
messageStatus = json['messageStatus'];
|
||||||
|
message = json['message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['totalItemsCount'] = this.totalItemsCount;
|
||||||
|
data['messageStatus'] = this.messageStatus;
|
||||||
|
data['message'] = this.message;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
PasswordOTPCompare otpCompareFromJson(String str) => PasswordOTPCompare.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String otpCompareToJson(PasswordOTPCompare data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class PasswordOTPCompare {
|
||||||
|
dynamic totalItemsCount;
|
||||||
|
Data? data;
|
||||||
|
int? messageStatus;
|
||||||
|
String? message;
|
||||||
|
|
||||||
|
PasswordOTPCompare({this.totalItemsCount, this.data, this.messageStatus, this.message});
|
||||||
|
|
||||||
|
PasswordOTPCompare.fromJson(Map<String, dynamic> json) {
|
||||||
|
totalItemsCount = json['totalItemsCount'];
|
||||||
|
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
||||||
|
messageStatus = json['messageStatus'];
|
||||||
|
message = json['message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['totalItemsCount'] = this.totalItemsCount;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
data['messageStatus'] = this.messageStatus;
|
||||||
|
data['message'] = this.message;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
String? userToken;
|
||||||
|
|
||||||
|
Data({this.userToken});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
userToken = json['userToken'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['userToken'] = this.userToken;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
PasswordOTPRequest otpRequestFromJson(String str) => PasswordOTPRequest.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String otpRequestToJson(PasswordOTPRequest data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class PasswordOTPRequest {
|
||||||
|
dynamic totalItemsCount;
|
||||||
|
Data? data;
|
||||||
|
int? messageStatus;
|
||||||
|
String? message;
|
||||||
|
|
||||||
|
PasswordOTPRequest(
|
||||||
|
{this.totalItemsCount, this.data, this.messageStatus, this.message});
|
||||||
|
|
||||||
|
PasswordOTPRequest.fromJson(Map<String, dynamic> json) {
|
||||||
|
totalItemsCount = json['totalItemsCount'];
|
||||||
|
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
||||||
|
messageStatus = json['messageStatus'];
|
||||||
|
message = json['message'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['totalItemsCount'] = this.totalItemsCount;
|
||||||
|
if (this.data != null) {
|
||||||
|
data['data'] = this.data!.toJson();
|
||||||
|
}
|
||||||
|
data['messageStatus'] = this.messageStatus;
|
||||||
|
data['message'] = this.message;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Data {
|
||||||
|
String? userToken;
|
||||||
|
|
||||||
|
Data({this.userToken});
|
||||||
|
|
||||||
|
Data.fromJson(Map<String, dynamic> json) {
|
||||||
|
userToken = json['userToken'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['userToken'] = this.userToken;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:car_customer_app/api/user_api_client.dart';
|
||||||
|
import 'package:car_customer_app/classes/utils.dart';
|
||||||
|
import 'package:car_customer_app/config/routes.dart';
|
||||||
|
import 'package:car_customer_app/extensions/int_extensions.dart';
|
||||||
|
import 'package:car_customer_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:car_customer_app/models/user/confirm_password.dart';
|
||||||
|
import 'package:car_customer_app/utils/navigator.dart';
|
||||||
|
import 'package:car_customer_app/widgets/app_bar.dart';
|
||||||
|
import 'package:car_customer_app/widgets/show_fill_button.dart';
|
||||||
|
import 'package:car_customer_app/widgets/txt_field.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
|
||||||
|
class ConfirmNewPasswordPage extends StatelessWidget {
|
||||||
|
String userToken;
|
||||||
|
|
||||||
|
ConfirmNewPasswordPage(this.userToken, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
String newPassword = "";
|
||||||
|
|
||||||
|
// String userToken = "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
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,
|
||||||
|
TxtField(
|
||||||
|
hint: "Inter New Password",
|
||||||
|
value: newPassword,
|
||||||
|
onChanged: (v) {
|
||||||
|
newPassword = v;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
40.height,
|
||||||
|
ShowFillButton(
|
||||||
|
title: "Confirm",
|
||||||
|
width: double.infinity,
|
||||||
|
onPressed: () {
|
||||||
|
confirmPasswordOTP(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> confirmPasswordOTP(BuildContext context) async {
|
||||||
|
Utils.showLoading(context);
|
||||||
|
Response res = await UserApiClent().ForgetPassword(userToken, newPassword);
|
||||||
|
Utils.hideLoading(context);
|
||||||
|
ConfirmPassword data = ConfirmPassword.fromJson(jsonDecode(res.body));
|
||||||
|
if (data.messageStatus == 1) {
|
||||||
|
navigateWithName(context, AppRoutes.loginWithPassword);
|
||||||
|
} else {
|
||||||
|
Utils.showToast(data.message ?? "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue