From dd94e3678d07d0ceec297023541dfe09c886d8b3 Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Thu, 7 Nov 2024 13:13:13 +0300 Subject: [PATCH] Issues Fixed --- lib/config/provider_routes.dart | 3 ++- .../schedule/schedules_list_page.dart | 2 +- lib/views/dashboard/dashboard_view.dart | 9 +++++++-- .../dashboard/fragments/home_fragment.dart | 1 - .../subscriptions/my_subscritions_page.dart | 2 +- .../sheet/upgrade_package_sheet.dart | 17 +++++++++-------- .../widget/my_subscriptions_card.dart | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/config/provider_routes.dart b/lib/config/provider_routes.dart index 6eb2944..814385b 100644 --- a/lib/config/provider_routes.dart +++ b/lib/config/provider_routes.dart @@ -22,11 +22,12 @@ import 'package:mc_common_app/config/routes.dart'; import 'package:flutter/material.dart'; import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart'; import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart'; +import 'package:mc_common_app/utils/enums.dart'; class ProviderAppRoutes { static final Map routes = { //Home page - AppRoutes.dashboard: (context) => const DashboardView(), + AppRoutes.dashboard: (context) => DashboardView(dashboardRouteEnum: ModalRoute.of(context)!.settings.arguments as DashboardRouteEnum), // defineLicense: (context) => DefineLicensePage(), AppRoutes.dealershipSetting: (context) => const DealershipView(), diff --git a/lib/views/branch_management/schedule/schedules_list_page.dart b/lib/views/branch_management/schedule/schedules_list_page.dart index 6579e2a..503dc43 100644 --- a/lib/views/branch_management/schedule/schedules_list_page.dart +++ b/lib/views/branch_management/schedule/schedules_list_page.dart @@ -130,7 +130,7 @@ class _SchedulesListPageState extends State { showItem("${LocaleKeys.shiftEndTime.tr()}:", scheduleVM.schedule!.data![index].endTime ?? ""), showItem("${LocaleKeys.slotsTime.tr()}:", "${scheduleVM.schedule!.data![index].slotDurationMinute} Mins"), showItem("${LocaleKeys.appointmentPerSlot.tr()}:", scheduleVM.schedule!.data![index].perSlotAppointment.toString()), - showItem(LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? "Company Location" : "Home Location"), + showItem(LocaleKeys.serviceLocation.tr(), scheduleVM.schedule!.data![index].appointmentType == 1 ? LocaleKeys.companyLocation.tr() : LocaleKeys.customerLocation.tr()), showItem("${LocaleKeys.offDays.tr()}:", offDays(scheduleVM.schedule!.data![index])), 12.height, "${LocaleKeys.services.tr()}:".toText(fontSize: 12, color: MyColors.lightTextColor), diff --git a/lib/views/dashboard/dashboard_view.dart b/lib/views/dashboard/dashboard_view.dart index abc5682..b243fa2 100644 --- a/lib/views/dashboard/dashboard_view.dart +++ b/lib/views/dashboard/dashboard_view.dart @@ -1,6 +1,8 @@ import 'dart:async'; +import 'dart:developer'; import 'package:car_provider_app/views/branch_management/branch/branch_list_page.dart'; import 'package:flutter/material.dart'; +import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/view_models/dashboard_view_model_provider.dart'; import 'package:mc_common_app/views/common_fragments/requests_fragment.dart'; import 'package:mc_common_app/widgets/common_widgets/bottom_nav_bar.dart'; @@ -10,7 +12,9 @@ import 'fragments/home_fragment.dart'; import 'package:mc_common_app/views/common_fragments/ads_fragment.dart'; class DashboardView extends StatefulWidget { - const DashboardView({Key? key}) : super(key: key); + final DashboardRouteEnum dashboardRouteEnum; + + const DashboardView({Key? key, required this.dashboardRouteEnum}) : super(key: key); @override State createState() => _DashboardViewState(); @@ -22,9 +26,10 @@ class _DashboardViewState extends State { @override void initState() { + log("widget.dashboardRouteEnum: ${widget.dashboardRouteEnum}"); super.initState(); dashboardVMProvider = Provider.of(context, listen: false); - scheduleMicrotask(() => dashboardVMProvider.onRefresh(context)); + scheduleMicrotask(() => dashboardVMProvider.onRefresh(context, dashboardRouteEnum: widget.dashboardRouteEnum)); } @override diff --git a/lib/views/dashboard/fragments/home_fragment.dart b/lib/views/dashboard/fragments/home_fragment.dart index dfa2d8c..9235339 100644 --- a/lib/views/dashboard/fragments/home_fragment.dart +++ b/lib/views/dashboard/fragments/home_fragment.dart @@ -17,7 +17,6 @@ import 'package:mc_common_app/views/advertisement/components/ads_list_widget.dar import 'package:mc_common_app/views/appointments/widgets/common_appointment_slider_widget.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/view_all_widget.dart'; -import 'package:badges/badges.dart' as b; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; import 'package:easy_localization/easy_localization.dart'; diff --git a/lib/views/subscriptions/my_subscritions_page.dart b/lib/views/subscriptions/my_subscritions_page.dart index 9e47759..81d2b4a 100644 --- a/lib/views/subscriptions/my_subscritions_page.dart +++ b/lib/views/subscriptions/my_subscritions_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'package:car_provider_app/views/subscriptions/sheet/upgrade_package_sheet.dart'; import 'package:car_provider_app/views/subscriptions/widget/my_subscriptions_card.dart'; import 'package:flutter/material.dart'; @@ -60,7 +61,6 @@ class _MySubscriptionsPageState extends State { backgroundColor: MyColors.darkIconColor, isMainPage: model.mySubscriptionsBySp[index].isExpired ?? false, onRenewSubscriptionClick: () async { - print(sub.toJson()); showMyBottomSheet( context, child: UpgradePackageSheet( diff --git a/lib/views/subscriptions/sheet/upgrade_package_sheet.dart b/lib/views/subscriptions/sheet/upgrade_package_sheet.dart index 579b4ff..550a675 100644 --- a/lib/views/subscriptions/sheet/upgrade_package_sheet.dart +++ b/lib/views/subscriptions/sheet/upgrade_package_sheet.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/app_state.dart'; @@ -58,7 +59,7 @@ class _UpgradePackageSheetState extends State { padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 4), child: Consumer(builder: (context, model, _) { if (model.state == ViewState.busy) { - print(model.newPrice); + log(model.newPrice); return SizedBox( width: double.infinity, height: MediaQuery.of(context).size.height / 2, @@ -79,7 +80,7 @@ class _UpgradePackageSheetState extends State { 12.height, packageItem( LocaleKeys.nowVar.tr(), - ("${LocaleKeys.yourSubscriptionUpgradeAffectingFrom.tr()} ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), + ("${LocaleKeys.yourSubscriptionUpgradeAffectingFrom.tr()} ${widget.subscription.dateEnd == null ? DateHelper.formatAsDayMonthYear(DateTime.now()) : DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(widget.subscription.dateEnd!)))}"), double.parse(model.newPrice).toStringAsFixed(2), isNowSelected, ).onPress(() { @@ -92,7 +93,7 @@ class _UpgradePackageSheetState extends State { if (AppState().getproviderSubscription.isNotEmpty && !AppState().getproviderSubscription.first.isExpired!) packageItem( LocaleKeys.upgradeAfterCurrentExpiry.tr(), - ("${LocaleKeys.yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom.tr()} ${DateHelper.formatAsLongDate(widget.subscription.dateEnd ?? DateTime.now())}"), + ("${LocaleKeys.yourSubscriptionUpgradeCurrentSubscriptionAffectingFrom.tr()} ${AppState().getproviderSubscription.first.dateEnd == null ? "" : AppState().getproviderSubscription.first.dateEnd == null ? DateHelper.formatAsDayMonthYear(DateTime.now()) : DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(AppState().getproviderSubscription.first.dateEnd!)))}"), widget.subscription.price.toString(), isNowSelected ? false : true, ).onPress(() { @@ -174,11 +175,11 @@ class _UpgradePackageSheetState extends State { fontWeight: FontWeight.bold, ), 4.height, - if (widget.subscription.dateEnd != null) - description.toText( - fontSize: 12, - color: MyColors.lightTextColor, - ), + // if (widget.subscription.dateEnd != null) + description.toText( + fontSize: 12, + color: MyColors.lightTextColor, + ), 10.height, Row( crossAxisAlignment: CrossAxisAlignment.end, diff --git a/lib/views/subscriptions/widget/my_subscriptions_card.dart b/lib/views/subscriptions/widget/my_subscriptions_card.dart index c92aab8..f605863 100644 --- a/lib/views/subscriptions/widget/my_subscriptions_card.dart +++ b/lib/views/subscriptions/widget/my_subscriptions_card.dart @@ -101,7 +101,7 @@ class MySubscriptionsCard extends StatelessWidget { ), Row( children: [ - "${pvm.isExpired! ? "Expired" : "Expires"} on ${DateHelper.formatAsDayMonthYear(pvm.dateEnd)}".toText(fontSize: 14, letterSpacing: -0.56, color: textColor, fontWeight: MyFonts.Medium), + "${pvm.isExpired! ? "Expired" : "Expires"} on ${DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(pvm.dateEnd ?? "")))}".toText(fontSize: 14, letterSpacing: -0.56, color: textColor, fontWeight: MyFonts.Medium), if (pvm.isRenewable!) Row( children: [