Merge branch 'faiz_development' into aamir_dev

aamir_dev
Aamir 12 months ago
commit 3fe34a6c0f

@ -5,7 +5,8 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:icon="@mipmap/ic_launcher"

@ -1,11 +1,11 @@
import 'package:car_customer_app/views/branches/branch_detail_view.dart';
import 'package:car_customer_app/views/branches/favourite_list_view.dart';
import 'package:car_customer_app/views/branches/provider_profile_view.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/views/appointments/appointment_detail_view.dart';
import 'package:mc_common_app/views/appointments/book_appointment_schedules_view.dart';
import 'package:mc_common_app/views/appointments/book_appointment_services_view.dart';
import 'package:mc_common_app/views/appointments/book_appointments_item_view.dart';
import 'package:mc_common_app/views/appointments/pick_items_view.dart';
import 'package:mc_common_app/views/appointments/review_appointment_view.dart';
import 'package:car_customer_app/views/dashboard/dashboard_view.dart';
import 'package:flutter/cupertino.dart';
@ -17,8 +17,7 @@ import 'package:mc_common_app/views/appointments/appointments_filter_view.dart';
class CustomerAppRoutes {
static final Map<String, WidgetBuilder> routes = {
AppRoutes.dashboard: (context) => DashboardView(),
AppRoutes.bookProviderAppView: (context) => BookProviderAppView(),
AppRoutes.dashboard: (context) => DashboardView(dashboardRouteEnum: ModalRoute.of(context)!.settings.arguments as DashboardRouteEnum),
AppRoutes.appointmentDetailView: (context) => AppointmentDetailView(appointmentListModel: ModalRoute.of(context)!.settings.arguments as AppointmentListModel),
AppRoutes.bookAppointmenServicesView: (context) => BookAppointmentServicesView(),
AppRoutes.bookAppointmenSchedulesView: (context) => BookAppointmentSchedulesView(

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:car_customer_app/views/branches/components/branch_reviews_widget.dart';
import 'package:car_customer_app/views/branches/components/items_list_sheet.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@ -106,25 +107,35 @@ class _BranchDetailViewState extends State<BranchDetailView> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
LocaleKeys.openMapLocation.tr().toText(
fontSize: 12,
isBold: true,
color: MyColors.primaryColor,
isUnderLine: true,
),
4.width,
Image.asset(
MyAssets.icRightUpPng,
height: 6,
width: 6,
color: MyColors.primaryColor,
),
],
).padding(EdgeInsets.symmetric(vertical: 6, horizontal: 2)),
if ((widget.branchDetailModel.latitude != null && widget.branchDetailModel.latitude!.isNotEmpty) && (widget.branchDetailModel.longitude != null && widget.branchDetailModel.longitude!.isNotEmpty)) ...[
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
LocaleKeys.openMapLocation.tr().toText(
fontSize: 12,
isBold: true,
color: MyColors.primaryColor,
isUnderLine: true,
),
4.width,
Image.asset(
MyAssets.icRightUpPng,
height: 6,
width: 6,
color: MyColors.primaryColor,
),
],
).padding(EdgeInsets.symmetric(vertical: 6, horizontal: 2)).onPress(() async {
double latitude, longitude = 0.0;
latitude = double.parse(widget.branchDetailModel.latitude!);
longitude = double.parse(widget.branchDetailModel.longitude!);
await Utils.openLocationInMaps(latitude: latitude, longitude: longitude);
}),
] else ...[
SizedBox(),
],
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -169,11 +180,15 @@ class _BranchDetailViewState extends State<BranchDetailView> {
),
ShowFillButton(
maxHeight: 55,
// isDisabled: widget.branchDetailModel.branchServices!.length == 0,
isDisabled: widget.branchDetailModel.branchServices!.length == 0,
title: LocaleKeys.bookAppointment.tr(),
margin: EdgeInsets.all(12),
maxWidth: double.infinity,
onPressed: () {
if (widget.branchDetailModel.branchServices!.length == 0) {
Utils.showToast(LocaleKeys.noServicesAvailable.tr());
return;
}
navigateWithName(context, AppRoutes.bookAppointmenServicesView);
context.read<AppointmentsVM>().updateSelectedBranch(widget.branchDetailModel);
},

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/services_models/item_model.dart';
import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:flutter/material.dart';
@ -14,19 +15,19 @@ import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
class ItemsListSheet extends StatefulWidget {
final int serviceId;
final int serviceProviderServiceId;
ItemsListSheet(this.serviceId);
ItemsListSheet(this.serviceProviderServiceId);
@override
State<ItemsListSheet> createState() => _ItemsListSheetState();
}
class _ItemsListSheetState extends State<ItemsListSheet> {
void initState() {
void initState() {
super.initState();
scheduleMicrotask(() {
context.read<AppointmentsVM>().getServiceItems(widget.serviceId);
context.read<AppointmentsVM>().getServiceItems(widget.serviceProviderServiceId);
});
}
@ -40,7 +41,7 @@ class _ItemsListSheetState extends State<ItemsListSheet> {
return Center(child: CircularProgressIndicator());
}
return appointmentsVM.serviceItemsFromApi.isEmpty
? EmptyWidget(text: LocaleKeys.noItemstoShow.tr(), isWrappedColumn: false)
? EmptyWidget(text: LocaleKeys.noItemsToShow.tr(), isWrappedColumn: false)
: ListView.separated(
itemCount: appointmentsVM.serviceItemsFromApi.length,
itemBuilder: (BuildContext context, int index) {
@ -57,7 +58,11 @@ class _ItemsListSheetState extends State<ItemsListSheet> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
serviceItemModel.name.toString().toText(fontSize: 16, isBold: true),
4.height,
serviceItemModel.description.toString().toText(fontSize: 12, color: MyColors.lightTextColor),
8.height,
if (serviceItemModel.manufactureDate != null && serviceItemModel.manufactureDate!.isNotEmpty) ...[
showItem(LocaleKeys.manufacturedOn.tr() + ":", (DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(serviceItemModel.manufactureDate!))), valueColor: MyColors.darkTextColor),
],
showItem(LocaleKeys.availableforAppointment.tr() + ":", (serviceItemModel.isAllowAppointment ?? false) ? "Yes" : "No", valueColor: Colors.green),
showItem(LocaleKeys.allowingWorkshopService.tr() + ":", (serviceItemModel.isAppointmentCompanyLoc ?? false) ? "Yes" : "No", valueColor: Colors.green),
showItem(LocaleKeys.allowingHomeService.tr() + ":", (serviceItemModel.isAppointmentCustomerLoc ?? false) ? "Yes" : "No", valueColor: Colors.green),
@ -104,7 +109,7 @@ class _ItemsListSheetState extends State<ItemsListSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
item.toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true),
item.toText(fontSize: 12, color: MyColors.lightTextColor),
4.width,
value.toText(fontSize: 12, color: valueColor, isBold: true),
],

@ -41,43 +41,49 @@ class _FavoriteListViewState extends State<FavoriteListView> {
title: LocaleKeys.favoriteList.tr(),
isRemoveBackButton: false,
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: Column(
children: [
Expanded(
child: Container(
width: double.infinity,
child: appointmentsVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator())
: appointmentsVM.myFavProvidersList.isEmpty
? Center(
child: (LocaleKeys.noProvidersInFav.tr()).toText(
fontSize: 16,
color: MyColors.lightTextColor,
body: RefreshIndicator(
onRefresh: () async {
await context.read<AppointmentsVM>().getMyFavoriteProviders();
},
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Column(
children: [
Expanded(
child: Container(
width: double.infinity,
child: appointmentsVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator())
: appointmentsVM.myFavProvidersList.isEmpty
? Center(
child: (LocaleKeys.noProvidersInFav.tr()).toText(
fontSize: 16,
color: MyColors.lightTextColor,
),
)
: ListView.separated(
itemCount: appointmentsVM.myFavProvidersList.length,
itemBuilder: (context, index) {
ProviderProfileModel providerProfileModel = appointmentsVM.myFavProvidersList[index];
return ProviderDetailCard(
isFromFavoriteList: true,
onCardTapped: () => navigateWithName(context, AppRoutes.providerProfileView, arguments: providerProfileModel.providerID),
providerImageUrl: MyAssets.bnCar,
title: providerProfileModel.name ?? "",
description: providerProfileModel.companyDescription ?? "",
startedSince: DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(providerProfileModel.memberSince ?? ""))),
branches: providerProfileModel.serviceProviderBranch ?? [],
totalBranches: (providerProfileModel.noOfBranches ?? 0).toString(),
);
},
separatorBuilder: (context, index) => 12.height,
padding: const EdgeInsets.all(12),
),
)
: ListView.separated(
itemCount: appointmentsVM.myFavProvidersList.length,
itemBuilder: (context, index) {
ProviderProfileModel providerProfileModel = appointmentsVM.myFavProvidersList[index];
return ProviderDetailCard(
onCardTapped: () => navigateWithName(context, AppRoutes.providerProfileView, arguments: providerProfileModel.providerID),
providerImageUrl: MyAssets.bnCar,
title: providerProfileModel.name ?? "",
description: providerProfileModel.companyDescription ?? "",
startedSince: DateHelper.formatAsMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(providerProfileModel.memberSince ?? ""))),
branches: providerProfileModel.serviceProviderBranch ?? [],
totalBranches: (providerProfileModel.noOfBranches ?? 0).toString(),
);
},
separatorBuilder: (context, index) => 12.height,
padding: const EdgeInsets.all(12),
),
).paddingOnly(left: 10, right: 10),
),
],
).paddingOnly(left: 10, right: 10),
),
],
),
),
),
);

@ -1,8 +1,10 @@
import 'dart:async';
import 'dart:developer';
import 'package:car_customer_app/views/dashboard/fragments/appointments_fragment.dart';
import 'package:car_customer_app/views/dashboard/fragments/home_fragment.dart';
import 'package:car_customer_app/views/dashboard/widgets/bottom_nav_bar.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/view_models/dashboard_view_model_customer.dart';
import 'package:mc_common_app/views/common_fragments/requests_fragment.dart';
import 'package:provider/provider.dart';
@ -10,7 +12,9 @@ import 'fragments/branches_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<DashboardView> createState() => _DashboardViewState();
@ -24,7 +28,7 @@ class _DashboardViewState extends State<DashboardView> {
void initState() {
super.initState();
dashboardVM = Provider.of<DashboardVmCustomer>(context, listen: false);
scheduleMicrotask(() => dashboardVM.onRefresh(context));
scheduleMicrotask(() => dashboardVM.onRefresh(context, dashboardRouteEnum: widget.dashboardRouteEnum));
}
@override

@ -59,7 +59,7 @@ class AppointmentsFragment extends StatelessWidget {
Expanded(
child: RefreshIndicator(
onRefresh: () async {
appointmentsVM.getMyAppointments();
appointmentsVM.getMyAppointmentsForCustomer(isNeedToRebuild: true);
},
child: appointmentsVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator())
@ -68,6 +68,20 @@ class AppointmentsFragment extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
LocaleKeys.noAppointmentstoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
if (appointmentsVM.appointmentFiltersCounter > 0) ...[
8.height,
InkWell(
onTap: () async {
appointmentsVM.clearAppointmentFilters();
await appointmentsVM.getMyAppointmentsForCustomer(isNeedToRebuild: true);
},
child: LocaleKeys.clearFilters.tr().toText(
fontSize: 14,
isBold: true,
color: MyColors.darkPrimaryColor,
),
),
],
],
)
: ListView.separated(

@ -32,7 +32,7 @@ class CustomBottomNavbar extends StatelessWidget {
color: MyColors.lightIconColor,
).paddingAll(5),
activeIcon: SvgPicture.asset(MyAssets.homeIcon, color: MyColors.darkIconColor).paddingAll(5),
label: LocaleKeys.home.tr(),
label: LocaleKeys.explore.tr(),
),
BottomNavigationBarItem(
icon: SvgPicture.asset(MyAssets.announcementIcon).paddingAll(5),

Loading…
Cancel
Save