diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index f73f875..63f2094 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -583,11 +583,11 @@ "addNewAppointment": "Add New Appointment", "myNearbyBranches": "My Nearby Branches", "myRecentBranches": "My Recent Branches", - "favoriteList": "Favourite List", + "favoriteList": "Favorite List", "noReviewsBranch": "This branch has no reviews.", "readLess": "Read Less", "readMoreReviews": "Read More Reviews", - "noProvidersInFav": "You have no providers in Favourites.", + "noProvidersInFav": "You have no providers in Favorites.", "providerHasNoBranches": "This Provider has no branches yet.", "totalBranches": "Total Branches", "memberSince": "Member Since", @@ -681,7 +681,7 @@ "adsRemaining": "Ads Remaining", "attachPDF": "Attach PDF", "noItemsToShow": "No Items to show.", - "serviceItem" : "Service Item", - "createdBy" : "Created By", + "serviceItem": "Service Item", + "createdBy": "Created By", "createGroupServices": "Create Group Services" } \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 71c00f0..15572cb 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -633,11 +633,11 @@ extension DateTimeConversions on DateTime { } else if (difference.inHours >= 1) { return (numericDates) ? '1 hour ago' : 'An hour ago'; } else if (difference.inMinutes >= 2) { - return '${difference.inMinutes} minutes ago'; + return '${difference.inMinutes} min ago'; } else if (difference.inMinutes >= 1) { - return (numericDates) ? '1 minute ago' : 'A minute ago'; + return (numericDates) ? '1 min ago' : 'A min ago'; } else if (difference.inSeconds >= 3) { - return '${difference.inSeconds} seconds ago'; + return '${difference.inSeconds} sec ago'; } else { return 'Just now'; } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 02e47a3..6776ad1 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -1288,11 +1288,11 @@ static const Map en_US = { "addNewAppointment": "Add New Appointment", "myNearbyBranches": "My Nearby Branches", "myRecentBranches": "My Recent Branches", - "favoriteList": "Favourite List", + "favoriteList": "Favorite List", "noReviewsBranch": "This branch has no reviews.", "readLess": "Read Less", "readMoreReviews": "Read More Reviews", - "noProvidersInFav": "You have no providers in Favourites.", + "noProvidersInFav": "You have no providers in Favorites.", "providerHasNoBranches": "This Provider has no branches yet.", "totalBranches": "Total Branches", "memberSince": "Member Since", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index a0a0423..c45dd17 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -666,5 +666,4 @@ abstract class LocaleKeys { static const createdBy = 'createdBy'; static const createGroupServices = 'createGroupServices'; - } diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 2fe7109..622450e 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -28,7 +28,13 @@ class Utils { static bool get isLoading => _isLoadingVisible; static void showToast(String message) { - Fluttertoast.showToast(msg: message, toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 2, backgroundColor: Colors.black54, textColor: Colors.white, fontSize: 16.0); + Fluttertoast.showToast(msg: message, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 2, + backgroundColor: Colors.black54, + textColor: Colors.white, + fontSize: 16.0); } static Future openNumberViaCaller({required String phoneNumber}) async { @@ -71,7 +77,11 @@ class Utils { return ""; } - return ("${timeOfDay.hour.toString().length == 1 ? "0" : ""}${timeOfDay.hour}:${timeOfDay.minute.toString().length == 1 ? "0" : ""}${timeOfDay.minute}").toString(); + return ("${timeOfDay.hour + .toString() + .length == 1 ? "0" : ""}${timeOfDay.hour}:${timeOfDay.minute + .toString() + .length == 1 ? "0" : ""}${timeOfDay.minute}").toString(); } static dynamic getNotNullValue(List list, int index) { @@ -512,7 +522,7 @@ class Utils { border: Border.all( width: w, // color: color // <--- border width here - ), + ), borderRadius: BorderRadius.circular(radius), ); } @@ -535,7 +545,7 @@ class Utils { border: Border.all( width: 1, // color: color // <--- border width here - ), + ), borderRadius: BorderRadius.circular(radius), ); } @@ -553,7 +563,8 @@ class Utils { } static String getAdsPaymentBrowserForm({required int paymentId, required int adId}) { - return '
'; + return '
'; } // BOTTOM SHEETS @@ -577,15 +588,27 @@ class Utils { ); } - static Widget buildStatusContainer(String text) { + static Widget buildStatusContainer(String text, {double marginAll = 8, double fontSize = 14}) { return Center( - child: text.toText(color: MyColors.lightTextColor, fontSize: 14), + child: text.toText(color: MyColors.lightTextColor, fontSize: fontSize), ).toContainer( - marginAll: 8, + marginAll: marginAll, paddingAll: 15, borderRadius: 8, width: double.infinity, backgroundColor: MyColors.grey98Color.withOpacity(0.1), ); } + + static Future openLocationInMaps({required double latitude, required double longitude}) async { + final Uri googleMapsUrl = Uri.parse('https://www.google.com/maps/search/?api=1&query=$latitude,$longitude'); + + if (await canLaunchUrl(googleMapsUrl)) { + try { + await launchUrl(googleMapsUrl); + } catch (e) { + await launchUrl(googleMapsUrl); + } + } + } } diff --git a/lib/view_models/appointments_view_model.dart b/lib/view_models/appointments_view_model.dart index 0cbc64f..a690fac 100644 --- a/lib/view_models/appointments_view_model.dart +++ b/lib/view_models/appointments_view_model.dart @@ -149,7 +149,7 @@ class AppointmentsVM extends BaseVM { navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.appointment); } else { Utils.showToast(LocaleKeys.appointmentBookedSuccessfully.tr()); - getMyAppointments(); + getMyAppointmentsForCustomer(); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); } } @@ -181,9 +181,9 @@ class AppointmentsVM extends BaseVM { context.read().onNavbarTapped(1); applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled); Utils.showToast(genericRespModel.message.toString()); - await getMyAppointments(); + await getMyAppointmentsForCustomer(); Utils.hideLoading(context); - getMyAppointments(); + getMyAppointmentsForCustomer(); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); } } catch (e) { @@ -350,7 +350,7 @@ class AppointmentsVM extends BaseVM { // notifyListeners(); // } - Future getMyAppointments({bool isNeedToRebuild = false}) async { + Future getMyAppointmentsForCustomer({bool isNeedToRebuild = false}) async { if (isNeedToRebuild) setState(ViewState.busy); myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters(); @@ -383,7 +383,9 @@ class AppointmentsVM extends BaseVM { setState(ViewState.busy); myAppointments = await appointmentRepo.getMyAppointmentsForProvider(map); myFilteredAppointments = myAppointments; - myUpComingAppointments = myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.confirmed && (DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now()))).toList(); + myUpComingAppointments = myAppointments + .where((element) => (element.appointmentStatusEnum == AppointmentStatusEnum.confirmed || element.appointmentStatusEnum == AppointmentStatusEnum.booked) && (DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now()))) + .toList(); applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true); setState(ViewState.idle); } @@ -802,7 +804,7 @@ class AppointmentsVM extends BaseVM { context.read().onNavbarTapped(1); applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled); Utils.showToast(genericRespModel.message.toString()); - getMyAppointments(); + getMyAppointmentsForCustomer(); Utils.hideLoading(context); navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard); } @@ -1419,7 +1421,7 @@ class AppointmentsVM extends BaseVM { appointmentFilterBranchSearchHistory.clear(); appointmentFiltersCounter = 0; clearAppointmentFilterSelections(); - getMyAppointments(); + getMyAppointmentsForCustomer(); notifyListeners(); } diff --git a/lib/view_models/dashboard_view_model_customer.dart b/lib/view_models/dashboard_view_model_customer.dart index b17f536..d366d6d 100644 --- a/lib/view_models/dashboard_view_model_customer.dart +++ b/lib/view_models/dashboard_view_model_customer.dart @@ -65,7 +65,7 @@ class DashboardVmCustomer extends BaseVM { appointmentsVM.populateAppointmentsFilterList(); adVM.populateAdsFilterList(); requestsVM.populateDataForRequestsFilter(); - await appointmentsVM.getMyAppointments(); + await appointmentsVM.getMyAppointmentsForCustomer(); await appointmentsVM.applyFilterOnBranches(index: 0); // to get all branches! await appointmentsVM.getMyRecentBranches(); // to get my recent branches! await adVM.getMyAds(); diff --git a/lib/view_models/requests_view_model.dart b/lib/view_models/requests_view_model.dart index 9d21f92..7eaa8a4 100644 --- a/lib/view_models/requests_view_model.dart +++ b/lib/view_models/requests_view_model.dart @@ -626,7 +626,7 @@ class RequestsVM extends BaseVM { bool isCountryFetching = false; //Request Management - String price = "0.0"; + String price = "1.0"; String description = ""; String address = ""; String model = ""; diff --git a/lib/view_models/service_view_model.dart b/lib/view_models/service_view_model.dart index 8d41a6b..3b24fc4 100644 --- a/lib/view_models/service_view_model.dart +++ b/lib/view_models/service_view_model.dart @@ -149,7 +149,7 @@ class ServiceVM extends BaseVM { // } // } - final BranchDetailModel currentBranch = homePageBranches.firstWhere((element) => element.id == selectedBranchId); + final BranchDetailModel currentBranch = branches!.data!.serviceProviderBranch!.firstWhere((element) => element.id == selectedBranchId); for (var element in currentBranch.branchServices!) { categories.add( CategoryData( diff --git a/lib/view_models/user_view_model.dart b/lib/view_models/user_view_model.dart index a422f6a..51cf91b 100644 --- a/lib/view_models/user_view_model.dart +++ b/lib/view_models/user_view_model.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:developer'; import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:file_picker/file_picker.dart'; @@ -349,6 +350,7 @@ class UserVM extends BaseVM { } Future performBasicOtpLoginSelectionPage(BuildContext context, {required String userToken, required AppType appType, String? loginType}) async { + log("loginType: $loginType"); if (loginType == "3" || loginType == "4") { //Utils.showLoading(context); LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, loginType!); @@ -431,6 +433,9 @@ class UserVM extends BaseVM { } else { Utils.showToast(LocaleKeys.onlyCustomerApp.tr()); } + } else { + Utils.showToast("Please verify your credentials and role type."); + } } else { Utils.showToast(verifiedUser.message ?? ""); @@ -678,9 +683,12 @@ class UserVM extends BaseVM { AppState().getUser.data!.userInfo!.userImageUrl = null; } AppState().setUser = null; - AppState().setproviderSubscription = null; - context.read().mySubscriptionsBySp.clear(); - context.read().allSubscriptions = SubscriptionModel(); + if (AppState().currentAppType == AppType.provider) { + AppState().setproviderSubscription = null; + context.read().mySubscriptionsBySp.clear(); + context.read().allSubscriptions = SubscriptionModel(); + } + navigateReplaceWithNameUntilRoute(context, AppRoutes.registerSelection); } } diff --git a/lib/views/advertisement/components/ads_list_widget.dart b/lib/views/advertisement/components/ads_list_widget.dart index b2d2c9e..fd14790 100644 --- a/lib/views/advertisement/components/ads_list_widget.dart +++ b/lib/views/advertisement/components/ads_list_widget.dart @@ -30,7 +30,6 @@ class AdsListWidget extends StatelessWidget { @override Widget build(BuildContext context) { - if (isAdsFragment && adsList.isEmpty) { return Column( mainAxisAlignment: MainAxisAlignment.center, @@ -139,11 +138,7 @@ class AdCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, children: [ (adDetails.vehicle!.cityName ?? "").toText(color: MyColors.lightTextColor), - adDetails.createdOn != null - ? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText( - color: MyColors.lightTextColor, - ) - : const SizedBox(), + adDetails.createdOn != null ? DateTime.parse(adDetails.createdOn!).getTimeAgo().toText(color: MyColors.lightTextColor) : const SizedBox(), ], ), ], diff --git a/lib/views/requests/create_request_page.dart b/lib/views/requests/create_request_page.dart index af66080..4ebe016 100644 --- a/lib/views/requests/create_request_page.dart +++ b/lib/views/requests/create_request_page.dart @@ -26,7 +26,6 @@ class CreateRequestPage extends StatelessWidget { @override Widget build(BuildContext context) { - log("AppState().getUser.data!.userInfo :${AppState().getUser.data!.userInfo.toString()}"); return Scaffold( appBar: CustomAppBar( title: LocaleKeys.createRequest.tr(), @@ -223,11 +222,13 @@ class CreateRequestPage extends StatelessWidget { ), 8.height, ], - DottedRectContainer( - onTap: () => context.read().pickMultipleImages(), - text: LocaleKeys.attachImage.tr(), - icon: MyAssets.attachmentIcon.buildSvg(), - ), + if (requestsVM.pickedVehicleImages.isEmpty) ...[ + DottedRectContainer( + onTap: () => context.read().pickMultipleImages(), + text: LocaleKeys.attachImage.tr(), + icon: MyAssets.attachmentIcon.buildSvg(), + ), + ], if (requestsVM.vehicleImageError != "") ...[ 10.height, Row( diff --git a/lib/views/requests/request_bottomsheets.dart b/lib/views/requests/request_bottomsheets.dart index 00fada3..ce26d33 100644 --- a/lib/views/requests/request_bottomsheets.dart +++ b/lib/views/requests/request_bottomsheets.dart @@ -48,7 +48,6 @@ Future buildSendOfferBottomSheet({required BuildContext context, required Reques TxtField( value: requestsVM.serviceItem, errorValue: requestsVM.offerPriceError, - keyboardType: TextInputType.number, hint: LocaleKeys.serviceItem.tr(), onChanged: (v) => requestsVM.updateServiceItem(v), ), @@ -56,7 +55,6 @@ Future buildSendOfferBottomSheet({required BuildContext context, required Reques TxtField( value: requestsVM.itemManufacturer, errorValue: requestsVM.offerPriceError, - keyboardType: TextInputType.number, hint: LocaleKeys.createdBy.tr(), onChanged: (v) => requestsVM.updateItemManufacturer(v), ), diff --git a/lib/widgets/common_widgets/card_button_with_icon.dart b/lib/widgets/common_widgets/card_button_with_icon.dart index 65b666c..873ddaf 100644 --- a/lib/widgets/common_widgets/card_button_with_icon.dart +++ b/lib/widgets/common_widgets/card_button_with_icon.dart @@ -18,19 +18,18 @@ class CardButtonWithIcon extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: 110, - width: 110, + // height: 150, + width: 150, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ icon, - // 16.height, title.toText( fontSize: 11, isBold: true, textAlign: TextAlign.left, - ) + ).paddingOnly(top: 10) ], ).toWhiteContainer(allPading: 12, width: double.infinity).onPress(onCardTapped), ); diff --git a/lib/widgets/dialog/otp_dialog.dart b/lib/widgets/dialog/otp_dialog.dart index 6f1da1a..dc15ea9 100644 --- a/lib/widgets/dialog/otp_dialog.dart +++ b/lib/widgets/dialog/otp_dialog.dart @@ -97,7 +97,7 @@ class _OtpDialogState extends State { height: 1.2, ), ), - Text(" " + LocaleKeys.sec.tr()), + Text(" ${LocaleKeys.sec.tr()}"), ], ), ),