From 9a8a21e41b3c415fa9d6ee587549cc036ce45ed1 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Sun, 11 Aug 2024 09:19:08 +0300 Subject: [PATCH 1/2] subscription & profile --- assets/langs/ar-SA.json | 12 +- assets/langs/en-US.json | 12 +- lib/config/routes.dart | 3 + lib/generated/codegen_loader.g.dart | 22 +- lib/generated/locale_keys.g.dart | 8 + lib/main.dart | 22 +- lib/models/user_models/user.dart | 2 + lib/utils/enums.dart | 16 +- lib/view_models/payment_view_model.dart | 80 +++--- lib/view_models/user_view_model.dart | 4 +- lib/views/payments/payment_methods_view.dart | 70 ++---- .../setting_options_language.dart | 233 ++++++++++-------- lib/views/user/login_with_password_page.dart | 17 +- 13 files changed, 262 insertions(+), 239 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index d0857a2..bce73bd 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -567,7 +567,17 @@ "logOut": "تسجيل الخروج", "customer": "العميل", "accept": "قبول", - "amountVAR": "كمية" + "amountVAR": "كمية", + "nowVar": "الآن", + "whendoyouWanttoUpgrade": "متى تريد الترقية", + "yourSubscriptionUpgradeAffectingFrom": "سيتم ترقية اشتراكك الآن. ساري المفعول من", + "upgradeAfterCurrentExpiry": "الترقية بعد انتهاء الاشتراك الحالي", + "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "سيتم ترقية اشتراكك بعد انتهاء اشتراكك الحالي. ساري المفعول من", + "upgradeVar": "ترقية", + "whendoyouWanttoRenew" : "متى تريد التجديد", + "renewVar" : "تجديد" + + diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 9010e64..db7402d 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -404,7 +404,7 @@ "passwordAcceptableStrong": "Your password is acceptable but not strong", "passwordIsStrong": "Your password is strong", "passwordVeryStrong": "Your password is very strong", - "onlyProviderApp": "Sorry, Only Customer's can log in this app", + "onlyProviderApp": "Sorry, Only Providers can log in this app", "selectDuration": "Select Duration", "daysVar": "Days", "adCharges": "Ad Charges", @@ -568,5 +568,13 @@ "logOut": "Log Out", "customer": "Customer", "accept": "Accept", - "amountVAR": "Amount" + "amountVAR": "Amount", + "nowVar": "Now", + "whendoyouWanttoUpgrade": "When do you want to upgrade", + "yourSubscriptionUpgradeAffectingFrom": "Your subscription will upgrade now. Affecting from", + "upgradeAfterCurrentExpiry": "Upgrade after current expiry", + "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "Your subscription will upgrade after you current subscription will end. Affecting from", + "upgradeVar": "Upgrade", + "whendoyouWanttoRenew" : "When do you want to renew", + "renewVar" : "Renew" } \ No newline at end of file diff --git a/lib/config/routes.dart b/lib/config/routes.dart index ae8892a..6e2b43f 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -99,6 +99,9 @@ class AppRoutes { static const providerLicensePage = "/providerLicensePage"; + //Provider User Page + static const dealerUser = "/dealerUser"; + //Chat static const String chatView = "/chatView"; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 22be496..7f84591 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -583,7 +583,15 @@ class CodegenLoader extends AssetLoader{ "logOut": "تسجيل الخروج", "customer": "العميل", "accept": "قبول", - "amountVAR": "كمية" + "amountVAR": "كمية", + "nowVar": "الآن", + "whendoyouWanttoUpgrade": "متى تريد الترقية", + "yourSubscriptionUpgradeAffectingFrom": "سيتم ترقية اشتراكك الآن. ساري المفعول من", + "upgradeAfterCurrentExpiry": "الترقية بعد انتهاء الاشتراك الحالي", + "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "سيتم ترقية اشتراكك بعد انتهاء اشتراكك الحالي. ساري المفعول من", + "upgradeVar": "ترقية", + "whendoyouWanttoRenew": "متى تريد التجديد", + "renewVar": "تجديد" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -991,7 +999,7 @@ static const Map en_US = { "passwordAcceptableStrong": "Your password is acceptable but not strong", "passwordIsStrong": "Your password is strong", "passwordVeryStrong": "Your password is very strong", - "onlyProviderApp": "Sorry, Only Customer's can log in this app", + "onlyProviderApp": "Sorry, Only Providers can log in this app", "selectDuration": "Select Duration", "daysVar": "Days", "adCharges": "Ad Charges", @@ -1155,7 +1163,15 @@ static const Map en_US = { "logOut": "Log Out", "customer": "Customer", "accept": "Accept", - "amountVAR": "Amount" + "amountVAR": "Amount", + "nowVar": "Now", + "whendoyouWanttoUpgrade": "When do you want to upgrade", + "yourSubscriptionUpgradeAffectingFrom": "Your subscription will upgrade now. Affecting from", + "upgradeAfterCurrentExpiry": "Upgrade after current expiry", + "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "Your subscription will upgrade after you current subscription will end. Affecting from", + "upgradeVar": "Upgrade", + "whendoyouWanttoRenew": "When do you want to renew", + "renewVar": "Renew" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index f02cbb4..602b959 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -547,5 +547,13 @@ abstract class LocaleKeys { static const customer = 'customer'; static const accept = 'accept'; static const amountVAR = 'amountVAR'; + static const nowVar = 'nowVar'; + static const whendoyouWanttoUpgrade = 'whendoyouWanttoUpgrade'; + static const yourSubscriptionUpgradeAffectingFrom = 'yourSubscriptionUpgradeAffectingFrom'; + static const upgradeAfterCurrentExpiry = 'upgradeAfterCurrentExpiry'; + static const yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom = 'yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom'; + static const upgradeVar = 'upgradeVar'; + static const whendoyouWanttoRenew = 'whendoyouWanttoRenew'; + static const renewVar = 'renewVar'; } diff --git a/lib/main.dart b/lib/main.dart index 67dd452..e6f3ecc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,14 +13,17 @@ import 'package:sizer/sizer.dart'; final navigatorKey = GlobalKey(); Logger logger = Logger( - // printer: PrettyPrinter(lineLength: 0, methodCount: 0,), + printer: PrettyPrinter(printEmojis: false, colors: true,printTime: false), +); + + - ); class MyHttpOverrides extends HttpOverrides { @override HttpClient createHttpClient(SecurityContext? context) { - return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true; + return super.createHttpClient(context) + ..badCertificateCallback = (X509Certificate cert, String host, int port) => true; } } @@ -64,11 +67,9 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return LayoutBuilder(builder: (context, constraints) { return Sizer( - builder: ( - BuildContext context, - Orientation orientation, - DeviceType deviceType, - ) { + builder: (BuildContext context, + Orientation orientation, + DeviceType deviceType,) { List> delegates = context.localizationDelegates; // AppState().setPostParamsModel( // PostParamsModel( @@ -79,7 +80,10 @@ class MyApp extends StatelessWidget { // key: navigatorKey, navigatorKey: navigatorKey, theme: AppTheme.getTheme( - isArabic: EasyLocalization.of(context)?.locale.languageCode == "ar", + isArabic: EasyLocalization + .of(context) + ?.locale + .languageCode == "ar", ), debugShowCheckedModeBanner: false, localizationsDelegates: delegates, diff --git a/lib/models/user_models/user.dart b/lib/models/user_models/user.dart index 27e38c0..049ca47 100644 --- a/lib/models/user_models/user.dart +++ b/lib/models/user_models/user.dart @@ -117,6 +117,8 @@ class UserInfo { AppState().userType = UserType.providerDealer; } else if (json["roleID"] == 6) { AppState().userType = UserType.providerIndividual; + } else if (json["roleID"] == 7) { + AppState().userType = UserType.providerIndividual; } else { AppState().userType = UserType.customer; } diff --git a/lib/utils/enums.dart b/lib/utils/enums.dart index d2123cd..b96afb5 100644 --- a/lib/utils/enums.dart +++ b/lib/utils/enums.dart @@ -78,15 +78,7 @@ enum PaymentMethods { tamara, } -enum PaymentTypes { - subscription, - appointment, - adReserve, - ads, - request, - extendAds, - partialAppointment -} +enum PaymentTypes { subscription, appointment, adReserve, ads, request, extendAds, partialAppointment } enum AdCreationSteps { vehicleDetails, @@ -199,3 +191,9 @@ enum SubscriptionTypeEnum { upgrade, downgrade, } + +enum SubscriptionActionTypeEnum { + ads, + users, + branches, +} diff --git a/lib/view_models/payment_view_model.dart b/lib/view_models/payment_view_model.dart index 44049d3..f873c03 100644 --- a/lib/view_models/payment_view_model.dart +++ b/lib/view_models/payment_view_model.dart @@ -53,75 +53,62 @@ class PaymentVM extends ChangeNotifier { notifyListeners(); } - Future onContinuePressed(BuildContext context, - {required PaymentTypes paymentType}) async { + Future onContinuePressed(BuildContext context, {required PaymentTypes paymentType}) async { switch (selectedPaymentMethod) { case PaymentMethods.mada: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentMethods.visa: await onVisaCardSelected(context, paymentType); break; case PaymentMethods.applePay: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentMethods.masterCard: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentMethods.tamara: - // TODO: Handle this case. + // TODO: Handle this case. break; } return; } - Future onAdsPaymentSuccess( - {required BuildContext context, - required int currentAdId, - required int paymentTypeId}) async { + Future onAdsPaymentSuccess({required BuildContext context, required int currentAdId, required int paymentTypeId}) async { Utils.showLoading(context); - PayOrderDetailRespModel payOrderDetailRespModel = await paymentRepo - .getPayOrderDetails(paymentId: paymentTypeId, adId: currentAdId); + PayOrderDetailRespModel payOrderDetailRespModel = await paymentRepo.getPayOrderDetails(paymentId: paymentTypeId, adId: currentAdId); await Future.delayed(const Duration(seconds: 2)); Utils.hideLoading(context); log("payOrderDetailRespModel: ${payOrderDetailRespModel.toString()}"); - if (payOrderDetailRespModel.isPaid == null || - !payOrderDetailRespModel.isPaid!) { + if (payOrderDetailRespModel.isPaid == null || !payOrderDetailRespModel.isPaid!) { Utils.showToast(LocaleKeys.paymentFailed.tr()); return; } - if (payOrderDetailRespModel.isPaid != null && - payOrderDetailRespModel.isPaid!) { + if (payOrderDetailRespModel.isPaid != null && payOrderDetailRespModel.isPaid!) { Utils.showToast(LocaleKeys.paymentSuccessful.tr()); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); } } - Future onAppointmentPaymentSuccess( - {required BuildContext context, - required int currentAdId, - required int paymentTypeId}) async { + Future onAppointmentPaymentSuccess({required BuildContext context, required int currentAdId, required int paymentTypeId}) async { Utils.showLoading(context); //TODO: CONFIRM FROM ZAHOOR THAT WILL THIS METHOD WORK FOR APPOINTMENT - PayOrderDetailRespModel payOrderDetailRespModel = await paymentRepo - .getPayOrderDetails(paymentId: paymentTypeId, adId: currentAdId); + PayOrderDetailRespModel payOrderDetailRespModel = await paymentRepo.getPayOrderDetails(paymentId: paymentTypeId, adId: currentAdId); await Future.delayed(const Duration(seconds: 2)); Utils.hideLoading(context); log("payOrderDetailRespModel: ${payOrderDetailRespModel.toString()}"); - if (payOrderDetailRespModel.isPaid == null || - !payOrderDetailRespModel.isPaid!) { + if (payOrderDetailRespModel.isPaid == null || !payOrderDetailRespModel.isPaid!) { Utils.showToast(LocaleKeys.paymentFailed.tr()); return; } - if (payOrderDetailRespModel.isPaid != null && - payOrderDetailRespModel.isPaid!) { + if (payOrderDetailRespModel.isPaid != null && payOrderDetailRespModel.isPaid!) { Utils.showToast(LocaleKeys.paymentSuccessful.tr()); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); } @@ -143,9 +130,7 @@ class PaymentVM extends ChangeNotifier { } } - Future placeThePayment( - {required PaymentTypes paymentTypeEnum, - required BuildContext context}) async { + Future placeThePayment({required PaymentTypes paymentTypeEnum, required BuildContext context}) async { await paymentService.placePayment( // This will be request ID for request payment || ad ID for Ad Related Payment || OrderProviderSubscriptionID for SubscriptionPayment id: getIdTypeByPaymentType(paymentTypeEnum), @@ -155,23 +140,23 @@ class PaymentVM extends ChangeNotifier { Utils.showToast(LocaleKeys.paymentFailed.tr()); switch (paymentTypeEnum) { case PaymentTypes.subscription: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.appointment: - // TODO: Handle this case. + // TODO: Handle this case. log("Appointment Payment has been Failed!!"); break; case PaymentTypes.adReserve: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.ads: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.request: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.extendAds: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.partialAppointment: log("Partial Appointment Payment has been Failed!!"); @@ -193,10 +178,7 @@ class PaymentVM extends ChangeNotifier { case PaymentTypes.adReserve: case PaymentTypes.ads: case PaymentTypes.extendAds: - await onAdsPaymentSuccess( - context: context, - paymentTypeId: paymentTypeEnum.getIdFromPaymentTypesEnum(), - currentAdId: currentAdId); + await onAdsPaymentSuccess(context: context, paymentTypeId: paymentTypeEnum.getIdFromPaymentTypesEnum(), currentAdId: currentAdId); break; case PaymentTypes.partialAppointment: log("Partial Appointment Payment has been Succeeded"); @@ -207,15 +189,19 @@ class PaymentVM extends ChangeNotifier { } onSubscriptionSuccess(BuildContext context) { - pop(context); - pop(context); - pop(context); - context.read().getMySubscriptions( - AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); + // pop(context); + // pop(context); + // pop(context); + + // context.read().getMySubscriptions(AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); + context + .read() + .mySubscriptionsBySp = []; + context.read().getMySubscriptionsBySP(AppState().getUser.data?.userInfo?.providerId.toString() ?? ""); + navigateReplaceWithNameUntilRoute(context, AppRoutes.mySubscriptionsPage); } - Future onVisaCardSelected( - BuildContext context, PaymentTypes paymentType) async { + Future onVisaCardSelected(BuildContext context, PaymentTypes paymentType) async { currentPaymentType = paymentType; switch (currentPaymentType) { case PaymentTypes.appointment: @@ -224,7 +210,7 @@ class PaymentVM extends ChangeNotifier { await placeThePayment(context: context, paymentTypeEnum: paymentType); break; case PaymentTypes.request: - // TODO: Handle this case. + // TODO: Handle this case. break; case PaymentTypes.subscription: await placeThePayment(context: context, paymentTypeEnum: paymentType); diff --git a/lib/view_models/user_view_model.dart b/lib/view_models/user_view_model.dart index 6e95508..b488d3f 100644 --- a/lib/view_models/user_view_model.dart +++ b/lib/view_models/user_view_model.dart @@ -352,7 +352,7 @@ class UserVM extends BaseVM { if (verifiedUser.messageStatus == 1) { User user = User.fromJson(jsonDecode(response2.body)); if (appType == AppType.provider) { - if (user.data!.userInfo!.roleId == 5 || user.data!.userInfo!.roleId == 6) { + if (user.data!.userInfo!.roleId == 5 || user.data!.userInfo!.roleId == 6 || user.data!.userInfo!.roleId == 7) { AppState().setUser = user; SharedPrefManager.setUserToken(user.data!.accessToken ?? ""); SharedPrefManager.setUserId(user.data!.userInfo!.userId ?? ""); @@ -393,7 +393,7 @@ class UserVM extends BaseVM { if (verifiedUser.messageStatus == 1) { User user = User.fromJson(jsonDecode(response2.body)); if (appType == AppType.provider) { - if (user.data!.userInfo!.roleId == 5 || user.data!.userInfo!.roleId == 6) { + if (user.data!.userInfo!.roleId == 5 || user.data!.userInfo!.roleId == 6 || user.data!.userInfo!.roleId == 7 ) { AppState().setUser = user; SharedPrefManager.setUserToken(user.data!.accessToken ?? ""); SharedPrefManager.setUserId(user.data!.userInfo!.userId ?? ""); diff --git a/lib/views/payments/payment_methods_view.dart b/lib/views/payments/payment_methods_view.dart index 08d3bf1..7b7c1f5 100644 --- a/lib/views/payments/payment_methods_view.dart +++ b/lib/views/payments/payment_methods_view.dart @@ -16,9 +16,7 @@ class PaymentMethodsView extends StatelessWidget { final PaymentTypes paymentType; final Function? onTempContinue; - const PaymentMethodsView( - {Key? key, required this.paymentType, this.onTempContinue}) - : super(key: key); + const PaymentMethodsView({Key? key, required this.paymentType, this.onTempContinue}) : super(key: key); @override Widget build(BuildContext context) { @@ -36,46 +34,29 @@ class PaymentMethodsView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ 20.height, - LocaleKeys.selectPaymentMethod - .tr() - .toText(fontSize: 18, isBold: true), + LocaleKeys.selectPaymentMethod.tr().toText(fontSize: 18, isBold: true), 15.height, Consumer( - builder: - (BuildContext context, PaymentVM paymentVm, Widget? child) { + builder: (BuildContext context, PaymentVM paymentVm, Widget? child) { return Expanded( child: ListView( shrinkWrap: true, children: [ PaymentMethodContainer( - isSelected: paymentVm.selectedPaymentMethod == - PaymentMethods.mada, - onTap: () => paymentVm - .updateSelectedPaymentMethod(PaymentMethods.mada), - cardAsset: MyAssets.madaPng), + isSelected: paymentVm.selectedPaymentMethod == PaymentMethods.mada, onTap: () => paymentVm.updateSelectedPaymentMethod(PaymentMethods.mada), cardAsset: MyAssets.madaPng), PaymentMethodContainer( - isSelected: paymentVm.selectedPaymentMethod == - PaymentMethods.visa, - onTap: () => paymentVm - .updateSelectedPaymentMethod(PaymentMethods.visa), - cardAsset: MyAssets.visaPng), + isSelected: paymentVm.selectedPaymentMethod == PaymentMethods.visa, onTap: () => paymentVm.updateSelectedPaymentMethod(PaymentMethods.visa), cardAsset: MyAssets.visaPng), PaymentMethodContainer( - isSelected: paymentVm.selectedPaymentMethod == - PaymentMethods.applePay, - onTap: () => paymentVm.updateSelectedPaymentMethod( - PaymentMethods.applePay), + isSelected: paymentVm.selectedPaymentMethod == PaymentMethods.applePay, + onTap: () => paymentVm.updateSelectedPaymentMethod(PaymentMethods.applePay), cardAsset: MyAssets.applePayPng), PaymentMethodContainer( - isSelected: paymentVm.selectedPaymentMethod == - PaymentMethods.masterCard, - onTap: () => paymentVm.updateSelectedPaymentMethod( - PaymentMethods.masterCard), + isSelected: paymentVm.selectedPaymentMethod == PaymentMethods.masterCard, + onTap: () => paymentVm.updateSelectedPaymentMethod(PaymentMethods.masterCard), cardAsset: MyAssets.mastercardPng), PaymentMethodContainer( - isSelected: paymentVm.selectedPaymentMethod == - PaymentMethods.tamara, - onTap: () => paymentVm.updateSelectedPaymentMethod( - PaymentMethods.tamara), + isSelected: paymentVm.selectedPaymentMethod == PaymentMethods.tamara, + onTap: () => paymentVm.updateSelectedPaymentMethod(PaymentMethods.tamara), cardAsset: MyAssets.tamaraEngPng), ], ), @@ -93,10 +74,7 @@ class PaymentMethodsView extends StatelessWidget { isNeedToCallPayment = await onTempContinue!(); } if (isNeedToCallPayment) { - context.read().onContinuePressed( - context, - paymentType: paymentType, - ); + context.read().onContinuePressed(context, paymentType: paymentType); } }, backgroundColor: MyColors.darkPrimaryColor, @@ -114,12 +92,7 @@ class PaymentMethodContainer extends StatelessWidget { final String cardAsset; final Function() onTap; - const PaymentMethodContainer( - {Key? key, - required this.isSelected, - required this.cardAsset, - required this.onTap}) - : super(key: key); + const PaymentMethodContainer({Key? key, required this.isSelected, required this.cardAsset, required this.onTap}) : super(key: key); @override Widget build(BuildContext context) { @@ -132,9 +105,7 @@ class PaymentMethodContainer extends StatelessWidget { decoration: BoxDecoration( color: MyColors.white, borderRadius: BorderRadius.circular(10), - border: Border.all( - color: isSelected ? Colors.green : Colors.transparent, - width: isSelected ? 2.0 : 0.0), + border: Border.all(color: isSelected ? Colors.green : Colors.transparent, width: isSelected ? 2.0 : 0.0), ), child: Padding( padding: const EdgeInsets.all(12), @@ -143,11 +114,7 @@ class PaymentMethodContainer extends StatelessWidget { Container( width: 24, height: 24, - decoration: Utils.containerColorRadiusBorderWidth( - isSelected ? MyColors.primaryColor : Colors.transparent, - 100, - Colors.grey, - 0.5), + decoration: Utils.containerColorRadiusBorderWidth(isSelected ? MyColors.primaryColor : Colors.transparent, 100, Colors.grey, 0.5), ), 12.width, Container( @@ -157,12 +124,7 @@ class PaymentMethodContainer extends StatelessWidget { child: Image.asset(cardAsset), ), Utils.mFlex(1), - isSelected - ? Utils.statusContainerChip( - text: "Selected", - padding: - EdgeInsets.symmetric(vertical: 6, horizontal: 10)) - : SizedBox(), + isSelected ? Utils.statusContainerChip(text: "Selected", padding: EdgeInsets.symmetric(vertical: 6, horizontal: 10)) : SizedBox(), ], ), ), diff --git a/lib/views/setting_options/setting_options_language.dart b/lib/views/setting_options/setting_options_language.dart index 22bf940..43fd943 100644 --- a/lib/views/setting_options/setting_options_language.dart +++ b/lib/views/setting_options/setting_options_language.dart @@ -35,122 +35,139 @@ class SettingOptionsLanguage extends StatelessWidget { // ? Expanded( child: ListView( - shrinkWrap: true, - padding: EdgeInsets.zero, - children: [ - Column( + shrinkWrap: true, + padding: EdgeInsets.zero, children: [ + Column( + children: [ + CustomSettingOptionsTile( + leadingWidget: const Icon(Icons.quickreply_outlined, size: 20), + titleText: LocaleKeys.requests.tr(), + needBorderBelow: true, + onTap: () { + context.read().onNavbarTapped(4); + Navigator.pop(context); + }), + CustomSettingOptionsTile( + leadingWidget: const Icon(Icons.settings, size: 20), + titleText: LocaleKeys.settings.tr(), + needBorderBelow: true, + onTap: () {}, + //navigateWithName(context, AppRoutes.settingOptionsInviteFriends), + ), + CustomSettingOptionsTile( + leadingWidget: const Icon(Icons.question_mark_outlined, size: 20), + titleText: LocaleKeys.help.tr(), + needBorderBelow: true, + onTap: () => navigateWithName(context, AppRoutes.settingOptionsHelp), + ), + CustomSettingOptionsTile( + leadingWidget: const Icon(Icons.person, size: 20), + titleText: LocaleKeys.account.tr(), + needBorderBelow: false, + onTap: () { + navigateWithName(context, AppRoutes.profileView); + // context.read().onNavbarTapped(4); + // Navigator.pop(context); + }), + ], + ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0), + 10.height, CustomSettingOptionsTile( - leadingWidget: const Icon(Icons.quickreply_outlined, size: 20), - titleText: LocaleKeys.requests.tr(), - needBorderBelow: true, - onTap: () { - context.read().onNavbarTapped(4); - Navigator.pop(context); - }), - CustomSettingOptionsTile( - leadingWidget: const Icon(Icons.settings, size: 20), - titleText: LocaleKeys.settings.tr(), - needBorderBelow: true, - onTap: () {}, - //navigateWithName(context, AppRoutes.settingOptionsInviteFriends), - ), - CustomSettingOptionsTile( - leadingWidget: const Icon(Icons.question_mark_outlined, size: 20), - titleText: LocaleKeys.help.tr(), - needBorderBelow: true, - onTap: () => navigateWithName(context, AppRoutes.settingOptionsHelp), - ), - CustomSettingOptionsTile( - leadingWidget: const Icon(Icons.person, size: 20), - titleText: LocaleKeys.account.tr(), - needBorderBelow: false, - onTap: () { - navigateWithName(context, AppRoutes.profileView); - // context.read().onNavbarTapped(4); - // Navigator.pop(context); - }), - ], - ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0), - 10.height, - CustomSettingOptionsTile( - leadingWidget: const Icon(Icons.translate, size: 20), - titleText: LocaleKeys.language.tr(), - isForLanguage: true, - onTap: () { - // if (EasyLocalization.of(context) - // ?.currentLocale - // ?.countryCode == - // "SA") { - // context.setLocale(const Locale("en", "US")); - // } else { - // context.setLocale(const Locale('ar', 'SA')); - // } + leadingWidget: const Icon(Icons.translate, size: 20), + titleText: LocaleKeys.language.tr(), + isForLanguage: true, + onTap: () { + // if (EasyLocalization.of(context) + // ?.currentLocale + // ?.countryCode == + // "SA") { + // context.setLocale(const Locale("en", "US")); + // } else { + // context.setLocale(const Locale('ar', 'SA')); + // } - context.read().changeLanguage(context); - }, - ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0), - 10.height, - (AppState().currentAppType == AppType.provider) - ? Column( - children: [ - CustomSettingOptionsTile( - leadingWidget: SizedBox( - width: 16, - height: 16, - child: SvgPicture.asset( - MyAssets.icStar, - color: MyColors.primaryColor, - ), + context.read().changeLanguage(context); + }, + ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0), + 10.height, + (AppState().currentAppType == AppType.provider) + ? Column( + children: [ + CustomSettingOptionsTile( + leadingWidget: SizedBox( + width: 16, + height: 16, + child: SvgPicture.asset( + MyAssets.icStar, + color: MyColors.primaryColor, ), - titleText: LocaleKeys.mySubscription.tr(), - subTitle: AppState().getproviderSubscription.first.subscriptionName ?? "Silver", - isForLanguage: false, - needBorderBelow: true, - onTap: () { - navigateWithName(context, AppRoutes.mySubscriptionsPage); - }, ), - CustomSettingOptionsTile( - leadingWidget: SizedBox( - width: 16, - height: 16, - child: SvgPicture.asset( - MyAssets.icGroupStar, - // color: MyColors.primaryColor, - ), + titleText: LocaleKeys.mySubscription.tr(), + subTitle: AppState().getproviderSubscription.first.subscriptionName ?? "Silver", + isForLanguage: false, + needBorderBelow: true, + onTap: () { + navigateWithName(context, AppRoutes.mySubscriptionsPage); + }, + ), + CustomSettingOptionsTile( + leadingWidget: SizedBox( + width: 16, + height: 16, + child: SvgPicture.asset( + MyAssets.icGroupStar, + // color: MyColors.primaryColor, ), - titleText: LocaleKeys.subscriptions.tr(), - subTitle: null, - isForLanguage: false, - needBorderBelow: true, - onTap: () { - navigateWithName(context, AppRoutes.subscriptionsPage); - }, ), - CustomSettingOptionsTile( - leadingWidget: SizedBox( - width: 16, - height: 16, - child: SvgPicture.asset( - MyAssets.icGroupStar, - // color: MyColors.primaryColor, - ), + titleText: LocaleKeys.subscriptions.tr(), + subTitle: null, + isForLanguage: false, + needBorderBelow: true, + onTap: () { + navigateWithName(context, AppRoutes.subscriptionsPage); + }, + ), + CustomSettingOptionsTile( + leadingWidget: SizedBox( + width: 16, + height: 16, + child: SvgPicture.asset( + MyAssets.icGroupStar, + // color: MyColors.primaryColor, ), - titleText: LocaleKeys.defineLicenses.tr(), - subTitle: null, - isForLanguage: false, - needBorderBelow: false, - onTap: () { - navigateWithName(context, AppRoutes.providerLicensePage); - }, - ) - ], - ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0) - : SizedBox(), - (AppState().currentAppType == AppType.provider) ? 10.height : SizedBox(), - ], - )), + ), + titleText: LocaleKeys.defineLicenses.tr(), + subTitle: null, + isForLanguage: false, + needBorderBelow: false, + onTap: () { + navigateWithName(context, AppRoutes.providerLicensePage); + }, + ), + // CustomSettingOptionsTile( + // leadingWidget: SizedBox( + // width: 16, + // height: 16, + // child: SvgPicture.asset( + // MyAssets.providersIcon, + // // color: MyColors.primaryColor, + // ), + // ), + // titleText: "Users", + // subTitle: null, + // isForLanguage: false, + // needBorderBelow: false, + // onTap: () { + // navigateWithName(context, AppRoutes.dealerUser, arguments: AppState().getUser.data!.userInfo!.id.toString()); + // }, + // ) + ], + ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0) + : SizedBox(), + (AppState().currentAppType == AppType.provider) ? 10.height : SizedBox(), + ], + )), // : Expanded( // child: ListView( // children: [ diff --git a/lib/views/user/login_with_password_page.dart b/lib/views/user/login_with_password_page.dart index c6f1bb3..dd9b91a 100644 --- a/lib/views/user/login_with_password_page.dart +++ b/lib/views/user/login_with_password_page.dart @@ -49,10 +49,19 @@ class _LoginWithPasswordState extends State { userVM = Provider.of(context, listen: false); context.read().getAvailBio(); if (AppState().currentAppType == AppType.provider) { - // phoneNum = "966530896018"; - // password = "Amir@1234"; - phoneNum = "966569755630"; - password = "Amir12345@"; + phoneNum = "966530896018"; + password = "Amir@1234"; + + // phoneNum = "966569755630"; + // password = "Amir12345@"; //AAmir Sal + + // phoneNum = "966598646795"; + // password = "Zahoor@123"; + + // User Details + // phoneNum = "966554870506"; + // password = "Sikander123@"; // "lastName": "sik", + // "email": "sikander@gmail.com", } getCountryList(); From f2ab8529e92859e8a9decd7866c75246316e00ee Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Sun, 11 Aug 2024 09:23:51 +0300 Subject: [PATCH 2/2] subscription & profile --- lib/generated/codegen_loader.g.dart | 6 ++++-- lib/generated/locale_keys.g.dart | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 7f84591..33fd133 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -591,7 +591,8 @@ class CodegenLoader extends AssetLoader{ "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "سيتم ترقية اشتراكك بعد انتهاء اشتراكك الحالي. ساري المفعول من", "upgradeVar": "ترقية", "whendoyouWanttoRenew": "متى تريد التجديد", - "renewVar": "تجديد" + "renewVar": "تجديد", + "requestAlreadyInProgress": "هذا الطلب قيد التقدم بالفعل." }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -1171,7 +1172,8 @@ static const Map en_US = { "yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom": "Your subscription will upgrade after you current subscription will end. Affecting from", "upgradeVar": "Upgrade", "whendoyouWanttoRenew": "When do you want to renew", - "renewVar": "Renew" + "renewVar": "Renew", + "requestAlreadyInProgress": "This request is already in progress." }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 75b0c60..2b56728 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -547,7 +547,6 @@ abstract class LocaleKeys { static const customer = 'customer'; static const accept = 'accept'; static const amountVAR = 'amountVAR'; - static const requestAlreadyInProgress = 'requestAlreadyInProgress'; static const nowVar = 'nowVar'; static const whendoyouWanttoUpgrade = 'whendoyouWanttoUpgrade'; static const yourSubscriptionUpgradeAffectingFrom = 'yourSubscriptionUpgradeAffectingFrom'; @@ -556,5 +555,6 @@ abstract class LocaleKeys { static const upgradeVar = 'upgradeVar'; static const whendoyouWanttoRenew = 'whendoyouWanttoRenew'; static const renewVar = 'renewVar'; + static const requestAlreadyInProgress = 'requestAlreadyInProgress'; }