6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit f46e48e2
Changed files
.../lib/booking_details/bloc/booking_details_bloc.dart | 11 +++-------- .../components/booking_details_bottom_sheet.dart | 10 +++++----- .../lib/booking_details/components/preregister_button.dart | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-)
Diff
diff --git a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
index 018887de..b516aa6f 100644
--- a/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
+++ b/comwell_key_app/lib/booking_details/bloc/booking_details_bloc.dart
@@ -29,7 +29,6 @@ class BookingDetailsBloc
final SeosRepository seosRepository = locator<SeosRepository>();
Duration _remainingTime = Duration.zero;
final UpSalesRepository upSaleRepository;
- UpSales? upSales;
BookingDetailsBloc(
this.booking, {
@@ -94,14 +93,10 @@ class BookingDetailsBloc
}
Future<void> getUpSales(Emitter<BookingDetailsState> emit) async {
-
- upSales = await upSaleRepository.getUpSales(
- booking.confirmationId, booking.hotelCode);
-
- if (upSales != null) {
- emit(state.getUpSales(upSales!));
- }
+ final response = await upSaleRepository.getUpSales(
+ booking.confirmationId, booking.hotelCode);
+ emit(state.getUpSales(response));
}
Future<Booking> getBookingDetails(
diff --git a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
index 089fc14f..a6d7d3af 100644
--- a/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
+++ b/comwell_key_app/lib/booking_details/components/booking_details_bottom_sheet.dart
@@ -89,7 +89,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
if (state.keys.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
- child:
+ child:
Text('room_keys'.tr(), style: theme.textTheme.headlineMedium),
),
const SizedBox(height: 16),
@@ -124,9 +124,9 @@ class BookingDetailsBottomSheet extends StatelessWidget {
case ReservationStatus.checkedin:
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: cubit.upSales != null
+ child: cubit.state.upSales != null
? UpSalesCatalogButton(
- upSales: cubit.upSales!, booking: cubit.booking)
+ upSales: cubit.state.upSales!, booking: cubit.booking)
: const SizedBox(),
);
case ReservationStatus.newreservation:
@@ -144,7 +144,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
Widget _buildServices(BuildContext context) {
final theme = Theme.of(context);
- final serviceUpgrades = cubit.upSales?.addOnUpgrades
+ final serviceUpgrades = cubit.state.upSales?.addOnUpgrades
.where((upgrade) => upgrade.isService)
.toList() ?? [];
return Column(
@@ -165,7 +165,7 @@ class BookingDetailsBottomSheet extends StatelessWidget {
text: 'up_sales_see_all'.tr(),
onTap: () async {
await context.pushNamed(AppRoutes.upSalesCatalog.name,
- extra: [cubit.upSales, cubit.booking]);
+ extra: [cubit.state.upSales, cubit.booking]);
cubit.add(InitialEvent());
},
),
diff --git a/comwell_key_app/lib/booking_details/components/preregister_button.dart b/comwell_key_app/lib/booking_details/components/preregister_button.dart
index aa38b4a4..1e8cf3fe 100644
--- a/comwell_key_app/lib/booking_details/components/preregister_button.dart
+++ b/comwell_key_app/lib/booking_details/components/preregister_button.dart
@@ -21,7 +21,7 @@ class PreregisterButton extends StatelessWidget {
onPressed: () async {
final (result) = await context.pushNamed(
AppRoutes.preregistration.name,
- extra: [bloc.booking, bloc.upSales]);
+ extra: [bloc.booking, bloc.state.upSales]);
if (result != null) {
bloc.add(InitialEvent());
}