Merge branch 'aamir_dev' into faiz_development_common

# Conflicts:
#	assets/langs/ar-SA.json
#	assets/langs/en-US.json
#	lib/generated/codegen_loader.g.dart
#	lib/generated/locale_keys.g.dart
#	lib/view_models/service_view_model.dart
aamir_dev
Faiz Hashmi 1 year ago
commit 04bcf76083

@ -705,6 +705,10 @@
"customerLocation": "موقع العميل",
"deliveryAvailable": "التوصيل متاح",
"viewed": "تم المشاهدة",
"updateUserDetails": "تحديث تفاصيل المستخدم",
"enterNewFirstName": "أدخل الاسم الأول",
"enterNewLastName": "أدخل الاسم الأخير",
"userDetailsUpdated": "يتم تحديث تفاصيل المستخدم",
"itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.",
"reactivateAd": "إعادة تنشيط الإعلان",
"dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.",
@ -741,6 +745,16 @@
"active": "نشط",
"paymentType": "نوع الدفع",
"searchByCreatedDate": "البحث حسب تاريخ الإنشاء",
"cityNameMandatory": "المدينة إلزامية",
"genderMandatory": "الجنس إلزامي",
"updateCity": "تحديث المدينة",
"userGender": "جنس",
"userMale": "ذكر",
"userFemale": "أنثى",
"maxFileSelection" :"يمكنك تحديد الحد الأقصى لملفات 7",
"maxFileSize": "يجب أن يكون حجم كل ملف أقل من 2 ميغابايت",
"onlyJPGandPNG": "يُسمح فقط بملفات JPG وPNG",
"expiryDate": "تاريخ انتهاء الصلاحية",
"dealCompleted": "تم إتمام الصفقة",
"theDealNotCompleted": "لم تكتمل الصفقة",
"cancelRequest": "أريد إلغاء الطلب.",

@ -760,4 +760,19 @@
"noteCopyItemsExplanation": "Note: You will be able to copy items from one service to another in a selected category. You must create the services first and they should be approved. Then you will be able to get the available services from which you can copy all or selected items.",
"requestCreatedOn": "Request created on",
"online": "Online"
"searchByCreatedDate": "Search By Created Date",
"updateUserDetails": "Update User Details",
"enterNewFirstName": "Enter First Name",
"enterNewLastName": "Enter Last Name",
"userDetailsUpdated": "User Details is Updated",
"cityNameMandatory": "City is mandatory",
"genderMandatory": "Gender is mandatory",
"updateCity": "Update City",
"userGender": "Gender",
"userMale": "Male",
"userFemale": "Female",
"maxFileSelection" :"You can select a maximum of 7 files",
"maxFileSize": "Each file size must be less than 2 MB",
"onlyJPGandPNG": "Only JPG and PNG files are allowed",
"expiryDate": "Expiry Date"
}

@ -4,6 +4,7 @@ import 'package:mc_common_app/models/subscriptions_models/provider_subscription_
import 'package:mc_common_app/models/subscriptions_models/subscription_model.dart';
import 'package:mc_common_app/models/user_models/user.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
class AppState {
static final AppState _instance = AppState._internal();
@ -70,4 +71,13 @@ class AppState {
set setproviderSubscription(List<Subscription>? value) {
_providerSubscription = value;
}
DropValue? _userRegisterCountrySelection ;
DropValue get getUserRegisterCountrySelection => _userRegisterCountrySelection!;
set setUserRegisterCountrySelection(DropValue value) {
_userRegisterCountrySelection = value;
}
}

@ -39,6 +39,7 @@ class ApiConsts {
static String logoutUser = "${baseUrlServices}api/Account/Logout";
static String updateUserImage = "${baseUrlServices}api/User_UpdateProfileImage";
static String getUserImage = "${baseUrlServices}api/ProfileImage";
static String userUpdate = "${baseUrlServices}api/User_Update";
static String providerComplaintCreate = "${baseUrlServices}api/ServiceProviders/ProviderComplaint_Create";
//Profile
@ -255,6 +256,12 @@ class GlobalConsts {
}
return appInvitationMessageEn;
}
// Attachment Values
int maxFileCount = 7;
int maxFileSizeInBytes = 2 * 1024 * 1024;
}
class MyAssets {
@ -396,4 +403,6 @@ class SignalrConsts {
// General
static String sendMessageGeneral = "SendMessageGeneral";
static String receiveMessageGeneral = "ReceiveMessageGeneral";
}

@ -44,6 +44,8 @@ import 'package:mc_common_app/views/user/register_page.dart';
import 'package:mc_common_app/views/user/register_provider_page.dart';
import 'package:mc_common_app/views/user/register_selection_page.dart';
import 'package:mc_common_app/views/splash/splash_page.dart';
import 'package:mc_common_app/views/user/update_user_city_country.dart';
import 'package:mc_common_app/views/user/update_user_details.dart';
import 'package:mc_common_app/views/user/vertify_password_page.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/widgets/image_viewer/image_viewer_screen.dart';
@ -168,6 +170,8 @@ class AppRoutes {
//Chat
static const String chatView = "/chatView";
static const String updateUserDetails = "/updateUserDetails";
static const String updateUserCity = "/updateUserCity";
static const String initialRoute = splash;
static final Map<String, WidgetBuilder> routes = {
@ -187,6 +191,8 @@ class AppRoutes {
forgetPasswordMethodPage: (context) => ForgetPasswordMethodPage(ModalRoute.of(context)!.settings.arguments as String),
changeMobilePage: (context) => ChangeMobilePage(),
changeEmailPage: (context) => const ChangeEmailPage(),
updateUserDetails: (context) => const UpdateUserDetails(),
updateUserCity: (context) => const UpdateUserCityCountry(),
changePassword: (context) => const ChangePasswordPage(),
editAccountPage: (context) => const EditAccountPage(),
profileView: (context) => const ProfileScreen(),

@ -721,6 +721,10 @@ class CodegenLoader extends AssetLoader{
"customerLocation": "موقع العميل",
"deliveryAvailable": "التوصيل متاح",
"viewed": "تم المشاهدة",
"updateUserDetails": "تحديث تفاصيل المستخدم",
"enterNewFirstName": "أدخل الاسم الأول",
"enterNewLastName": "أدخل الاسم الأخير",
"userDetailsUpdated": "يتم تحديث تفاصيل المستخدم",
"itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.",
"reactivateAd": "إعادة تنشيط الإعلان",
"dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.",
@ -757,6 +761,16 @@ class CodegenLoader extends AssetLoader{
"active": "نشط",
"paymentType": "نوع الدفع",
"searchByCreatedDate": "البحث حسب تاريخ الإنشاء",
"cityNameMandatory": "المدينة إلزامية",
"genderMandatory": "الجنس إلزامي",
"updateCity": "تحديث المدينة",
"userGender": "جنس",
"userMale": "ذكر",
"userFemale": "أنثى",
"maxFileSelection": "يمكنك تحديد الحد الأقصى لملفات 7",
"maxFileSize": "يجب أن يكون حجم كل ملف أقل من 2 ميغابايت",
"onlyJPGandPNG": "يُسمح فقط بملفات JPG وPNG",
"expiryDate": "تاريخ انتهاء الصلاحية",
"dealCompleted": "تم إتمام الصفقة",
"theDealNotCompleted": "لم تكتمل الصفقة",
"cancelRequest": "أريد إلغاء الطلب.",
@ -1520,6 +1534,21 @@ static const Map<String,dynamic> en_US = {
"active": "Active",
"paymentType": "Payment Type",
"searchByCreatedDate": "Search By Created Date",
"updateUserDetails": "Update User Details",
"enterNewFirstName": "Enter First Name",
"enterNewLastName": "Enter Last Name",
"userDetailsUpdated": "User Details is Updated",
"cityNameMandatory": "City is mandatory",
"genderMandatory": "Gender is mandatory",
"updateCity": "Update City",
"userGender": "Gender",
"userMale": "Male",
"userFemale": "Female",
"maxFileSelection": "You can select a maximum of 7 files",
"maxFileSize": "Each file size must be less than 2 MB",
"onlyJPGandPNG": "Only JPG and PNG files are allowed",
"expiryDate": "Expiry Date"
"searchByCreatedDate": "Search By Created Date",
"dealCompleted": "The Deal Completed",
"theDealNotCompleted": "The Deal Not Completed",
"cancelRequest": "I want to cancel the request.",

@ -684,6 +684,10 @@ abstract class LocaleKeys {
static const customerLocation = 'customerLocation';
static const deliveryAvailable = 'deliveryAvailable';
static const viewed = 'viewed';
static const updateUserDetails = 'updateUserDetails';
static const enterNewFirstName = 'enterNewFirstName';
static const enterNewLastName = 'enterNewLastName';
static const userDetailsUpdated = 'userDetailsUpdated';
static const itemNoLongerAvailable = 'itemNoLongerAvailable';
static const reactivateAd = 'reactivateAd';
static const dealOutsideApp = 'dealOutsideApp';
@ -720,6 +724,16 @@ abstract class LocaleKeys {
static const active = 'active';
static const paymentType = 'paymentType';
static const searchByCreatedDate = 'searchByCreatedDate';
static const cityNameMandatory = 'cityNameMandatory';
static const genderMandatory = 'genderMandatory';
static const updateCity = 'updateCity';
static const userGender = 'userGender';
static const userMale = 'userMale';
static const userFemale = 'userFemale';
static const maxFileSelection = 'maxFileSelection';
static const maxFileSize = 'maxFileSize';
static const onlyJPGandPNG = 'onlyJPGandPNG';
static const expiryDate = 'expiryDate';
static const dealCompleted = 'dealCompleted';
static const theDealNotCompleted = 'theDealNotCompleted';
static const cancelRequest = 'cancelRequest';

@ -4,6 +4,8 @@
import 'dart:convert';
import 'package:mc_common_app/utils/enums.dart';
Document documentFromJson(String str) => Document.fromJson(json.decode(str));
String documentToJson(Document data) => json.encode(data.toJson());
@ -37,26 +39,29 @@ class Document {
}
class DocumentData {
DocumentData({
this.id,
this.serviceProviderId,
this.documentId,
this.documentUrl,
this.status,
this.statusText,
this.comment,
this.isActive,
this.document,
this.fileExt,
this.documentName,
this.isLocalFile,
});
DocumentData(
{this.id,
this.serviceProviderId,
this.documentId,
this.documentUrl,
this.status,
this.statusText,
this.comment,
this.isActive,
this.document,
this.fileExt,
this.documentName,
this.isLocalFile,
this.description,
this.dateExpire,
this.isAllowUpdate,
this.isExpired});
int? id;
int? serviceProviderId;
int? documentId;
String? documentUrl;
int? status;
DocumentStatusEnum? status;
String? comment;
bool? isActive;
String? document;
@ -64,20 +69,28 @@ class DocumentData {
String? statusText;
String? documentName;
bool? isLocalFile;
String? description;
String? dateExpire;
bool? isExpired;
bool? isAllowUpdate;
factory DocumentData.fromJson(Map<String, dynamic> json) => DocumentData(
id: json["id"],
serviceProviderId: json["serviceProviderID"],
documentId: json["documentID"],
documentUrl: json["documentURL"],
status: json["status"],
status: json.containsKey("status") ? (json['status'] as int).toDocumentStatusEnum() : null,
statusText: json["statusText"],
comment: json["comment"],
isActive: json["isActive"],
dateExpire: json["dateExpire"],
isExpired: json["isExpired"],
isAllowUpdate: json["isAllowUpdate"],
document: null,
fileExt: null,
documentName: json["documentName"],
isLocalFile: false);
isLocalFile: false,
description: null);
Map<String, dynamic> toJson() => {
"id": id,
@ -87,5 +100,27 @@ class DocumentData {
"status": status,
"comment": comment,
"isActive": isActive,
"dateExpire": dateExpire,
"isExpired": isExpired,
"isAllowUpdate": isAllowUpdate,
};
}
extension DocumentEnum on int {
DocumentStatusEnum toDocumentStatusEnum() {
switch (this) {
case 0:
return DocumentStatusEnum.needUpload;
case 1:
return DocumentStatusEnum.pending;
case 2:
return DocumentStatusEnum.review;
case 3:
return DocumentStatusEnum.approvedOrActive;
case 4:
return DocumentStatusEnum.rejected;
default:
throw Exception('Invalid status value: $this'); // Explicit handling for invalid cases
}
}
}

@ -60,6 +60,7 @@ class Subscription {
this.totalAds,
this.branchesRemaining,
this.subUsersRemaining,
this.subscriptionType,
this.adsRemaining});
int? id;
@ -81,6 +82,7 @@ class Subscription {
SubscriptionTypeEnum? subscriptionTypeEnum;
bool? isMyCurrentPackage;
bool? isRenewable;
int? subscriptionType;
int? subscriptionBranches;
int? subscriptionSubUsers;
@ -121,5 +123,6 @@ class Subscription {
branchesRemaining: json["branchesRemaining"],
subUsersRemaining: json["subUsersRemaining"],
adsRemaining: json["adsRemaining"],
subscriptionType: json["subscriptionType"],
);
}

@ -25,14 +25,16 @@ class User {
int? messageStatus;
String? message;
factory User.fromJson(Map<String, dynamic> json) => User(
factory User.fromJson(Map<String, dynamic> json) =>
User(
totalItemsCount: json["totalItemsCount"],
data: json["data"] == null ? null : UserData.fromJson(json["data"]),
messageStatus: json["messageStatus"],
message: json["message"],
);
Map<String, dynamic> toJson() => {
Map<String, dynamic> toJson() =>
{
"totalItemsCount": totalItemsCount,
"data": data?.toJson(),
"messageStatus": messageStatus,
@ -53,14 +55,16 @@ class UserData {
DateTime? expiryDate;
UserInfo? userInfo;
factory UserData.fromJson(Map<String, dynamic> json) => UserData(
factory UserData.fromJson(Map<String, dynamic> json) =>
UserData(
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() => {
Map<String, dynamic> toJson() =>
{
"accessToken": accessToken,
"refreshToken": refreshToken,
"expiryDate": expiryDate?.toIso8601String(),
@ -69,34 +73,43 @@ class UserData {
}
class UserInfo {
UserInfo(
{this.id,
this.userId,
this.firstName,
this.lastName,
this.mobileNo,
this.email,
this.userImageUrl,
this.roleId,
this.roleName,
this.isEmailVerified,
this.serviceProviderBranch,
this.isVerified,
this.userRoles,
this.isCustomer,
this.isProviderDealership,
this.isDealershipUser,
this.providerId,
this.customerId,
this.countryId,
this.cityId,
this.dealershipId,
this.userLocalImage});
UserInfo({this.id,
this.userId,
this.firstName,
this.lastName,
this.mobileNo,
this.email,
this.userImageUrl,
this.roleId,
this.roleName,
this.genderID,
this.genderName,
this.isEmailVerified,
this.serviceProviderBranch,
this.isVerified,
this.userRoles,
this.isCustomer,
this.isProviderDealership,
this.isDealershipUser,
this.providerId,
this.customerId,
this.countryId,
this.cityId,
this.dealershipId,
this.userLocalImage,
this.cityName,
this.countryName,
});
int? id;
String? userId;
String? firstName;
String? lastName;
String? countryName;
String? cityName;
int? genderID;
String? genderName;
String? mobileNo;
String? email;
dynamic userImageUrl;
@ -130,6 +143,10 @@ class UserInfo {
userId = json["userID"];
firstName = json["firstName"];
lastName = json["lastName"];
cityName = json["cityName"];
genderID = json["genderID"];
genderName = json["genderName"];
countryName = json["countryName"];
mobileNo = json["mobileNo"];
email = json["email"];
userImageUrl = json["userImageUrl"];
@ -172,11 +189,14 @@ class UserInfo {
// dealershipId: json["dealershipID"],
// );
Map<String, dynamic> toJson() => {
Map<String, dynamic> toJson() =>
{
"id": id,
"userID": userId,
"firstName": firstName,
"lastName": lastName,
"countryName": countryName,
"cityName": cityName,
"mobileNo": mobileNo,
"email": email,
"userImageUrl": userImageUrl,
@ -192,6 +212,8 @@ class UserInfo {
"providerID": providerId,
"customerID": customerId,
"dealershipID": dealershipId,
"genderName": genderName,
"genderID": genderID
};
@override

@ -217,6 +217,7 @@ class BranchRepoImp implements BranchRepo {
"documentExt": documents[i].fileExt,
"documentImage": documents[i].document,
"isActive": true,
"dateExpire":documents[i].dateExpire,
};
map.add(postParams);
}

@ -31,7 +31,7 @@ abstract class UserRepo {
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, {bool isNeedToPassToken = false});
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password, String cityID, String genderID, {bool isNeedToPassToken = false});
Future<Response> loginV1(String phoneNo, String password);
@ -55,6 +55,8 @@ abstract class UserRepo {
Future<GenericRespModel> changePassword(String currentPassword, String newPassword);
Future<Map<String, dynamic>> updateUserInfo(String firstName, String lastName, String? city);
Future<ChangeMobileRespModel> changeMobileNoOTPRequest(countryID, String mobileNo, String password);
Future<ConfirmMobileRespModel> changeMobileNo(String userToken, String userOTP);
@ -104,12 +106,12 @@ class UserRepoImp implements UserRepo {
}
@override
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password, {bool isNeedToPassToken = false}) async {
Future<RegisterUserRespModel> basicComplete(String userId, String firstName, String lastName, String email, String password, String cityID, String genderID, {bool isNeedToPassToken = false}) async {
Map<String, Object> postParams;
if (email.isEmpty) {
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "companyName": "string", "isEmailVerified": true, "password": password};
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "companyName": "string", "isEmailVerified": true, "password": password, "cityID": cityID, "genderID": genderID};
} else {
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "email": email, "companyName": "string", "isEmailVerified": true, "password": password};
postParams = {"userID": userId, "firstName": firstName, "lastName": lastName, "email": email, "companyName": "string", "isEmailVerified": true, "password": password, "cityID": cityID, "genderID": genderID};
}
String? t;
if (isNeedToPassToken) {
@ -164,6 +166,11 @@ class UserRepoImp implements UserRepo {
return await injector.get<ApiClient>().getJsonForObject((json) => Country.fromJson(json), ApiConsts.getAllCountry);
}
// @override
// Future<Country> getAllCountriesForUser() async {
// return await injector.get<ApiClient>().getJsonForObject((json) => Country.fromJson(json), ApiConsts.getAllCountry);
// }
@override
Future<Cities> getAllCites(String countryId) async {
var postParams = {
@ -254,6 +261,13 @@ class UserRepoImp implements UserRepo {
return await injector.get<ApiClient>().postJsonForObject((json) => ConfirmEmailRespModel.fromJson(json), ApiConsts.changeEmail, postParams, token: t);
}
@override
Future<Map<String, dynamic>> updateUserInfo(String firstName, String lastName, String? city) async {
var postParams = {"userID": "${AppState().getUser.data!.userInfo!.userId}", "firstName": "${firstName}", "lastName": "${lastName}", "genderID": 1, "cityID": city ?? 1};
String t = AppState().getUser.data!.accessToken ?? "";
return await injector.get<ApiClient>().postJsonForObject((json) => json, ApiConsts.userUpdate, postParams, token: t);
}
@override
Future<VerifyEmailRespModel> emailVerify(String email, String userID) async {
var postParams = {

@ -60,11 +60,11 @@ class CommonAuthImp implements CommonAuthServices {
return await localAuth.getAvailableBiometrics();
}
Future<void> getHuaweiAuth() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
// if (androidInfo.brand == "HUAWEI") {
// huawei.canAuth();
// }
}
// Future<void> getHuaweiAuth() async {
// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
// // if (androidInfo.brand == "HUAWEI") {
// // huawei.canAuth();
// // }
// }
}

@ -4,8 +4,11 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:image_picker/image_picker.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/main.dart';
import 'package:mc_common_app/utils/app_permission_handler.dart';
import 'package:mc_common_app/utils/utils.dart';
abstract class CommonAppServices {
Future<List<File>> pickMultipleImages();
@ -55,21 +58,35 @@ class CommonServicesImp implements CommonAppServices {
return pickedFiles;
}
@override
Future<List<File>> pickMultipleImages() async {
final picker = ImagePicker();
final pickedImagesXFiles = await picker.pickMultiImage();
List<File> imageModels = [];
List<File> pickedImages = [];
if (pickedImagesXFiles == null) {
return [];
}
if (pickedImagesXFiles.isEmpty) {
return [];
var images = await picker.pickMultiImage(imageQuality: 70);
for (var element in images) {
final extension = element.path.split('.').last.toLowerCase();
if (extension != 'jpg' && extension != 'jpeg' && extension != 'png') {
Utils.showToast(LocaleKeys.onlyJPGandPNG);
return [];
}
if (await element.length() > GlobalConsts().maxFileSizeInBytes) {
Utils.showToast(LocaleKeys.maxFileSize);
return [];
}
imageModels.add(File(element.path));
}
for (var element in pickedImagesXFiles) {
pickedImages.add(File(element.path));
if (imageModels.length > GlobalConsts().maxFileCount) {
Utils.showToast(LocaleKeys.maxFileSelection);
imageModels = imageModels.sublist(0, GlobalConsts().maxFileCount); // Keep only the first 7 images
}
pickedImages.addAll(imageModels);
return pickedImages;
}

@ -26,16 +26,8 @@ abstract class PaymentService {
class PaymentServiceImp implements PaymentService {
MyInAppBrowser? myInAppBrowser;
// var inAppBrowserOptions = InAppBrowserClassOptions(
// inAppWebViewGroupOptions:
// InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), ios: IOSInAppWebViewOptions(applePayAPIEnabled: true)),
// crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black),
// android: AndroidInAppBrowserOptions(),
// ios:
// IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN));
var inAppBrowserOptions = InAppBrowserClassSettings(
webViewSettings: InAppWebViewSettings(
useShouldOverrideUrlLoading: false,
transparentBackground: false,
@ -113,10 +105,13 @@ class PaymentServiceImp implements PaymentService {
onBrowserLoadStart(onFailure: onFailure, onSuccess: onSuccess, url: url);
});
await myInAppBrowser!.openUrlRequest(
// Uri.parse(urlRequest)
urlRequest: URLRequest(url: WebUri(urlRequest)),
urlRequest: URLRequest(
url: WebUri(urlRequest, forceToStringRawValue: true),
allowsCellularAccess: true,
allowsConstrainedNetworkAccess: true,
allowsExpensiveNetworkAccess: true,
),
settings: inAppBrowserOptions,
// in: inAppBrowserOptions,
);
}

@ -213,9 +213,9 @@ enum ChatTypeEnum {
}
enum SubscriptionTypeEnum {
current,
upgrade,
downgrade,
current, //1
upgrade, //2
downgrade, //3
}
enum SubscriptionActionTypeEnum {

@ -81,7 +81,8 @@ class LocationService implements Location {
if (granted) {
Geolocator.getLastKnownPosition(forceAndroidLocationManager: true).then((value) {
if (value == null) {
Geolocator.getCurrentPosition().then((value) {
Geolocator.getCurrentPosition().then((value) async {
if(value == null) await Geolocator.openAppSettings();
done(value);
});
} else {

@ -1261,7 +1261,14 @@ class AdVM extends BaseVM {
for (var element in images) {
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
}
pickedPostingImages.addAll(imageModels);
// Added By Aamir
if (pickedPostingImages.length > GlobalConsts().maxFileCount) {
pickedPostingImages = pickedPostingImages.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
if (pickedPostingImages.isNotEmpty) vehicleImageError = "";
notifyListeners();
}
@ -1304,7 +1311,13 @@ class AdVM extends BaseVM {
vehicleDamageCards[index].partImages = imageModels;
} else {
vehicleDamageCards[index].partImages!.addAll(imageModels);
// Added By Aamir
if (vehicleDamageCards[index].partImages!.length > GlobalConsts().maxFileCount) {
vehicleDamageCards[index].partImages = vehicleDamageCards[index].partImages!.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
}
vehicleDamageCards[index].partImageErrorValue = "";
notifyListeners();
}
@ -1354,6 +1367,11 @@ class AdVM extends BaseVM {
void pickMultipleDamageImages() async {
List<File> images = await commonServices.pickMultipleImages();
pickedDamageImages.addAll(images);
if (pickedDamageImages.length > GlobalConsts().maxFileCount) {
pickedDamageImages = pickedDamageImages.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
if (pickedDamageImages.isNotEmpty) vehicleDamageImageError = "";
notifyListeners();
}

@ -443,6 +443,11 @@ class ChatVM extends BaseVM {
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
}
pickedImagesForMessage.addAll(imageModels);
if (pickedImagesForMessage.length > GlobalConsts().maxFileCount) {
pickedImagesForMessage = pickedImagesForMessage.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
notifyListeners();
}

@ -217,7 +217,7 @@ class PaymentVM extends ChangeNotifier {
context.read<DashboardVmCustomer>().onNavbarTapped(1);
}
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
}
}
Future<void> onVisaCardSelected(BuildContext context, PaymentTypes paymentType) async {
currentPaymentType = paymentType;

@ -269,10 +269,17 @@ class RequestsVM extends BaseVM {
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
}
pickedVehicleImages.addAll(imageModels);
if (pickedVehicleImages.length > GlobalConsts().maxFileCount) {
pickedVehicleImages = pickedVehicleImages.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
if (pickedVehicleImages.isNotEmpty) vehicleImageError = "";
notifyListeners();
}
bool isFetchingRequestType = false;
bool isFetchingVehicleType = true;
bool isFetchingVehicleDetail = false;

@ -140,6 +140,10 @@ class ServiceVM extends BaseVM {
imageModels.add(ImageModel(filePath: element.path, isFromNetwork: false));
}
pickedBranchImages.addAll(imageModels);
if (pickedBranchImages.length > GlobalConsts().maxFileCount) {
pickedBranchImages = pickedBranchImages.sublist(0, GlobalConsts().maxFileCount);
Utils.showToast(LocaleKeys.maxFileSelection);
}
if (pickedBranchImages.isNotEmpty) branchImageError = "";
notifyListeners();
}
@ -164,7 +168,6 @@ class ServiceVM extends BaseVM {
final BranchDetailModel currentBranch = branches!.data!.serviceProviderBranch!.firstWhere((element) => element.id == selectedBranchId);
for (var element in currentBranch.branchServices!) {
// TODO: Here , we need to add the category deactivated status.
categories.add(
CategoryData(
id: element.categoryId,
@ -283,11 +286,11 @@ class ServiceVM extends BaseVM {
isFromNetwork: false,
));
}
documentID == 1
? commerceCertificates.addAll(imageModels)
: documentID == 2
? commercialCertificates.addAll(imageModels)
: vatCertificates.addAll(imageModels);
// documentID == 1
// ? commerceCertificates.addAll(imageModels)
// : documentID == 2
// ? commercialCertificates.addAll(imageModels)
// : vatCertificates.addAll(imageModels);
document!.data![index].document = Utils.convertFileToBase64(files.first);
document!.data![index].fileExt = Utils.checkFileExt(files.first.path);
document!.data![index].documentUrl = files.first.path;

@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:developer';
import 'package:mc_common_app/classes/app_state.dart';
@ -189,7 +190,9 @@ class SubscriptionsVM extends BaseVM {
mySubscriptionsBySp.clear();
setState(ViewState.busy);
// allSubscriptions.data
print("====================== SUB =============");
for (var element in allSubscriptions.data!) {
print("SuBBB "+ element.subscriptionType.toString());
if (element.subscriptionTypeEnum == SubscriptionTypeEnum.current) {
mySubscriptionsBySp.add(element);
}

@ -18,12 +18,14 @@ import 'package:mc_common_app/models/subscriptions_models/subscription_model.dar
import 'package:mc_common_app/models/user_models/basic_otp.dart';
import 'package:mc_common_app/models/user_models/change_email.dart';
import 'package:mc_common_app/models/user_models/change_mobile.dart';
import 'package:mc_common_app/models/user_models/cities.dart';
import 'package:mc_common_app/models/user_models/confirm_email.dart';
import 'package:mc_common_app/models/user_models/confirm_mobile.dart';
import 'package:mc_common_app/models/user_models/confirm_password.dart';
import 'package:mc_common_app/models/user_models/country.dart';
import 'package:mc_common_app/models/user_models/forget_password_otp_compare.dart';
import 'package:mc_common_app/models/user_models/forget_password_otp_request.dart';
import 'package:mc_common_app/models/user_models/image_response.dart';
import 'package:mc_common_app/models/user_models/login_password.dart';
import 'package:mc_common_app/models/user_models/register_user.dart';
import 'package:mc_common_app/models/user_models/user.dart';
@ -43,6 +45,7 @@ import 'package:mc_common_app/views/location_views/map_selection_widget.dart';
import 'package:mc_common_app/widgets/dialog/dialogs.dart';
import 'package:mc_common_app/widgets/dialog/message_dialog.dart';
import 'package:mc_common_app/widgets/dialog/otp_dialog.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/tab/login_email_tab.dart';
import 'package:provider/provider.dart';
@ -62,6 +65,9 @@ class UserVM extends BaseVM {
_loginOtherAccount = value;
}
Country? userCountries;
Cities? userCities;
void updateCompleteProfilePageCheckbox(bool newValue) {
completeProfilePageCheckbox = newValue;
notifyListeners();
@ -164,8 +170,35 @@ class UserVM extends BaseVM {
}
}
Future<void> performCompleteProfile(
BuildContext context, {
Future<void> userDetailsUpdate(BuildContext context, String firstName, String lastName, String? city, String? cityName, String? countryName) async {
Utils.showLoading(context);
Map<String, dynamic> res = await userRepo.updateUserInfo(firstName, lastName, city);
Utils.hideLoading(context);
if (res["data"] != null && res["data"].isNotEmpty) {
print(res["data"]);
User localUser = AppState().getUser;
if (localUser.data != null) {
localUser.data!.userInfo!.firstName = res["data"]["firstName"];
localUser.data!.userInfo!.lastName = res["data"]["lastName"];
localUser.data!.userInfo!.cityId = res["data"]["cityID"];
localUser.data!.userInfo!.countryId = res["data"]["countryID"];
if (cityName != null && countryName != null) {
localUser.data!.userInfo!.cityName = cityName;
localUser.data!.userInfo!.countryName = countryName;
}
// localUser.data!.userInfo!.cityId = res["data"]["cityId"];
AppState().setUser = localUser;
}
Utils.showToast(LocaleKeys.userDetailsUpdated.tr());
pop(context);
} else {
Utils.showToast(res.toString() ?? "");
}
notifyListeners();
}
Future<void> performCompleteProfile(BuildContext context, {
required String password,
required String confirmPassword,
required String firstName,
@ -173,18 +206,21 @@ class UserVM extends BaseVM {
required String email,
required String? userId,
bool isNeedToPassToken = false,
required String cityID,
required String genderID,
}) async {
if (Utils.passwordValidateStructure(password)) {
if (password == confirmPassword) {
Utils.showLoading(context);
RegisterUserRespModel user = await userRepo.basicComplete(
userId ?? "",
firstName,
lastName,
email,
password,
isNeedToPassToken: isNeedToPassToken,
);
userId ?? "",
firstName,
lastName,
email,
password,
cityID,
genderID,
isNeedToPassToken: isNeedToPassToken);
Utils.hideLoading(context);
if (user.messageStatus == 1) {
Utils.showToast(LocaleKeys.successfullyRegistered.tr());
@ -207,6 +243,8 @@ class UserVM extends BaseVM {
required String? firstName,
required String? lastName,
required String? email,
required DropValue? city,
required DropValue? gender,
}) {
bool isValid = true;
if (firstName!.isEmpty) {
@ -230,6 +268,12 @@ class UserVM extends BaseVM {
Utils.showToast(LocaleKeys.pleaseAcceptTerms.tr());
//("Please accept terms");
isValid = false;
} else if (city == null) {
Utils.showToast(LocaleKeys.cityNameMandatory.tr());
isValid = false;
} else if (gender == null) {
Utils.showToast(LocaleKeys.genderMandatory.tr());
isValid = false;
}
return isValid;
}
@ -538,8 +582,8 @@ class UserVM extends BaseVM {
type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null
? phoneNum
: phoneNum,
? phoneNum
: phoneNum,
password);
Utils.hideLoading(context);
LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body));
@ -547,8 +591,8 @@ class UserVM extends BaseVM {
SharedPrefManager.setPhoneOrEmail(type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null
? phoneNum
: phoneNum);
? phoneNum
: phoneNum);
SharedPrefManager.setUserPassword(password);
navigateReplaceWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken);
} else {
@ -560,6 +604,18 @@ class UserVM extends BaseVM {
return await userRepo.getAllCountries();
}
Future<void> getAllCountriesForUser() async {
userCountries = null;
userCities = null;
userCountries = await userRepo.getAllCountries();
notifyListeners();
}
Future<void> getAllCitiesForUser(int countryId) async {
userCities = await userRepo.getAllCites(countryId.toString());
notifyListeners();
}
Future<void> performBasicOtpRegisterPage(BuildContext context,
{required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async {
Utils.showLoading(context);
@ -627,9 +683,9 @@ class UserVM extends BaseVM {
Future<void> updateUserImage(BuildContext context) async {
File? myPick = await commanServices.pickFile(context, fileType: FileType.image);
if (myPick != null) {
userRepo.updateUserImage(encodeBase64Image(myPick)).whenComplete(() {
AppState().getUser.data!.userInfo!.userLocalImage = myPick;
});
await userRepo.updateUserImage(encodeBase64Image(myPick));
AppState().getUser.data!.userInfo!.userLocalImage = myPick;
notifyListeners();
}
notifyListeners();
}
@ -662,8 +718,13 @@ class UserVM extends BaseVM {
}
void changeLanguage(BuildContext context) {
print("${EasyLocalization.of(context)?.currentLocale}");
if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA") {
print("${EasyLocalization
.of(context)
?.currentLocale}");
if (EasyLocalization
.of(context)
?.currentLocale
?.countryCode == "SA") {
context.setLocale(const Locale("en", "US"));
} else {
context.setLocale(const Locale('ar', 'SA'));
@ -688,8 +749,13 @@ class UserVM extends BaseVM {
AppState().setUser = null;
if (AppState().currentAppType == AppType.provider) {
AppState().setproviderSubscription = null;
context.read<SubscriptionsVM>().mySubscriptionsBySp.clear();
context.read<SubscriptionsVM>().allSubscriptions = SubscriptionModel();
context
.read<SubscriptionsVM>()
.mySubscriptionsBySp
.clear();
context
.read<SubscriptionsVM>()
.allSubscriptions = SubscriptionModel();
}
navigateReplaceWithNameUntilRoute(context, AppRoutes.registerSelection);

@ -54,8 +54,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (mySubscription!.id == 1) {
freeTrialName = mySubscription!.name ?? "";
} else {
startDate = (mySubscription!.dateStart != null && mySubscription!.dateStart!.isNotEmpty) ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateStart!))) : "";
endDate = (mySubscription!.dateEnd != null && mySubscription!.dateEnd!.isNotEmpty) ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateEnd!))) : "";
startDate = (mySubscription!.dateStart != null && mySubscription!.dateStart!.isNotEmpty)
? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateStart!)))
: "";
endDate = (mySubscription!.dateEnd != null && mySubscription!.dateEnd!.isNotEmpty)
? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateEnd!)))
: "";
}
}
return Stack(
@ -101,24 +105,39 @@ class _ProfileScreenState extends State<ProfileScreen> {
child: ListView(
children: [
60.height,
"${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
"${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25, right: 10),
MyAssets.icEdit.buildSvg(width: 15).onPress(
() async {
Navigator.pushNamed(context, AppRoutes.updateUserDetails);
},
),
],
).margin(left: 0, top: 0, right: 24, bottom: 0),
Column(
children: [
if (AppState().currentAppType == AppType.provider && mySubscription != null) ...[
CustomProfileOptionsTile(
titleText: LocaleKeys.mySubscription.tr(),
subtitleText: freeTrialName.isNotEmpty ? freeTrialName : "${startDate.isNotEmpty ? "${LocaleKeys.startDate.tr()}: $startDate" : ""} ${endDate.isNotEmpty ? "${LocaleKeys.expiresOn.tr()}: $endDate" : ""}",
subtitleText: freeTrialName.isNotEmpty
? freeTrialName
: "${startDate.isNotEmpty ? "${LocaleKeys.startDate.tr()}: $startDate" : ""} ${endDate.isNotEmpty ? "${LocaleKeys.expiresOn.tr()}: $endDate" : ""}",
needBorderBelow: true,
needEditButton: false,
onTap: () {},
),
],
CustomProfileOptionsTile(
titleText: LocaleKeys.country.tr(),
subtitleText: "Saudi Arabia",
titleText: LocaleKeys.city.tr(),
subtitleText: "${AppState().getUser.data!.userInfo!.cityName ?? ""}, ${AppState().getUser.data!.userInfo!.countryName ?? ""}",
needBorderBelow: true,
needEditButton: false,
onTap: () {},
needEditButton: true,
onTap: () {
Navigator.pushNamed(context, AppRoutes.updateUserCity);
},
),
CustomProfileOptionsTile(
titleText: LocaleKeys.email.tr(),
@ -194,10 +213,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
width: 40,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(color: MyColors.white, shape: BoxShape.circle, border: Border.all(color: MyColors.darkTextColor, width: 0.1)),
child: MyAssets.icEdit.buildSvg(),
child: Center(
child: MyAssets.icEdit.buildSvg(),
),
).onPress(
() async {
await model.updateUserImage(context).whenComplete(() => setState(() {}));
await model.updateUserImage(context);
},
),
),

@ -19,6 +19,7 @@ import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_creation_
import 'package:mc_common_app/views/advertisement/components/picked_images_container_widget.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/common_widgets/search_entity_widget.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
@ -35,6 +36,7 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
late ServiceVM branchVM;
bool showAttachment = false;
String? attachedFile;
String? formattedDate;
@override
void initState() {
@ -50,7 +52,7 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
if (model.document != null && model.document!.data != null && model.document!.data!.isNotEmpty) {
for (var doc in model.document!.data!) {
log("doc: ${doc.status}");
if (doc.status == 4 || doc.status == 0) {
if (doc.status == DocumentStatusEnum.rejected || doc.status == DocumentStatusEnum.needUpload || doc.isAllowUpdate!) {
isShow = true;
}
}
@ -162,6 +164,7 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
padding: const EdgeInsets.symmetric(horizontal: 20),
itemBuilder: (context, index) {
DocumentData? document = serviceVM.document?.data![index];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -172,40 +175,58 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
(document!.documentName!).toText(fontSize: 16, letterSpacing: -0.56, fontWeight: MyFonts.SemiBold),
if (document.statusText != null && document.statusText!.isNotEmpty) ...[
10.width,
Utils.statusContainerChip(text: document.statusText!.replaceFirst('OrActive', ''), chipColor: getColorByStatus(document.status ?? 1)),
Utils.statusContainerChip(text: document.statusText!.replaceFirst('OrActive', ''), chipColor: getColorByStatus(document.status!)),
],
],
),
// if (document.status != 1 && document.status != 3) ...[
// Padding(
// padding: const EdgeInsets.only(top: 4, bottom: 8),
// child: LocaleKeys.enter_licence_detail.tr().toText(fontSize: 14, color: MyColors.lightTextColor),
// ),
// TxtField(
// hint: LocaleKeys.description.tr(),
// maxLines: 3,
// isBackgroundEnabled: true,
// ),
// ],
10.height,
if (isNeedToShow(model: serviceVM, document: document)) ...[
PickedFilesContainer(
isReview: document.status != 0 && (document.status == 1 || document.status == 3),
allowAdButton: false,
pickedFiles: isLocalOrNetworkFiles(model: serviceVM, document: document),
onCrossPressedPrimary: isNetworkImage(document: document)
? serviceVM.removeNetworkImage
: document.documentId == 1
? serviceVM.commerceRemove
: document.documentId == 2
? serviceVM.commercialRemove
: serviceVM.vatRemove,
if (document.documentUrl != null) ...[
BuildFilesContainer(
image: ImageModel(id: index, filePath: document.documentUrl!, isFromNetwork: document.isLocalFile! ? false : true),
onCrossPressedPrimary: (String val) {
document.documentUrl = null;
document.isLocalFile = false;
setState(() {});
},
index: index,
isReview: isReview(document),
isPdf: true,
isFromNetwork: !(document.isLocalFile ?? false),
onAddFilePressed: () {
serviceVM.pickPdfReceiptFile(context, document.documentId!, index);
),
5.height,
("${document.documentName} Expiry").toText(fontSize: 14, letterSpacing: -0.56, fontWeight: MyFonts.Medium),
5.height,
TxtField(
isBackgroundEnabled: (document.status == DocumentStatusEnum.pending || document.status == DocumentStatusEnum.approvedOrActive && !document.isAllowUpdate!),
isNeedBorder: document.isAllowUpdate! ? true : false,
isSidePaddingZero: true,
hint: LocaleKeys.expiryDate.tr(),
value: document.dateExpire != null && document.status == DocumentStatusEnum.pending || document.status == DocumentStatusEnum.approvedOrActive ? "${DateFormat('yyyy-MM-dd').format(
DateTime.parse(document.dateExpire!))}" : formattedDate == null
? ""
: "${DateFormat('yyyy-MM-dd').format(DateTime.parse(document.dateExpire!))}",
isNeedClickAll: true,
postFixDataColor: MyColors.darkTextColor,
onTap: () async {
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.approvedOrActive || document.status == DocumentStatusEnum.needUpload ||
document.status == DocumentStatusEnum.rejected) {
formattedDate =
await Utils.pickDateFromDatePicker(context, lastDate: DateTime(DateTime
.now()
.year + 3, DateTime
.now()
.month + 1, DateTime
.now()
.day), firstDate: DateTime.now());
if (formattedDate!.isNotEmpty) {
document.dateExpire = formattedDate;
setState(() {});
}
}
// requestsVM.updateRequestedDate(formattedDate);
},
),
10.height,
buildCommentContainer(document: document),
] else
...[
@ -215,107 +236,133 @@ class _ProviderLicensePageState extends State<ProviderLicensePage> {
text: LocaleKeys.attachPDF.tr(),
icon: MyAssets.attachmentIcon.buildSvg(),
),
],
]
],
);
},
);
}
List<ImageModel> isLocalOrNetworkFiles({required ServiceVM model, required DocumentData document}) {
bool isNetworkImage = false;
if (!document.isLocalFile!) {
isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
bool isReview(DocumentData document) {
print(document.toJson());
bool val = false;
if (document.isAllowUpdate == null) {
val = false;
}
if (isNetworkImage) {
return [ImageModel(id: document.id, isFromNetwork: isNetworkImage, filePath: document.documentUrl)];
} else if (document.documentId == 1) {
return model.commerceCertificates;
} else if (document.documentId == 2) {
return model.commercialCertificates;
} else {
return model.vatCertificates;
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.approvedOrActive) {
val = false;
}
}
bool isNeedToShow({required ServiceVM model, required DocumentData document}) {
bool allow = false;
bool isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty && !(document.isLocalFile ?? true);
if (isNetworkImage) {
allow = true;
} else {
if (document.documentId == 1 && model.commerceCertificates.isNotEmpty) {
allow = true;
}
if (document.documentId == 2 && model.commercialCertificates.isNotEmpty) {
allow = true;
}
if (document.documentId == 3 && model.vatCertificates.isNotEmpty) {
allow = true;
}
if (!document.isAllowUpdate! && document.status == DocumentStatusEnum.approvedOrActive) {
val = true;
}
return allow;
}
dynamic checkOnCrossPress({required ServiceVM model, required DocumentData document}) async {
bool isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
if (isNetworkImage) {
return document.documentUrl;
} else {
if (document.documentId == 1) {
model.commerceRemove;
}
if (document.documentId == 2) {
model.commercialRemove;
}
if (document.documentId == 3) {
model.vatRemove;
}
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.pending) {
val = true;
}
}
bool isNetworkImage({required DocumentData document}) {
bool isNetworkImage = false;
if (!document.isLocalFile!) {
isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.rejected) {
val = false;
}
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.needUpload) {
val = true;
}
return isNetworkImage;
if (document.isAllowUpdate! && document.status == DocumentStatusEnum.review) {
val = true;
}
return val;
}
Widget buildCommentContainer({required DocumentData document}) {
String comment = "";
if (document.status == 4 && document.comment != null) {
comment = document.comment ?? "";
}
// List<ImageModel> isLocalOrNetworkFiles({required ServiceVM model, required DocumentData document}) {
// bool isNetworkImage = false;
// print(document);
// if (!document.isLocalFile!) {
// isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
// }
// if (isNetworkImage) {
// return [ImageModel(id: document.id, isFromNetwork: isNetworkImage, filePath: document.documentUrl)];
// } else {
// return [ImageModel(id: document.id, isFromNetwork: false, filePath: document.documentUrl)];
// ;
// }
// }
if (comment.isEmpty) {
return const SizedBox();
}
return Center(child: comment.toString().toText(color: MyColors.adCancelledStatusColor, fontSize: 14)).toContainer(
borderRadius: 8,
margin: const EdgeInsets.only(top: 10),
width: double.infinity,
backgroundColor: MyColors.adCancelledStatusColor.withOpacity(0.16),
);
// bool isNeedToShow({required ServiceVM model, required DocumentData document}) {
// bool allow = false;
// bool isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty && !(document.isLocalFile ?? true);
// if (isNetworkImage) {
// allow = true;
// } else {
// if (document.documentId == 1 && document.documentUrl!.isNotEmpty) {
// allow = true;
// }
// if (document.documentId == 2 && document.documentUrl!.isNotEmpty) {
// allow = true;
// }
// if (document.documentId == 3 && document.documentUrl!.isNotEmpty) {
// allow = true;
// }
// }
// return allow;
// }
//
// dynamic checkOnCrossPress({required ServiceVM model, required DocumentData document}) async {
// bool isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
// if (isNetworkImage) {
// print(document.documentUrl);
// return document.documentUrl;
// }
//} else {
// if (document.documentId == 1) {
// model.commerceRemove;
// }
// if (document.documentId == 2) {
// model.commercialRemove;
// }
// if (document.documentId == 3) {
// model.vatRemove;
// }
// }
}
bool isNetworkImage({required DocumentData document}) {
bool isNetworkImage = false;
if (!document.isLocalFile!) {
isNetworkImage = document.documentUrl != null && document.documentUrl!.isNotEmpty ? true : false;
}
return isNetworkImage;
}
Widget buildCommentContainer({required DocumentData document}) {
String comment = "";
if (document.status == 4 && document.comment != null) {
comment = document.comment ?? "";
}
Color getColorByStatus(int docStatus) {
switch (docStatus) {
case 1:
return MyColors.adPendingStatusColor;
if (comment.isEmpty) {
return const SizedBox();
}
return Center(child: comment.toString().toText(color: MyColors.adCancelledStatusColor, fontSize: 14)).toContainer(
borderRadius: 8,
margin: const EdgeInsets.only(top: 10),
width: double.infinity,
backgroundColor: MyColors.adCancelledStatusColor.withOpacity(0.16),
);
}
case 2:
return MyColors.adActiveStatusColor;
Color getColorByStatus(DocumentStatusEnum docStatus) {
switch (docStatus) {
case DocumentStatusEnum.pending:
return MyColors.adPendingStatusColor;
case 3:
return MyColors.greenColor;
case DocumentStatusEnum.approvedOrActive:
return MyColors.adActiveStatusColor;
case 4:
return MyColors.adCancelledStatusColor;
case DocumentStatusEnum.rejected:
return MyColors.adCancelledStatusColor;
default:
return MyColors.adPendingStatusColor;
}
case DocumentStatusEnum.needUpload:
return MyColors.adPendingStatusColor;
default:
return MyColors.adPendingStatusColor;
}
}

@ -41,12 +41,12 @@ class _ChangeEmailPageState extends State<ChangeEmailPage> {
padding: const EdgeInsets.all(20),
child: Column(
children: [
LocaleKeys.enterEmail.tr().toText(
height: 23 / 24,
fontSize: 24,
letterSpacing: -1.44,
),
12.height,
// LocaleKeys.enterEmail.tr().toText(
// height: 23 / 24,
// fontSize: 24,
// letterSpacing: -1.44,
// ),
// 12.height,
TxtField(
hint: LocaleKeys.enterNewEmail.tr(),
onChanged: (v) => email = v,

@ -39,12 +39,12 @@ class _ChangeMobilePageState extends State<ChangeMobilePage> {
padding: const EdgeInsets.all(20),
child: Column(
children: [
LocaleKeys.enterNewPhoneNumber.tr().toText(
height: 23 / 24,
fontSize: 24,
letterSpacing: -1.44,
),
12.height,
// LocaleKeys.enterNewPhoneNumber.tr().toText(
// height: 23 / 24,
// fontSize: 24,
// letterSpacing: -1.44,
// ),
// 12.height,
TxtField(
hint: LocaleKeys.enterNewPhoneNumber.tr(),
onChanged: (v) => mobileNo = v,

@ -39,12 +39,12 @@ class _ChangePasswordPageState extends State<ChangePasswordPage> {
padding: const EdgeInsets.all(20),
child: Column(
children: [
LocaleKeys.enterNewPassword.tr().toText(
height: 23 / 24,
fontSize: 24,
letterSpacing: -1.44,
),
12.height,
// LocaleKeys.enterNewPassword.tr().toText(
// height: 23 / 24,
// fontSize: 24,
// letterSpacing: -1.44,
// ),
// 12.height,
TxtField(
hint: LocaleKeys.enterOldPassword.tr(),
onChanged: (v) => currentPassword = v,

@ -1,3 +1,4 @@
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/classes/consts.dart';
import 'package:mc_common_app/config/routes.dart';
import 'package:mc_common_app/theme/colors.dart';
@ -9,6 +10,7 @@ import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:easy_localization/easy_localization.dart';
@ -25,182 +27,246 @@ class CompleteProfilePage extends StatefulWidget {
}
class _CompleteProfilePageState extends State<CompleteProfilePage> {
String? firstName = "", lastName = "", email = "", confirmPassword = "";
String? firstName = "",
lastName = "",
email = "",
confirmPassword = "";
late String password = "";
bool isChecked = false;
late UserVM userVM;
DropValue? city;
DropValue? gender;
@override
void initState() {
userVM = Provider.of<UserVM>(context, listen: false);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
isRemoveBackButton: widget.user.data!.roleId == 7 ? false : true,
title: widget.user.data!.roleId == 7 ? "" : LocaleKeys.signUp.tr(),
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
6.height,
LocaleKeys.completeProfile.tr().toText(
return Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
print("Country ID = " + AppState().getUserRegisterCountrySelection.id.toString());
userVM.getAllCitiesForUser(AppState().getUserRegisterCountrySelection.id);
return Scaffold(
appBar: CustomAppBar(
isRemoveBackButton: widget.user.data!.roleId == 7 ? false : true,
title: widget.user.data!.roleId == 7 ? "" : LocaleKeys.signUp.tr(),
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
children: [
6.height,
LocaleKeys.completeProfile.tr().toText(
height: 23 / 24,
fontSize: 24,
letterSpacing: -1.44,
),
12.height,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: LocaleKeys.profileMsg.tr().toText(
12.height,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: LocaleKeys.profileMsg.tr().toText(
color: MyColors.lightTextColor,
textAlign: TextAlign.center,
fontSize: 14,
height: 23 / 24,
letterSpacing: -0.48,
),
),
12.height,
TxtField(
hint: LocaleKeys.firstName.tr(),
value: firstName,
onChanged: (v) {
firstName = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.surname.tr(),
value: lastName,
onChanged: (v) {
lastName = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.email.tr(),
value: email,
// isButtonEnable: email!.length > 0 ? true : false,
buttonTitle: LocaleKeys.verify.tr(),
onChanged: (v) {
email = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.createPass.tr(),
isPasswordEnabled: true,
maxLines: 1,
value: password,
onChanged: (v) {
password = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.confirmPass.tr(),
isPasswordEnabled: true,
maxLines: 1,
value: confirmPassword,
onChanged: (v) {
confirmPassword = v;
},
),
50.height,
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
return Checkbox(
value: userVM.completeProfilePageCheckbox,
activeColor: MyColors.darkPrimaryColor,
onChanged: (value) {
userVM.updateCompleteProfilePageCheckbox(value!);
},
);
}),
Expanded(
child: Text.rich(
TextSpan(
children: [
),
12.height,
TxtField(
hint: LocaleKeys.firstName.tr(),
value: firstName,
onChanged: (v) {
firstName = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.surname.tr(),
value: lastName,
onChanged: (v) {
lastName = v;
},
),
12.height,
Container(
padding: const EdgeInsets.only(right: 0, left: 0, top: 0, bottom: 0),
child: Builder(builder: (context) {
List<DropValue> userGender = [];
userGender.add(DropValue(1.toInt(), "${LocaleKeys.userMale.tr()}", "", isEnabled: true));
userGender.add(DropValue(2.toInt(), "${LocaleKeys.userFemale.tr()}", "", isEnabled: true));
// for (var element in userVM.userCities!.data!) {
// if (AppState().getUser.data != null) {
// if (AppState().getUser.data!.userInfo!.cityId == element.id) {
// city = DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", "");
// }
// }
//
// }
return DropdownField(
(DropValue value) {
gender = value;
setState(() {});
},
list: userGender,
dropdownValue: gender != null && gender != -1 ? DropValue(gender!.id, gender!.value, "") : null,
hint: gender != null && gender != -1 ? gender!.value : "${LocaleKeys.userGender.tr()} *",
// errorValue: adVM.vehicleCountryId.errorValue,
);
})),
12.height,
TxtField(
hint: LocaleKeys.email.tr(),
value: email,
// isButtonEnable: email!.length > 0 ? true : false,
buttonTitle: LocaleKeys.verify.tr(),
onChanged: (v) {
email = v;
},
),
12.height,
userVM.userCities != null
? Container(
padding: const EdgeInsets.only(right: 0, left: 0, top: 0, bottom: 0),
child: Builder(builder: (context) {
List<DropValue> userCityDrop = [];
for (var element in userVM.userCities!.data!) {
if (AppState().getUser.data != null) {
if (AppState().getUser.data!.userInfo!.cityId == element.id) {
city = DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", "");
}
}
userCityDrop.add(DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", ""));
}
return DropdownField(
(DropValue value) {
city = value;
setState(() {});
},
list: userCityDrop,
dropdownValue: city != null && city != -1 ? DropValue(city!.id, city!.value, "") : null,
hint: city != null && city != -1 ? city!.value : "${LocaleKeys.city.tr()} *",
// errorValue: adVM.vehicleCountryId.errorValue,
);
}))
: SizedBox(),
12.height,
TxtField(
hint: LocaleKeys.createPass.tr(),
isPasswordEnabled: true,
maxLines: 1,
value: password,
onChanged: (v) {
password = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.confirmPass.tr(),
isPasswordEnabled: true,
maxLines: 1,
value: confirmPassword,
onChanged: (v) {
confirmPassword = v;
},
),
50.height,
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
return Checkbox(
value: userVM.completeProfilePageCheckbox,
activeColor: MyColors.darkPrimaryColor,
onChanged: (value) {
userVM.updateCompleteProfilePageCheckbox(value!);
},
);
}),
Expanded(
child: Text.rich(
TextSpan(
text: LocaleKeys.termsOfService.tr(),
style: const TextStyle(fontSize: 12, fontWeight: MyFonts.Medium),
children: [
TextSpan(
text: LocaleKeys.termsOfService.tr(),
style: const TextStyle(fontSize: 12, fontWeight: MyFonts.Medium),
),
TextSpan(
text: " ${LocaleKeys.terms.tr()}",
style: const TextStyle(
decoration: TextDecoration.underline,
fontSize: 12,
color: MyColors.darkPrimaryColor,
fontWeight: MyFonts.Bold,
))
],
),
TextSpan(
text: " ${LocaleKeys.terms.tr()}",
style: const TextStyle(
decoration: TextDecoration.underline,
fontSize: 12,
color: MyColors.darkPrimaryColor,
fontWeight: MyFonts.Bold,
))
],
),
).onPress(() {
navigateWithName(context, AppRoutes.settingOptionsTermsAndConditions);
}),
)
// Column(
// children: [
// LocaleKeys.termsOfService.tr().toText(fontSize: 12),
// LocaleKeys.terms.tr().toText(fontSize: 12, color: MyColors.darkPrimaryColor),
// ],
// ),
// Theme(
// data: ThemeData(unselectedWidgetColor: Colors.transparent),
// child: Checkbox(
// value: false,
// onChanged: (_) {},
// ),
// )
).onPress(() {
navigateWithName(context, AppRoutes.settingOptionsTermsAndConditions);
}),
)
// Column(
// children: [
// LocaleKeys.termsOfService.tr().toText(fontSize: 12),
// LocaleKeys.terms.tr().toText(fontSize: 12, color: MyColors.darkPrimaryColor),
// ],
// ),
// Theme(
// data: ThemeData(unselectedWidgetColor: Colors.transparent),
// child: Checkbox(
// value: false,
// onChanged: (_) {},
// ),
// )
],
),
16.height,
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
return ShowFillButton(
title: LocaleKeys.save.tr(),
maxWidth: double.infinity,
isDisabled: !userVM.completeProfilePageCheckbox,
onPressed: () {
if (!userVM.completeProfilePageCheckbox) {
return;
}
bool validateStatus = userVM.dataValidation(password: password,
firstName: firstName,
lastName: lastName,
email: email,
city: city,
gender: gender);
if (validateStatus) {
userVM.performCompleteProfile(
context,
password: password,
confirmPassword: confirmPassword!,
firstName: firstName!,
lastName: lastName!,
email: email!,
userId: widget.user.data!.userId ?? "",
isNeedToPassToken: widget.user.data!.isNeedToPassToken,
cityID: city!.id.toString(),
genderID: gender!.id.toString(),
);
}
});
}),
16.height,
],
),
16.height,
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
return ShowFillButton(
title: LocaleKeys.save.tr(),
maxWidth: double.infinity,
isDisabled: !userVM.completeProfilePageCheckbox,
onPressed: () {
if (!userVM.completeProfilePageCheckbox) {
return;
}
bool validateStatus = userVM.dataValidation(
password: password,
firstName: firstName,
lastName: lastName,
email: email,
);
if (validateStatus) {
userVM.performCompleteProfile(
context,
password: password,
confirmPassword: confirmPassword!,
firstName: firstName!,
lastName: lastName!,
email: email!,
userId: widget.user.data!.userId ?? "",
isNeedToPassToken: widget.user.data!.isNeedToPassToken,
);
}
});
}),
16.height,
],
),
),
),
),
),
);
}
);
}
}

@ -1,3 +1,4 @@
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
@ -79,7 +80,7 @@ class _RegisterPageState extends State<RegisterCustomerPage> {
dropdownValue: selectedDrop,
(DropValue value) {
selectedDrop = value;
AppState().setUserRegisterCountrySelection = value;
setState(() {
countryCode = value.subValue;
countryId = value.id;

@ -1,5 +1,6 @@
import 'dart:developer';
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/config/dependency_injection.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
@ -118,8 +119,12 @@ class _RegisterPageState extends State<RegisterProviderPage> {
if (snapshot.hasData) {
List<DropValue> dropList = [];
snapshot.data?.data?.forEach((element) {
dropList.add(DropValue(element.id ?? 0,
EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" ? "${element.countryNameN ?? ""} ${element.countryCode ?? ""}" : "${element.countryName ?? ""} ${element.countryCode ?? ""}", element.countryCode ?? ""));
dropList.add(DropValue(
element.id ?? 0,
EasyLocalization.of(context)?.currentLocale?.countryCode == "SA"
? "${element.countryNameN ?? ""} ${element.countryCode ?? ""}"
: "${element.countryName ?? ""} ${element.countryCode ?? ""}",
element.countryCode ?? ""));
});
return Column(
children: [
@ -132,6 +137,7 @@ class _RegisterPageState extends State<RegisterProviderPage> {
DropdownField(
(DropValue value) {
selectedDrop = value;
AppState().setUserRegisterCountrySelection = value;
setState(() {
countryCode = value.subValue;
countryId = value.id;

@ -0,0 +1,123 @@
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/general_models/widgets_models.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/ad_view_model.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class UpdateUserCityCountry extends StatefulWidget {
const UpdateUserCityCountry({Key? key}) : super(key: key);
@override
State<UpdateUserCityCountry> createState() => _UpdateUserCityCountryState();
}
class _UpdateUserCityCountryState extends State<UpdateUserCityCountry> {
DropValue? city;
DropValue? country;
@override
void initState() {
print(AppState().getUser!.data!.userInfo!.toJson());
context.read<UserVM>().getAllCountriesForUser();
super.initState();
}
@override
void dispose() {
city = null;
country = null;
print(" Dispose Called");
super.dispose();
}
@override
Widget build(BuildContext context) {
return Consumer(builder: (BuildContext context, UserVM uVM, Widget? child) {
return Scaffold(
appBar: CustomAppBar(
title: LocaleKeys.updateCity.tr(),
),
body: Column(
children: [
uVM.userCountries != null
? Container(
padding: const EdgeInsets.only(right: 20, left: 20, top: 12),
child: Builder(builder: (context) {
List<DropValue> userCountryDrop = [];
for (var element in uVM.userCountries!.data!) {
var countryid = country == null ? AppState().getUser.data!.userInfo!.countryId : country!.id;
print("Country ID" + countryid.toString());
if (countryid == element.id) {
print("Country Matched");
country = DropValue(element.id?.toInt() ?? 0, element.countryName ?? "", "");
}
userCountryDrop.add(DropValue(element.id?.toInt() ?? 0, element.countryName ?? "", ""));
}
return DropdownField(
(DropValue value) async {
country = value;
city = null;
await uVM.getAllCitiesForUser(country!.id);
setState(() {});
},
list: userCountryDrop,
dropdownValue: country != null && country != -1 ? DropValue(country!.id, country!.value, "") : null,
hint: country != null && country != -1 ? country!.value : "${LocaleKeys.country.tr()} *",
// errorValue: adVM.vehicleCountryId.errorValue,
);
}))
: SizedBox(),
uVM.userCities != null && uVM.userCities!.data!.isNotEmpty
? Container(
padding: const EdgeInsets.only(right: 20, left: 20, top: 12),
child: Builder(builder: (context) {
List<DropValue> userCityDrop = [];
for (var element in uVM.userCities!.data!) {
var cid = city == null ? AppState().getUser.data!.userInfo!.cityId : city!.id;
print("City ID" + cid.toString());
if (cid == element.id) {
city = DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", "");
}
userCityDrop.add(DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", ""));
}
return DropdownField(
(DropValue value) {
city = value;
setState(() {});
},
list: userCityDrop,
dropdownValue: city != null && city!.id != -1 ? DropValue(city!.id, city!.value, "") : null,
hint: city != null && city != -1 ? city!.value : "${LocaleKeys.city.tr()} *",
// errorValue: uVM.userCities!.data!.isEmpty ? "No Cities Found" : "",
);
}))
: SizedBox(),
20.height,
Padding(
padding: const EdgeInsets.all(20.0),
child: ShowFillButton(
title: LocaleKeys.confirm.tr(),
maxWidth: double.infinity,
onPressed: () async {
await uVM.userDetailsUpdate(
context, AppState().getUser.data!.userInfo!.firstName!, AppState().getUser.data!.userInfo!.lastName!, city != null ? city?.id.toString() : null, city!.value, country!.value);
},
),
),
],
),
);
});
}
}

@ -0,0 +1,68 @@
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/txt_field.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class UpdateUserDetails extends StatefulWidget {
const UpdateUserDetails({Key? key}) : super(key: key);
@override
State<UpdateUserDetails> createState() => _UpdateUserDetailsState();
}
class _UpdateUserDetailsState extends State<UpdateUserDetails> {
String firstname = "";
String lastname = "";
late UserVM userVM;
@override
void initState() {
userVM = Provider.of<UserVM>(context, listen: false);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: LocaleKeys.updateUserDetails.tr(),
),
body: SingleChildScrollView(
child: Container(
// width: double.infinity,
// height: double.infinity,
padding: const EdgeInsets.all(20),
child: Column(
children: [
TxtField(
hint: LocaleKeys.enterNewFirstName.tr(),
onChanged: (v) => firstname = v,
),
12.height,
TxtField(
hint: LocaleKeys.enterNewLastName.tr(),
onChanged: (v) => lastname = v,
),
40.height,
ShowFillButton(
title: LocaleKeys.confirm.tr(),
maxWidth: double.infinity,
onPressed: () async {
await userVM.userDetailsUpdate(context, firstname, lastname, AppState().getUser.data!.userInfo!.cityId!.toString(), null, null);
},
),
],
),
),
),
);
}
}
Loading…
Cancel
Save