BASE: Update Icons & Name Of The App.

This commit is contained in:
2025-12-04 10:23:59 +05:00
parent b04050384d
commit e602782edd
228 changed files with 34364 additions and 7905 deletions

View File

@@ -13,11 +13,12 @@ import '../models/attributes_model.dart';
import '../service/cart_provider.dart';
import '../service/fire_store_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' hide Trans;
import 'package:intl/intl.dart';
class RestaurantDetailsController extends GetxController {
Rx<TextEditingController> searchEditingController = TextEditingController().obs;
Rx<TextEditingController> searchEditingController =
TextEditingController().obs;
RxBool isLoading = true.obs;
Rx<PageController> pageController = PageController().obs;
@@ -44,7 +45,8 @@ class RestaurantDetailsController extends GetxController {
}
void animateSlider() {
if (vendorModel.value.photos != null && vendorModel.value.photos!.isNotEmpty) {
if (vendorModel.value.photos != null &&
vendorModel.value.photos!.isNotEmpty) {
Timer.periodic(const Duration(seconds: 2), (Timer timer) {
if (currentPage < vendorModel.value.photos!.length - 1) {
currentPage++;
@@ -53,7 +55,11 @@ class RestaurantDetailsController extends GetxController {
}
if (pageController.value.hasClients) {
pageController.value.animateToPage(currentPage.value, duration: const Duration(milliseconds: 300), curve: Curves.easeIn);
pageController.value.animateToPage(
currentPage.value,
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
);
}
});
}
@@ -86,14 +92,25 @@ class RestaurantDetailsController extends GetxController {
RxList<BrandsModel> brandList = <BrandsModel>[].obs;
Future<void> getProduct() async {
await FireStoreUtils.getProductByVendorId(vendorModel.value.id.toString()).then((value) {
if ((Constant.isSubscriptionModelApplied == true || vendorModel.value.adminCommission?.isEnabled == true) && vendorModel.value.subscriptionPlan != null) {
await FireStoreUtils.getProductByVendorId(
vendorModel.value.id.toString(),
).then((value) {
if ((Constant.isSubscriptionModelApplied == true ||
vendorModel.value.adminCommission?.isEnabled == true) &&
vendorModel.value.subscriptionPlan != null) {
if (vendorModel.value.subscriptionPlan?.itemLimit == '-1') {
allProductList.value = value;
productList.value = value;
} else {
int selectedProduct =
value.length < int.parse(vendorModel.value.subscriptionPlan?.itemLimit ?? '0') ? (value.isEmpty ? 0 : (value.length)) : int.parse(vendorModel.value.subscriptionPlan?.itemLimit ?? '0');
value.length <
int.parse(
vendorModel.value.subscriptionPlan?.itemLimit ?? '0',
)
? (value.isEmpty ? 0 : (value.length))
: int.parse(
vendorModel.value.subscriptionPlan?.itemLimit ?? '0',
);
allProductList.value = value.sublist(0, selectedProduct);
productList.value = value.sublist(0, selectedProduct);
}
@@ -104,7 +121,9 @@ class RestaurantDetailsController extends GetxController {
});
for (var element in productList) {
await FireStoreUtils.getVendorCategoryById(element.categoryID.toString()).then((value) {
await FireStoreUtils.getVendorCategoryById(
element.categoryID.toString(),
).then((value) {
if (value != null) {
vendorCategoryList.add(value);
}
@@ -116,7 +135,10 @@ class RestaurantDetailsController extends GetxController {
});
var seen = <String>{};
vendorCategoryList.value = vendorCategoryList.where((element) => seen.add(element.id.toString())).toList();
vendorCategoryList.value =
vendorCategoryList
.where((element) => seen.add(element.id.toString()))
.toList();
}
void searchProduct(String name) {
@@ -126,25 +148,42 @@ class RestaurantDetailsController extends GetxController {
} else {
isVag.value = false;
isNonVag.value = false;
productList.value = allProductList.where((p0) => p0.name!.toLowerCase().contains(name.toLowerCase())).toList();
productList.value =
allProductList
.where(
(p0) => p0.name!.toLowerCase().contains(name.toLowerCase()),
)
.toList();
}
update();
}
void filterRecord() {
if (isVag.value == true && isNonVag.value == true) {
productList.value = allProductList.where((p0) => p0.nonveg == true || p0.nonveg == false).toList();
productList.value =
allProductList
.where((p0) => p0.nonveg == true || p0.nonveg == false)
.toList();
} else if (isVag.value == true && isNonVag.value == false) {
productList.value = allProductList.where((p0) => p0.nonveg == false).toList();
productList.value =
allProductList.where((p0) => p0.nonveg == false).toList();
} else if (isVag.value == false && isNonVag.value == true) {
productList.value = allProductList.where((p0) => p0.nonveg == true).toList();
productList.value =
allProductList.where((p0) => p0.nonveg == true).toList();
} else if (isVag.value == false && isNonVag.value == false) {
productList.value = allProductList.where((p0) => p0.nonveg == true || p0.nonveg == false).toList();
productList.value =
allProductList
.where((p0) => p0.nonveg == true || p0.nonveg == false)
.toList();
}
}
Future<List<ProductModel>> getProductByCategory(VendorCategoryModel vendorCategoryModel) async {
return productList.where((p0) => p0.categoryID == vendorCategoryModel.id).toList();
Future<List<ProductModel>> getProductByCategory(
VendorCategoryModel vendorCategoryModel,
) async {
return productList
.where((p0) => p0.categoryID == vendorCategoryModel.id)
.toList();
}
Future<void> getFavouriteList() async {
@@ -157,7 +196,9 @@ class RestaurantDetailsController extends GetxController {
favouriteItemList.value = value;
});
await FireStoreUtils.getOfferByVendorId(vendorModel.value.id.toString()).then((value) {
await FireStoreUtils.getOfferByVendorId(
vendorModel.value.id.toString(),
).then((value) {
couponList.value = value;
});
}
@@ -175,8 +216,12 @@ class RestaurantDetailsController extends GetxController {
if (day == element.day.toString()) {
if (element.timeslot!.isNotEmpty) {
for (var element in element.timeslot!) {
var start = DateFormat("dd-MM-yyyy HH:mm").parse("$date ${element.from}");
var end = DateFormat("dd-MM-yyyy HH:mm").parse("$date ${element.to}");
var start = DateFormat(
"dd-MM-yyyy HH:mm",
).parse("$date ${element.from}");
var end = DateFormat(
"dd-MM-yyyy HH:mm",
).parse("$date ${element.to}");
if (isCurrentDateInRange(start, end)) {
isOpen.value = true;
}
@@ -219,15 +264,33 @@ class RestaurantDetailsController extends GetxController {
String adOnsPrice = "0";
if (productModel.itemAttribute != null) {
if (productModel.itemAttribute!.variants!.where((element) => element.variantSku == selectedVariants.join('-')).isNotEmpty) {
if (productModel.itemAttribute!.variants!
.where((element) => element.variantSku == selectedVariants.join('-'))
.isNotEmpty) {
variantPrice = Constant.productCommissionPrice(
vendorModel.value,
productModel.itemAttribute!.variants!.where((element) => element.variantSku == selectedVariants.join('-')).first.variantPrice ?? '0',
productModel.itemAttribute!.variants!
.where(
(element) =>
element.variantSku == selectedVariants.join('-'),
)
.first
.variantPrice ??
'0',
);
}
} else {
String price = Constant.productCommissionPrice(vendorModel.value, productModel.price.toString());
String disPrice = double.parse(productModel.disPrice.toString()) <= 0 ? "0" : Constant.productCommissionPrice(vendorModel.value, productModel.disPrice.toString());
String price = Constant.productCommissionPrice(
vendorModel.value,
productModel.price.toString(),
);
String disPrice =
double.parse(productModel.disPrice.toString()) <= 0
? "0"
: Constant.productCommissionPrice(
vendorModel.value,
productModel.disPrice.toString(),
);
if (double.parse(disPrice) <= 0) {
variantPrice = price;
} else {
@@ -237,11 +300,23 @@ class RestaurantDetailsController extends GetxController {
for (int i = 0; i < productModel.addOnsPrice!.length; i++) {
if (selectedAddOns.contains(productModel.addOnsTitle![i]) == true) {
adOnsPrice = (double.parse(adOnsPrice.toString()) + double.parse(Constant.productCommissionPrice(vendorModel.value, productModel.addOnsPrice![i].toString()))).toString();
adOnsPrice =
(double.parse(adOnsPrice.toString()) +
double.parse(
Constant.productCommissionPrice(
vendorModel.value,
productModel.addOnsPrice![i].toString(),
),
))
.toString();
}
}
adOnsPrice = (quantity.value * double.parse(adOnsPrice)).toString();
mainPrice = ((double.parse(variantPrice.toString()) * double.parse(quantity.value.toString())) + double.parse(adOnsPrice.toString())).toString();
mainPrice =
((double.parse(variantPrice.toString()) *
double.parse(quantity.value.toString())) +
double.parse(adOnsPrice.toString()))
.toString();
return mainPrice;
}
@@ -253,18 +328,35 @@ class RestaurantDetailsController extends GetxController {
});
}
Future<void> addToCart({required ProductModel productModel, required String price, required String discountPrice, required bool isIncrement, required int quantity, VariantInfo? variantInfo}) async {
Future<void> addToCart({
required ProductModel productModel,
required String price,
required String discountPrice,
required bool isIncrement,
required int quantity,
VariantInfo? variantInfo,
}) async {
CartProductModel cartProductModel = CartProductModel();
String adOnsPrice = "0";
for (int i = 0; i < productModel.addOnsPrice!.length; i++) {
if (selectedAddOns.contains(productModel.addOnsTitle![i]) == true && productModel.addOnsPrice![i] != '0') {
adOnsPrice = (double.parse(adOnsPrice.toString()) + double.parse(Constant.productCommissionPrice(vendorModel.value, productModel.addOnsPrice![i].toString()))).toString();
if (selectedAddOns.contains(productModel.addOnsTitle![i]) == true &&
productModel.addOnsPrice![i] != '0') {
adOnsPrice =
(double.parse(adOnsPrice.toString()) +
double.parse(
Constant.productCommissionPrice(
vendorModel.value,
productModel.addOnsPrice![i].toString(),
),
))
.toString();
}
}
if (variantInfo != null) {
cartProductModel.id = "${productModel.id!}~${variantInfo.variantId.toString()}";
cartProductModel.id =
"${productModel.id!}~${variantInfo.variantId.toString()}";
cartProductModel.name = productModel.name!;
cartProductModel.photo = productModel.photo!;
cartProductModel.categoryId = productModel.categoryID!;