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

@@ -1,7 +1,7 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' hide Trans;
import '../constant/collection_name.dart';
import '../models/onprovider_order_model.dart';
import '../models/provider_serivce_model.dart';
@@ -20,7 +20,8 @@ class OnDemandReviewController extends GetxController {
final TextEditingController comment = TextEditingController();
final Rxn<UserModel> provider = Rxn<UserModel>();
final Rxn<ProviderServiceModel> providerServiceModel = Rxn<ProviderServiceModel>();
final Rxn<ProviderServiceModel> providerServiceModel =
Rxn<ProviderServiceModel>();
final Rxn<WorkerModel> workerModel = Rxn<WorkerModel>();
final RxInt providerReviewCount = 0.obs;
@@ -46,14 +47,20 @@ class OnDemandReviewController extends GetxController {
void getReview() async {
// Get existing rating
if (reviewFor.value == "Provider") {
RatingModel? value = await FireStoreUtils.getReviewsByProviderID(order.value!.id, order.value!.provider.author.toString());
RatingModel? value = await FireStoreUtils.getReviewsByProviderID(
order.value!.id,
order.value!.provider.author.toString(),
);
if (value != null) {
ratingModel.value = value;
ratings.value = value.rating ?? 0.0;
comment.text = value.comment ?? '';
}
} else {
RatingModel? value = await FireStoreUtils.getReviewsByWorkerID(order.value!.id, order.value!.workerId.toString());
RatingModel? value = await FireStoreUtils.getReviewsByWorkerID(
order.value!.id,
order.value!.workerId.toString(),
);
if (value != null) {
ratingModel.value = value;
ratings.value = value.rating ?? 0.0;
@@ -63,7 +70,9 @@ class OnDemandReviewController extends GetxController {
// Worker review logic
if (reviewFor.value == "Worker") {
WorkerModel? value = await FireStoreUtils.getWorker(order.value!.workerId.toString());
WorkerModel? value = await FireStoreUtils.getWorker(
order.value!.workerId.toString(),
);
if (value != null) {
workerModel.value = value;
@@ -71,25 +80,35 @@ class OnDemandReviewController extends GetxController {
final double existingSum = (value.reviewsSum ?? 0.0).toDouble();
final double oldRating = ratingModel.value?.rating ?? 0.0;
workerReviewCount.value = ratingModel.value != null ? (existingCount - 1) : existingCount;
workerReviewSum.value = ratingModel.value != null ? (existingSum - oldRating) : existingSum;
workerReviewCount.value =
ratingModel.value != null ? (existingCount - 1) : existingCount;
workerReviewSum.value =
ratingModel.value != null ? (existingSum - oldRating) : existingSum;
}
}
// Provider & service review logic
else {
UserModel? user = await FireStoreUtils.getUserProfile(order.value!.provider.author.toString());
UserModel? user = await FireStoreUtils.getUserProfile(
order.value!.provider.author.toString(),
);
if (user != null) {
provider.value = user;
final int existingCount = int.tryParse(user.reviewsCount?.toString() ?? '0') ?? 0;
final double existingSum = double.tryParse(user.reviewsSum?.toString() ?? '0.0') ?? 0.0;
final int existingCount =
int.tryParse(user.reviewsCount?.toString() ?? '0') ?? 0;
final double existingSum =
double.tryParse(user.reviewsSum?.toString() ?? '0.0') ?? 0.0;
final double oldRating = ratingModel.value?.rating ?? 0.0;
providerReviewCount.value = ratingModel.value != null ? (existingCount - 1) : existingCount;
providerReviewSum.value = ratingModel.value != null ? (existingSum - oldRating) : existingSum;
providerReviewCount.value =
ratingModel.value != null ? (existingCount - 1) : existingCount;
providerReviewSum.value =
ratingModel.value != null ? (existingSum - oldRating) : existingSum;
}
ProviderServiceModel? service = await FireStoreUtils.getCurrentProvider(order.value!.provider.id.toString());
ProviderServiceModel? service = await FireStoreUtils.getCurrentProvider(
order.value!.provider.id.toString(),
);
if (service != null) {
providerServiceModel.value = service;
@@ -97,8 +116,10 @@ class OnDemandReviewController extends GetxController {
final double existingSum = (service.reviewsSum ?? 0.0).toDouble();
final double oldRating = ratingModel.value?.rating ?? 0.0;
serviceReviewCount.value = ratingModel.value != null ? (existingCount - 1) : existingCount;
serviceReviewSum.value = ratingModel.value != null ? (existingSum - oldRating) : existingSum;
serviceReviewCount.value =
ratingModel.value != null ? (existingCount - 1) : existingCount;
serviceReviewSum.value =
ratingModel.value != null ? (existingSum - oldRating) : existingSum;
}
}
}
@@ -114,22 +135,29 @@ class OnDemandReviewController extends GetxController {
Future<void> _providerReviewSubmit() async {
ShowToastDialog.showLoader("Submit in...".tr());
providerServiceModel.value!.reviewsCount = serviceReviewCount.value + 1;
providerServiceModel.value!.reviewsSum = serviceReviewSum.value + ratings.value;
providerServiceModel.value!.reviewsSum =
serviceReviewSum.value + ratings.value;
// Convert to string only if your model field is String
provider.value!.reviewsCount = (providerReviewCount.value + 1).toString();
provider.value!.reviewsSum = (providerReviewSum.value + ratings.value).toString();
provider.value!.reviewsSum =
(providerReviewSum.value + ratings.value).toString();
RatingModel rate = RatingModel(
id: ratingModel.value?.id ?? firestore.collection(CollectionName.itemsReview).doc().id,
id:
ratingModel.value?.id ??
firestore.collection(CollectionName.itemsReview).doc().id,
productId: ratingModel.value?.productId ?? order.value!.provider.id,
comment: comment.text,
photos: ratingModel.value?.photos ?? [],
rating: ratings.value,
orderId: ratingModel.value?.orderId ?? order.value!.id,
vendorId: ratingModel.value?.vendorId ?? order.value!.provider.author.toString(),
vendorId:
ratingModel.value?.vendorId ??
order.value!.provider.author.toString(),
customerId: Constant.userModel?.id,
uname: '${Constant.userModel?.firstName ?? ''} ${Constant.userModel?.lastName ?? ''}',
uname:
'${Constant.userModel?.firstName ?? ''} ${Constant.userModel?.lastName ?? ''}',
profile: Constant.userModel?.profilePictureURL,
createdAt: Timestamp.now(),
);
@@ -148,7 +176,9 @@ class OnDemandReviewController extends GetxController {
workerModel.value!.reviewsSum = workerReviewSum.value + ratings.value;
RatingModel rate = RatingModel(
id: ratingModel.value?.id ?? firestore.collection(CollectionName.itemsReview).doc().id,
id:
ratingModel.value?.id ??
firestore.collection(CollectionName.itemsReview).doc().id,
productId: ratingModel.value?.productId ?? order.value!.provider.id,
comment: comment.text,
photos: ratingModel.value?.photos ?? [],
@@ -156,7 +186,8 @@ class OnDemandReviewController extends GetxController {
orderId: ratingModel.value?.orderId ?? order.value!.id,
driverId: ratingModel.value?.driverId ?? order.value!.workerId.toString(),
customerId: Constant.userModel?.id,
uname: '${Constant.userModel?.firstName ?? ''} ${Constant.userModel?.lastName ?? ''}',
uname:
'${Constant.userModel?.firstName ?? ''} ${Constant.userModel?.lastName ?? ''}',
profile: Constant.userModel?.profilePictureURL,
createdAt: Timestamp.now(),
);