aamir_dev
Aamir 11 months ago
parent c8e1f6d756
commit 671b9d9e6f

@ -708,7 +708,7 @@
"updateUserDetails": "تحديث تفاصيل المستخدم", "updateUserDetails": "تحديث تفاصيل المستخدم",
"enterNewFirstName": "أدخل الاسم الأول", "enterNewFirstName": "أدخل الاسم الأول",
"enterNewLastName": "أدخل الاسم الأخير", "enterNewLastName": "أدخل الاسم الأخير",
"userDetailsUpdated": "يتم تحديث تفاصيل المستخدم" "userDetailsUpdated": "يتم تحديث تفاصيل المستخدم",
"itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.", "itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.",
"reactivateAd": "إعادة تنشيط الإعلان", "reactivateAd": "إعادة تنشيط الإعلان",
"dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.", "dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.",

@ -738,8 +738,7 @@
"blockedByAdmin": "Blocked by admin", "blockedByAdmin": "Blocked by admin",
"active": "Active", "active": "Active",
"paymentType": "Payment Type", "paymentType": "Payment Type",
"searchByCreatedDate": "Search By Created Date" "searchByCreatedDate": "Search By Created Date",
"itemNoLongerAvailable": "This item is no longer available.",
"updateUserDetails": "Update User Details", "updateUserDetails": "Update User Details",
"enterNewFirstName": "Enter First Name", "enterNewFirstName": "Enter First Name",
"enterNewLastName": "Enter Last Name", "enterNewLastName": "Enter Last Name",

@ -39,6 +39,7 @@ class ApiConsts {
static String logoutUser = "${baseUrlServices}api/Account/Logout"; static String logoutUser = "${baseUrlServices}api/Account/Logout";
static String updateUserImage = "${baseUrlServices}api/User_UpdateProfileImage"; static String updateUserImage = "${baseUrlServices}api/User_UpdateProfileImage";
static String getUserImage = "${baseUrlServices}api/ProfileImage"; static String getUserImage = "${baseUrlServices}api/ProfileImage";
static String userUpdate = "${baseUrlServices}api/User_Update";
static String providerComplaintCreate = "${baseUrlServices}api/ServiceProviders/ProviderComplaint_Create"; static String providerComplaintCreate = "${baseUrlServices}api/ServiceProviders/ProviderComplaint_Create";
//Profile //Profile

@ -44,6 +44,7 @@ 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_provider_page.dart';
import 'package:mc_common_app/views/user/register_selection_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/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/update_user_details.dart';
import 'package:mc_common_app/views/user/vertify_password_page.dart'; import 'package:mc_common_app/views/user/vertify_password_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -170,6 +171,7 @@ class AppRoutes {
//Chat //Chat
static const String chatView = "/chatView"; static const String chatView = "/chatView";
static const String updateUserDetails = "/updateUserDetails"; static const String updateUserDetails = "/updateUserDetails";
static const String updateUserCity = "/updateUserCity";
static const String initialRoute = splash; static const String initialRoute = splash;
static final Map<String, WidgetBuilder> routes = { static final Map<String, WidgetBuilder> routes = {
@ -190,6 +192,7 @@ class AppRoutes {
changeMobilePage: (context) => ChangeMobilePage(), changeMobilePage: (context) => ChangeMobilePage(),
changeEmailPage: (context) => const ChangeEmailPage(), changeEmailPage: (context) => const ChangeEmailPage(),
updateUserDetails: (context) => const UpdateUserDetails(), updateUserDetails: (context) => const UpdateUserDetails(),
updateUserCity: (context) => const UpdateUserCityCountry(),
changePassword: (context) => const ChangePasswordPage(), changePassword: (context) => const ChangePasswordPage(),
editAccountPage: (context) => const EditAccountPage(), editAccountPage: (context) => const EditAccountPage(),
profileView: (context) => const ProfileScreen(), profileView: (context) => const ProfileScreen(),

@ -721,11 +721,11 @@ class CodegenLoader extends AssetLoader{
"customerLocation": "موقع العميل", "customerLocation": "موقع العميل",
"deliveryAvailable": "التوصيل متاح", "deliveryAvailable": "التوصيل متاح",
"viewed": "تم المشاهدة", "viewed": "تم المشاهدة",
"itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.",
"updateUserDetails": "تحديث تفاصيل المستخدم", "updateUserDetails": "تحديث تفاصيل المستخدم",
"enterNewFirstName": "أدخل الاسم الأول", "enterNewFirstName": "أدخل الاسم الأول",
"enterNewLastName": "أدخل الاسم الأخير", "enterNewLastName": "أدخل الاسم الأخير",
"userDetailsUpdated": "يتم تحديث تفاصيل المستخدم", "userDetailsUpdated": "يتم تحديث تفاصيل المستخدم",
"itemNoLongerAvailable": "لم يعد هذا العنصر متاحًا.",
"reactivateAd": "إعادة تنشيط الإعلان", "reactivateAd": "إعادة تنشيط الإعلان",
"dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.", "dealOutsideApp": "تمت الصفقة خارج التطبيق مع عميل آخر.",
"noAgreementCustomer": "لا يوجد اتفاق من جانب العميل.", "noAgreementCustomer": "لا يوجد اتفاق من جانب العميل.",
@ -1390,7 +1390,7 @@ static const Map<String,dynamic> en_US = {
"priceRange": "Price Range", "priceRange": "Price Range",
"cancelOffer": "Cancel Offer", "cancelOffer": "Cancel Offer",
"pleaseSpecify": "Please Specify", "pleaseSpecify": "Please Specify",
"customerNotResponding": "Customer Not Responding", "customerNotResponding": "The customer is not responding.",
"cancelRequestPrompt": "Do you want to cancel this request?", "cancelRequestPrompt": "Do you want to cancel this request?",
"requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.", "requestPermanentlyCancelled": "Your request will be permanently cancelled. You cannot undo this action.",
"awaitingResponseFromCustomer": "Awaiting Response From Customer", "awaitingResponseFromCustomer": "Awaiting Response From Customer",
@ -1410,7 +1410,7 @@ static const Map<String,dynamic> en_US = {
"customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.", "customerCarePrompt": "Got any question? We are here to service. Click here to talk to our customer care right now.",
"callNow": "Call Now", "callNow": "Call Now",
"condition": "Condition", "condition": "Condition",
"servicesNotAvailableHomeLocation": "Some services are not available on home location.", "servicesNotAvailableHomeLocation": "This location will be same for all services",
"additionalChargesNotice": "These charges are additional to the actual service charges. For heavy items the charges may vary.", "additionalChargesNotice": "These charges are additional to the actual service charges. For heavy items the charges may vary.",
"selectServiceLocation": "Select Service Location", "selectServiceLocation": "Select Service Location",
"apptOn": "Appt On", "apptOn": "Appt On",
@ -1467,10 +1467,6 @@ static const Map<String,dynamic> en_US = {
"deliveryAvailable": "Delivery Available", "deliveryAvailable": "Delivery Available",
"viewed": "Viewed", "viewed": "Viewed",
"itemNoLongerAvailable": "This item is no longer available.", "itemNoLongerAvailable": "This item is no longer available.",
"updateUserDetails": "Update User Details",
"enterNewFirstName": "Enter First Name",
"enterNewLastName": "Enter Last Name",
"userDetailsUpdated": "User Details is Updated"
"reactivateAd": "Reactivate Ad", "reactivateAd": "Reactivate Ad",
"dealOutsideApp": "The deal was done outside the app with another customer.", "dealOutsideApp": "The deal was done outside the app with another customer.",
"noAgreementCustomer": "There is no agreement from the customer side.", "noAgreementCustomer": "There is no agreement from the customer side.",
@ -1506,7 +1502,11 @@ static const Map<String,dynamic> en_US = {
"blockedByAdmin": "Blocked by admin", "blockedByAdmin": "Blocked by admin",
"active": "Active", "active": "Active",
"paymentType": "Payment Type", "paymentType": "Payment Type",
"searchByCreatedDate": "Search By Created Date" "searchByCreatedDate": "Search By Created Date",
"updateUserDetails": "Update User Details",
"enterNewFirstName": "Enter First Name",
"enterNewLastName": "Enter Last Name",
"userDetailsUpdated": "User Details is Updated"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

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

@ -55,7 +55,7 @@ abstract class UserRepo {
Future<GenericRespModel> changePassword(String currentPassword, String newPassword); Future<GenericRespModel> changePassword(String currentPassword, String newPassword);
Future<Map<String, dynamic>> updateUserInfo(String firstName, String lastName); Future<Map<String, dynamic>> updateUserInfo(String firstName, String lastName, String? city);
Future<ChangeMobileRespModel> changeMobileNoOTPRequest(countryID, String mobileNo, String password); Future<ChangeMobileRespModel> changeMobileNoOTPRequest(countryID, String mobileNo, String password);
@ -166,6 +166,11 @@ class UserRepoImp implements UserRepo {
return await injector.get<ApiClient>().getJsonForObject((json) => Country.fromJson(json), ApiConsts.getAllCountry); 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 @override
Future<Cities> getAllCites(String countryId) async { Future<Cities> getAllCites(String countryId) async {
var postParams = { var postParams = {
@ -257,8 +262,8 @@ class UserRepoImp implements UserRepo {
} }
@override @override
Future<Map<String, dynamic>> updateUserInfo(String firstName, String lastName) async { 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": 1}; var postParams = {"userID": "${AppState().getUser.data!.userInfo!.userId}", "firstName": "${firstName}", "lastName": "${lastName}", "genderID": 1, "cityID": city ?? 1};
String t = AppState().getUser.data!.accessToken ?? ""; String t = AppState().getUser.data!.accessToken ?? "";
return await injector.get<ApiClient>().postJsonForObject((json) => json, ApiConsts.userUpdate, postParams, token: t); return await injector.get<ApiClient>().postJsonForObject((json) => json, ApiConsts.userUpdate, postParams, token: t);
} }

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

@ -18,6 +18,7 @@ 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/basic_otp.dart';
import 'package:mc_common_app/models/user_models/change_email.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/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_email.dart';
import 'package:mc_common_app/models/user_models/confirm_mobile.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/confirm_password.dart';
@ -63,6 +64,9 @@ class UserVM extends BaseVM {
_loginOtherAccount = value; _loginOtherAccount = value;
} }
Country? userCountries;
Cities? userCities;
void updateCompleteProfilePageCheckbox(bool newValue) { void updateCompleteProfilePageCheckbox(bool newValue) {
completeProfilePageCheckbox = newValue; completeProfilePageCheckbox = newValue;
notifyListeners(); notifyListeners();
@ -165,15 +169,17 @@ class UserVM extends BaseVM {
} }
} }
Future<void> userDetailsUpdate(BuildContext context, String firstName, String lastName) async { Future<void> userDetailsUpdate(BuildContext context, String firstName, String lastName, String? city) async {
Utils.showLoading(context); Utils.showLoading(context);
Map<String, dynamic> res = await userRepo.updateUserInfo(firstName, lastName); Map<String, dynamic> res = await userRepo.updateUserInfo(firstName, lastName, city);
Utils.hideLoading(context); Utils.hideLoading(context);
if (res["data"] != null && res["data"].isNotEmpty) { if (res["data"] != null && res["data"].isNotEmpty) {
print(res["data"]);
User localUser = AppState().getUser; User localUser = AppState().getUser;
if (localUser.data != null) { if (localUser.data != null) {
localUser.data!.userInfo!.firstName = res["data"]["firstName"]; localUser.data!.userInfo!.firstName = res["data"]["firstName"];
localUser.data!.userInfo!.lastName = res["data"]["lastName"]; localUser.data!.userInfo!.lastName = res["data"]["lastName"];
// localUser.data!.userInfo!.cityId = res["data"]["cityId"];
AppState().setUser = localUser; AppState().setUser = localUser;
} }
Utils.showToast(LocaleKeys.userDetailsUpdated.tr()); Utils.showToast(LocaleKeys.userDetailsUpdated.tr());
@ -572,6 +578,16 @@ class UserVM extends BaseVM {
return await userRepo.getAllCountries(); return await userRepo.getAllCountries();
} }
Future<void> getAllCountriesForUser() async {
userCountries = await userRepo.getAllCountries();
notifyListeners();
}
Future<void> getAllCitiesForUser(int countryId) async {
userCities = await userRepo.getAllCites(countryId.toString());
notifyListeners();
}
Future<void> performBasicOtpRegisterPage(BuildContext context, Future<void> performBasicOtpRegisterPage(BuildContext context,
{required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async { {required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async {
Utils.showLoading(context); Utils.showLoading(context);

@ -72,21 +72,21 @@ class _ProfileScreenState extends State<ProfileScreen> {
decoration: BoxDecoration( decoration: BoxDecoration(
image: AppState().getUser.data!.userInfo!.userLocalImage != null image: AppState().getUser.data!.userInfo!.userLocalImage != null
? DecorationImage( ? DecorationImage(
image: FileImage(AppState().getUser.data!.userInfo!.userLocalImage!), image: FileImage(AppState().getUser.data!.userInfo!.userLocalImage!),
fit: BoxFit.cover, fit: BoxFit.cover,
) )
: AppState().getUser.data!.userInfo!.userImageUrl != null : AppState().getUser.data!.userInfo!.userImageUrl != null
? DecorationImage( ? DecorationImage(
image: CachedNetworkImageProvider( image: CachedNetworkImageProvider(
AppState().getUser.data!.userInfo!.userImageUrl, AppState().getUser.data!.userInfo!.userImageUrl,
), ),
fit: BoxFit.cover, fit: BoxFit.cover,
) )
: DecorationImage( : DecorationImage(
image: AssetImage( image: AssetImage(
MyAssets.icLogoWhitePng, MyAssets.icLogoWhitePng,
), ),
), ),
), ),
child: BackdropFilter( child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 7.0, sigmaY: 7.0), filter: ImageFilter.blur(sigmaX: 7.0, sigmaY: 7.0),
@ -111,7 +111,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
children: [ children: [
"${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25, right: 10), "${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25, right: 10),
MyAssets.icEdit.buildSvg(width: 15).onPress( MyAssets.icEdit.buildSvg(width: 15).onPress(
() async { () async {
Navigator.pushNamed(context, AppRoutes.updateUserDetails); Navigator.pushNamed(context, AppRoutes.updateUserDetails);
}, },
), ),
@ -131,11 +131,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
), ),
], ],
CustomProfileOptionsTile( CustomProfileOptionsTile(
titleText: LocaleKeys.country.tr(), titleText: LocaleKeys.city.tr(),
subtitleText: "Saudi Arabia", subtitleText: "${AppState().getUser.data!.userInfo!.cityName ?? ""}, ${AppState().getUser.data!.userInfo!.countryName ?? ""}",
needBorderBelow: true, needBorderBelow: true,
needEditButton: false, needEditButton: true,
onTap: () {}, onTap: () {
Navigator.pushNamed(context, AppRoutes.updateUserCity);
},
), ),
CustomProfileOptionsTile( CustomProfileOptionsTile(
titleText: LocaleKeys.email.tr(), titleText: LocaleKeys.email.tr(),
@ -161,11 +163,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
}, },
), ),
], ],
).toContainer(width: double.infinity, ).toContainer(width: double.infinity, isShadowEnabled: true, paddingAll: 10, margin: const EdgeInsets.fromLTRB(24, 20, 24, 0), borderRadius: 0),
isShadowEnabled: true,
paddingAll: 10,
margin: const EdgeInsets.fromLTRB(24, 20, 24, 0),
borderRadius: 0),
], ],
), ),
), ),
@ -173,83 +171,69 @@ class _ProfileScreenState extends State<ProfileScreen> {
], ],
), ),
Positioned( Positioned(
top: MediaQuery top: MediaQuery.of(context).size.height * 0.24,
.of(context)
.size
.height * 0.24,
child: Container( child: Container(
height: 100, height: 100,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ClipOval( child: ClipOval(
child: AppState().getUser.data!.userInfo!.userLocalImage != null child: AppState().getUser.data!.userInfo!.userLocalImage != null
? Image.file( ? Image.file(
AppState().getUser.data!.userInfo!.userLocalImage!, AppState().getUser.data!.userInfo!.userLocalImage!,
width: 100, width: 100,
height: 100, height: 100,
fit: BoxFit.fill, fit: BoxFit.fill,
) )
: CachedNetworkImage( : CachedNetworkImage(
imageUrl: "${AppState().getUser.data!.userInfo!.userImageUrl}", imageUrl: "${AppState().getUser.data!.userInfo!.userImageUrl}",
imageBuilder: (context, imageProvider) => imageBuilder: (context, imageProvider) => Container(
Container( decoration: BoxDecoration(
decoration: BoxDecoration( image: DecorationImage(
image: DecorationImage( image: imageProvider,
image: imageProvider, fit: BoxFit.cover,
fit: BoxFit.cover, ),
), ),
), ),
placeholder: (context, url) => const Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => const Icon(Icons.error),
width: 100,
height: 100,
fit: BoxFit.fill,
fadeInCurve: Curves.easeIn,
fadeInDuration: const Duration(milliseconds: 1000),
useOldImageOnUrlChange: false,
), ),
placeholder: (context, url) => const Center(child: CircularProgressIndicator()),
errorWidget: (context, url, error) => const Icon(Icons.error),
width: 100,
height: 100,
fit: BoxFit.fill,
fadeInCurve: Curves.easeIn,
fadeInDuration: const Duration(milliseconds: 1000),
useOldImageOnUrlChange: false,
),
), ),
).horPaddingMain(), ).horPaddingMain(),
), ),
Positioned( Positioned(
top: MediaQuery top: MediaQuery.of(context).size.height * 0.30,
.of(context) right: MediaQuery.of(context).size.height * 0.03,
.size
.height * 0.30,
right: MediaQuery
.of(context)
.size
.height * 0.03,
child: Container( child: Container(
height: 40, height: 40,
width: 40, width: 40,
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration(color: MyColors.white, shape: BoxShape.circle, border: Border.all(color: MyColors.darkTextColor, width: 0.1)), decoration: BoxDecoration(color: MyColors.white, shape: BoxShape.circle, border: Border.all(color: MyColors.darkTextColor, width: 0.1)),
child: Center(child: MyAssets.icEdit.buildSvg(),), child: Center(
child: MyAssets.icEdit.buildSvg(),
),
).onPress( ).onPress(
() async { () async {
await model.updateUserImage(context); await model.updateUserImage(context);
}, },
), ),
), ),
Positioned( Positioned(
top: MediaQuery top: MediaQuery.of(context).size.height * 0.05,
.of(context) left: MediaQuery.of(context).size.height * 0.03,
.size
.height * 0.05,
left: MediaQuery
.of(context)
.size
.height * 0.03,
child: const Icon(Icons.arrow_back_ios, color: Colors.black, size: 18) child: const Icon(Icons.arrow_back_ios, color: Colors.black, size: 18)
.toContainer( .toContainer(
padding: const EdgeInsets.only(left: 5), padding: const EdgeInsets.only(left: 5),
borderRadius: 100, borderRadius: 100,
borderColor: MyColors.lightGreyEFColor, borderColor: MyColors.lightGreyEFColor,
isEnabledBorder: true, isEnabledBorder: true,
height: 40, height: 40,
width: 40, width: 40,
) )
.onPress(() => pop(context))), .onPress(() => pop(context))),
], ],
); );

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

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

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

@ -0,0 +1,105 @@
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/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() {
context.read<UserVM>().getAllCountriesForUser();
super.initState();
}
@override
Widget build(BuildContext context) {
return Consumer(builder: (BuildContext context, UserVM uVM, Widget? child) {
return Scaffold(
appBar: CustomAppBar(
title: "Update City",
),
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!) {
if (AppState().getUser.data!.userInfo!.countryId == element.id) {
country = DropValue(element.id?.toInt() ?? 0, element.countryName ?? "", "");
}
userCountryDrop.add(DropValue(element.id?.toInt() ?? 0, element.countryName ?? "", ""));
}
return DropdownField(
(DropValue value) async {
country = value;
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 : "Country",
// errorValue: adVM.vehicleCountryId.errorValue,
);
}))
: SizedBox(),
uVM.userCities != null
? 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!) {
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 : "City",
// errorValue: adVM.vehicleCountryId.errorValue,
);
}))
: 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);
},
),
),
],
),
);
});
}
}

@ -55,7 +55,7 @@ class _UpdateUserDetailsState extends State<UpdateUserDetails> {
title: LocaleKeys.confirm.tr(), title: LocaleKeys.confirm.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
onPressed: () async { onPressed: () async {
await userVM.userDetailsUpdate(context, firstname, lastname); await userVM.userDetailsUpdate(context, firstname, lastname, null);
}, },
), ),

@ -22,7 +22,7 @@ dependencies:
sizer: ^3.0.4 sizer: ^3.0.4
fluttertoast: ^8.0.8 fluttertoast: ^8.0.8
shared_preferences: ^2.0.6 shared_preferences: ^2.0.6
file_picker: ^8.1.2 file_picker: ^8.0.7
image_picker: ^1.1.2 image_picker: ^1.1.2
equatable: ^2.0.3 equatable: ^2.0.3
logger: ^2.4.0 logger: ^2.4.0
@ -34,7 +34,7 @@ dependencies:
badges: ^3.0.2 badges: ^3.0.2
carousel_slider: 5.0.0 carousel_slider: 5.0.0
dropdown_button2: ^2.0.0 dropdown_button2: ^2.0.0
flutter_inappwebview: ^6.1.5 flutter_inappwebview: ^6.0.0
country_code_picker: ^3.0.0 country_code_picker: ^3.0.0
table_calendar: ^3.0.9 table_calendar: ^3.0.9
intl: any intl: any
@ -47,8 +47,8 @@ dependencies:
# Firebase Packages # Firebase Packages
firebase_messaging: ^15.1.3 firebase_messaging: ^15.0.4
firebase_core: ^3.6.0 firebase_core: ^3.3.0
flutter_local_notifications: ^18.0.0 flutter_local_notifications: ^18.0.0
@ -62,7 +62,7 @@ dependencies:
# Auth # Auth
local_auth: ^2.2.0 local_auth: ^2.2.0
# huawei_fido: ^6.3.0+305 # huawei_fido: ^6.3.0+305
device_info_plus: ^11.0.0 device_info_plus: ^10.1.0
dev_dependencies: dev_dependencies:

Loading…
Cancel
Save