Merge branch 'master' into fatima

# Conflicts:
#	lib/api/user_api_client.dart
#	lib/classes/consts.dart
#	lib/config/routes.dart
#	lib/models/user/change_email.dart
#	lib/models/user/change_mobile.dart
#	lib/models/user/change_password.dart
#	lib/models/user/confirm_email.dart
#	lib/models/user/confirm_mobile.dart
#	lib/pages/dashboard/dashboard_page.dart
#	lib/pages/user/change_email_page.dart
#	lib/pages/user/change_mobile_page.dart
#	lib/pages/user/change_password_page.dart
#	lib/pages/user/complete_profile_page.dart
#	lib/pages/user/confirm_new_password.dart
#	lib/pages/user/edit_account_page.dart
#	lib/pages/user/forget_password_method_page.dart
#	lib/pages/user/forget_password_page.dart
#	lib/pages/user/login_with_password_page.dart
#	pubspec.lock
fatima
Fatimah Alshammari 4 years ago
commit 952937a8bb

@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@ -45,7 +45,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.car_customer_app"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

@ -0,0 +1,11 @@
<svg id="Group_761" data-name="Group 761" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="21.545" height="22.965" viewBox="0 0 21.545 22.965">
<defs>
<clipPath id="clip-path">
<rect id="Rectangle_1484" data-name="Rectangle 1484" width="21.545" height="22.965" fill="#2699fb"/>
</clipPath>
</defs>
<g id="Group_761-2" data-name="Group 761" clip-path="url(#clip-path)">
<path id="Path_663" data-name="Path 663" d="M21.3,136.849l-1.91-.49-.881.734c0-.049-1.812-4.7-1.714-4.407a1.879,1.879,0,0,0-1.567-1.175,53.565,53.565,0,0,0-8.863,0A1.857,1.857,0,0,0,4.8,132.687c0,.049-1.812,4.7-1.714,4.407l-.881-.734-1.91.49a.42.42,0,0,0-.294.343v.441a.573.573,0,0,0,.392.539l1.861.783-.245.343a2.372,2.372,0,0,0-.343,1.273v5.876a1.547,1.547,0,0,0,1.567,1.567H4.456a1.547,1.547,0,0,0,1.567-1.567v-.832h9.646v.832a1.578,1.578,0,0,0,1.567,1.567H18.46a1.547,1.547,0,0,0,1.567-1.567V140.57a2.908,2.908,0,0,0-.343-1.273l-.294-.343,1.763-.734a.573.573,0,0,0,.392-.539v-.441A.388.388,0,0,0,21.3,136.849Zm-15.718,4.6-.734,1.518a.3.3,0,0,1-.294.2H2.938a.335.335,0,0,1-.343-.343V141.3a.335.335,0,0,1,.343-.343h2.3a.345.345,0,0,1,.343.49m-1.763-3.428,1.273-3.33c.588-.049,1.567-.147,3.183-.2a61.5,61.5,0,0,1,8.226.2l1.273,3.33h-.686a2.88,2.88,0,0,0-5.68,0Zm8.667,0a1.9,1.9,0,0,1,1.861-1.42,1.939,1.939,0,0,1,1.861,1.42ZM14,143.557H7.737a.579.579,0,0,1-.539-.832l.783-1.812a.6.6,0,0,1,.539-.343h4.75a.6.6,0,0,1,.539.343l.783,1.812a.623.623,0,0,1-.588.832m5.043-.734a.335.335,0,0,1-.343.343H17.138a.331.331,0,0,1-.294-.2l-.734-1.518a.337.337,0,0,1,.294-.49h2.3a.335.335,0,0,1,.343.343Z" transform="translate(0 -125.048)" fill="#2699fb"/>
<path id="Path_664" data-name="Path 664" d="M123.925,3.085a1.986,1.986,0,0,1,2.008,2.008h3.134V4.7a.477.477,0,0,0-.392-.49l-.93-.147a5.837,5.837,0,0,0-.392-.979l.539-.734a.4.4,0,0,0-.049-.588l-.539-.588a.519.519,0,0,0-.637-.049l-.734.539a2.428,2.428,0,0,0-.979-.392l-.147-.881a.477.477,0,0,0-.49-.392h-.783a.527.527,0,0,0-.49.392l-.147.881a5.836,5.836,0,0,0-.979.392l-.734-.539a.518.518,0,0,0-.637.049l-.539.588a.513.513,0,0,0-.049.637l.539.686a2.428,2.428,0,0,0-.392.979l-.93.147a.477.477,0,0,0-.392.49v.392h3.134A2.017,2.017,0,0,1,123.925,3.085Z" transform="translate(-113.104)" fill="#2699fb"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1,4 @@
<svg id="Component_144_1" data-name="Component 144 1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<rect id="Rectangle_324" data-name="Rectangle 324" width="16" height="16" fill="none"/>
<path id="Path_110" data-name="Path 110" d="M8.154,3.077,2.462,8.923,0,16l7.077-2.308L12.769,8Zm7.231-.462-2-2a1.865,1.865,0,0,0-2.769,0L8.923,2.308l4.615,4.769,1.846-1.846A1.95,1.95,0,0,0,16,3.846,1.9,1.9,0,0,0,15.385,2.615Z" fill="#2699fb"/>
</svg>

After

Width:  |  Height:  |  Size: 480 B

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="13.412" height="17.882" viewBox="0 0 13.412 17.882">
<path id="Path_665" data-name="Path 665" d="M11.735,7.265V5.029a5.029,5.029,0,0,0-10.059,0V7.265A1.647,1.647,0,0,0,0,8.941v7.265a1.681,1.681,0,0,0,1.676,1.676H11.735a1.681,1.681,0,0,0,1.676-1.676V8.941a1.646,1.646,0,0,0-1.676-1.676M2.794,5.029a3.912,3.912,0,0,1,7.823,0V7.265H2.794ZM7.265,13.3v1.229a.559.559,0,1,1-1.118,0V13.3a1.628,1.628,0,0,1-1.118-1.565,1.676,1.676,0,0,1,3.353,0A1.628,1.628,0,0,1,7.265,13.3" fill="#2699fb"/>
</svg>

After

Width:  |  Height:  |  Size: 540 B

@ -0,0 +1,11 @@
<svg id="Group_773" data-name="Group 773" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="19.6" height="16" viewBox="0 0 19.6 16">
<defs>
<clipPath id="clip-path">
<rect id="Rectangle_1471" data-name="Rectangle 1471" width="19.6" height="16" fill="#2699fb"/>
</clipPath>
</defs>
<g id="Group_18" data-name="Group 18" clip-path="url(#clip-path)">
<path id="Path_649" data-name="Path 649" d="M8,14.8a.325.325,0,0,1-.025-.169c.008-.046-.021-.083-.087-.112s-.1-.052-.1-.069-.048-.029-.144-.037L7.5,14.4H3.6a1.925,1.925,0,0,1-1.413-.588A1.926,1.926,0,0,1,1.6,12.4V3.6a1.926,1.926,0,0,1,.587-1.412A1.926,1.926,0,0,1,3.6,1.6h4a.378.378,0,0,0,.256-.081.415.415,0,0,0,.125-.244A2.1,2.1,0,0,0,8.019.981,3.11,3.11,0,0,0,8.012.65Q8,.45,8,.4A.385.385,0,0,0,7.881.119.385.385,0,0,0,7.6,0h-4A3.468,3.468,0,0,0,1.056,1.056,3.467,3.467,0,0,0,0,3.6v8.8a3.467,3.467,0,0,0,1.056,2.544A3.467,3.467,0,0,0,3.6,16h4a.379.379,0,0,0,.256-.081.415.415,0,0,0,.125-.244,2.108,2.108,0,0,0,.038-.294,3.107,3.107,0,0,0-.006-.331Q8,14.85,8,14.8" fill="#2699fb"/>
<path id="Path_650" data-name="Path 650" d="M124.2,16.169l-6.8-6.8a.8.8,0,0,0-1.363.563v3.6h-5.6a.811.811,0,0,0-.8.8v4.8a.811.811,0,0,0,.8.8h5.6v3.6a.8.8,0,0,0,1.363.562l6.8-6.8a.785.785,0,0,0,0-1.125" transform="translate(-104.833 -8.731)" fill="#2699fb"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,10 @@
<svg id="Group_775" data-name="Group 775" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="13" height="23.853" viewBox="0 0 13 23.853">
<defs>
<clipPath id="clip-path">
<rect id="Rectangle_1493" data-name="Rectangle 1493" width="13" height="23.853" fill="#2699fb"/>
</clipPath>
</defs>
<g id="Group_774" data-name="Group 774" clip-path="url(#clip-path)">
<path id="Path_689" data-name="Path 689" d="M11.306,0H1.67A1.675,1.675,0,0,0,0,1.67V22.183a1.675,1.675,0,0,0,1.67,1.67H11.33A1.675,1.675,0,0,0,13,22.183V1.67A1.7,1.7,0,0,0,11.306,0M6.488,1.312a.477.477,0,1,1-.477.477.479.479,0,0,1,.477-.477M7.919,22.541H5.057v-.954H7.919Zm4.1-2.29H.93V3.6H12.022Z" fill="#2699fb"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 745 B

@ -0,0 +1,12 @@
<svg id="Group_766" data-name="Group 766" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="15" height="16.406" viewBox="0 0 15 16.406">
<defs>
<clipPath id="clip-path">
<rect id="Rectangle_1486" data-name="Rectangle 1486" width="15" height="16.406" fill="#2699fb"/>
</clipPath>
</defs>
<g id="Group_765" data-name="Group 765" clip-path="url(#clip-path)">
<path id="Path_666" data-name="Path 666" d="M2.813,6.094H13.125V.937A.938.938,0,0,0,12.187,0H.937A.937.937,0,0,0,0,.937V15a.937.937,0,0,0,.937.937H8.906V12.656H2.813a.469.469,0,0,1,0-.938H8.325a3.924,3.924,0,0,1-.356-1.641V9.844H2.813a.469.469,0,0,1,0-.938h5.33A4.013,4.013,0,0,1,9.375,7.031H2.813a.469.469,0,1,1,0-.938m0-3.75H6.094a.469.469,0,0,1,0,.937H2.813a.469.469,0,1,1,0-.937" fill="#2699fb"/>
<path id="Path_667" data-name="Path 667" d="M205.714,160a3.047,3.047,0,1,1-3.047,3.047A3.047,3.047,0,0,1,205.714,160" transform="translate(-193.761 -152.969)" fill="#2699fb"/>
<path id="Path_668" data-name="Path 668" d="M228.219,306.24a3.98,3.98,0,0,1-4.219,0v2.948l2.109-.937,2.109.938Z" transform="translate(-214.156 -292.782)" fill="#2699fb"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,4 @@
<svg id="Notifications" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<rect id="Rectangle_479" data-name="Rectangle 479" width="16" height="16" fill="none"/>
<path id="Path_1" data-name="Path 1" d="M15,14H10a2,2,0,0,1-4,0H1a.961.961,0,0,1-.9-.7,1.068,1.068,0,0,1,.3-1.1A4.026,4.026,0,0,0,2,9V6A6,6,0,0,1,14,6V9a4.026,4.026,0,0,0,1.6,3.2.947.947,0,0,1,.3,1.1A.961.961,0,0,1,15,14Z" transform="translate(-0.063)" fill="#2699fb"/>
</svg>

After

Width:  |  Height:  |  Size: 472 B

@ -0,0 +1,4 @@
<svg id="Component_147_1" data-name="Component 147 1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<rect id="Rectangle_193" data-name="Rectangle 193" width="16" height="16" fill="none"/>
<path id="Path_104" data-name="Path 104" d="M267.5,10a2,2,0,1,0-2-2A2.006,2.006,0,0,0,267.5,10Zm-4.1-6.4a5.64,5.64,0,0,1,2.4-1.3l.8-2.3h2l.8,2.3a6.983,6.983,0,0,1,2.4,1.3l2.4-.5,1,1.8-1.6,1.8a5.7,5.7,0,0,1,.1,1.3c0,.4-.1.9-.1,1.3l1.6,1.8-1,1.8-2.4-.5a5.64,5.64,0,0,1-2.4,1.3l-.8,2.3h-2l-.8-2.3a6.983,6.983,0,0,1-2.4-1.3l-2.4.5-1-1.8,1.6-1.8a5.7,5.7,0,0,1-.1-1.3c0-.4.1-.9.1-1.3L260,4.9l1-1.8Z" transform="translate(-260)" fill="#2699fb"/>
</svg>

After

Width:  |  Height:  |  Size: 675 B

@ -0,0 +1,69 @@
import 'dart:async';
import 'package:car_customer_app/classes/app_state.dart';
import 'package:car_customer_app/models/m_response.dart';
import 'package:car_customer_app/models/profile/branch.dart';
import 'package:car_customer_app/models/profile/categroy.dart';
import 'package:car_customer_app/models/profile/document.dart';
import 'package:car_customer_app/models/profile/services.dart';
import 'package:car_customer_app/models/user/country.dart';
import 'package:car_customer_app/models/user/role.dart';
import 'package:http/http.dart';
import 'package:car_customer_app/classes/consts.dart';
import 'package:car_customer_app/models/content_info_model.dart';
import 'package:car_customer_app/models/member_model.dart';
import 'package:car_customer_app/models/surah_model.dart';
import 'package:car_customer_app/models/user/basic_otp.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import '../api_client.dart';
class BranchApiClent {
static final BranchApiClent _instance = BranchApiClent._internal();
BranchApiClent._internal();
factory BranchApiClent() => _instance;
Future<MResponse> createBranch(String branchName, String branchDescription, String cityId, String address, String latitude, String longitude) async {
var postParams = {
// "id": 0,
"serviceProviderID": AppState().getUser.data?.userInfo?.providerId ?? "",
"branchName": branchName,
"branchDescription": branchDescription,
"cityID": cityId,
"address": address,
"latitude": latitude,
"longitude": longitude,
"isActive": true
};
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.createProviderBranch, postParams, token: t);
}
Future<Branch> fetchAllBranches() async {
var postParams = {"ServiceProviderID": AppState().getUser.data?.userInfo?.providerId.toString() ?? ""};
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().getJsonForObject((json) => Branch.fromJson(json), ApiConsts.ServiceProviderBranchGet, queryParameters: postParams, token: t);
}
Future<Category> fetchBranchCategory() async {
var postParams = {"ServiceProviderID": AppState().getUser.data?.userInfo?.providerId.toString() ?? ""};
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().getJsonForObject((json) => Category.fromJson(json), ApiConsts.ServiceCategory_Get, queryParameters: postParams, token: t);
}
Future<Services> fetchServices(String serviceCategoryId) async {
var postParams = {"ServiceCategoryID": serviceCategoryId};
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().getJsonForObject((json) => Services.fromJson(json), ApiConsts.Services_Get, queryParameters: postParams, token: t);
}
Future<MResponse> createService(List<Map<String, dynamic>> map) async {
String t = AppState().getUser.data!.accessToken ?? "";
return await ApiClient().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.ServiceProviderService_Create, map, token: t);
}
}

@ -0,0 +1,52 @@
import 'dart:async';
import 'package:car_customer_app/classes/app_state.dart';
import 'package:car_customer_app/models/m_response.dart';
import 'package:car_customer_app/models/profile/document.dart';
import 'package:car_customer_app/models/user/country.dart';
import 'package:car_customer_app/models/user/role.dart';
import 'package:http/http.dart';
import 'package:car_customer_app/classes/consts.dart';
import 'package:car_customer_app/models/content_info_model.dart';
import 'package:car_customer_app/models/member_model.dart';
import 'package:car_customer_app/models/surah_model.dart';
import 'package:car_customer_app/models/user/basic_otp.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import '../api_client.dart';
class ProfileApiClent {
static final ProfileApiClent _instance = ProfileApiClent._internal();
ProfileApiClent._internal();
factory ProfileApiClent() => _instance;
Future<Document> getServiceProviderDocument(dynamic userId) async {
var queryParameters = {
"ServiceProviderID": userId.toString(),
};
String? token = AppState().getUser.data?.accessToken;
print(token);
return await ApiClient().getJsonForObject((json) => Document.fromJson(json), ApiConsts.GetProviderDocument, queryParameters: queryParameters, token: AppState().getUser.data!.accessToken ?? "");
}
Future<MResponse> serviceProviderDocumentsUpdate(List<DocumentData>? documents) async {
List<Map<String, dynamic>> map = [];
for (int i = 0; i < documents!.length; i++) {
if (documents[i].document != null) {
var postParams = {
"id": documents[i].id,
"serviceProviderID": documents[i].serviceProviderId,
"documentID": documents[i].documentId,
"documentExt": documents[i].fileExt,
"documentImage": documents[i].document,
"isActive": true
};
map.add(postParams);
}
}
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.ServiceProviderDocument_Update, map, token: t);
}
}

@ -1,13 +1,17 @@
import 'dart:async';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/classes/app_state.dart';
import 'package:car_customer_app/models/user/change_email.dart';
import 'package:car_customer_app/models/user/change_mobile.dart';
import 'package:car_customer_app/models/user/change_password.dart';
import 'package:car_customer_app/models/user/cities.dart';
import 'package:car_customer_app/models/user/confirm_email.dart';
import 'package:car_customer_app/models/user/confirm_mobile.dart';
import 'package:car_customer_app/models/user/country.dart';
import 'package:car_customer_app/models/user/email_verify.dart';
import 'package:car_customer_app/models/user/image_response.dart';
import 'package:car_customer_app/models/user/role.dart';
import 'package:car_customer_app/models/user/confirm_password.dart';
import 'package:car_customer_app/models/user/forget_password_otp_compare.dart';
import 'package:car_customer_app/models/user/forget_password_otp_request.dart';
import 'package:car_customer_app/models/user/verify_email.dart';
import 'package:car_customer_app/models/user/verify_email_otp.dart';
import 'package:http/http.dart';
import 'package:car_customer_app/classes/consts.dart';
import 'package:car_customer_app/models/content_info_model.dart';
@ -15,9 +19,12 @@ import 'package:car_customer_app/models/member_model.dart';
import 'package:car_customer_app/models/surah_model.dart';
import 'package:car_customer_app/models/user/basic_otp.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import 'package:car_customer_app/models/user/email_verify_otp.dart';
import 'api_client.dart';
import '../../classes/app_state.dart';
import '../../models/m_response.dart';
import '../api_client.dart';
class UserApiClent {
static final UserApiClent _instance = UserApiClent._internal();
@ -26,8 +33,8 @@ class UserApiClent {
factory UserApiClent() => _instance;
Future<BasicOtp> basicOtp(String phoneNo, {int otpType = 1}) async {
var postParams = {"countryID": 1, "userMobileNo": phoneNo, "otpType": otpType, "userRole": 4};
Future<BasicOtp> basicOtp(String phoneNo, {int otpType = 1, int roleId = 4, int countryId = 1}) async {
var postParams = {"countryID": countryId, "userMobileNo": phoneNo, "otpType": otpType, "userRole": roleId};
return await ApiClient().postJsonForObject((json) => BasicOtp.fromJson(json), ApiConsts.BasicOTP, postParams);
}
@ -42,10 +49,12 @@ class UserApiClent {
Future<RegisterUser> basicComplete(String userId, String firstName, String lastName, String email, String password) async {
var postParams;
if(email.isEmpty)
{ postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "companyName": "string", "isEmailVerified": true, "password": password};
}else{ postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "email": email, "companyName": "string", "isEmailVerified": true, "password": password};
}
if(email.isEmpty){
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "companyName": "string", "isEmailVerified": true, "password": password};
}else{
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "email": email, "companyName": "string", "isEmailVerified": true, "password": password};
}
return await ApiClient().postJsonForObject((json) => RegisterUser.fromJson(json), ApiConsts.BasicComplete, postParams);
}
@ -76,6 +85,16 @@ class UserApiClent {
return await ApiClient().getJsonForObject((json) => Country.fromJson(json), ApiConsts.GetAllCountry);
}
Future<Cities> getAllCites(String countryId) async {
var postParams = {
"CountryID": countryId,
};
return await ApiClient().getJsonForObject((json) => Cities.fromJson(json), ApiConsts.GetAllCities, queryParameters: postParams);
}
Future<Role> getRoles() async {
return await ApiClient().getJsonForObject((json) => Role.fromJson(json), ApiConsts.GetProviderRoles);
}
Future<Response> ForgetPasswordOTPRequest(String userName, int otpType) async {
var postParams = {
@ -83,14 +102,13 @@ class UserApiClent {
"otpType": 1,
};
return await ApiClient().postJsonForResponse(ApiConsts.ForgetPasswordOTPRequest, postParams);
//return await ApiClient().postJsonForObject((json) => PasswordOTPRequest.fromJson(json), ApiConsts.ForgetPasswordOTPRequest, postParams);
}
Future<Response> ForgetPasswordOTPCompare(String userToken, String userOTP) async {
var postParams =
{"userToken": userToken,
"userOTP": userOTP};
var postParams = {"userToken": userToken, "userOTP": userOTP};
return await ApiClient().postJsonForResponse(ApiConsts.ForgetPasswordOTPCompare, postParams);
// return await ApiClient().postJsonForObject((json) => PasswordOTPCompare.fromJson(json), ApiConsts.ForgetPasswordOTPCompare, postParams);
}
Future<Response> ForgetPassword(String userToken, String newPassword) async {
@ -99,7 +117,7 @@ class UserApiClent {
"newPassword": newPassword,
};
return await ApiClient().postJsonForResponse(ApiConsts.ForgetPassword, postParams);
//return await ApiClient().postJsonForObject((json) => ConfirmPassword.fromJson(json), ApiConsts.ForgetPassword, postParams);
}
Future<MResponse> ChangePassword(String currentPasswor, String newPassword) async {
@ -115,11 +133,12 @@ class UserApiClent {
}
Future<ChangeMobile> ChangeMobileNoOTPRequest(countryID, String mobileNo, String password,) async {
var postParams =
{ "countryID":1,
"mobileNo": mobileNo,
"password": password};
Future<ChangeMobile> ChangeMobileNoOTPRequest(
countryID,
String mobileNo,
String password,
) async {
var postParams = {"countryID": 1, "mobileNo": mobileNo, "password": password};
String t = AppState().getUser.data!.accessToken ?? "";
return await ApiClient().postJsonForObject((json) => ChangeMobile.fromJson(json), ApiConsts.ChangeMobileNoOTPRequest, postParams, token: t);
}
@ -134,19 +153,13 @@ class UserApiClent {
}
Future<ChanEmail> ChangeEmailOTPRequest(String email, String password) async {
var postParams =
{"email": email,
"password":password
};
var postParams = {"email": email, "password": password};
String t = AppState().getUser.data!.accessToken ?? "";
return await ApiClient().postJsonForObject((json) => ChanEmail.fromJson(json), ApiConsts.ChangeEmailOTPRequest, postParams, token: t);
}
Future<ConfirmEmail> ChangeEmail(String userToken, String userOTP) async {
var postParams =
{"userToken": userToken,
"userOTP": userOTP
};
var postParams = {"userToken": userToken, "userOTP": userOTP};
String t = AppState().getUser.data!.accessToken ?? "";
return await ApiClient().postJsonForObject((json) => ConfirmEmail.fromJson(json), ApiConsts.ChangeEmail, postParams, token: t);
}
@ -172,5 +185,21 @@ class UserApiClent {
return await ApiClient().postJsonForObject((json) => MResponse.fromJson(json), ApiConsts.EmailVerifyOTPVerify, postParams, token: t);
}
Future<ImageResponse> UpdateUserImage(String image) async {
var postParams = {"userID": AppState().getUser.data!.userInfo!.userId, "userImage": image};
// return await ApiClient().postJsonForResponse(ApiConsts.ChangePassword, postParams);
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().postJsonForObject((json) => ImageResponse.fromJson(json), ApiConsts.UpdateUserImage, postParams, token: t);
}
Future<ImageResponse> GetUserImage(String image) async {
var postParams = {};
// return await ApiClient().postJsonForResponse(ApiConsts.ChangePassword, postParams);
String t = AppState().getUser.data!.accessToken ?? "";
print("tokeen " + t);
return await ApiClient().postJsonForObject((json) => ImageResponse.fromJson(json), ApiConsts.UpdateUserImage, postParams, token: t);
}
}

@ -1,23 +1,25 @@
class ApiConsts {
//static String baseUrl = "http://10.200.204.20:2801/"; // Local server
// static String baseUrl = "http://10.200.204.20:2801/"; // Local server
static String baseUrl = "https://mdlaboratories.com"; // production server
static String baseUrlServices = baseUrl + "/mc/"; // production server
// static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server
static String BasicOTP = baseUrlServices + "api/Register/BasicOTP";
static String BasicVerify = baseUrlServices + "api/Register/BasicVerify";
static String BasicComplete = baseUrlServices + "api/Register/BasicComplete";
//User
static String Login_V1 = baseUrlServices + "api/Account/Login_V1";
static String Login_V2_OTP = baseUrlServices + "api/Account/Login_V2_OTP";
static String Login_V2_OTPVerify = baseUrlServices + "api/Account/Login_V2_OTPVerify";
static String user = baseUrlServices + "api/User/";
static String GetAllCountry = baseUrlServices + "api/Master/Country_Get";
static String GetProviderRoles = baseUrlServices + "api/Master/RoleServiceProvider_Get";
static String GetAllCities = baseUrlServices + "api/Master/City_Get";
static String ForgetPasswordOTPRequest = baseUrlServices + "api/Account/ForgetPasswordOTPRequest";
static String ForgetPasswordOTPCompare = baseUrlServices + "api/Account/ForgetPasswordOTPCompare";
static String ForgetPassword = baseUrlServices + "api/Account/ForgetPassword";
static String ProfileImage = baseUrlServices + "api/api/ProfileImage";
static String UpdateProfileImage = baseUrlServices + "api/api/User_UpdateProfileImage";
static String Login_Email_OTP = baseUrlServices + "api/Account/EmailVerify";
static String Login_Email_OTPVerify = baseUrlServices + "api/Account/EmailVerifyOTPVerify";
static String ChangePassword = baseUrlServices + "api/Account/ChangePassword";
static String ChangeMobileNoOTPRequest = baseUrlServices + "api/Account/ChangeMobileNoOTPRequest";
static String ChangeMobileNo = baseUrlServices + "api/Account/ChangeMobileNo";
@ -25,9 +27,21 @@ class ApiConsts {
static String ChangeEmail = baseUrlServices + "api/Account/ChangeEmail";
static String EmailVerify = baseUrlServices + "api/Account/EmailVerify";
static String EmailVerifyOTPVerify = baseUrlServices + "api/Account/EmailVerifyOTPVerify";
static String UpdateUserImage = baseUrlServices + "api/User_UpdateProfileImage";
static String GetUserImage = baseUrlServices + "api/ProfileImage";
}
//Profile
static String GetProviderDocument = baseUrlServices + "api/ServiceProviders/ServiceProviderDocument_Get";
static String ServiceProviderDocument_Update = baseUrlServices + "api/ServiceProviders/ServiceProviderDocument_Update";
//Branch
static String createProviderBranch = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Create";
static String ServiceProviderBranchGet = baseUrlServices + "api/ServiceProviders/ServiceProviderBranch_Get";
static String ServiceCategory_Get = baseUrlServices + "api/Master/ServiceCategory_Get";
static String Services_Get = baseUrlServices + "api/ServiceProviders/Services_Get";
static String ServiceProviderService_Create = baseUrlServices + "api/ServiceProviders/ServiceProviderService_Create";
}
class GlobalConsts {
static String isRememberMe = "remember_me";

@ -1,21 +1,29 @@
import 'package:car_customer_app/models/user/register_user.dart';
import 'package:car_customer_app/pages/dashboard/dashboard_page.dart';
// import 'package:car_customer_app/pages/settings/create_services_page.dart';
// import 'package:car_customer_app/pages/settings/dealership_page.dart';
// import 'package:car_customer_app/pages/settings/define_branch_page.dart';
// import 'package:car_customer_app/pages/settings/define_license_page.dart';
import 'package:car_customer_app/pages/user/change_email_page.dart';
import 'package:car_customer_app/pages/user/change_mobile_page.dart';
import 'package:car_customer_app/pages/user/change_password_page.dart';
import 'package:car_customer_app/pages/user/complete_profile_page.dart';
import 'package:car_customer_app/pages/user/confirm_new_password_page.dart';
import 'package:car_customer_app/pages/user/edit_account_page.dart';
import 'package:car_customer_app/pages/user/forget_password_method_page.dart';
import 'package:car_customer_app/pages/user/forget_password_page.dart';
import 'package:car_customer_app/pages/user/login_method_selection_page.dart';
import 'package:car_customer_app/pages/user/login_verification_page.dart';
import 'package:car_customer_app/pages/user/login_verify_account_page.dart';
import 'package:car_customer_app/pages/user/login_with_password_page.dart';
// import 'package:car_customer_app/pages/user/profile/profile_1_page.dart';
// import 'package:car_customer_app/pages/user/profile/profile_2_page.dart';
// import 'package:car_customer_app/pages/user/profile/profile_3_page.dart';
import 'package:car_customer_app/pages/user/register_page.dart';
import 'package:car_customer_app/pages/user/register_selection_page.dart';
import 'package:car_customer_app/pages/user/splash_page.dart';
import 'package:car_customer_app/pages/user/vertify_password_page.dart';
import 'package:flutter/material.dart';
import 'package:car_customer_app/pages/user/confirm_new_password.dart';
import 'package:car_customer_app/pages/user/forget_password_method_page.dart';
class AppRoutes {
//User
@ -28,16 +36,25 @@ class AppRoutes {
static final String loginWithPassword = "/loginWithPassword";
static final String loginMethodSelection = "/loginMethodSelection";
static final String completeProfile = "/completeProfile";
static final String profile1 = "/profile1";
static final String profile2 = "/profile2";
static final String profile3 = "/profile3";
static final String vertifyPassword = "/vertifyPassword";
static final String confirmNewPasswordPage = "/confirmNewPasswordPage";
static final String changePasswordPage = "/changePasswordPage";
static final String forgetPasswordMethodSPage = "/forgetPasswordMethodPage";
static final String defineLicense = "/defineLicese";
static final String changePassword = "/changePassword";
static final String forgetPasswordMethodPage = "/forgetPasswordMethodPage";
static final String changeMobilePage = "/changeMobilePage";
static final String changeEmailPage = "/changeEmailPage";
static final String editAccoundPage = "/editAccoundPage";
static final String dashboard = "/dashboard";
//settings
static final String dealershipSetting = "/dealershipSetting";
static final String defineBranch = "/defineBranch";
static final String createServices = "/createServices";
static final String initialRoute = splash;
static final Map<String, WidgetBuilder> routes = {
@ -51,14 +68,23 @@ class AppRoutes {
loginWithPassword: (context) => LoginWithPassword(),
loginMethodSelection: (context) => LoginMethodSelectionPage(ModalRoute.of(context)!.settings.arguments as String),
completeProfile: (context) => CompleteProfilePage(ModalRoute.of(context)!.settings.arguments as RegisterUser),
// profile1: (context) => Profile1Page(),
// profile2: (context) => Profile2Page(),
// profile3: (context) => Profile3Page(),
// defineLicense: (context) => DefineLicensePage(),
vertifyPassword: (context) => VerifyPasswordPage(),
confirmNewPasswordPage: (context) => ConfirmNewPasswordPage(ModalRoute.of(context)!.settings.arguments as String),
changePasswordPage: (context) => ChangePasswordPage(),
forgetPasswordMethodSPage : (context) => ForgetPasswordMethodPage(ModalRoute.of(context)!.settings.arguments as String),
changePassword: (context) => ChangePasswordPage(),
forgetPasswordMethodPage: (context) => ForgetPasswordMethodPage(ModalRoute.of(context)!.settings.arguments as String),
changeMobilePage: (context) => ChangeMobilePage(),
changeEmailPage : (context) => ChangeEmailPage(),
editAccoundPage : (context) => EditAccountPage(),
//Home page
dashboard: (context) => DashboardPage(),
//setting
// dealershipSetting: (context) => DealershipPage(),
// defineBranch: (context) => DefineBranchPage(),
// createServices: (context) => CreateServicesPage(),
};
}

@ -8,6 +8,7 @@ import 'package:car_customer_app/models/parent_list.dart';
Account accountFromJson(String str) => Account.fromJson(json.decode(str));
String accountToJson(Account data) => json.encode(data.toJson());

@ -0,0 +1,33 @@
// To parse this JSON data, do
//
// final mResponse = mResponseFromJson(jsonString);
import 'dart:convert';
MResponse mResponseFromJson(String str) => MResponse.fromJson(json.decode(str));
String mResponseToJson(MResponse data) => json.encode(data.toJson());
class MResponse {
MResponse({
this.totalItemsCount,
this.messageStatus,
this.message,
});
int? totalItemsCount;
int? messageStatus;
String? message;
factory MResponse.fromJson(Map<String, dynamic> json) => MResponse(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}

@ -0,0 +1,85 @@
// To parse this JSON data, do
//
// final branch = branchFromJson(jsonString);
import 'dart:convert';
Branch branchFromJson(String str) => Branch.fromJson(json.decode(str));
String branchToJson(Branch data) => json.encode(data.toJson());
class Branch {
Branch({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<BranchData>? data;
int? messageStatus;
String? message;
factory Branch.fromJson(Map<String, dynamic> json) => Branch(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<BranchData>.from(json["data"].map((x) => BranchData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class BranchData {
BranchData({
this.id,
this.serviceProviderId,
this.branchName,
this.branchDescription,
this.cityId,
this.address,
this.latitude,
this.longitude,
this.status,
});
int? id;
int? serviceProviderId;
String? branchName;
String? branchDescription;
int? cityId;
String? address;
String? latitude;
String? longitude;
int? status;
factory BranchData.fromJson(Map<String, dynamic> json) => BranchData(
id: json["id"] == null ? null : json["id"],
serviceProviderId: json["serviceProviderID"] == null ? null : json["serviceProviderID"],
branchName: json["branchName"] == null ? null : json["branchName"],
branchDescription: json["branchDescription"] == null ? null : json["branchDescription"],
cityId: json["cityID"] == null ? null : json["cityID"],
address: json["address"] == null ? null : json["address"],
latitude: json["latitude"] == null ? null : json["latitude"],
longitude: json["longitude"] == null ? null : json["longitude"],
status: json["status"] == null ? null : json["status"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"serviceProviderID": serviceProviderId == null ? null : serviceProviderId,
"branchName": branchName == null ? null : branchName,
"branchDescription": branchDescription == null ? null : branchDescription,
"cityID": cityId == null ? null : cityId,
"address": address == null ? null : address,
"latitude": latitude == null ? null : latitude,
"longitude": longitude == null ? null : longitude,
"status": status == null ? null : status,
};
}

@ -0,0 +1,69 @@
// To parse this JSON data, do
//
// final category = categoryFromJson(jsonString);
import 'dart:convert';
Category categoryFromJson(String str) => Category.fromJson(json.decode(str));
String categoryToJson(Category data) => json.encode(data.toJson());
class Category {
Category({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<CategoryData>? data;
int? messageStatus;
String? message;
factory Category.fromJson(Map<String, dynamic> json) => Category(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<CategoryData>.from(json["data"].map((x) => CategoryData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class CategoryData {
CategoryData({
this.id,
this.categoryName,
this.categoryNameN,
this.serviceCategoryIconUrl,
this.serviceCategoryImageUrl,
});
int? id;
String? categoryName;
String? categoryNameN;
dynamic? serviceCategoryIconUrl;
dynamic? serviceCategoryImageUrl;
factory CategoryData.fromJson(Map<String, dynamic> json) => CategoryData(
id: json["id"] == null ? null : json["id"],
categoryName: json["categoryName"] == null ? null : json["categoryName"],
categoryNameN: json["categoryNameN"] == null ? null : json["categoryNameN"],
serviceCategoryIconUrl: json["serviceCategoryIconUrl"],
serviceCategoryImageUrl: json["serviceCategoryImageUrl"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"categoryName": categoryName == null ? null : categoryName,
"categoryNameN": categoryNameN == null ? null : categoryNameN,
"serviceCategoryIconUrl": serviceCategoryIconUrl,
"serviceCategoryImageUrl": serviceCategoryImageUrl,
};
}

@ -0,0 +1,83 @@
// To parse this JSON data, do
//
// final document = documentFromJson(jsonString);
import 'dart:convert';
Document documentFromJson(String str) => Document.fromJson(json.decode(str));
String documentToJson(Document data) => json.encode(data.toJson());
class Document {
Document({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<DocumentData>? data;
int? messageStatus;
String? message;
factory Document.fromJson(Map<String, dynamic> json) => Document(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<DocumentData>.from(json["data"].map((x) => DocumentData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class DocumentData {
DocumentData({
this.id,
this.serviceProviderId,
this.documentId,
this.documentUrl,
this.status,
this.comment,
this.isActive,
this.document,
this.fileExt,
});
int? id;
int? serviceProviderId;
int? documentId;
dynamic? documentUrl;
int? status;
dynamic? comment;
bool? isActive;
String? document;
String? fileExt;
factory DocumentData.fromJson(Map<String, dynamic> json) => DocumentData(
id: json["id"] == null ? null : json["id"],
serviceProviderId: json["serviceProviderID"] == null ? null : json["serviceProviderID"],
documentId: json["documentID"] == null ? null : json["documentID"],
documentUrl: json["documentURL"],
status: json["status"] == null ? null : json["status"],
comment: json["comment"],
isActive: json["isActive"] == null ? null : json["isActive"],
document: null,
fileExt: null,
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"serviceProviderID": serviceProviderId == null ? null : serviceProviderId,
"documentID": documentId == null ? null : documentId,
"documentURL": documentUrl,
"status": status == null ? null : status,
"comment": comment,
"isActive": isActive == null ? null : isActive,
};
}

@ -0,0 +1,80 @@
// To parse this JSON data, do
//
// final services = servicesFromJson(jsonString);
import 'dart:convert';
Services servicesFromJson(String str) => Services.fromJson(json.decode(str));
String servicesToJson(Services data) => json.encode(data.toJson());
class Services {
Services({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<ServicesData>? data;
int? messageStatus;
String? message;
factory Services.fromJson(Map<String, dynamic> json) => Services(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<ServicesData>.from(json["data"].map((x) => ServicesData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class ServicesData {
ServicesData({
this.id,
this.description,
this.descriptionN,
this.serviceIconUrl,
this.serviceImageUrl,
this.serviceCategoryId,
this.categoryName,
this.isSelected,
});
int? id;
String? description;
String? descriptionN;
dynamic? serviceIconUrl;
dynamic? serviceImageUrl;
int? serviceCategoryId;
dynamic? categoryName;
bool? isSelected;
factory ServicesData.fromJson(Map<String, dynamic> json) => ServicesData(
id: json["id"] == null ? null : json["id"],
description: json["description"] == null ? null : json["description"],
descriptionN: json["descriptionN"] == null ? null : json["descriptionN"],
serviceIconUrl: json["serviceIconUrl"],
serviceImageUrl: json["serviceImageUrl"],
serviceCategoryId: json["serviceCategoryID"] == null ? null : json["serviceCategoryID"],
categoryName: json["categoryName"],
isSelected: false,
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"description": description == null ? null : description,
"descriptionN": descriptionN == null ? null : descriptionN,
"serviceIconUrl": serviceIconUrl,
"serviceImageUrl": serviceImageUrl,
"serviceCategoryID": serviceCategoryId == null ? null : serviceCategoryId,
"categoryName": categoryName,
};
}

@ -1,4 +1,5 @@
import 'dart:convert';
ChanEmail changeEmailFromJson(String str) => ChanEmail.fromJson(json.decode(str));

@ -1,4 +1,5 @@
import 'dart:convert';
ChangeMobile changeMobileFromJson(String str) => ChangeMobile.fromJson(json.decode(str));

@ -1,30 +1,34 @@
import 'dart:convert';
MResponse mResponseFromJson(String str) => MResponse.fromJson(json.decode(str));
String mResponseToJson(MResponse data) => json.encode(data.toJson());
import 'dart:convert';
ChangePassword changePasswordFromJson(String str) => ChangePassword.fromJson(json.decode(str));
class MResponse {
MResponse({
this.totalItemsCount,
this.messageStatus,
this.message,
});
String changePasswordToJson(ChangePassword data) => json.encode(data.toJson());
int? totalItemsCount;
class ChangePassword {
int? messageStatus;
Null? totalItemsCount;
bool? data;
String? message;
factory MResponse.fromJson(Map<String, dynamic> json) => MResponse(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
ChangePassword(
{this.messageStatus, this.totalItemsCount, this.data, this.message});
ChangePassword.fromJson(Map<String, dynamic> json) {
messageStatus = json['messageStatus'];
totalItemsCount = json['totalItemsCount'];
data = json['data'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['messageStatus'] = this.messageStatus;
data['totalItemsCount'] = this.totalItemsCount;
data['data'] = this.data;
data['message'] = this.message;
return data;
}
}

@ -0,0 +1,65 @@
// To parse this JSON data, do
//
// final cities = citiesFromJson(jsonString);
import 'dart:convert';
Cities citiesFromJson(String str) => Cities.fromJson(json.decode(str));
String citiesToJson(Cities data) => json.encode(data.toJson());
class Cities {
Cities({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<CityData>? data;
int? messageStatus;
String? message;
factory Cities.fromJson(Map<String, dynamic> json) => Cities(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<CityData>.from(json["data"].map((x) => CityData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class CityData {
CityData({
this.id,
this.cityName,
this.cityNameN,
this.countryId,
});
int? id;
String? cityName;
String? cityNameN;
int? countryId;
factory CityData.fromJson(Map<String, dynamic> json) => CityData(
id: json["id"] == null ? null : json["id"],
cityName: json["cityName"] == null ? null : json["cityName"],
cityNameN: json["cityNameN"] == null ? null : json["cityNameN"],
countryId: json["countryID"] == null ? null : json["countryID"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"cityName": cityName == null ? null : cityName,
"cityNameN": cityNameN == null ? null : cityNameN,
"countryID": countryId == null ? null : countryId,
};
}

@ -1,4 +1,5 @@
import 'dart:convert';
ConfirmEmail confirmEmailFromJson(String str) => ConfirmEmail.fromJson(json.decode(str));

@ -1,4 +1,6 @@
import 'dart:convert';
ConfirmMobile confirmMobileFromJson(String str) => ConfirmMobile.fromJson(json.decode(str));

@ -1,6 +1,4 @@
import 'dart:convert';
ConfirmPassword confirmPasswordFromJson(String str) => ConfirmPassword.fromJson(json.decode(str));

@ -1,5 +1,3 @@
import 'dart:convert';
PasswordOTPCompare otpCompareFromJson(String str) => PasswordOTPCompare.fromJson(json.decode(str));

@ -1,6 +1,4 @@
import 'dart:convert';
PasswordOTPRequest otpRequestFromJson(String str) => PasswordOTPRequest.fromJson(json.decode(str));

@ -0,0 +1,37 @@
// To parse this JSON data, do
//
// final imageResponse = imageResponseFromJson(jsonString);
import 'dart:convert';
ImageResponse imageResponseFromJson(String str) => ImageResponse.fromJson(json.decode(str));
String imageResponseToJson(ImageResponse data) => json.encode(data.toJson());
class ImageResponse {
ImageResponse({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
dynamic? totalItemsCount;
String? data;
int? messageStatus;
String? message;
factory ImageResponse.fromJson(Map<String, dynamic> json) => ImageResponse(
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : json["data"],
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data,
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}

@ -0,0 +1,65 @@
// To parse this JSON data, do
//
// final role = roleFromJson(jsonString);
import 'dart:convert';
Role roleFromJson(String str) => Role.fromJson(json.decode(str));
String roleToJson(Role data) => json.encode(data.toJson());
class Role {
Role({
this.totalItemsCount,
this.data,
this.messageStatus,
this.message,
});
int? totalItemsCount;
List<RoleData>? data;
int? messageStatus;
String? message;
factory Role.fromJson(Map<String, dynamic> json) => Role(
totalItemsCount: json["totalItemsCount"] == null ? null : json["totalItemsCount"],
data: json["data"] == null ? null : List<RoleData>.from(json["data"].map((x) => RoleData.fromJson(x))),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount == null ? null : totalItemsCount,
"data": data == null ? null : List<dynamic>.from(data!.map((x) => x.toJson())),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
}
class RoleData {
RoleData({
this.id,
this.roleName,
this.roleNameN,
this.isActive,
});
int? id;
String? roleName;
String? roleNameN;
bool? isActive;
factory RoleData.fromJson(Map<String, dynamic> json) => RoleData(
id: json["id"] == null ? null : json["id"],
roleName: json["roleName"] == null ? null : json["roleName"],
roleNameN: json["roleNameN"] == null ? null : json["roleNameN"],
isActive: json["isActive"] == null ? null : json["isActive"],
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"roleName": roleName == null ? null : roleName,
"roleNameN": roleNameN == null ? null : roleNameN,
"isActive": isActive == null ? null : isActive,
};
}

@ -0,0 +1,53 @@
import 'dart:convert';
VerifyEmail verifyEmailFromJson(String str) => VerifyEmail.fromJson(json.decode(str));
String verifyEmailToJson(VerifyEmail data) => json.encode(data.toJson());
class VerifyEmail {
Null? totalItemsCount;
Data? data;
int? messageStatus;
String? message;
VerifyEmail(
{this.totalItemsCount, this.data, this.messageStatus, this.message});
VerifyEmail.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,27 @@
import 'dart:convert';
VerifyEmailOTP verifyEmailOTPFromJson(String str) => VerifyEmailOTP.fromJson(json.decode(str));
String verifyEmailOTPToJson(VerifyEmailOTP data) => json.encode(data.toJson());
class VerifyEmailOTP {
bool? success;
Null? errors;
VerifyEmailOTP({this.success, this.errors});
VerifyEmailOTP.fromJson(Map<String, dynamic> json) {
success = json['success'];
errors = json['errors'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['success'] = this.success;
data['errors'] = this.errors;
return data;
}
}

@ -1,5 +1,4 @@
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/config/routes.dart';
import 'package:car_customer_app/theme/colors.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
@ -8,9 +7,18 @@ import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:flutter/material.dart';
import '../../api/client/user_api_client.dart';
import '../../classes/app_state.dart';
import '../../classes/consts.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import '../../classes/utils.dart';
import '../../config/routes.dart';
import '../../models/user/image_response.dart';
import '../../utils/utils.dart';
class DashboardPage extends StatefulWidget {
@override
State<DashboardPage> createState() => _DashboardPageState();
@ -18,7 +26,14 @@ class DashboardPage extends StatefulWidget {
class _DashboardPageState extends State<DashboardPage> {
String userName = "";
// void _handleURLButtonPress(BuildContext context, var type) {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => ImageFromGalleryEx(type)));
// }
File? imagePicked;
String image64 = "";
final _picker = ImagePicker();
@override
@ -53,41 +68,66 @@ class _DashboardPageState extends State<DashboardPage> {
child: Container(
child: Column(
children: [
Stack(
children:[
Container(
Stack(children: [
Container(
width: double.infinity,
height: 200,
color: accentColor.withOpacity(0.3),
child: Icon(
Icons.person,
size: 80,
color: accentColor.withOpacity(0.3),
),
child: Image.network(ApiConsts.baseUrlServices + AppState().getUser.data!.userInfo!.userImageUrl.toString()),
),
Positioned(
top: 10,
right: 10,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30),
),
child: Icon(Icons.edit,
color: Colors.blue,).onPress(() {
_openImagePicker();
}),
Positioned(
top: 10,
right: 10,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30),
),
child: Icon(
Icons.edit,
color: Colors.blue,
).onPress(() {
_openImagePicker();
// _handleURLButtonPress(context, ImageSourceType.camera);
}),
),
12.height,
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(30),
),
child: Icon(
Icons.delete,
color: Colors.blue,
).onPress(() async {
Utils.showLoading(context);
ImageResponse response = await UserApiClent().UpdateUserImage("");
if (response.messageStatus == 1) {
Utils.showToast("Image is Deleted");
setState(() {
AppState().getUser.data!.userInfo!.userImageUrl = response.data;
});
}
Utils.hideLoading(context);
}),
),
],
),
],
),
)
] ),
],
),
)
]),
Container(
width: double.infinity,
color: accentColor.withOpacity(0.1),
@ -125,27 +165,6 @@ class _DashboardPageState extends State<DashboardPage> {
leading: Icon(Icons.person),
title: "Account".toText12(),
),
// ListTile(
// leading: Icon(Icons.password),
// title: "Change Password".toText12(),
// onTap: () {
// navigateWithName(context, AppRoutes.changePasswordPage);
// },
// ),
// ListTile(
// leading: Icon(Icons.phone_android_sharp),
// title: "Change Mobile".toText12(),
// onTap: () {
// navigateWithName(context, AppRoutes.changeMobilePage);
// },
// ),
// ListTile(
// leading: Icon(Icons.email_outlined),
// title: "Change Email".toText12(),
// onTap: () {
// navigateWithName(context, AppRoutes.changeEmailPage);
// },
// ),
ListTile(
leading: Icon(Icons.logout),
title: "Sign Out".toText12(),
@ -163,20 +182,10 @@ class _DashboardPageState extends State<DashboardPage> {
void _openImagePicker() {
showDialog<ImageSource>(
context: context,
builder: (context) => AlertDialog(
content: Text("Choose image source"),
actions: [
FlatButton(
child: Text("Camera"),
onPressed: () =>
cameraImage()
),
FlatButton(
child: Text("Gallery"),
onPressed: () => gallaryImage()
),
]
),
builder: (context) => AlertDialog(content: Text("Choose image source"), actions: [
FlatButton(child: Text("Camera"), onPressed: () => cameraImage()),
FlatButton(child: Text("Gallery"), onPressed: () => gallaryImage()),
]),
// .then((ImageSource source) async {
// if (source != null) {
// final pickedFile = await ImagePicker().getImage(source: source);
@ -192,9 +201,28 @@ class _DashboardPageState extends State<DashboardPage> {
source: ImageSource.gallery,
);
final pickedImageFile = File(pickedImage!.path);
setState(() {
imagePicked = pickedImageFile;
});
int sizeInBytes = pickedImageFile.lengthSync();
// double sizeInMb = sizeInBytes / (1024 * 1024);
if (sizeInBytes > 1000) {
Utils.showToast("File is larger then 1KB");
} else {
image64 = convertFileToBase64(pickedImageFile);
Utils.showLoading(context);
ImageResponse response = await UserApiClent().UpdateUserImage(image64);
Utils.hideLoading(context);
Navigator.pop(context);
if (response.messageStatus == 1) {
Utils.showToast("Image is uploaded");
AppState().getUser.data!.userInfo!.userImageUrl = response.data;
} else {
Utils.showToast(response.message ?? "");
}
setState(() {
imagePicked = pickedImageFile;
});
}
}
void cameraImage() async {
@ -203,8 +231,27 @@ class _DashboardPageState extends State<DashboardPage> {
source: ImageSource.camera,
);
final pickedImageFile = File(pickedImage!.path);
setState(() {
imagePicked = pickedImageFile;
});
int sizeInBytes = pickedImageFile.lengthSync();
// double sizeInMb = sizeInBytes / (1024 * 1024);
if (sizeInBytes > 1000) {
Utils.showToast("File is larger then 1KB");
} else {
image64 = convertFileToBase64(pickedImageFile);
Utils.showLoading(context);
ImageResponse response = await UserApiClent().UpdateUserImage(image64);
Utils.hideLoading(context);
Navigator.pop(context);
if (response.messageStatus == 1) {
Utils.showToast("Image is uploaded");
AppState().getUser.data!.userInfo!.userImageUrl = response.data;
} else {
Utils.showToast(response.message ?? "");
}
setState(() {
imagePicked = pickedImageFile;
});
}
}
}

@ -1,7 +1,5 @@
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/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';
@ -99,7 +97,7 @@ class _ChangeEmailPageState extends State<ChangeEmailPage> {
showMDialog(
context,
child: MessageDialog(
title: "Email Changed Successfully",
title: "Email is Changed Successfully",
onClick: () {
Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.loginWithPassword, (Route<dynamic> route) => false);
},

@ -1,15 +1,11 @@
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/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/change_mobile.dart';
import 'package:car_customer_app/models/user/confirm_mobile.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/dialog/dialogs.dart';

@ -1,21 +1,27 @@
import 'package:car_customer_app/api/client/user_api_client.dart';
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/change_password.dart';
import 'package:car_customer_app/models/user/confirm_password.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart';
import '../../models/m_response.dart';
class ChangePasswordPage extends StatefulWidget {
ChangePasswordPage({Key? key}) : super(key: key);
@override
State<ChangePasswordPage> createState() => _ChangePasswordPageState();
@ -23,7 +29,7 @@ class ChangePasswordPage extends StatefulWidget {
class _ChangePasswordPageState extends State<ChangePasswordPage> {
String newPassword = "";
String currentPassword = '';
String currentPasswor = '';
@override
Widget build(BuildContext context) {
@ -42,21 +48,21 @@ class _ChangePasswordPageState extends State<ChangePasswordPage> {
decoration: InputDecoration(
hintText: "Enter Old Password",
hintStyle: TextStyle(color: Colors.grey),
border: OutlineInputBorder(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0),
),
),
),
obscureText: true,
onChanged: (v) => currentPassword = v,
onChanged: (v) => currentPasswor = v,
),
12.height,
TextFormField(
decoration: InputDecoration(
hintText: "Enter New Password",
hintStyle: TextStyle(color: Colors.grey),
border: OutlineInputBorder(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0),
),
@ -69,7 +75,8 @@ class _ChangePasswordPageState extends State<ChangePasswordPage> {
ShowFillButton(
title: "Confirm",
width: double.infinity,
onPressed: () {changePassword(context);
onPressed: () {
changePassword(context);
},
),
],
@ -82,7 +89,7 @@ class _ChangePasswordPageState extends State<ChangePasswordPage> {
Future<void> changePassword(BuildContext context) async {
if (validateStructure(newPassword ?? "")) {
Utils.showLoading(context);
MResponse res = await UserApiClent().ChangePassword(currentPassword, newPassword);
MResponse res = await UserApiClent().ChangePassword(currentPasswor, newPassword);
Utils.hideLoading(context);
if (res.messageStatus == 1) {
Utils.showToast("Password is Updated");
@ -97,9 +104,8 @@ class _ChangePasswordPageState extends State<ChangePasswordPage> {
}
}
bool validateStructure(String value){
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
bool validateStructure(String value) {
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
RegExp regExp = new RegExp(pattern);
return regExp.hasMatch(value);
}

@ -1,6 +1,7 @@
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/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/models/m_response.dart';
import 'package:car_customer_app/models/user/basic_otp.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import 'package:car_customer_app/utils/navigator.dart';
@ -26,8 +27,8 @@ class CompleteProfilePage extends StatefulWidget {
}
class _CompleteProfilePageState extends State<CompleteProfilePage> {
bool isChecked = false;
String? firstName = "", lastName = "", email = "", password = "", confirmPassword = "";
bool isChecked = false;
@override
void initState() {
@ -44,7 +45,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
height: double.infinity,
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(40),
padding: EdgeInsets.all(20),
child: Column(
children: [
"Complete Profile".toText24(),
@ -69,6 +70,8 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
TxtField(
hint: "Email",
value: email,
isButtonEnable: email!.length > 0 ? true : false,
buttonTitle: "Verify",
onChanged: (v) {
email = v;
},
@ -109,7 +112,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
title: "Continue",
width: double.infinity,
onPressed: () {
if(validation()) performCompleteProfile();
if (validation()) performCompleteProfile();
},
),
],
@ -118,18 +121,41 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
),
),
);
}
Widget buildCheckbox() => Checkbox(
value: isChecked,
activeColor: Colors.blue,
onChanged: (value){
setState(() {
isChecked = value!;
});
},
);
value: isChecked,
activeColor: Colors.blue,
onChanged: (value) {
setState(() {
isChecked = value!;
});
},
);
// Future<void> performCompleteProfile() async {
// if(validateStructure(password??"")){
// if (password == confirmPassword) {
// print(widget.user.data!.userId??"userId");
// Utils.showLoading(context);
// RegisterUser user = await UserApiClent().basicComplete(widget.user.data?.userId ?? "", firstName!, lastName!, email!, password!);
// Utils.hideLoading(context);
// if (user.messageStatus == 1) {
// Utils.showToast( "Successfully registered, Please login once");
// pop(context);
// // pop(context);
// // navigateReplaceWithName(context, AppRoutes.dashboard,arguments: user);
// } else {
// Utils.showToast(user.message ?? "");
// }
// } else {
// Utils.showToast("Please enter same password");
// }
// }else{
// Utils.showToast("Password Should contains character, Number, Capital and small letters");
// }
//
// }
Future<void> performCompleteProfile() async {
if (validateStructure(password ?? "")) {
@ -153,12 +179,18 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
}
}
bool validateStructure(String value){
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
bool validateStructure(String value) {
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
RegExp regExp = new RegExp(pattern);
return regExp.hasMatch(value);
}
bool isEmail(String em) {
String p = r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
RegExp regExp = new RegExp(p);
return regExp.hasMatch(em);
}
bool validation() {
bool isValid = true;
if (firstName!.isEmpty) {
@ -167,10 +199,15 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
} else if (lastName!.isEmpty) {
Utils.showToast("Surname is mandatory");
isValid = false;
} else if (password!.isEmpty) {
} else if (email!.isNotEmpty) {
if(!isEmail(email!)){
Utils.showToast("Enter Valid Email");
isValid = false;
}
}else if (password!.isEmpty) {
Utils.showToast("Password is mandatory");
isValid = false;
}else if (!isChecked) {
} else if (!isChecked) {
Utils.showToast("Please accept terms");
isValid = false;
}

@ -1,4 +1,6 @@
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';
@ -13,103 +15,59 @@ import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart';
class ConfirmNewPasswordPage extends StatefulWidget {
import '../../api/client/user_api_client.dart';
class ConfirmNewPasswordPage extends StatelessWidget {
String userToken;
ConfirmNewPasswordPage(this.userToken, {Key? key}) : super(key: key);
@override
State<ConfirmNewPasswordPage> createState() => _ConfirmNewPasswordPageState();
}
class _ConfirmNewPasswordPageState extends State<ConfirmNewPasswordPage> {
String newPassword = "";
String confirmPassword = '';
// String userToken = "";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBar(title: "Forget Password"),
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,
),
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);
},
),
],
),
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 {
if(validateStructure(newPassword??"")){
Utils.showLoading(context);
Response res = await UserApiClent().ForgetPassword(widget.userToken, newPassword);
Response res = await UserApiClent().ForgetPassword(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 ?? "");
}
}else{
Utils.showToast("Password Should contains Character, Number, Capital and small letters");
}
}
bool validation() {
bool isValid = true;
if (newPassword != confirmPassword) {
Utils.showToast("Confirmation password does not match the entered password");
isValid = false;
}
return isValid;
}
bool validateStructure(String value){
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
RegExp regExp = new RegExp(pattern);
return regExp.hasMatch(value);
}
}

@ -0,0 +1,119 @@
import 'package:car_customer_app/api/client/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/models/user/confirm_password.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/int_extensions.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 StatefulWidget {
String userToken;
ConfirmNewPasswordPage(this.userToken, {Key? key}) : super(key: key);
@override
State<ConfirmNewPasswordPage> createState() => _ConfirmNewPasswordPageState();
}
class _ConfirmNewPasswordPageState extends State<ConfirmNewPasswordPage> {
String newPassword = "";
String confirmPassword = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBar(title: "Forget Password"),
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,
),
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);
},
),
],
),
),
),
);
}
Future<void> confirmPasswordOTP(BuildContext context) async {
if(validateStructure(newPassword??"")){
Utils.showLoading(context);
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 ?? "");
}
}else{
Utils.showToast("Password Should contains Character, Number, Capital and small letters");
}
}
bool validation() {
bool isValid = true;
if (newPassword != confirmPassword) {
Utils.showToast("Confirmation password does not match the entered password");
isValid = false;
}
return isValid;
}
bool validateStructure(String value){
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{6,}$';
RegExp regExp = new RegExp(pattern);
return regExp.hasMatch(value);
}
}

@ -1,25 +1,21 @@
import 'dart:convert';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/app_state.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/change_password.dart';
import 'package:car_customer_app/models/user/email_verify.dart';
import 'package:car_customer_app/models/user/email_verify_otp.dart';
import 'package:car_customer_app/models/m_response.dart';
import 'package:car_customer_app/models/user/verify_email.dart';
import 'package:car_customer_app/models/user/verify_email_otp.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/widgets/dialog/otp_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class EditAccountPage extends StatefulWidget {
@override
@ -29,7 +25,6 @@ class EditAccountPage extends StatefulWidget {
class _EditAccountPageState extends State<EditAccountPage> {
String userID = "";
String email = '';
//bool isVerified = true;
@override
Widget build(BuildContext context) {
@ -38,69 +33,94 @@ class _EditAccountPageState extends State<EditAccountPage> {
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.all(20),
padding: EdgeInsets.all(40),
child: Column(
children: [
20.height,
ListTile(
leading: Icon(Icons.lock, color: Colors.blue,),
leading: SvgPicture.asset("assets/images/ic_lock.svg"),
title: "Change Password".toText12(),
onTap: () {
navigateWithName(context, AppRoutes.changePasswordPage);
navigateWithName(context, AppRoutes.changePassword);
},
),
15.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Icon(Icons.phone_android_sharp, color: Colors.blue,),
SvgPicture.asset("assets/images/ic_mobile.svg"),
"Change Mobile".toText12(),
"Verify".toText12(),
RaisedButton(
onPressed: (){
onPressed: () {
navigateWithName(context, AppRoutes.changeMobilePage);
},
child: Text("Change",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),),color:Colors.blue,
child: Text(
"Change",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
color: Colors.blue,
textColor: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)
)
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8))
],
),
20.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Icon(Icons.email, color: Colors.blue,),
Icon(
Icons.email,
color: Colors.blue,
),
"Change Email".toText12(),
InkWell(
child:((AppState().getUser.data!.userInfo!.isEmailVerified??false)?"Verified" :"Verify").toText12(),
onTap:
(AppState().getUser.data!.userInfo!.isEmailVerified??false) ?
null
:(){
verifyEmail(context);
},
child: ((AppState().getUser.data!.userInfo!.isEmailVerified ?? false) ? "Verified" : "Verify").toText12(),
onTap: (AppState().getUser.data!.userInfo!.isEmailVerified ?? false)
? null
: () {
verifyEmail(context);
},
),
RaisedButton(
onPressed: (){
onPressed: () {
navigateWithName(context, AppRoutes.changeEmailPage);
},
child: Text("Change",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),),color:Colors.blue,
child: Text(
"Change",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
color: Colors.blue,
textColor: Colors.white,
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8)
)
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8))
],
)
// ListTile(
// leading: SvgPicture.asset("assets/images/ic_mobile.svg"),
// title: "Change Mobile".toText12(),
// onTap: () {
// navigateWithName(context, AppRoutes.changeMobilePage);
// },
// ),
// ListTile(
// leading: Icon(Icons.email_outlined, color: Colors.blue,),
// title: "Change Email".toText12(),
// onTap: () {
// navigateWithName(context, AppRoutes.changeEmailPage);
// },
// ),
],
),
),
);
}
Future<void> verifyEmail(BuildContext context) async {
Utils.showLoading(context);
VerifyEmail otpRequest = await UserApiClent().EmailVerify(email, userID);
@ -113,13 +133,19 @@ class _EditAccountPageState extends State<EditAccountPage> {
MResponse otpCompare = await UserApiClent().EmailVerifyOTPVerify(otpRequest.data!.userToken ?? "", code);
Utils.hideLoading(context);
if (otpCompare.messageStatus == 1) {
AppState().getUser.data!.userInfo!.isEmailVerified=true;
setState(() {
});
AppState().getUser.data!.userInfo!.isEmailVerified = true;
setState(() {});
Utils.showToast("Email is verified successfully");
pop(context);
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
// showMDialog(
// context,
// child: MessageDialog(
// title: "Email is Verified",
// onClick: () {
// Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.dashboard, (Route<dynamic> route) => false);
// },
// ),
// );
} else {
Utils.showToast(otpCompare.message ?? "");
}
@ -129,7 +155,4 @@ class _EditAccountPageState extends State<EditAccountPage> {
Utils.showToast(otpRequest.message ?? "");
}
}
}

@ -1,28 +1,20 @@
import 'dart:convert';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/classes/app_state.dart';
import 'dart:convert';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.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/forget_password_otp_compare.dart';
import 'package:car_customer_app/models/user/login_password.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import 'package:car_customer_app/models/user/user.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/widgets/button/show_image_button.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:car_customer_app/widgets/dialog/otp_dialog.dart';
import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
@ -84,20 +76,20 @@ class _ForgetPasswordMethodPageState extends State<ForgetPasswordMethodPage> {
}
Future<void> forgetPasswordOTPMethod(BuildContext context) async {
showMDialog(context, child: OtpDialog(
onClick: (String code) async {
pop(context);
Utils.showLoading(context);
Response res = await UserApiClent().ForgetPasswordOTPCompare(widget.userToken?? "", code);
Utils.hideLoading(context);
PasswordOTPCompare otpCompare = PasswordOTPCompare.fromJson(jsonDecode(res.body));
if (otpCompare.messageStatus == 1) {
var userToken = otpCompare.data!.userToken;
navigateWithName(context, AppRoutes.confirmNewPasswordPage, arguments: userToken);
} else {
Utils.showToast(otpCompare.message ?? "");
}
},
));
showMDialog(context, child: OtpDialog(
onClick: (String code) async {
pop(context);
Utils.showLoading(context);
Response res = await UserApiClent().ForgetPasswordOTPCompare(widget.userToken?? "", code);
Utils.hideLoading(context);
PasswordOTPCompare otpCompare = PasswordOTPCompare.fromJson(jsonDecode(res.body));
if (otpCompare.messageStatus == 1) {
var userToken = otpCompare.data!.userToken;
navigateWithName(context, AppRoutes.confirmNewPasswordPage, arguments: userToken);
} else {
Utils.showToast(otpCompare.message ?? "");
}
},
));
}
}

@ -1,25 +1,34 @@
import 'dart:convert';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
import 'package:car_customer_app/config/routes.dart';
import 'package:car_customer_app/models/user/forget_password_otp_compare.dart';
import 'package:car_customer_app/models/user/forget_password_otp_request.dart';
import 'package:car_customer_app/pages/user/vertify_password_page.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/widgets/button/show_image_button.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/widgets/dialog/otp_dialog.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
import 'package:car_customer_app/models/user/user.dart';
import 'dart:convert';
import 'package:http/http.dart';
import '../../models/user/country.dart';
import '../../widgets/dropdown/dropdow_field.dart';
import '../../widgets/tab/login_email_tab.dart';
class ForgetPasswordPage extends StatefulWidget {
@override
State<ForgetPasswordPage> createState() => _ForgetPasswordPageState();
@ -29,79 +38,67 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
int otpType = 1;
String userName = "";
ClassType type = ClassType.NUMBER;
Country? _country;
String countryCode = "";
bool _email = true;
bool _mobile = true;
@override
void initState() {
super.initState();
getCountryList();
}
getCountryList() async {
_country = await UserApiClent().getAllCountries();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBar(title: "Forget Password"),
appBar: appBar(title: "Change Password"),
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.all(40),
child: Column(
children: [
20.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RaisedButton(
onPressed: () {
setState(() {
_mobile = true;
_email = false;
});
},child:
Text("Mobile Number",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),
),color: _mobile ? Colors.blue : Colors.transparent,textColor: _mobile ? Colors.white : Colors.blue,
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),),
RaisedButton(onPressed: () {
setState(() {
_mobile = false;
_email = true;
});
},child:
Text("Email Address",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),),color: _email? Colors.blue : Colors.transparent
,textColor: _email ? Colors.white : Colors.blue,
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),),
],
mFlex(1),
LoginEmailTab(
onSelection: (ClassType type) {
setState(() {
this.type = type;
});
},
),
50.height,
"Retrieve Password".toText24(),
12.height,
_mobile ? TxtField(
hint: "Phone Number" ,
value: userName,
onChanged: (v) {
userName = v;
},
):
_email ? TxtField(
type == ClassType.NUMBER ? Column(children: [
getCountry(),
TxtField(
hint: "5********",
value: userName,
onChanged: (v) {
userName = v;
},
)
],) : TxtField(
hint: "Email Address",
value: userName,
onChanged: (v) {
userName = v;
},
): Container(),
),
50.height,
ShowFillButton(
title: "Continue",
width: double.infinity,
txtColor: Colors.white,
onPressed: () {
// _mobile ? forgetPasswordPhoneOTP(context)
// : forgetPasswordEmailOTP(context);
if(userName.isNum() && _mobile) {
if (userName.isNum() && type==ClassType.NUMBER) {
forgetPasswordPhoneOTP(context);
}else if (!userName.isNum() && _email) {
} else if (!userName.isNum() && type==ClassType.EMAIL) {
forgetPasswordEmailOTP(context);
}
},
@ -113,14 +110,33 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage> {
);
}
Widget getCountry() {
if (_country != null) {
List<DropValue> dropList = [];
_country!.data?.forEach((element) {
dropList.add(new DropValue(element.id ?? 0, (element.countryName ?? "") + " " + (element.countryCode ?? ""), element.countryCode ?? ""));
});
return Padding(
padding: const EdgeInsets.all(2.0),
child: DropdownField((DropValue value) {
countryCode = value.subValue;
}, list: dropList, hint: "Chose Country"),
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
}
Future<void> forgetPasswordPhoneOTP(BuildContext context) async {
Utils.showLoading(context);
Response response = await UserApiClent().ForgetPasswordOTPRequest(userName, otpType);
Response response = await UserApiClent().ForgetPasswordOTPRequest(countryCode+userName, otpType);
Utils.hideLoading(context);
PasswordOTPRequest otpRequest = PasswordOTPRequest.fromJson(jsonDecode(response.body));
if (otpRequest.messageStatus == 1) {
var userToken = otpRequest.data!.userToken;
navigateReplaceWithName(context, AppRoutes.forgetPasswordMethodSPage, arguments: userToken);
navigateReplaceWithName(context, AppRoutes.forgetPasswordMethodPage, arguments: userToken);
} else {
Utils.showToast(otpRequest.message ?? "");
}

@ -1,7 +1,7 @@
import 'dart:convert';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/app_state.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
@ -108,12 +108,19 @@ class LoginMethodSelectionPage extends StatelessWidget {
Response response2 = await UserApiClent().login_V2_OTPVerify(user.data!.userToken??"", code);
Utils.hideLoading(context);
RegisterUser verifiedUser = RegisterUser.fromJson(jsonDecode(response2.body));
if (verifiedUser.messageStatus == 1) {
User user = User.fromJson(jsonDecode(response2.body));
AppState().setUser = user;
SharedPrefManager.setUserToken(user.data!.accessToken ?? "");
SharedPrefManager.setUserId(user.data!.userInfo!.userId ?? "");
navigateReplaceWithName(context, AppRoutes.dashboard);
if(user.data!.userInfo!.roleId==5||user.data!.userInfo!.roleId==6){
AppState().setUser = user;
SharedPrefManager.setUserToken(user.data!.accessToken ?? "");
SharedPrefManager.setUserId(user.data!.userInfo!.userId ?? "");
navigateReplaceWithName(context, AppRoutes.dashboard);
}else{
Utils.showToast("Sorry, Only Provider's can log in this app");
}
} else {
Utils.showToast(verifiedUser.message??"");
}

@ -1,7 +1,7 @@
import 'dart:convert';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/app_state.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
@ -48,7 +48,6 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
LoginPassword user = LoginPassword.fromJson(jsonDecode(response.body));
if (user.messageStatus == 1) {
userToken = user.data!.userToken ?? "";
// navigateWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken);
} else {
Utils.showToast(user.message ?? "");
@ -72,6 +71,7 @@ class _LoginVerificationPageState extends State<LoginVerificationPage> {
if (verifiedUser.messageStatus == 1) {
User user = User.fromJson(jsonDecode(response2.body));
AppState().setUser = user;
print(user.data!.userInfo!.providerId.toString());
navigateReplaceWithName(context, AppRoutes.dashboard);
} else {
Utils.showToast(verifiedUser.message ?? "");

@ -1,4 +1,4 @@
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
import 'package:car_customer_app/config/routes.dart';
@ -128,7 +128,7 @@ class LoginVerifyAccountPage extends StatelessWidget {
title: "Phone Number Verified",
onClick: () {
pop(context);
navigateWithName(context, AppRoutes.completeProfile,arguments: user);
navigateWithName(context, AppRoutes.profile1,arguments: user);
},
),
);

@ -1,7 +1,7 @@
import 'dart:convert';
import 'package:car_customer_app/api/shared_prefrence.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/user_api_client.dart';
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
import 'package:car_customer_app/config/routes.dart';
@ -19,10 +19,14 @@ import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:car_customer_app/widgets/show_fill_button.dart';
import 'package:car_customer_app/widgets/tab/login_email_tab.dart';
import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import '../../models/user/country.dart';
import '../../widgets/dropdown/dropdow_field.dart';
class LoginWithPassword extends StatefulWidget {
@override
State<LoginWithPassword> createState() => _LoginWithPasswordState();
@ -31,11 +35,22 @@ class LoginWithPassword extends StatefulWidget {
class _LoginWithPasswordState extends State<LoginWithPassword> {
int otpType = 1;
ClassType type = ClassType.NUMBER;
String phoneNum = "", password = "";
String email = "";
String countryCode = "";
Country? _country;
bool _email = true;
@override
void initState() {
super.initState();
getCountryList();
}
bool _mobile = true;
getCountryList() async {
_country = await UserApiClent().getAllCountries();
setState(() {});
}
@override
Widget build(BuildContext context) {
@ -47,50 +62,31 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
padding: EdgeInsets.all(40),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RaisedButton(
onPressed: () {
setState(() {
_mobile = true;
_email = false;
});
},child:
Text("Mobile Number",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),
),color: _mobile ? Colors.blue : Colors.transparent,textColor: _mobile ? Colors.white : Colors.blue,
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),),
RaisedButton(onPressed: () {
setState(() {
_mobile = false;
_email = true;
});
},child:
Text("Email Address",
style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600,),),color: _email? Colors.blue : Colors.transparent
,textColor: _email ? Colors.white : Colors.blue,
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),),
],
LoginEmailTab(
onSelection: (ClassType type) {
setState(() {
this.type = type;
});
},
),
50.height,
"Enter Mobile or Email".toText24(),
(type == ClassType.NUMBER ? "Enter Phone" : "Enter Email").toText24(),
mFlex(1),
Column(
children: [
if (type == ClassType.NUMBER)
getCountry(),
6.height,
TxtField(
hint: _mobile ? "Enter phone number" : "Enter Email",
hint: type == ClassType.NUMBER ? "5********" : "Enter Email",
value: phoneNum,
onChanged: (v) {
phoneNum = v;
},
),
12.height,
6.height,
TxtField(
hint: "Enter Password",
hint: "Enter Password?",
value: password,
isPasswordEnabled: true,
maxLines: 1,
@ -104,7 +100,7 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
"Forget Password ?".toText12(color: Colors.blue).onPress(() {
"Forget Password?".toText12(color: Colors.blue).onPress(() {
navigateWithName(context, AppRoutes.forgetPassword);
}),
],
@ -124,17 +120,37 @@ class _LoginWithPasswordState extends State<LoginWithPassword> {
);
}
Widget getCountry() {
if (_country != null) {
List<DropValue> dropList = [];
_country!.data?.forEach((element) {
dropList.add(new DropValue(element.id ?? 0, (element.countryName ?? "") + " " + (element.countryCode ?? ""), element.countryCode ?? ""));
});
return Padding(
padding: const EdgeInsets.all(2.0),
child: DropdownField((DropValue value) {
countryCode = value.subValue;
}, list: dropList, hint: "Chose Country"),
);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
}
Future<void> performBasicOtp(BuildContext context) async {
Utils.showLoading(context);
Response response = await UserApiClent().login_V1(phoneNum, password);
Response response = await UserApiClent().login_V1(type == ClassType.NUMBER ? countryCode + phoneNum : phoneNum, password);
Utils.hideLoading(context);
LoginPassword user = LoginPassword.fromJson(jsonDecode(response.body));
if (user.messageStatus == 1) {
SharedPrefManager.setPhoneOrEmail(phoneNum);
SharedPrefManager.setPhoneOrEmail(type == ClassType.NUMBER ? countryCode + phoneNum : phoneNum);
SharedPrefManager.setUserPassword(password);
navigateReplaceWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken);
} else {
Utils.showToast(user.message ?? "");
}
}
}

@ -1,10 +1,12 @@
import 'package:car_customer_app/api/api_client.dart';
import 'package:car_customer_app/api/user_api_client.dart';
import 'package:car_customer_app/api/client/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/models/user/basic_otp.dart';
import 'package:car_customer_app/models/user/country.dart';
import 'package:car_customer_app/models/user/register_user.dart';
import 'package:car_customer_app/models/user/role.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
@ -20,7 +22,8 @@ import 'package:flutter/material.dart';
class RegisterPage extends StatelessWidget {
String phoneNum = "", countryCode = "";
int role = -1, countryId = -1;
int role = 4, countryId = -1;
@override
Widget build(BuildContext context) {
return Scaffold(
@ -32,6 +35,23 @@ class RegisterPage extends StatelessWidget {
child: Column(
children: [
"Enter Phone Number".toText24(),
// 12.height,
// FutureBuilder<Role>(
// future: UserApiClent().getRoles(),
// builder: (context, snapshot) {
// if (snapshot.hasData) {
// List<DropValue> dropList = [];
// snapshot.data?.data?.forEach((element) {
// dropList.add(new DropValue(element.id ?? 0, element.roleName ?? "", ""));
// });
// return DropdownField((DropValue value) {
// role = value.id;
// }, list: dropList, hint: "Chosse Role");
// } else {
// return CircularProgressIndicator();
// }
// },
// ),
12.height,
FutureBuilder<Country>(
future: UserApiClent().getAllCountries(),
@ -44,14 +64,14 @@ class RegisterPage extends StatelessWidget {
return DropdownField((DropValue value) {
countryCode = value.subValue;
countryId = value.id;
}, list: dropList, hint: "Chosse Country");
}, list: dropList, hint: "Chose Country");
} else {
return CircularProgressIndicator();
}
},
),
TxtField(
hint: "Enter Phone number to Register",
hint: "5********",
onChanged: (v) {
phoneNum = v;
},
@ -61,7 +81,7 @@ class RegisterPage extends StatelessWidget {
title: "Continue",
width: double.infinity,
onPressed: () {
performBasicOtp(context);
if (validation()) performBasicOtp(context);
},
),
],
@ -72,7 +92,7 @@ class RegisterPage extends StatelessWidget {
Future<void> performBasicOtp(BuildContext context) async {
Utils.showLoading(context);
BasicOtp basicOtp = await UserApiClent().basicOtp(countryCode + phoneNum,);
BasicOtp basicOtp = await UserApiClent().basicOtp(countryCode + phoneNum, roleId: role);
Utils.hideLoading(context);
if (basicOtp.messageStatus == 1) {
showMDialog(context, child: OtpDialog(
@ -83,25 +103,29 @@ class RegisterPage extends StatelessWidget {
Utils.hideLoading(context);
if (user.messageStatus == 1) {
Utils.showToast(user.message ?? "");
navigateReplaceWithName(context, AppRoutes.completeProfile,arguments: user);
navigateReplaceWithName(context, AppRoutes.completeProfile, arguments: user);
} else {
Utils.showToast(user.message ?? "");
}
// delay(300).then(
// (value) => showMDialog(
// context,
// child: MessageDialog(
// title: "Phone Number Verified",
// onClick: () {
// navigateWithName(context, AppRoutes.completeProfile);
// },
// ),
// ),
// );
},
));
} else {
Utils.showToast(basicOtp.message ?? "");
}
}
bool validation() {
bool isValid = true;
if (role == -1) {
Utils.showToast("Please select Provider Role");
isValid = false;
} else if (countryCode.isEmpty) {
Utils.showToast("Please select Country Code");
isValid = false;
} else if (phoneNum.isEmpty) {
Utils.showToast("Please add Phone No");
isValid = false;
}
return isValid;
}
}

@ -23,6 +23,7 @@ class RegisterSelectionPage extends StatelessWidget {
mFlex(1),
ShowFillButton(
title: "Log In",
// title: "Log In With Password",
width: double.infinity,
onPressed: () {
navigateWithName(context, AppRoutes.loginWithPassword);

@ -0,0 +1,162 @@
import 'package:car_customer_app/classes/utils.dart';
import 'package:car_customer_app/config/constants.dart';
import 'package:car_customer_app/config/routes.dart';
import 'package:car_customer_app/models/user/forget_password_otp_compare.dart';
import 'package:car_customer_app/models/user/forget_password_otp_request.dart';
import 'package:car_customer_app/utils/navigator.dart';
import 'package:car_customer_app/utils/utils.dart';
import 'package:car_customer_app/widgets/app_bar.dart';
import 'package:car_customer_app/widgets/button/show_image_button.dart';
import 'package:car_customer_app/extensions/int_extensions.dart';
import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/extensions/widget_extensions.dart';
import 'package:car_customer_app/widgets/dialog/dialogs.dart';
import 'package:car_customer_app/widgets/dialog/message_dialog.dart';
import 'package:car_customer_app/widgets/dialog/otp_dialog.dart';
import 'package:car_customer_app/widgets/txt_field.dart';
import 'package:flutter/material.dart';
class VerifyPasswordPage extends StatelessWidget {
int otpType = 1;
String phoneNum = "";
String userName = "";
String userToken = "";
String otp = "";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: appBar(title: "Change Password"),
body: Container(
width: double.infinity,
height: double.infinity,
padding: EdgeInsets.all(40),
child: Column(
children: [
"Verify New Password".toText24(),
mFlex(1),
TxtField(
hint: "966500000000",
value: phoneNum,
onChanged: (v) {
phoneNum = v;
},
),
mFlex(2),
Row(
children: [
Expanded(
child: ShowImageButton(
onClick: () {
otpType = 1;
// sendPasswordOTP(context);
showMDialog(context, child: OtpDialog(
onClick: (String code) {
pop(context);
delay(300).then(
(value) => showMDialog(
context,
child: MessageDialog(
title: "Phone Number Verified",
onClick: () {
otpType=1;
navigateWithName(context, AppRoutes.confirmNewPasswordPage);
// ForgetPasswordOTP(context);
},
),
),
);
},
));
},
title: 'With SMS',
icon: icons + "ic_sms.png",
),
),
20.width,
Expanded(
child: ShowImageButton(
onClick: () {
otpType = 1;
// sendPasswordOTP(context);
showMDialog(context, child: OtpDialog(
onClick: (String code) {
pop(context);
delay(300).then(
(value) => showMDialog(
context,
child: MessageDialog(
title: "Phone Number Verified",
onClick: () {
otpType=2;
navigateWithName(context, AppRoutes.confirmNewPasswordPage);
// ForgetPasswordOTP(context);
},
),
),
);
},
));
},
title: 'With Whatsapp',
icon: icons + "ic_whatsapp.png",
),
),
],
),
mFlex(10),
],
),
),
);
}
// Future<void> sendPasswordOTP(BuildContext context) async {
// Utils.showLoading(context);
// PasswordOTPCompare otpCompare = await UserApiClent().ForgetPasswordOTPCompare(userToken, otp);
// Utils.hideLoading(context);
// if (otpCompare.messageStatus == 1) {
// // navigateWithName(context, AppRoutes.confirmNewPasswordPage);
// showMDialog(context, child: OtpDialog(
// onClick: (String code) async {
// pop(context);
// Utils.showLoading(context);
// // PasswordOTPCompare otpCompare = await UserApiClent().ForgetPasswordOTPCompare(userToken, otp);
// Utils.hideLoading(context);
// },
// ));
// } else {
// Utils.showToast(otpCompare.message ?? "");
// }
// }
// User otpRequest = User.fromJson(jsonDecode(res.body));
// SharedPrefManager.setUserToken(otpRequest.data!.accessToken ?? "");
// SharedPrefManager.setUserId(otpRequest.data!.userInfo!.userId ?? "");
// showMDialog(context, child: OtpDialog(
// onClick: (String code) {
// pop(context);
// delay(300).then(
// (value) => showMDialog(
// context,
// child: MessageDialog(
// title: "Phone Number Verified",
// onClick: () {
// otpType=1;
// navigateWithName(context, AppRoutes.confirmNewPasswordPage);
// // ForgetPasswordOTP(context);
// },
// ),
// ),
// );
// },
// ));
}

@ -26,6 +26,18 @@ Widget spacerVertical(double v) {
width: double.infinity,
);
}
String convertFileToBase64(File file) {
List<int> imageBytes = file.readAsBytesSync();
return base64Encode(imageBytes);
}
// String checkFileExt(String path) {
// String ex = p.extension(path);
// var parts = ex.split('.');
// return parts[1] ?? "png"; // '.dart'
// }
Future delay(int millis) async {
return await Future.delayed(Duration(milliseconds: millis));
}
@ -104,6 +116,7 @@ Widget mFlex(int f) {
),
);
}
Widget mExp(int f) {
return Expanded(
flex: f,
@ -197,17 +210,19 @@ String base64String(Uint8List data) {
return base64Encode(data);
}
Widget overLayWidget({double? width, double? height,List<Color>? color}) {
Widget overLayWidget({double? width, double? height, List<Color>? color}) {
return Container(
width: width ?? double.infinity,
height: height ?? 60,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: color!=null?color:[
Colors.black.withOpacity(0.2),
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.004),
],
colors: color != null
? color
: [
Colors.black.withOpacity(0.2),
Colors.black.withOpacity(0.1),
Colors.black.withOpacity(0.004),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
tileMode: TileMode.clamp,
@ -286,11 +301,6 @@ Decoration containerColorRadiusBorder(Color background, double radius, Color col
);
}
//Decoration appGradient = BoxDecoration(
// gradient: LinearGradient(
// colors: [

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
enum ClassType { EMAIL, NUMBER }
class LoginEmailTab extends StatefulWidget {
Function(ClassType) onSelection;
LoginEmailTab({required this.onSelection});
@override
State<LoginEmailTab> createState() => _LoginEmailTabState();
}
class _LoginEmailTabState extends State<LoginEmailTab> {
ClassType type = ClassType.NUMBER;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Row(
children: [
Expanded(
child: InkWell(
onTap: () {
type = ClassType.NUMBER;
widget.onSelection(ClassType.NUMBER);
},
child: Container(
width: double.infinity,
height: 45,
color: type == ClassType.NUMBER ? Colors.blue : Colors.transparent,
child: Center(
child: Text(
"Number",
style: TextStyle(
color: type == ClassType.NUMBER ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),
),
),
Expanded(
child: InkWell(
onTap: () {
type = ClassType.EMAIL;
widget.onSelection(ClassType.EMAIL);
},
child: Container(
width: double.infinity,
height: 45,
color: type == ClassType.EMAIL ? Colors.blue : Colors.transparent,
child: Center(
child: Text(
"Email",
style: TextStyle(
color: type == ClassType.EMAIL ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
)),
),
),
),
],
),
);
}
}

@ -136,7 +136,7 @@ packages:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.22.0"
version: "1.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
@ -153,7 +153,7 @@ packages:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.8"
version: "8.0.9"
http:
dependency: "direct dev"
description:
@ -169,7 +169,7 @@ packages:
source: hosted
version: "4.0.0"
image_picker:
dependency: "direct main"
dependency: "direct dev"
description:
name: image_picker
url: "https://pub.dartlang.org"
@ -224,6 +224,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
@ -251,14 +258,14 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.1+1"
version: "1.0.0"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
version: "1.0.0"
path_provider:
dependency: "direct dev"
description:
@ -314,7 +321,21 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
version: "9.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.2+1"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.4"
permission_handler_platform_interface:
dependency: transitive
description:
@ -322,6 +343,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.7.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
petitparser:
dependency: transitive
description:
@ -466,7 +494,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
version: "0.4.8"
typed_data:
dependency: transitive
description:
@ -510,5 +538,5 @@ packages:
source: hosted
version: "5.3.1"
sdks:
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.8.0"

@ -51,11 +51,12 @@ dev_dependencies:
provider: ^6.0.0
easy_localization: ^3.0.0
http: ^0.13.3
permission_handler: 7.1.0
flutter_svg: ^0.22.0
permission_handler: ^9.2.0
flutter_svg: ^1.0.3
sizer: ^2.0.15
fluttertoast: ^8.0.8
fluttertoast: ^8.0.9
shared_preferences: ^2.0.6
image_picker: ^0.8.4+4
# For information on the generic Dart part of this file, see the

Loading…
Cancel
Save