Merge branch 'refs/heads/master' into aamir_dev

aamir_dev
Aamir Muhammad 1 year ago
commit 03ccb1a60c

@ -261,6 +261,9 @@ class GlobalConsts {
static int maxFileCount = 7; static int maxFileCount = 7;
static int maxFileSizeInBytes = 2 * 1024 * 1024; static int maxFileSizeInBytes = 2 * 1024 * 1024;
static int providerDealerRoleTypeId = 6;
static int providerIndividualRoleTypeId = 5;
} }
class MyAssets { class MyAssets {

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';

@ -17,10 +17,10 @@ class AppointmentListModel {
String? customerMobileNum; String? customerMobileNum;
int? appointmentType; int? appointmentType;
AppointmentTypeEnum? appointmentTypeEnum; AppointmentTypeEnum? appointmentTypeEnum;
String? providerName; String? providerName;
String? duration; String? duration;
String? appointmentDate; String? appointmentDate;
String? appointmentCreatedOn;
String? paymentType; String? paymentType;
String? appointmentAddress; String? appointmentAddress;
String? appointmentLatitude; String? appointmentLatitude;
@ -65,6 +65,7 @@ class AppointmentListModel {
this.remainingAmount, this.remainingAmount,
this.isSelected, this.isSelected,
this.appointmentDate, this.appointmentDate,
this.appointmentCreatedOn,
this.appointmentServicesList, this.appointmentServicesList,
this.customerAppointmentList, this.customerAppointmentList,
this.mergeAppointmentList, this.mergeAppointmentList,
@ -72,7 +73,7 @@ class AppointmentListModel {
@override @override
String toString() { String toString() {
return 'AppointmentListModel{id: $id, serviceSlotID: $serviceSlotID, appointmentStatusID: $appointmentStatusID, appointmentStatusText: $appointmentStatusText, serviceProviderID: $serviceProviderID, customerID: $customerID, isActive: $isActive, isPaymentRequired: $isPaymentRequired, paymentStatus: $paymentStatus, paymentStatusText: $paymentStatusText, customerName: $customerName, providerName: $providerName, duration: $duration, appointmentDate: $appointmentDate, appointmentStatusEnum: $appointmentStatusEnum, appointmentServicesList: $appointmentServicesList}'; return 'AppointmentListModel{id: $id, serviceSlotID: $serviceSlotID, appointmentStatusID: $appointmentStatusID, appointmentStatusText: $appointmentStatusText, serviceProviderID: $serviceProviderID, customerID: $customerID, isActive: $isActive, isPaymentRequired: $isPaymentRequired, paymentStatus: $paymentStatus, paymentStatusText: $paymentStatusText, customerName: $customerName, providerName: $providerName, duration: $duration, appointmentDate: $appointmentDate,appointmentCreatedOn: $appointmentCreatedOn, appointmentStatusEnum: $appointmentStatusEnum, appointmentServicesList: $appointmentServicesList}';
} }
AppointmentListModel.fromJson(Map<String, dynamic> json) { AppointmentListModel.fromJson(Map<String, dynamic> json) {
@ -93,6 +94,7 @@ class AppointmentListModel {
providerName = json['providerName']; providerName = json['providerName'];
duration = json['duration']; duration = json['duration'];
appointmentDate = json['appointmentDate']; appointmentDate = json['appointmentDate'];
appointmentCreatedOn = json['createdOn'];
paymentType = json['paymentType']; paymentType = json['paymentType'];
appointmentAddress = json['address'] ?? ""; appointmentAddress = json['address'] ?? "";
appointmentLatitude = json['branchLatitude']; appointmentLatitude = json['branchLatitude'];

@ -28,7 +28,7 @@ class ShippingRepoImp extends ShippingRepo {
String token = appState.getUser.data!.accessToken ?? ""; String token = appState.getUser.data!.accessToken ?? "";
Map queryParameters = { Map queryParameters = {
"requestID": "${requestId ?? 0}", "requestID": "${requestId ?? 0}",
"shippingStatus": "${shippingStatusEnum != null ? shippingStatusEnum.getIdFromShippingStatusEnum() : 0}", "shippingStatus": "${shippingStatusEnum != null ? shippingStatusEnum.getIdFromShippingStatusEnum() : -1}", // -1 to get all requests
}; };
GenericRespModel genericRespModel = await apiClient.postJsonForObject( GenericRespModel genericRespModel = await apiClient.postJsonForObject(

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
@ -81,7 +82,7 @@ class CommonServicesImp implements CommonAppServices {
} }
if (imageModels.length > GlobalConsts.maxFileCount) { if (imageModels.length > GlobalConsts.maxFileCount) {
Utils.showToast(LocaleKeys.maxFileSelection); Utils.showToast(LocaleKeys.maxFileSelection.tr());
imageModels = imageModels.sublist(0, GlobalConsts.maxFileCount); // Keep only the first 7 images imageModels = imageModels.sublist(0, GlobalConsts.maxFileCount); // Keep only the first 7 images
} }

@ -4,11 +4,14 @@ import 'dart:typed_data';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/utils/date_helper.dart'; import 'package:mc_common_app/utils/date_helper.dart';
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart'; import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/views/setting_options/widgets/custom_setting_options_tile.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/info_bottom_sheet.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
@ -636,4 +639,57 @@ class Utils {
ShareResult result = await Share.share(GlobalConsts.getAppInvitationLink(), subject: 'Join Mowater'); ShareResult result = await Share.share(GlobalConsts.getAppInvitationLink(), subject: 'Join Mowater');
return result; return result;
} }
static buildProviderContactInfoBottomSheet({required BuildContext context, required String? email, required String? mobileNo}) {
return showModalBottomSheet(
context: context,
isScrollControlled: true,
enableDrag: true,
builder: (BuildContext context) {
return InfoBottomSheet(
title: LocaleKeys.contactDetails.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
description: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (mobileNo != null && mobileNo.isNotEmpty) ...[
CustomSettingOptionsTile(
leadingWidget: const Icon(
Icons.call,
size: 20,
color: MyColors.greyColor,
),
titleText: LocaleKeys.phoneNumber.tr(),
subTitle: " $mobileNo",
needBorderBelow: true,
showTrailingArrow: false,
subtitleTextColor: MyColors.greyColor,
onTap: () {
Utils.openNumberViaCaller(phoneNumber: mobileNo);
},
),
],
if (email != null && email.isNotEmpty) ...[
CustomSettingOptionsTile(
leadingWidget: const Icon(
Icons.email_outlined,
size: 20,
color: MyColors.greyColor,
),
titleText: LocaleKeys.emailAddress.tr(),
subTitle: " $email",
needBorderBelow: false,
showTrailingArrow: false,
subtitleTextColor: MyColors.greyColor,
onTap: () {
Utils.openEmailViaEmailApp(emailAddress: email);
},
),
],
30.height,
],
),
);
},
);
}
} }

@ -372,28 +372,28 @@ class AppointmentsVM extends BaseVM {
if (appointmentStatusEnum == AppointmentStatusEnum.allAppointments) { if (appointmentStatusEnum == AppointmentStatusEnum.allAppointments) {
myFilteredAppointments = myAppointments; myFilteredAppointments = myAppointments;
if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers(); if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers(myFilteredAppointments);
notifyListeners(); notifyListeners();
return; return;
} }
myFilteredAppointments = myAppointments.where((element) => element.appointmentStatusID! == appointmentStatusEnum.getIdFromAppointmentStatusEnum()).toList(); myFilteredAppointments = myAppointments.where((element) => element.appointmentStatusID! == appointmentStatusEnum.getIdFromAppointmentStatusEnum()).toList();
if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers(); if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers(myFilteredAppointments);
notifyListeners(); notifyListeners();
} }
findAppointmentsBasedOnCustomers() { findAppointmentsBasedOnCustomers(List<AppointmentListModel> appointments) {
// Use a Set to ensure uniqueness of customerIDs // Use a Set to ensure uniqueness of customerIDs
Set<int> uniqueCustomerIDs = <int>{}; Set<int> uniqueCustomerIDs = <int>{};
// Extract unique customerIDs // Extract unique customerIDs
for (var item in myFilteredAppointments) { for (var item in appointments) {
uniqueCustomerIDs.add(item.customerID ?? 0); uniqueCustomerIDs.add(item.customerID ?? 0);
} }
// Create a list of CustomerData instances // Create a list of CustomerData instances
myFilteredAppointments2 = uniqueCustomerIDs.map((id) { myFilteredAppointments2 = uniqueCustomerIDs.map((id) {
List<AppointmentListModel> list = myFilteredAppointments.where((item) => item.customerID == id).toList(); List<AppointmentListModel> list = appointments.where((item) => item.customerID == id).toList();
list.sort((a, b) => DateHelper.parseStringToDate(DateHelper.formatDateT(b.appointmentDate!)) list.sort((a, b) => DateHelper.parseStringToDate(DateHelper.formatDateT(b.appointmentDate!))
.millisecondsSinceEpoch .millisecondsSinceEpoch
.compareTo(DateHelper.parseStringToDate(DateHelper.formatDateT(a.appointmentDate!)).millisecondsSinceEpoch)); .compareTo(DateHelper.parseStringToDate(DateHelper.formatDateT(a.appointmentDate!)).millisecondsSinceEpoch));
@ -1920,8 +1920,8 @@ class AppointmentsVM extends BaseVM {
customerPhonesList: customerPhonesList, customerPhonesList: customerPhonesList,
deliveryTypeIdsList: customerDeliveryTypesList, deliveryTypeIdsList: customerDeliveryTypesList,
serviceProviderServiceIdsList: servicesIdsList, serviceProviderServiceIdsList: servicesIdsList,
fromDate: selectedDateForAppointments, fromDate: '',
toDate: selectedDateForAppointments); toDate: '');
log(" myFilteredAppointments : ${myFilteredAppointments.length}"); log(" myFilteredAppointments : ${myFilteredAppointments.length}");
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true); applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true);

@ -51,7 +51,12 @@ class ShippingManagementVM extends BaseVM {
shippingRequestFilterOptions.add(FilterListModel(title: shippingStatusEnums[i].enumValueStr, isSelected: false, id: shippingStatusEnums[i].enumValue)); shippingRequestFilterOptions.add(FilterListModel(title: shippingStatusEnums[i].enumValueStr, isSelected: false, id: shippingStatusEnums[i].enumValue));
shippingRequestStatusesList.add(FilterListModel(title: shippingStatusEnums[i].enumValueStr, isSelected: false, id: shippingStatusEnums[i].enumValue)); shippingRequestStatusesList.add(FilterListModel(title: shippingStatusEnums[i].enumValueStr, isSelected: false, id: shippingStatusEnums[i].enumValue));
} }
shippingRequestFilterOptions.insert(0, FilterListModel(title: Utils.getNameByShippingRequestStatusEnum(0.toShippingStatusEnum()), isSelected: false, id: 0));
int index = shippingRequestFilterOptions.indexWhere((element) => element.id == 0);
if (index == -1) {
log("index: $index");
shippingRequestFilterOptions.insert(0, FilterListModel(title: Utils.getNameByShippingRequestStatusEnum(0.toShippingStatusEnum()), isSelected: false, id: 0));
}
shippingRequestFilterOptions.insert(0, FilterListModel(title: Utils.getNameByShippingRequestStatusEnum(ShippingRequestStatusEnum.allRequests), isSelected: true, id: -1)); shippingRequestFilterOptions.insert(0, FilterListModel(title: Utils.getNameByShippingRequestStatusEnum(ShippingRequestStatusEnum.allRequests), isSelected: true, id: -1));
notifyListeners(); notifyListeners();
} }
@ -66,8 +71,6 @@ class ShippingManagementVM extends BaseVM {
notifyListeners(); notifyListeners();
return; return;
} }
log("shippingRequestStatusEnum.getIdFromShippingStatusEnum(): ${shippingRequestStatusEnum.getIdFromShippingStatusEnum()}");
log("shippingRequestFilterOptions: ${shippingRequestFilterOptions[shippingRequestStatusEnum.getIdFromShippingStatusEnum() + 1].title}");
shippingRequestFilterOptions[shippingRequestStatusEnum.getIdFromShippingStatusEnum() + 1].isSelected = true; // +1 to match with the index 0 index has all requests shippingRequestFilterOptions[shippingRequestStatusEnum.getIdFromShippingStatusEnum() + 1].isSelected = true; // +1 to match with the index 0 index has all requests
await getShippingRequestsListByFilters(shippingStatusEnum: shippingRequestStatusEnum); await getShippingRequestsListByFilters(shippingStatusEnum: shippingRequestStatusEnum);
notifyListeners(); notifyListeners();

@ -60,14 +60,22 @@ class VehicleDetails extends StatelessWidget {
Builder(builder: (context) { Builder(builder: (context) {
List<DropValue> vehicleSellerTypesDrop = []; List<DropValue> vehicleSellerTypesDrop = [];
for (var element in adVM.vehicleSellerTypes) { for (var element in adVM.vehicleSellerTypes) {
log("${element.id} : ${element.sellerType}");
vehicleSellerTypesDrop.add(DropValue(element.id?.toInt() ?? 0, element.sellerType ?? "", "")); vehicleSellerTypesDrop.add(DropValue(element.id?.toInt() ?? 0, element.sellerType ?? "", ""));
} }
DropValue? model; DropValue? model;
int index = -1;
if (AppState().userType == UserType.providerDealer) { if (AppState().userType == UserType.providerDealer) {
model = vehicleSellerTypesDrop.firstWhere((element) => element.id == 2); index = vehicleSellerTypesDrop.indexWhere((element) => element.id == GlobalConsts.providerDealerRoleTypeId);
} else { } else {
model = vehicleSellerTypesDrop.firstWhere((element) => element.id == 1); index = vehicleSellerTypesDrop.indexWhere((element) => element.id == GlobalConsts.providerIndividualRoleTypeId);
}
if (index == -1) {
model = vehicleSellerTypesDrop.first;
} else {
model = vehicleSellerTypesDrop[index];
} }
adVM.updateSelectionVehicleSellerTypeId(SelectionModel(selectedId: model.id, selectedOption: model.value), needRefresh: false); adVM.updateSelectionVehicleSellerTypeId(SelectionModel(selectedId: model.id, selectedOption: model.value), needRefresh: false);

@ -28,7 +28,7 @@ class ScreenArgumentsForAppointmentDetailPage {
class BookAppointmentSchedulesView extends StatelessWidget { class BookAppointmentSchedulesView extends StatelessWidget {
final ScreenArgumentsForAppointmentDetailPage screenArgumentsForAppointmentDetailPage; final ScreenArgumentsForAppointmentDetailPage screenArgumentsForAppointmentDetailPage;
const BookAppointmentSchedulesView({Key? key, required this.screenArgumentsForAppointmentDetailPage}) : super(key: key); const BookAppointmentSchedulesView({super.key, required this.screenArgumentsForAppointmentDetailPage});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart'; import 'package:mc_common_app/classes/app_state.dart';
@ -14,70 +12,13 @@ import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/utils.dart'; import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/view_models/appointments_view_model.dart';
import 'package:mc_common_app/views/setting_options/widgets/custom_setting_options_tile.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/common_widgets/info_bottom_sheet.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class ReviewAppointment extends StatelessWidget { class ReviewAppointment extends StatelessWidget {
const ReviewAppointment({Key? key}) : super(key: key); const ReviewAppointment({super.key});
// buildProviderContactInfoBottomSheet(BuildContext context) {
// final appointmentsVM = context.read<AppointmentsVM>();
// log(": ${appointmentsVM.selectedBranchModel}");
// return showModalBottomSheet(
// context: context,
// isScrollControlled: true,
// enableDrag: true,
// builder: (BuildContext context) {
// return InfoBottomSheet(
// title: LocaleKeys.contactDetails.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
// description: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// if (requestVM.currentSelectedOffer!.mobileNo != null && requestVM.currentSelectedOffer!.mobileNo!.isNotEmpty) ...[
// CustomSettingOptionsTile(
// leadingWidget: const Icon(
// Icons.call,
// size: 20,
// color: MyColors.greyColor,
// ),
// titleText: LocaleKeys.phoneNumber.tr(),
// subTitle: " ${requestVM.currentSelectedOffer!.mobileNo ?? ""}",
// needBorderBelow: true,
// showTrailingArrow: false,
// subtitleTextColor: MyColors.greyColor,
// onTap: () {
// Utils.openNumberViaCaller(phoneNumber: requestVM.currentSelectedOffer!.mobileNo ?? "");
// },
// ),
// ],
// if (requestVM.currentSelectedOffer!.email != null && requestVM.currentSelectedOffer!.email!.isNotEmpty) ...[
// CustomSettingOptionsTile(
// leadingWidget: const Icon(
// Icons.email_outlined,
// size: 20,
// color: MyColors.greyColor,
// ),
// titleText: LocaleKeys.emailAddress.tr(),
// subTitle: " ${requestVM.currentSelectedOffer!.email ?? ""}",
// needBorderBelow: false,
// showTrailingArrow: false,
// subtitleTextColor: MyColors.greyColor,
// onTap: () {
// Utils.openEmailViaEmailApp(emailAddress: requestVM.currentSelectedOffer!.email ?? "");
// },
// ),
// ],
// 30.height,
// ],
// ),
// );
// },
// );
// }
Widget showItem(String title, String value) { Widget showItem(String title, String value) {
return Row( return Row(
@ -440,7 +381,7 @@ class ReviewAppointment extends StatelessWidget {
actions: [ actions: [
IconButton( IconButton(
onPressed: () { onPressed: () {
// buildProviderContactInfoBottomSheet(context); // Utils.buildProviderContactInfoBottomSheet(context: context, email:, mobileNo:);
}, },
icon: const Icon(Icons.help_outline_outlined).paddingOnly(right: 21), icon: const Icon(Icons.help_outline_outlined).paddingOnly(right: 21),
), ),

@ -275,61 +275,6 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
); );
} }
buildProviderContactInfoBottomSheet(BuildContext context) {
final requestVM = context.read<RequestsVM>();
return showModalBottomSheet(
context: context,
isScrollControlled: true,
enableDrag: true,
builder: (BuildContext context) {
return InfoBottomSheet(
title: LocaleKeys.contactDetails.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
description: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (requestVM.currentSelectedOffer!.mobileNo != null && requestVM.currentSelectedOffer!.mobileNo!.isNotEmpty) ...[
CustomSettingOptionsTile(
leadingWidget: const Icon(
Icons.call,
size: 20,
color: MyColors.greyColor,
),
titleText: LocaleKeys.phoneNumber.tr(),
subTitle: " ${requestVM.currentSelectedOffer!.mobileNo ?? ""}",
needBorderBelow: true,
showTrailingArrow: false,
subtitleTextColor: MyColors.greyColor,
onTap: () {
Utils.openNumberViaCaller(phoneNumber: requestVM.currentSelectedOffer!.mobileNo ?? "");
},
),
],
if (requestVM.currentSelectedOffer!.email != null && requestVM.currentSelectedOffer!.email!.isNotEmpty) ...[
CustomSettingOptionsTile(
leadingWidget: const Icon(
Icons.email_outlined,
size: 20,
color: MyColors.greyColor,
),
titleText: LocaleKeys.emailAddress.tr(),
subTitle: " ${requestVM.currentSelectedOffer!.email ?? ""}",
needBorderBelow: false,
showTrailingArrow: false,
subtitleTextColor: MyColors.greyColor,
onTap: () {
Utils.openEmailViaEmailApp(emailAddress: requestVM.currentSelectedOffer!.email ?? "");
},
),
],
30.height,
],
),
);
},
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -340,7 +285,14 @@ class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
onBackButtonTapped: () => Navigator.pop(context), onBackButtonTapped: () => Navigator.pop(context),
actions: [ actions: [
IconButton( IconButton(
onPressed: () => buildProviderContactInfoBottomSheet(context), onPressed: () {
final requestVM = context.read<RequestsVM>();
Utils.buildProviderContactInfoBottomSheet(
context: context,
email: requestVM.currentSelectedOffer!.email,
mobileNo: requestVM.currentSelectedOffer!.mobileNo,
);
},
icon: const Icon(Icons.help_outline_outlined).paddingOnly(right: 21), icon: const Icon(Icons.help_outline_outlined).paddingOnly(right: 21),
), ),
], ],

@ -121,7 +121,8 @@ class _ShippingManagementViewState extends State<ShippingManagementView> {
if (status) { if (status) {
pop(context); pop(context);
int index = shippingManagementVM.shippingRequestFilterOptions.indexWhere((element) => element.isSelected); int index = shippingManagementVM.shippingRequestFilterOptions.indexWhere((element) => element.isSelected);
await shippingManagementVM.getShippingRequestsListByFilters(shippingStatusEnum: index.toShippingStatusEnum()); int id = shippingManagementVM.shippingRequestFilterOptions[index].id;
await shippingManagementVM.getShippingRequestsListByFilters(shippingStatusEnum: id.toShippingStatusEnum());
} }
}, },
maxWidth: double.infinity, maxWidth: double.infinity,
@ -164,12 +165,11 @@ class _ShippingManagementViewState extends State<ShippingManagementView> {
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () async { onRefresh: () async {
int index = shippingVm.shippingRequestFilterOptions.indexWhere((element) => element.isSelected); int index = shippingVm.shippingRequestFilterOptions.indexWhere((element) => element.isSelected);
await shippingVm.getShippingRequestsListByFilters(shippingStatusEnum: index.toShippingStatusEnum()); int id = shippingVm.shippingRequestFilterOptions[index].id;
await shippingVm.getShippingRequestsListByFilters(shippingStatusEnum: id.toShippingStatusEnum());
}, },
child: (shippingVm.state == ViewState.busy) child: (shippingVm.state == ViewState.busy)
? const Center( ? const Center(child: CircularProgressIndicator())
child: CircularProgressIndicator(),
)
: shippingVm.shippingRequestsList.isEmpty : shippingVm.shippingRequestsList.isEmpty
? Center(child: LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor)) ? Center(child: LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor))
: ListView.separated( : ListView.separated(

@ -20,7 +20,7 @@ class ProviderDetailCard extends StatelessWidget {
final bool isFromFavoriteList; final bool isFromFavoriteList;
const ProviderDetailCard({ const ProviderDetailCard({
Key? key, super.key,
required this.providerImageUrl, required this.providerImageUrl,
required this.title, required this.title,
required this.totalBranches, required this.totalBranches,
@ -29,19 +29,31 @@ class ProviderDetailCard extends StatelessWidget {
required this.startedSince, required this.startedSince,
required this.onCardTapped, required this.onCardTapped,
this.isFromFavoriteList = false, this.isFromFavoriteList = false,
}) : super(key: key); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String nameInitials = "";
if (title.isNotEmpty) {
nameInitials = title[0];
}
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Image.asset( if (isFromFavoriteList) ...[
providerImageUrl, CircleAvatar(
width: 80, radius: 22,
height: 85, backgroundColor: MyColors.darkPrimaryColor,
fit: BoxFit.cover, child: nameInitials.toText(fontSize: 25, isBold: true),
), ),
] else ...[
Image.asset(
providerImageUrl,
width: 80,
height: 85,
fit: BoxFit.cover,
),
],
12.width, 12.width,
Expanded( Expanded(
child: Column( child: Column(

Loading…
Cancel
Save