BASE: Update Icons & Name Of The App.
This commit is contained in:
@@ -4,7 +4,7 @@ import 'package:customer/models/favorite_ondemand_service_model.dart';
|
||||
import 'package:customer/models/provider_serivce_model.dart';
|
||||
import 'package:customer/screen_ui/auth_screens/login_screen.dart';
|
||||
import 'package:customer/service/fire_store_utils.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get.dart' hide Trans;
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import '../constant/constant.dart';
|
||||
|
||||
@@ -40,24 +40,31 @@ class OnDemandHomeController extends GetxController {
|
||||
// Fetch provider services
|
||||
FireStoreUtils.getProviderFuture()
|
||||
.then((providerServiceList) {
|
||||
Set<String?> uniqueAuthorIds = providerServiceList.map((service) => service.author).toSet();
|
||||
Set<String?> uniqueAuthorIds =
|
||||
providerServiceList.map((service) => service.author).toSet();
|
||||
List<String?> listOfUniqueProviders = uniqueAuthorIds.toList();
|
||||
|
||||
List<ProviderServiceModel> filteredProviders = [];
|
||||
|
||||
for (var provider in listOfUniqueProviders) {
|
||||
List<ProviderServiceModel> filteredList = providerServiceList.where((service) => service.author == provider).toList();
|
||||
List<ProviderServiceModel> filteredList =
|
||||
providerServiceList
|
||||
.where((service) => service.author == provider)
|
||||
.toList();
|
||||
|
||||
filteredList.sort((a, b) => a.createdAt!.compareTo(b.createdAt!));
|
||||
|
||||
for (int index = 0; index < filteredList.length; index++) {
|
||||
final service = filteredList[index];
|
||||
|
||||
if (Constant.isSubscriptionModelApplied == true || Constant.sectionConstantModel?.adminCommision?.isEnabled == true) {
|
||||
if (Constant.isSubscriptionModelApplied == true ||
|
||||
Constant.sectionConstantModel?.adminCommision?.isEnabled ==
|
||||
true) {
|
||||
if (service.subscriptionPlan?.itemLimit == "-1") {
|
||||
filteredProviders.add(service);
|
||||
} else {
|
||||
if (index < int.parse(service.subscriptionPlan?.itemLimit ?? '0')) {
|
||||
if (index <
|
||||
int.parse(service.subscriptionPlan?.itemLimit ?? '0')) {
|
||||
filteredProviders.add(service);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +82,9 @@ class OnDemandHomeController extends GetxController {
|
||||
isLoading.value = false;
|
||||
});
|
||||
|
||||
FireStoreUtils.getFavouritesServiceList(FireStoreUtils.getCurrentUid()).then((favList) {
|
||||
FireStoreUtils.getFavouritesServiceList(
|
||||
FireStoreUtils.getCurrentUid(),
|
||||
).then((favList) {
|
||||
lstFav.value = favList;
|
||||
});
|
||||
}
|
||||
@@ -85,7 +94,9 @@ class OnDemandHomeController extends GetxController {
|
||||
if (categoryId == null || categoryId.isEmpty) return null;
|
||||
|
||||
// Try to find category from cached list
|
||||
CategoryModel? cat = categories.firstWhereOrNull((element) => element.id == categoryId);
|
||||
CategoryModel? cat = categories.firstWhereOrNull(
|
||||
(element) => element.id == categoryId,
|
||||
);
|
||||
|
||||
// If not found, fetch from Firestore
|
||||
cat ??= await FireStoreUtils.getCategoryById(categoryId);
|
||||
@@ -94,29 +105,34 @@ class OnDemandHomeController extends GetxController {
|
||||
return cat;
|
||||
}
|
||||
|
||||
RxList<FavouriteOndemandServiceModel> lstFav = <FavouriteOndemandServiceModel>[].obs;
|
||||
RxList<FavouriteOndemandServiceModel> lstFav =
|
||||
<FavouriteOndemandServiceModel>[].obs;
|
||||
|
||||
void toggleFavourite(ProviderServiceModel provider) {
|
||||
if (Constant.userModel == null) {
|
||||
Get.to(LoginScreen());
|
||||
} else {
|
||||
var contain = lstFav.where((element) => element.service_id == provider.id);
|
||||
var contain = lstFav.where(
|
||||
(element) => element.service_id == provider.id,
|
||||
);
|
||||
if (contain.isNotEmpty) {
|
||||
FavouriteOndemandServiceModel favouriteModel = FavouriteOndemandServiceModel(
|
||||
section_id: provider.sectionId,
|
||||
service_id: provider.id,
|
||||
user_id: FireStoreUtils.getCurrentUid(),
|
||||
serviceAuthorId: provider.author,
|
||||
);
|
||||
FavouriteOndemandServiceModel favouriteModel =
|
||||
FavouriteOndemandServiceModel(
|
||||
section_id: provider.sectionId,
|
||||
service_id: provider.id,
|
||||
user_id: FireStoreUtils.getCurrentUid(),
|
||||
serviceAuthorId: provider.author,
|
||||
);
|
||||
FireStoreUtils.removeFavouriteOndemandService(favouriteModel);
|
||||
lstFav.removeWhere((item) => item.service_id == provider.id);
|
||||
} else {
|
||||
FavouriteOndemandServiceModel favouriteModel = FavouriteOndemandServiceModel(
|
||||
section_id: provider.sectionId,
|
||||
service_id: provider.id,
|
||||
user_id: FireStoreUtils.getCurrentUid(),
|
||||
serviceAuthorId: provider.author,
|
||||
);
|
||||
FavouriteOndemandServiceModel favouriteModel =
|
||||
FavouriteOndemandServiceModel(
|
||||
section_id: provider.sectionId,
|
||||
service_id: provider.id,
|
||||
user_id: FireStoreUtils.getCurrentUid(),
|
||||
serviceAuthorId: provider.author,
|
||||
);
|
||||
FireStoreUtils.setFavouriteOndemandSection(favouriteModel);
|
||||
lstFav.add(favouriteModel);
|
||||
}
|
||||
@@ -127,7 +143,13 @@ class OnDemandHomeController extends GetxController {
|
||||
await FireStoreUtils.getZone().then((value) {
|
||||
if (value != null) {
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
if (Constant.isPointInPolygon(LatLng(Constant.selectedLocation.location?.latitude ?? 0.0, Constant.selectedLocation.location?.longitude ?? 0.0), value[i].area!)) {
|
||||
if (Constant.isPointInPolygon(
|
||||
LatLng(
|
||||
Constant.selectedLocation.location?.latitude ?? 0.0,
|
||||
Constant.selectedLocation.location?.longitude ?? 0.0,
|
||||
),
|
||||
value[i].area!,
|
||||
)) {
|
||||
Constant.selectedZone = value[i];
|
||||
Constant.isZoneAvailable = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user