Added Services Widget on HomeScreen

aamir_dev
faizatflutter 11 months ago
parent 27c964fc1c
commit 803e81dbc9

@ -753,8 +753,9 @@
"done": "تم",
"notice": "إشعار",
"serviceDeactivated": "تم تعطيل الخدمة",
"totalNumberOfServices": "إجمالي عدد الخدمات:",
"totalNumberOfServices": "عدد الخدمات:",
"noAvailableOfficesInCity": "لا توجد مكاتب متاحة في مدينتك لخدمتك.",
"searchByItem": "البحث حسب العنصر"
"searchByItem": "البحث حسب العنصر",
"selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.",
"tapToSelect": "Tap to select"
}

@ -751,7 +751,9 @@
"done": "Done",
"notice": "Notice",
"serviceDeactivated": "Service Deactivated",
"totalNumberOfServices": "Total number of services:",
"totalNumberOfServices": "Number of services:",
"noAvailableOfficesInCity": "There are no available offices in your city for your service.",
"searchByItem": "Search By Item"
"searchByItem": "Search By Item",
"selectBranchToCopyServices": "Select the branch to copy their items to this branch. You can modify the selection at any time.",
"tapToSelect": "Tap to select"
}

@ -769,10 +769,11 @@ class CodegenLoader extends AssetLoader{
"done": "تم",
"notice": "إشعار",
"serviceDeactivated": "تم تعطيل الخدمة",
"totalNumberOfServices": "إجمالي عدد الخدمات:",
"noAvailableOfficesInCity": "لا توجد مكاتب متاحة في مدينتك لخدمتك."
"you": "أنتم",
"searchByItem": "البحث حسب العنصر"
"totalNumberOfServices": "عدد الخدمات:",
"noAvailableOfficesInCity": "لا توجد مكاتب متاحة في مدينتك لخدمتك.",
"searchByItem": "البحث حسب العنصر",
"selectBranchToCopyServices": "حدد الفرع لنسخ العناصر الخاصة بهم إلى هذا الفرع. يمكنك تعديل الاختيار في أي وقت.",
"tapToSelect": "Tap to select"
};
static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In",
@ -1527,10 +1528,11 @@ static const Map<String,dynamic> en_US = {
"done": "Done",
"notice": "Notice",
"serviceDeactivated": "Service Deactivated",
"totalNumberOfServices": "Total number of services:",
"noAvailableOfficesInCity": "There are no available offices in your city for your service."
"you": "You",
"searchByItem": "Search By Item"
"totalNumberOfServices": "Number of services:",
"noAvailableOfficesInCity": "There are no available offices in your city for your service.",
"searchByItem": "Search By Item",
"selectBranchToCopyServices": "Select the branch to copy their items to this branch. You can modify the selection at any time.",
"tapToSelect": "Tap to select"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
}

@ -735,5 +735,7 @@ abstract class LocaleKeys {
static const totalNumberOfServices = 'totalNumberOfServices';
static const noAvailableOfficesInCity = 'noAvailableOfficesInCity';
static const searchByItem = 'searchByItem';
static const selectBranchToCopyServices = 'selectBranchToCopyServices';
static const tapToSelect = 'tapToSelect';
}

@ -1,9 +1,10 @@
class FilterListModel {
String title;
String iconUrl;
int id;
bool isSelected;
FilterListModel({required this.id, required this.isSelected, required this.title});
FilterListModel({required this.id, required this.isSelected, this.iconUrl = "", required this.title});
}
class SelectionModel {

@ -259,7 +259,7 @@ class AppointmentsVM extends BaseVM {
notifyListeners();
}
List<FilterListModel> branchesFilterOptions = [];
List<FilterListModel> branchesCategoriesFilterOptions = [];
List<ServiceModel> servicesInCurrentAppointment = [];
ServiceModel? currentServiceSelection;
@ -478,6 +478,7 @@ class AppointmentsVM extends BaseVM {
(element.appointmentStatusEnum == AppointmentStatusEnum.confirmed || element.appointmentStatusEnum == AppointmentStatusEnum.booked) &&
(DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now())))
.toList();
notifyListeners();
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true);
setState(ViewState.idle);
}
@ -626,13 +627,13 @@ class AppointmentsVM extends BaseVM {
}
Future<void> applyFilterOnBranches({required int index}) async {
if (branchesFilterOptions.isEmpty) return;
for (var value in branchesFilterOptions) {
if (branchesCategoriesFilterOptions.isEmpty) return;
for (var value in branchesCategoriesFilterOptions) {
value.isSelected = false;
}
branchesFilterOptions[index].isSelected = true;
branchesCategoriesFilterOptions[index].isSelected = true;
await getBranchesBasedOnCategoryFilters(categoryId: branchesFilterOptions[index].id);
await getBranchesBasedOnCategoryFilters(categoryId: branchesCategoriesFilterOptions[index].id);
notifyListeners();
}
@ -1019,14 +1020,14 @@ class AppointmentsVM extends BaseVM {
List<ServiceModel> branchServices = [];
Future<void> populateBranchesFilterList() async {
if (branchesFilterOptions.isNotEmpty) return;
branchesFilterOptions.clear();
if (branchesCategoriesFilterOptions.isNotEmpty) return;
branchesCategoriesFilterOptions.clear();
setOnlyState(ViewState.busy);
Category category = await branchRepo.fetchBranchCategory();
category.data?.forEach((element) {
branchesFilterOptions.add(FilterListModel(id: element.id ?? 0, isSelected: false, title: element.categoryName ?? "N/A"));
branchesCategoriesFilterOptions.add(FilterListModel(id: element.id ?? 0, isSelected: false, iconUrl: element.serviceCategoryIconUrl ?? "", title: element.categoryName ?? "N/A"));
});
branchesFilterOptions.insert(0, FilterListModel(id: 0, isSelected: true, title: "All Branches"));
branchesCategoriesFilterOptions.insert(0, FilterListModel(id: 0, isSelected: true, title: "All Branches"));
notifyListeners();
setState(ViewState.idle);
}
@ -1036,7 +1037,7 @@ class AppointmentsVM extends BaseVM {
if (isNeedToRebuild) setState(ViewState.busy);
if (isFromRefresh) {
var selectedFilter = branchesFilterOptions.firstWhere((element) => element.isSelected);
var selectedFilter = branchesCategoriesFilterOptions.firstWhere((element) => element.isSelected);
log("selectedFilter: ${selectedFilter.id}");
if (selectedFilter.id == 0) {

@ -21,12 +21,14 @@ class AdsListWidget extends StatelessWidget {
final ScrollPhysics? scrollPhysics;
final bool isAdsFragment;
final bool shouldShowAdStatus;
final Function() onFetchMoreAds;
const AdsListWidget({
super.key,
required this.adsList,
this.scrollPhysics,
required this.shouldShowAdStatus,
required this.onFetchMoreAds,
this.scrollPhysics,
this.isAdsFragment = false,
});

@ -26,7 +26,7 @@ import 'package:sizer/sizer.dart';
class CommonAppointmentSliderWidget extends StatelessWidget {
final Function(AppointmentListModel)? onAppointmentClick;
const CommonAppointmentSliderWidget({Key? key, this.onAppointmentClick}) : super(key: key);
const CommonAppointmentSliderWidget({super.key, this.onAppointmentClick});
Widget getCarouselSliderWidget(AppType appType, AppointmentsVM appointmentsVM) {
return CarouselSlider.builder(
@ -95,7 +95,7 @@ class AppointmentHomeTileWidget extends StatelessWidget {
final AppointmentListModel? appointmentListModel;
final Function()? onTapped;
const AppointmentHomeTileWidget({Key? key, this.isForProvider = false, this.onTapped, required this.appointmentListModel, this.isForCustomerHome = false}) : super(key: key);
const AppointmentHomeTileWidget({super.key, this.isForProvider = false, this.onTapped, required this.appointmentListModel, this.isForCustomerHome = false});
Widget showServices(String title, String icon, {bool isMoreText = false}) {
return Row(
@ -227,7 +227,7 @@ class AppointmentFragmentTileWidget extends StatelessWidget {
final AppointmentListModel? appointmentListModel;
final Function()? onTapped;
const AppointmentFragmentTileWidget({Key? key, this.onTapped, required this.appointmentListModel}) : super(key: key);
const AppointmentFragmentTileWidget({super.key, this.onTapped, required this.appointmentListModel});
Widget showServices(String title, String icon, {bool isMoreText = false}) {
return Row(

@ -135,7 +135,12 @@ class AdsFragment extends StatelessWidget {
},
child: adVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator())
: AdsListWidget(isAdsFragment: true, shouldShowAdStatus: !adVM.isExploreAdsTapped, adsList: getAdsList(adVM)),
: AdsListWidget(
isAdsFragment: true,
shouldShowAdStatus: !adVM.isExploreAdsTapped,
adsList: getAdsList(adVM),
onFetchMoreAds: () {},
),
),
)
],

@ -1,14 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
class DropDownText extends StatelessWidget {
String title;
final String title;
final bool showDropDownIcon;
DropDownText(this.title, {super.key});
DropDownText({required this.title, required this.showDropDownIcon, super.key});
@override
Widget build(BuildContext context) {
@ -20,7 +19,8 @@ class DropDownText extends StatelessWidget {
fontSize: 16,
letterSpacing: -0.64,
),
const Icon(Icons.keyboard_arrow_down_outlined),
if (showDropDownIcon)
const Icon(Icons.keyboard_arrow_down_outlined),
],
).toContainer(
isEnabledBorder: true,

Loading…
Cancel
Save