Merge pull request 'Provider Dealer User' (#4) from mirza_development into master

Reviewed-on: http://34.17.52.79/Haroon6138/car_common_app/pulls/4
models_removal
Mirza Shafique 1 year ago
commit f2224a3f76

@ -17,6 +17,7 @@ class AppState {
bool? get getIsLogged => isLogged;
AppType currentAppType = AppType.provider;
UserType userType = UserType.customer;
void setAppType(AppType appType) {
currentAppType = appType;

@ -108,6 +108,16 @@ class ApiConsts {
static String getMatchedServices = "${baseUrlServices}api/ServiceProviders/ServiceProviderBranchServicesMapping_Get";
static String duplicateItems = "${baseUrlServices}api/ServiceProviders/ServiceItemCopy_Create";
//Branch Users
static String getAllProviderDealers = "${baseUrlServices}api/ServiceProviders/DealershipUserBranchWise_Get";
// /api/ServiceProviders/BranchUser_Get
//DealershipUserBranchWise_Get
static String getBranchUser = "${baseUrlServices}api/ServiceProviders/BranchUser_Get";
static String assignDealerToBranch = "${baseUrlServices}api/ServiceProviders/BranchUser_Create";
static String removeDealerFromBranch = "${baseUrlServices}api/ServiceProviders/BranchUser_Update";
static List<String> closingUrls = ["PayFortResponse"];
}

@ -19,7 +19,7 @@ class PostParamsModel {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = Map<String, dynamic>();
data['VersionID'] = this.versionID;
data['Channel'] = this.channel;
data['LanguageID'] = this.languageID;

@ -0,0 +1,48 @@
class BranchUser {
int id;
String? userId;
int? serviceProviderId;
int? dealershipUserID;
String firstName;
String lastName;
String mobileNo;
String email;
bool isBranchUser;
BranchUser({
required this.id,
required this.userId,
required this.serviceProviderId,
required this.dealershipUserID,
required this.firstName,
required this.lastName,
required this.mobileNo,
required this.email,
required this.isBranchUser,
});
factory BranchUser.fromJson(Map<String, dynamic> json) =>
BranchUser(
id: json["id"],
userId: json.containsKey("userID") ? json["userID"] : null,
serviceProviderId: json.containsKey("serviceProviderID") ? json["serviceProviderID"] : null,
dealershipUserID: json.containsKey("dealershipUserID") ? json["dealershipUserID"] : null,
firstName: json["firstName"],
lastName: json["lastName"],
mobileNo: json["mobileNo"],
email: json["email"],
isBranchUser: json.containsKey("isBranchUser") ? json["isBranchUser"] : false,
);
Map<String, dynamic> toJson() =>
{
"id": id,
"userID": userId,
"serviceProviderID": serviceProviderId,
"firstName": firstName,
"lastName": lastName,
"mobileNo": mobileNo,
"email": email,
"isBranchUser": isBranchUser,
};
}

@ -22,18 +22,18 @@ class RegisterUserRespModel {
final String? message;
factory RegisterUserRespModel.fromJson(Map<String, dynamic> json) => RegisterUserRespModel(
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : Data.fromJson(json["data"]),
message: json["message"] == null ? null : json["message"],
);
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : Data.fromJson(json["data"]),
message: json["message"] == null ? null : json["message"],
);
Map<String, dynamic> toJson() => {
"messageStatus": messageStatus == null ? null : messageStatus,
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toJson(),
"message": message == null ? null : message,
};
"messageStatus": messageStatus == null ? null : messageStatus,
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toJson(),
"message": message == null ? null : message,
};
}
class Data {
@ -58,6 +58,7 @@ class Data {
this.providerId,
this.customerId,
this.dealershipId,
required this.isNeedToPassToken,
});
final int? id;
@ -67,7 +68,7 @@ class Data {
final String? mobileNo;
final String? email;
final dynamic? userImageUrl;
final int? roleId;
int? roleId;
final dynamic? roleName;
final bool? isEmailVerified;
final List<dynamic>? serviceProviderBranch;
@ -80,50 +81,52 @@ class Data {
final dynamic? providerId;
final dynamic? customerId;
final dynamic? dealershipId;
bool isNeedToPassToken;
factory Data.fromJson(Map<String, dynamic> json) => Data(
id: json["id"] == null ? null : json["id"],
userId: json["userID"] == null ? null : json["userID"],
firstName: json["firstName"],
lastName: json["lastName"],
mobileNo: json["mobileNo"] == null ? null : json["mobileNo"],
email: json["email"] == null ? null : json["email"],
userImageUrl: json["userImageUrl"],
roleId: json["roleID"] == null ? null : json["roleID"],
roleName: json["roleName"],
isEmailVerified: json["isEmailVerified"] == null ? null : json["isEmailVerified"],
serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)),
isVerified: json["isVerified"] == null ? null : json["isVerified"],
userRoles: json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x)),
isCustomer: json["isCustomer"] == null ? null : json["isCustomer"],
isProviderDealership: json["isProviderDealership"] == null ? null : json["isProviderDealership"],
isProviderIndividual: json["isProviderIndividual"] == null ? null : json["isProviderIndividual"],
isDealershipUser: json["isDealershipUser"] == null ? null : json["isDealershipUser"],
providerId: json["providerID"],
customerId: json["customerID"],
dealershipId: json["dealershipID"],
);
id: json["id"] == null ? null : json["id"],
userId: json["userID"] == null ? null : json["userID"],
firstName: json["firstName"],
lastName: json["lastName"],
mobileNo: json["mobileNo"] == null ? null : json["mobileNo"],
email: json["email"] == null ? null : json["email"],
userImageUrl: json["userImageUrl"],
roleId: json["roleID"] == null ? null : json["roleID"],
roleName: json["roleName"],
isEmailVerified: json["isEmailVerified"] == null ? null : json["isEmailVerified"],
serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)),
isVerified: json["isVerified"] == null ? null : json["isVerified"],
userRoles: json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x)),
isCustomer: json["isCustomer"] == null ? null : json["isCustomer"],
isProviderDealership: json["isProviderDealership"] == null ? null : json["isProviderDealership"],
isProviderIndividual: json["isProviderIndividual"] == null ? null : json["isProviderIndividual"],
isDealershipUser: json["isDealershipUser"] == null ? null : json["isDealershipUser"],
providerId: json["providerID"],
customerId: json["customerID"],
dealershipId: json["dealershipID"],
isNeedToPassToken: false,
);
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userID": userId == null ? null : userId,
"firstName": firstName,
"lastName": lastName,
"mobileNo": mobileNo == null ? null : mobileNo,
"email": email == null ? null : email,
"userImageUrl": userImageUrl,
"roleID": roleId == null ? null : roleId,
"roleName": roleName,
"isEmailVerified": isEmailVerified == null ? null : isEmailVerified,
"serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x)),
"isVerified": isVerified == null ? null : isVerified,
"userRoles": userRoles == null ? null : List<dynamic>.from(userRoles!.map((x) => x)),
"isCustomer": isCustomer == null ? null : isCustomer,
"isProviderDealership": isProviderDealership == null ? null : isProviderDealership,
"isProviderIndividual": isProviderIndividual == null ? null : isProviderIndividual,
"isDealershipUser": isDealershipUser == null ? null : isDealershipUser,
"providerID": providerId,
"customerID": customerId,
"dealershipID": dealershipId,
};
"id": id == null ? null : id,
"userID": userId == null ? null : userId,
"firstName": firstName,
"lastName": lastName,
"mobileNo": mobileNo == null ? null : mobileNo,
"email": email == null ? null : email,
"userImageUrl": userImageUrl,
"roleID": roleId == null ? null : roleId,
"roleName": roleName,
"isEmailVerified": isEmailVerified == null ? null : isEmailVerified,
"serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x)),
"isVerified": isVerified == null ? null : isVerified,
"userRoles": userRoles == null ? null : List<dynamic>.from(userRoles!.map((x) => x)),
"isCustomer": isCustomer == null ? null : isCustomer,
"isProviderDealership": isProviderDealership == null ? null : isProviderDealership,
"isProviderIndividual": isProviderIndividual == null ? null : isProviderIndividual,
"isDealershipUser": isDealershipUser == null ? null : isDealershipUser,
"providerID": providerId,
"customerID": customerId,
"dealershipID": dealershipId,
};
}

@ -4,6 +4,9 @@
import 'dart:convert';
import '../../classes/app_state.dart';
import '../../utils/enums.dart';
User userFromJson(String str) => User.fromJson(json.decode(str));
String userToJson(User data) => json.encode(data.toJson());
@ -22,18 +25,18 @@ class User {
String? message;
factory User.fromJson(Map<String, dynamic> json) => User(
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : UserData.fromJson(json["data"]),
messageStatus: json["messageStatus"] == null ? null : json["messageStatus"],
message: json["message"] == null ? null : json["message"],
);
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : UserData.fromJson(json["data"]),
messageStatus: json["messageStatus"],
message: json["message"],
);
Map<String, dynamic> toJson() => {
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toJson(),
"messageStatus": messageStatus == null ? null : messageStatus,
"message": message == null ? null : message,
};
"totalItemsCount": totalItemsCount,
"data": data == null ? null : data!.toJson(),
"messageStatus": messageStatus,
"message": message,
};
}
class UserData {
@ -50,18 +53,18 @@ class UserData {
UserInfo? userInfo;
factory UserData.fromJson(Map<String, dynamic> json) => UserData(
accessToken: json["accessToken"] == null ? null : json["accessToken"],
refreshToken: json["refreshToken"] == null ? null : json["refreshToken"],
expiryDate: json["expiryDate"] == null ? null : DateTime.parse(json["expiryDate"]),
userInfo: json["userInfo"] == null ? null : UserInfo.fromJson(json["userInfo"]),
);
accessToken: json["accessToken"],
refreshToken: json["refreshToken"],
expiryDate: json["expiryDate"] == null ? null : DateTime.parse(json["expiryDate"]),
userInfo: json["userInfo"] == null ? null : UserInfo.fromJson(json["userInfo"]),
);
Map<String, dynamic> toJson() => {
"accessToken": accessToken == null ? null : accessToken,
"refreshToken": refreshToken == null ? null : refreshToken,
"expiryDate": expiryDate == null ? null : expiryDate!.toIso8601String(),
"userInfo": userInfo == null ? null : userInfo!.toJson(),
};
"accessToken": accessToken,
"refreshToken": refreshToken,
"expiryDate": expiryDate == null ? null : expiryDate!.toIso8601String(),
"userInfo": userInfo == null ? null : userInfo!.toJson(),
};
}
class UserInfo {
@ -107,47 +110,76 @@ class UserInfo {
int? customerId;
dynamic dealershipId;
factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
id: json["id"] == null ? null : json["id"],
userId: json["userID"] == null ? null : json["userID"],
firstName: json["firstName"] == null ? null : json["firstName"],
lastName: json["lastName"] == null ? null : json["lastName"],
mobileNo: json["mobileNo"] == null ? null : json["mobileNo"],
email: json["email"] == null ? null : json["email"],
userImageUrl: json["userImageUrl"],
roleId: json["roleID"] == null ? null : json["roleID"],
roleName: json["roleName"] == null ? null : json["roleName"],
isEmailVerified: json["isEmailVerified"] == null ? null : json["isEmailVerified"],
serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)),
isVerified: json["isVerified"] == null ? null : json["isVerified"],
userRoles: json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x)),
isCustomer: json["isCustomer"] == null ? null : json["isCustomer"],
isProviderDealership: json["isProviderDealership"] == null ? null : json["isProviderDealership"],
isDealershipUser: json["isDealershipUser"] == null ? null : json["isDealershipUser"],
providerId: json["providerID"],
customerId: json["customerID"] == null ? null : json["customerID"],
dealershipId: json["dealershipID"],
);
UserInfo.fromJson(Map<String, dynamic> json) {
if (json["roleID"] == 5) {
AppState().userType = UserType.providerDealer;
} else if (json["roleID"] == 6) {
AppState().userType = UserType.providerIndividual;
} else {
AppState().userType = UserType.customer;
}
id = json["id"];
userId = json["userID"];
firstName = json["firstName"];
lastName = json["lastName"];
mobileNo = json["mobileNo"];
email = json["email"];
userImageUrl = json["userImageUrl"];
roleId = json["roleID"];
roleName = json["roleName"];
isEmailVerified = json["isEmailVerified"];
serviceProviderBranch = json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x));
isVerified = json["isVerified"];
userRoles = json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x));
isCustomer = json["isCustomer"];
isProviderDealership = json["isProviderDealership"];
isDealershipUser = json["isDealershipUser"];
providerId = json["providerID"];
customerId = json["customerID"];
dealershipId = json["dealershipID"];
}
// factory UserInfo.fromJson(Map<String, dynamic> json) => UserInfo(
// id: json["id"],
// userId: json["userID"],
// firstName: json["firstName"],
// lastName: json["lastName"],
// mobileNo: json["mobileNo"],
// email: json["email"],
// userImageUrl: json["userImageUrl"],
// roleId: json["roleID"],
// roleName: json["roleName"],
// isEmailVerified: json["isEmailVerified"],
// serviceProviderBranch: json["serviceProviderBranch"] == null ? null : List<dynamic>.from(json["serviceProviderBranch"].map((x) => x)),
// isVerified: json["isVerified"],
// userRoles: json["userRoles"] == null ? null : List<dynamic>.from(json["userRoles"].map((x) => x)),
// isCustomer: json["isCustomer"],
// isProviderDealership: json["isProviderDealership"],
// isDealershipUser: json["isDealershipUser"],
// providerId: json["providerID"],
// customerId: json["customerID"],
// dealershipId: json["dealershipID"],
// );
Map<String, dynamic> toJson() => {
"id": id == null ? null : id,
"userID": userId == null ? null : userId,
"firstName": firstName == null ? null : firstName,
"lastName": lastName == null ? null : lastName,
"mobileNo": mobileNo == null ? null : mobileNo,
"email": email == null ? null : email,
"userImageUrl": userImageUrl,
"roleID": roleId == null ? null : roleId,
"roleName": roleName == null ? null : roleName,
"isEmailVerified": isEmailVerified == null ? null : isEmailVerified,
"serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x)),
"isVerified": isVerified == null ? null : isVerified,
"userRoles": userRoles == null ? null : List<dynamic>.from(userRoles!.map((x) => x)),
"isCustomer": isCustomer == null ? null : isCustomer,
"isProviderDealership": isProviderDealership == null ? null : isProviderDealership,
"isDealershipUser": isDealershipUser == null ? null : isDealershipUser,
"providerID": providerId,
"customerID": customerId == null ? null : customerId,
"dealershipID": dealershipId,
};
"id": id,
"userID": userId,
"firstName": firstName,
"lastName": lastName,
"mobileNo": mobileNo,
"email": email,
"userImageUrl": userImageUrl,
"roleID": roleId,
"roleName": roleName,
"isEmailVerified": isEmailVerified,
"serviceProviderBranch": serviceProviderBranch == null ? null : List<dynamic>.from(serviceProviderBranch!.map((x) => x)),
"isVerified": isVerified,
"userRoles": userRoles == null ? null : List<dynamic>.from(userRoles!.map((x) => x)),
"isCustomer": isCustomer,
"isProviderDealership": isProviderDealership,
"isDealershipUser": isDealershipUser,
"providerID": providerId,
"customerID": customerId,
"dealershipID": dealershipId,
};
}

@ -27,11 +27,11 @@ import 'package:mc_common_app/models/user/verify_email.dart';
import 'package:mc_common_app/utils/shared_prefrence.dart';
abstract class UserRepo {
Future<BasicOtpRespModel> basicOtp(String phoneNo, {int otpType = 1, int roleId = 4, int countryId = 1});
Future<BasicOtpRespModel> basicOtp(String phoneNo, {int otpType = 1, int roleId = 4, int countryId = 1, bool isNeedToPassToken = false});
Future<RegisterUserRespModel> basicVerify(String phoneNo, String otp, String userToken);
Future<RegisterUserRespModel> basicVerify(String phoneNo, String otp, String userToken, {bool isNeedToPassToken = false});
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password);
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password, {bool isNeedToPassToken = false});
Future<Response> loginV1(String phoneNo, String password);
@ -76,31 +76,45 @@ abstract class UserRepo {
class UserRepoImp implements UserRepo {
@override
Future<BasicOtpRespModel> basicOtp(String phoneNo, {int otpType = 1, int roleId = 4, int countryId = 1}) async {
Future<BasicOtpRespModel> basicOtp(String phoneNo, {int otpType = 1, int roleId = 4, int countryId = 1, bool isNeedToPassToken = false}) async {
var postParams = {"countryID": countryId, "userMobileNo": phoneNo, "otpType": otpType, "userRole": roleId};
return await injector.get<ApiClient>().postJsonForObject((json) => BasicOtpRespModel.fromJson(json), ApiConsts.BasicOTP, postParams);
String? t;
if (isNeedToPassToken) {
t = AppState().getUser.data!.accessToken ?? "";
debugPrint("token " + t);
}
return await injector.get<ApiClient>().postJsonForObject((json) => BasicOtpRespModel.fromJson(json), ApiConsts.BasicOTP, postParams, token: t);
}
@override
Future<RegisterUserRespModel> basicVerify(String phoneNo, String otp, String userToken) async {
Future<RegisterUserRespModel> basicVerify(String phoneNo, String otp, String userToken, {bool isNeedToPassToken = false}) async {
var postParams = {
"userMobileNo": phoneNo,
"userOTP": otp,
"userToken": userToken,
};
return await injector.get<ApiClient>().postJsonForObject((json) => RegisterUserRespModel.fromJson(json), ApiConsts.BasicVerify, postParams);
String? t;
if (isNeedToPassToken) {
t = AppState().getUser.data!.accessToken ?? "";
debugPrint("token " + t);
}
return await injector.get<ApiClient>().postJsonForObject((json) => RegisterUserRespModel.fromJson(json), ApiConsts.BasicVerify, postParams, token: t);
}
@override
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password) async {
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password, {bool isNeedToPassToken = false}) async {
Map<String, Object> 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};
}
return await injector.get<ApiClient>().postJsonForObject((json) => RegisterUserRespModel.fromJson(json), ApiConsts.BasicComplete, postParams);
String? t;
if (isNeedToPassToken) {
t = AppState().getUser.data!.accessToken ?? "";
debugPrint("token " + t);
}
return await injector.get<ApiClient>().postJsonForObject((json) => RegisterUserRespModel.fromJson(json), ApiConsts.BasicComplete, postParams, token: t);
}
@override
@ -285,6 +299,7 @@ class UserRepoImp implements UserRepo {
UserInfo info = UserInfo.fromJson(jsonDecode(mdata));
User user = User();
user.data = UserData(accessToken: refresh.data!.accessToken ?? "", refreshToken: refresh.data!.refreshToken ?? "", userInfo: info);
AppState().setUser = user;
return refresh.data!.accessToken ?? "";
}

@ -21,6 +21,12 @@ enum AdReserveStatus {
enum CreatedByRoleEnum { customer, provider, admin, allAds }
enum UserType {
providerDealer,
providerIndividual,
customer,
}
enum AdPostStatus {
pendingForReview,
pendingForPayment,

@ -4,8 +4,8 @@ navigateWithName(BuildContext context, String routeName, {Object? arguments}) {
Navigator.pushNamed(context, routeName, arguments: arguments);
}
navigateReplaceWithName(BuildContext context, String routeName, {Object? arguments}) {
Navigator.pushReplacementNamed(context, routeName, arguments: arguments);
Future<void> navigateReplaceWithName(BuildContext context, String routeName, {Object? arguments}) async {
await Navigator.pushReplacementNamed(context, routeName, arguments: arguments);
}
navigateReplaceWithNameUntilRoute(BuildContext context, String routeName, {Object? arguments}) {

@ -142,19 +142,26 @@ class UserVM extends BaseVM {
}
}
Future<void> performCompleteProfile(
BuildContext context, {
Future<void> performCompleteProfile(BuildContext context, {
required String password,
required String confirmPassword,
required String firstName,
required String lastName,
required String email,
required String? userId,
bool isNeedToPassToken = false,
}) async {
if (Utils.passwordValidateStructure(password)) {
if (password == confirmPassword) {
Utils.showLoading(context);
RegisterUserRespModel user = await userRepo.basicComplete(userId ?? "", firstName, lastName, email, password);
RegisterUserRespModel user = await userRepo.basicComplete(
userId ?? "",
firstName,
lastName,
email,
password,
isNeedToPassToken: isNeedToPassToken,
);
Utils.hideLoading(context);
if (user.messageStatus == 1) {
Utils.showToast(LocaleKeys.successfullyRegistered.tr());
@ -334,7 +341,6 @@ class UserVM extends BaseVM {
RegisterUserRespModel verifiedUser = RegisterUserRespModel.fromJson(jsonDecode(response2.body));
if (verifiedUser.messageStatus == 1) {
User user = User.fromJson(jsonDecode(response2.body));
if (appType == AppType.provider) {
if (user.data!.userInfo!.roleId == 5 || user.data!.userInfo!.roleId == 6) {
AppState().setUser = user;
@ -466,20 +472,33 @@ class UserVM extends BaseVM {
return await userRepo.getAllCountries();
}
Future<void> performBasicOtpRegisterPage(BuildContext context, {required String countryCode, required String phoneNum, required int role}) async {
Future<void> performBasicOtpRegisterPage(BuildContext context,
{required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async {
Utils.showLoading(context);
BasicOtpRespModel basicOtp = await userRepo.basicOtp(countryCode + phoneNum, roleId: role);
BasicOtpRespModel basicOtp = await userRepo.basicOtp(countryCode + phoneNum, roleId: role, isNeedToPassToken: isNeedToPassToken);
Utils.hideLoading(context);
if (basicOtp.messageStatus == 1) {
showMDialog(context, child: OtpDialog(
onClick: (String code) async {
pop(context);
if (reloadPage == null)
pop(context);
Utils.showLoading(context);
RegisterUserRespModel user = await userRepo.basicVerify(countryCode + phoneNum, code, basicOtp.data!.userToken ?? "");
RegisterUserRespModel user = await userRepo.basicVerify(
countryCode + phoneNum,
code,
basicOtp.data!.userToken ?? "",
isNeedToPassToken: isNeedToPassToken,
);
Utils.hideLoading(context);
if (user.messageStatus == 1) {
Utils.showToast(user.message ?? "");
navigateReplaceWithName(context, AppRoutes.completeProfile, arguments: user);
user.data!.roleId = role;
user.data!.isNeedToPassToken = isNeedToPassToken;
navigateReplaceWithName(context, AppRoutes.completeProfile, arguments: user).then((value) {
if (reloadPage != null) {
reloadPage();
}
});
} else {
Utils.showToast(user.message ?? "");
}

@ -35,8 +35,9 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar( isRemoveBackButton: true,
title: LocaleKeys.signUp.tr(),
appBar: CustomAppBar(
isRemoveBackButton: widget.user.data!.roleId == 7 ? false : true,
title: widget.user.data!.roleId == 7 ? "" : LocaleKeys.signUp.tr(),
),
body: SizedBox(
width: double.infinity,
@ -47,7 +48,11 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
child: Column(
children: [
6.height,
LocaleKeys.completeProfile.tr().toText(height: 23 / 24, fontSize: 24, letterSpacing: -1.44,),
LocaleKeys.completeProfile.tr().toText(
height: 23 / 24,
fontSize: 24,
letterSpacing: -1.44,
),
12.height,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
@ -55,7 +60,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
color: MyColors.lightTextColor,
textAlign: TextAlign.center,
fontSize: 14,
height: 23 / 24,
height: 23 / 24,
letterSpacing: -0.48,
),
),
@ -139,7 +144,12 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
title: LocaleKeys.save.tr(),
maxWidth: double.infinity,
onPressed: () {
bool validateStatus = userVM.dataValidation(password: password, firstName: firstName, lastName: lastName, email: email);
bool validateStatus = userVM.dataValidation(
password: password,
firstName: firstName,
lastName: lastName,
email: email,
);
if (validateStatus) {
userVM.performCompleteProfile(
context,
@ -149,6 +159,7 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
lastName: lastName!,
email: email!,
userId: widget.user.data!.userId ?? "",
isNeedToPassToken: widget.user.data!.isNeedToPassToken,
);
}
}),

@ -1,10 +1,11 @@
import 'package:flutter/material.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
void showMyBottomSheet(BuildContext context, {required Widget child, VoidCallback? callBackFunc}) {
void showMyBottomSheet(BuildContext context, {bool isDismissible = true, required Widget child, VoidCallback? callBackFunc}) {
showModalBottomSheet<String>(
context: context,
isScrollControlled: true,
isDismissible: isDismissible,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return Container(
@ -40,9 +41,10 @@ void showMyBottomSheet(BuildContext context, {required Widget child, VoidCallbac
).then((value) {
// print("BACK FROM DELEGATE!!!!");
// print("value: $value");
if (value == "delegate_reload") {
if (callBackFunc != null) callBackFunc();
}
// if (value == "delegate_reload") {
// if (callBackFunc != null) callBackFunc();
// }
if (callBackFunc != null) callBackFunc();
});
}

@ -23,13 +23,14 @@ extension ExtendedText on Widget {
}
extension ContainerExt on Widget {
Widget toWhiteContainer({required double width, double? allPading, EdgeInsets? pading, EdgeInsets? margin, VoidCallback? onTap, Color? backgroundColor, bool isBorderRequired = false}) {
Widget toWhiteContainer({required double width, double? allPading, EdgeInsets? pading, EdgeInsets? margin, VoidCallback? onTap, Color? backgroundColor, bool isBorderRequired = false, double borderRadius = 0}) {
return InkWell(
onTap: onTap,
child: Container(
decoration: BoxDecoration(
border: isBorderRequired ? Border.all(color: MyColors.darkPrimaryColor, width: 2) : null,
color: backgroundColor ?? MyColors.white,
borderRadius: BorderRadius.circular(borderRadius),
boxShadow: const [
BoxShadow(
blurRadius: 8,
@ -76,12 +77,12 @@ extension ContainerExt on Widget {
boxShadow: !isShadowEnabled
? null
: [
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
BoxShadow(
color: const Color(0xff000000).withOpacity(.05),
blurRadius: 26,
offset: const Offset(0, -3),
),
],
),
padding: padding ?? EdgeInsets.all(paddingAll),
margin: margin ?? EdgeInsets.all(marginAll),
@ -355,3 +356,5 @@ extension LocaleSetup on MultiProvider {
extension WidgetExtensions on Widget {
Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this);
}

Loading…
Cancel
Save