selectOffer method
void
selectOffer( - OfferModel offer,
- void onSelected()
)
Implementation
void selectOffer(OfferModel offer, void Function() onSelected) async {
if (offer.offerId == null) {
CustomFlashWidget.showFlashMessage(
type: FlashType.error,
title: "Invalid trip",
message: "The trip you selected is not found",
);
return;
}
if (searchExpireTimerCount.value < 1) {
if (currentRoute() == Routes.FLIGHT_SEARCH) {
SessionExpiredDialog.show(
barrierDismissible: false,
title: 'Booking Session Expired',
content:
'Your 30-minute booking session has expired, and the selected flight is no longer reserved. To continue, you can either search for a new flight or review your NEOPASS Search History to quickly find similar options.',
);
}
return;
}
expandedIndex.value = -1;
selectedExclusiveOffer.value = null;
selectedStandardOffer.value = offer;
if (selectedStandardOffer.value != null) {
Requests.box.write('offer', selectedStandardOffer.value?.toJson());
} else {
Requests.box.remove('offer');
}
await Requests.box.save();
currentTab.value = 1;
onSelected();
initPassengers();
}