6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit d3a772e6
Changed files
.../hotel_information/models/facilities.g.dart | 2 + .../hotel_information/models/parking_info.g.dart | 28 ------ .../hotel_information/models/restaurant.g.dart | 28 ------ .../.generated/hotel_information/models/spa.g.dart | 40 -------- .../components/hotel_bottom_sheet_button.dart | 65 ++++++++++++ .../components/practical_information.dart | 42 -------- .../components/structured_text.dart | 111 +++++++++------------ .../hotel_information/hotel_information_page.dart | 45 +++------ .../lib/hotel_information/models/facilities.dart | 2 + .../lib/hotel_information/models/parking_info.dart | 24 ----- .../lib/hotel_information/models/restaurant.dart | 24 ----- .../lib/hotel_information/models/spa.dart | 40 -------- .../lib/hotel_information/pages/facility_page.dart | 8 +- .../pages/hotel_information_menu.dart | 6 +- .../pages/parking_facility_page.dart | 39 -------- .../hotel_information/pages/spa_facility_page.dart | 92 ----------------- comwell_key_app/lib/routing/app_router.dart | 19 ++-- .../components/up_sales_bottom_button.dart | 1 - .../up_sales/pages/up_sale_confirmation_page.dart | 1 - 19 files changed, 152 insertions(+), 465 deletions(-)
Diff
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
index 644206f0..62b3ba87 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/facilities.g.dart
@@ -17,6 +17,7 @@ Facility _$FacilityFromJson(Map json) => Facility(
? null
: CallToAction.fromJson(
Map<String, dynamic>.from(json['callToAction'] as Map)),
+ icon: json['icon'] as String,
);
Map<String, dynamic> _$FacilityToJson(Facility instance) => <String, dynamic>{
@@ -24,4 +25,5 @@ Map<String, dynamic> _$FacilityToJson(Facility instance) => <String, dynamic>{
'headerImage': instance.headerImage,
'structuredText': instance.structuredText.map((e) => e.toJson()).toList(),
'callToAction': instance.callToAction?.toJson(),
+ 'icon': instance.icon,
};
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart
deleted file mode 100644
index 0c0d99d5..00000000
--- a/comwell_key_app/lib/.generated/hotel_information/models/parking_info.g.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../hotel_information/models/parking_info.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-ParkingInfo _$ParkingInfoFromJson(Map json) => ParkingInfo(
- title: json['title'] as String,
- headerImage: json['headerImage'] as String?,
- structuredText: (json['structuredText'] as List<dynamic>)
- .map((e) =>
- StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- callToAction: json['callToAction'] == null
- ? null
- : CallToAction.fromJson(
- Map<String, dynamic>.from(json['callToAction'] as Map)),
- );
-
-Map<String, dynamic> _$ParkingInfoToJson(ParkingInfo instance) =>
- <String, dynamic>{
- 'title': instance.title,
- 'headerImage': instance.headerImage,
- 'structuredText': instance.structuredText.map((e) => e.toJson()).toList(),
- 'callToAction': instance.callToAction?.toJson(),
- };
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
deleted file mode 100644
index a8a7c588..00000000
--- a/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../hotel_information/models/restaurant.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-Restaurant _$RestaurantFromJson(Map json) => Restaurant(
- title: json['title'] as String,
- headerImage: json['headerImage'] as String?,
- structuredText: (json['structuredText'] as List<dynamic>)
- .map((e) =>
- StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- callToAction: json['callToAction'] == null
- ? null
- : CallToAction.fromJson(
- Map<String, dynamic>.from(json['callToAction'] as Map)),
- );
-
-Map<String, dynamic> _$RestaurantToJson(Restaurant instance) =>
- <String, dynamic>{
- 'title': instance.title,
- 'headerImage': instance.headerImage,
- 'structuredText': instance.structuredText.map((e) => e.toJson()).toList(),
- 'callToAction': instance.callToAction?.toJson(),
- };
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
deleted file mode 100644
index c1a23cfb..00000000
--- a/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of '../../../hotel_information/models/spa.dart';
-
-// **************************************************************************
-// JsonSerializableGenerator
-// **************************************************************************
-
-Spa _$SpaFromJson(Map json) => Spa(
- title: json['title'] as String,
- headerImage: json['headerImage'] as String?,
- structuredText: (json['structuredText'] as List<dynamic>)
- .map((e) =>
- StructuredTextBlock.fromJson(Map<String, dynamic>.from(e as Map)))
- .toList(),
- callToAction: json['callToAction'] == null
- ? null
- : CallToAction.fromJson(
- Map<String, dynamic>.from(json['callToAction'] as Map)),
- );
-
-Map<String, dynamic> _$SpaToJson(Spa instance) => <String, dynamic>{
- 'title': instance.title,
- 'headerImage': instance.headerImage,
- 'structuredText': instance.structuredText.map((e) => e.toJson()).toList(),
- 'callToAction': instance.callToAction?.toJson(),
- };
-
-SpaBookingLink _$SpaBookingLinkFromJson(Map json) => SpaBookingLink(
- name: json['name'] as String,
- url: json['url'] as String,
- target: json['target'] as String,
- );
-
-Map<String, dynamic> _$SpaBookingLinkToJson(SpaBookingLink instance) =>
- <String, dynamic>{
- 'name': instance.name,
- 'url': instance.url,
- 'target': instance.target,
- };
diff --git a/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart b/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart
new file mode 100644
index 00000000..46554bd0
--- /dev/null
+++ b/comwell_key_app/lib/hotel_information/components/hotel_bottom_sheet_button.dart
@@ -0,0 +1,65 @@
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+
+class HotelBottomSheetButton extends StatelessWidget {
+ final bool isLoading;
+ final Function() onPressed;
+ const HotelBottomSheetButton(
+ {super.key, required this.isLoading, required this.onPressed});
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+ return Builder(builder: (context) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(height: 1, color: colorDivider),
+ Row(
+ children: [
+ Expanded(
+ child: Container(
+ color: Colors.white,
+ child: Padding(
+ padding: const EdgeInsets.only(
+ left: 16.0, right: 16.0, bottom: 32.0, top: 16.0),
+ child: ElevatedButton(
+ onPressed: isLoading ? null : onPressed,
+ style: ButtonStyle(
+ backgroundColor:
+ WidgetStateProperty.resolveWith((states) {
+ if (states.contains(WidgetState.disabled)) {
+ return Colors.grey;
+ }
+ return sandColor[80];
+ }),
+ foregroundColor:
+ const WidgetStatePropertyAll(Colors.white),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 16.0),
+ child: Builder(builder: (context) {
+ if (isLoading) {
+ return const CircularProgressIndicator();
+ }
+ return Text(
+ "hotel_information_page_spa_button".tr(),
+ style: theme.textTheme.bodyLarge?.copyWith(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ );
+ }),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ );
+ });
+ }
+}
diff --git a/comwell_key_app/lib/hotel_information/components/practical_information.dart b/comwell_key_app/lib/hotel_information/components/practical_information.dart
deleted file mode 100644
index fce7b000..00000000
--- a/comwell_key_app/lib/hotel_information/components/practical_information.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-import 'package:comwell_key_app/hotel_information/components/maps_bottom_modal.dart';
-import 'package:comwell_key_app/hotel_information/models/restaurant.dart';
-import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
-import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
-import 'package:flutter/material.dart';
-
-class PracticalInformation extends StatelessWidget {
- final Restaurant restaurant;
- const PracticalInformation({super.key, required this.restaurant});
-
- @override
- Widget build(BuildContext context) {
- final theme = Theme.of(context);
-
- return Column(
- children: [
- const SizedBox(height: 40),
- Text(
- "restaurant_page_practical_information".tr(),
- style: theme.textTheme.headlineLarge,
- ),
- const SizedBox(height: 20),
- Text(
- "restaurant_page_address".tr(),
- style: theme.textTheme.headlineMedium,
- ),
- GestureDetector(
- onTap: () => MapsBottomModal.show(context, restaurant.structuredText.firstWhere((block) => block is AddressStructuredTextModel).toString()),
- child: Text(
- restaurant.structuredText.firstWhere((block) => block is AddressStructuredTextModel).toString(),
- style: theme.textTheme.bodySmall?.copyWith(
- color: sandColor,
- decoration: TextDecoration.underline,
- decorationColor: sandColor,
- ),
- ),
- ),
- ],
- );
- }
-}
diff --git a/comwell_key_app/lib/hotel_information/components/structured_text.dart b/comwell_key_app/lib/hotel_information/components/structured_text.dart
index dc0c884e..e2256b15 100644
--- a/comwell_key_app/lib/hotel_information/components/structured_text.dart
+++ b/comwell_key_app/lib/hotel_information/components/structured_text.dart
@@ -2,6 +2,7 @@ import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
import 'package:comwell_key_app/hotel_information/components/address.dart';
import 'package:comwell_key_app/hotel_information/components/phone_number.dart';
import 'package:comwell_key_app/hotel_information/components/contact_hotel_button.dart';
+import 'package:comwell_key_app/themes/dark_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -24,38 +25,35 @@ class StructuredText extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: blocks.map((block) {
- if (block is HeaderStructuredTextModel) {
- return Padding(
+ return switch (block) {
+ HeaderStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Text(
- block.header,
+ b.header,
style: theme.textTheme.headlineMedium,
),
- );
- } else if (block is TextModelStructuredTextModel) {
- return Padding(
+ ),
+ TextModelStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Text(
- block.text,
+ b.text,
style: theme.textTheme.bodySmall?.copyWith(
- color: Colors.black.withValues(alpha: 0.65),
+ color: colorHeadlineText,
),
),
- );
- } else if (block is AddressStructuredTextModel) {
- return Padding(
+ ),
+ AddressStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: Address(address: block.address),
- );
- } else if (block is EmailContactStructuredTextModel) {
- return Padding(
+ child: Address(address: b.address),
+ ),
+ EmailContactStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: ContactHotelButton(
- title: block.headline,
- subtitle: block.email,
+ title: b.headline,
+ subtitle: b.email,
iconPath: "assets/icons/ic_send.svg",
onClick: () async {
- final Uri emailUri = Uri.parse("mailto:${block.email}");
+ final Uri emailUri = Uri.parse("mailto:${b.email}");
if (await canLaunchUrl(emailUri)) {
await launchUrl(emailUri, mode: LaunchMode.externalApplication);
} else {
@@ -67,66 +65,55 @@ class StructuredText extends StatelessWidget {
}
},
),
- );
- } else if (block is PhoneContactStructuredTextModel) {
- return Padding(
+ ),
+ PhoneContactStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: PhoneNumber(phoneNumber: block.phoneNumber),
- );
- } else if (block is ImageWidgetStructuredTextModel) {
- return Padding(
+ child: PhoneNumber(phoneNumber: b.phoneNumber),
+ ),
+ ImageWidgetStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: ImageWidget(image: block.image),
- );
- } else if (block is SpaBookingLinkStructuredTextModel) {
- return Padding(
+ child: ImageWidget(image: b.image),
+ ),
+ SpaBookingLinkStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: SpaBookingLink(link: block.link),
- );
- } else if (block is HotelInformationListTileStructuredTextModel) {
- return Padding(
+ child: SpaBookingLink(link: b.link),
+ ),
+ HotelInformationListTileStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: HotelInformationListTile(
- iconPath: block.iconPath,
- title: block.title,
+ iconPath: b.iconPath,
+ title: b.title,
onClick: () {}, // You may want to provide a callback
),
- );
- } else if (block is MapsBottomModalStructuredTextModel) {
- return Padding(
+ ),
+ MapsBottomModalStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Builder(
builder: (context) => ElevatedButton(
- onPressed: () => MapsBottomModal.show(context, block.address),
- child: Text(block.address),
+ onPressed: () => MapsBottomModal.show(context, b.address),
+ child: Text(b.address),
),
),
- );
- } else if (block is OpeningHoursStructuredTextModel) {
- return Padding(
+ ),
+ OpeningHoursStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: OpeningHours(openingHours: block.openingHours),
- );
- } else if (block is PageTitleStructuredTextModel) {
- return Padding(
+ child: OpeningHours(openingHours: b.openingHours),
+ ),
+ PageTitleStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: PageTitle(title: block.title),
- );
- } else if (block is PracticalInformationStructuredTextModel) {
- // PracticalInformation expects a Restaurant, but block only has restaurantId. You may need to fetch the Restaurant by ID.
- // For now, just show the restaurantId as a placeholder.
- return Padding(
+ child: PageTitle(title: b.title),
+ ),
+ PracticalInformationStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: Text('Practical Information for Restaurant: \\${block.restaurantId}'),
- );
- } else if (block is EmailStructuredTextModel) {
- return Padding(
+ child: Text('Practical Information for Restaurant: \\${b.restaurantId}', style: theme.textTheme.bodySmall?.copyWith(
+ color: colorHeadlineText,
+ ),),
+ ),
+ EmailStructuredTextModel b => Padding(
padding: const EdgeInsets.only(bottom: 16.0),
- child: Email(email: block.email),
- );
- } else {
- return const SizedBox.shrink();
- }
+ child: Email(email: b.email),
+ ),
+ };
}).toList(),
);
}
diff --git a/comwell_key_app/lib/hotel_information/hotel_information_page.dart b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
index 583fcdbb..1d935e8c 100644
--- a/comwell_key_app/lib/hotel_information/hotel_information_page.dart
+++ b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
@@ -1,12 +1,7 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:comwell_key_app/hotel_information/repository/hotel_information_repository.dart';
-import 'package:comwell_key_app/overview/models/booking.dart';
-import 'package:comwell_key_app/utils/locator.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:go_router/go_router.dart';
class HotelInformationPage extends StatelessWidget {
final Widget child;
@@ -14,31 +9,21 @@ class HotelInformationPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- // Get the booking from GoRouter's extra parameter
- final booking = GoRouterState.of(context).extra as Booking;
-
- return BlocProvider<HotelInformationCubit>(
- create: (_) => HotelInformationCubit(
- hotelInformationRepository: locator<HotelInformationRepository>(),
- booking: booking,
- culture: context.locale, // Now it's safe!
- )..init(),
- child: BlocBuilder<HotelInformationCubit, HotelInformationState>(
- builder: (context, state) {
- return Scaffold(
- extendBodyBehindAppBar: true,
- appBar: const ComwellAppBar(),
- backgroundColor: Colors.white,
- body: Builder(builder: (context) {
- return switch (state.hotelState) {
- HotelState.loading => const Center(child: CircularProgressIndicator()),
- HotelState.error => const Center(child: Text("Error")),
- HotelState.success => child,
- };
- }),
- );
- }
- ),
+ return BlocBuilder<HotelInformationCubit, HotelInformationState>(
+ builder: (context, state) {
+ return Scaffold(
+ extendBodyBehindAppBar: true,
+ appBar: const ComwellAppBar(),
+ backgroundColor: Colors.white,
+ body: Builder(builder: (context) {
+ return switch (state.hotelState) {
+ HotelState.loading => const Center(child: CircularProgressIndicator()),
+ HotelState.error => const Center(child: Text("Error")),
+ HotelState.success => child,
+ };
+ }),
+ );
+ },
);
}
}
diff --git a/comwell_key_app/lib/hotel_information/models/facilities.dart b/comwell_key_app/lib/hotel_information/models/facilities.dart
index 735810d5..e464573f 100644
--- a/comwell_key_app/lib/hotel_information/models/facilities.dart
+++ b/comwell_key_app/lib/hotel_information/models/facilities.dart
@@ -11,12 +11,14 @@ class Facility {
final String? headerImage;
final List<StructuredTextBlock> structuredText;
final CallToAction? callToAction;
+ final String icon;
Facility({
required this.title,
this.headerImage,
required this.structuredText,
this.callToAction,
+ required this.icon,
});
factory Facility.fromJson(Json json) => _$FacilityFromJson(json);
diff --git a/comwell_key_app/lib/hotel_information/models/parking_info.dart b/comwell_key_app/lib/hotel_information/models/parking_info.dart
deleted file mode 100644
index b7dd48de..00000000
--- a/comwell_key_app/lib/hotel_information/models/parking_info.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-import 'package:comwell_key_app/hotel_information/models/call_to_action.dart';
-import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
-import 'package:comwell_key_app/utils/json.dart';
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../.generated/hotel_information/models/parking_info.g.dart';
-
-@JsonSerializable()
-class ParkingInfo {
- final String title;
- final String? headerImage;
- final List<StructuredTextBlock> structuredText;
- final CallToAction? callToAction;
-
- ParkingInfo({
- required this.title,
- this.headerImage,
- required this.structuredText,
- this.callToAction,
- });
-
- factory ParkingInfo.fromJson(Json json) => _$ParkingInfoFromJson(json);
- Json toJson() => _$ParkingInfoToJson(this);
-}
diff --git a/comwell_key_app/lib/hotel_information/models/restaurant.dart b/comwell_key_app/lib/hotel_information/models/restaurant.dart
deleted file mode 100644
index bdc622dc..00000000
--- a/comwell_key_app/lib/hotel_information/models/restaurant.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-import 'package:comwell_key_app/hotel_information/models/call_to_action.dart';
-import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
-import 'package:comwell_key_app/utils/json.dart';
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../.generated/hotel_information/models/restaurant.g.dart';
-
-@JsonSerializable()
-class Restaurant {
- final String title;
- final String? headerImage;
- final List<StructuredTextBlock> structuredText;
- final CallToAction? callToAction;
-
- Restaurant({
- required this.title,
- this.headerImage,
- required this.structuredText,
- this.callToAction,
- });
-
- factory Restaurant.fromJson(Json json) => _$RestaurantFromJson(json);
- Json toJson() => _$RestaurantToJson(this);
-}
diff --git a/comwell_key_app/lib/hotel_information/models/spa.dart b/comwell_key_app/lib/hotel_information/models/spa.dart
deleted file mode 100644
index 6b14f511..00000000
--- a/comwell_key_app/lib/hotel_information/models/spa.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-import 'package:comwell_key_app/hotel_information/models/call_to_action.dart';
-import 'package:comwell_key_app/hotel_information/models/structured_text.dart';
-import 'package:comwell_key_app/utils/json.dart';
-import 'package:json_annotation/json_annotation.dart';
-
-part '../../.generated/hotel_information/models/spa.g.dart';
-
-@JsonSerializable()
-class Spa {
- final String title;
- final String? headerImage;
- final List<StructuredTextBlock> structuredText;
- final CallToAction? callToAction;
-
- Spa({
- required this.title,
- this.headerImage,
- required this.structuredText,
- this.callToAction,
- });
-
- factory Spa.fromJson(Json json) => _$SpaFromJson(json);
- Json toJson() => _$SpaToJson(this);
-}
-
-@JsonSerializable()
-class SpaBookingLink {
- final String name;
- final String url;
- final String target;
-
- SpaBookingLink({
- required this.name,
- required this.url,
- required this.target,
- });
-
- factory SpaBookingLink.fromJson(Json json) => _$SpaBookingLinkFromJson(json);
- Json toJson() => _$SpaBookingLinkToJson(this);
-}
diff --git a/comwell_key_app/lib/hotel_information/pages/facility_page.dart b/comwell_key_app/lib/hotel_information/pages/facility_page.dart
index a6956dc6..0624add1 100644
--- a/comwell_key_app/lib/hotel_information/pages/facility_page.dart
+++ b/comwell_key_app/lib/hotel_information/pages/facility_page.dart
@@ -1,9 +1,8 @@
+import 'package:comwell_key_app/hotel_information/components/hotel_bottom_sheet_button.dart';
import 'package:comwell_key_app/hotel_information/components/image_widget.dart';
import 'package:comwell_key_app/hotel_information/components/structured_text.dart';
-import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
class FacilityPage extends StatelessWidget {
final Facility facility;
@@ -12,7 +11,6 @@ class FacilityPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final cubit = context.read<HotelInformationCubit>();
return Scaffold(
backgroundColor: Colors.white,
@@ -35,6 +33,10 @@ class FacilityPage extends StatelessWidget {
),
],
),
+ bottomSheet: facility.callToAction != null ? HotelBottomSheetButton(
+ isLoading: false,
+ onPressed: () {},
+ ) : null,
);
}
}
diff --git a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
index b257a5f8..c50ceb94 100644
--- a/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
+++ b/comwell_key_app/lib/hotel_information/pages/hotel_information_menu.dart
@@ -15,9 +15,7 @@ class HotelInformationMenu extends StatelessWidget {
Widget build(BuildContext context) {
final cubit = context.read<HotelInformationCubit>();
final hotel = cubit.hotel;
-
- print(hotel.facilities);
-
+
return Column(
children: [
ImageWidget(image: hotel.image),
@@ -35,7 +33,7 @@ class HotelInformationMenu extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(bottom: 6.0),
child: HotelInformationListTile(
- iconPath: "assets/icons/ic_info.svg",
+ iconPath: "assets/icons/ic_info.svg", // TODO: Add icon for facility when cms is updated
title: facility.title,
onClick: () {
context.pushNamed(
diff --git a/comwell_key_app/lib/hotel_information/pages/parking_facility_page.dart b/comwell_key_app/lib/hotel_information/pages/parking_facility_page.dart
deleted file mode 100644
index 48f4bba0..00000000
--- a/comwell_key_app/lib/hotel_information/pages/parking_facility_page.dart
+++ /dev/null
@@ -1,39 +0,0 @@
-import 'package:comwell_key_app/hotel_information/components/image_widget.dart';
-import 'package:comwell_key_app/hotel_information/components/structured_text.dart';
-import 'package:comwell_key_app/hotel_information/models/parking_info.dart';
-import 'package:flutter/material.dart';
-
-class ParkingFacilityPage extends StatelessWidget {
- final ParkingInfo parkingInfo;
-
- const ParkingFacilityPage({super.key, required this.parkingInfo});
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const ImageWidget(image: 'assets/images/parking.png'),
- Expanded(
- child: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 26),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- StructuredText(blocks: parkingInfo.structuredText),
- const SizedBox(height: 100),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}
diff --git a/comwell_key_app/lib/hotel_information/pages/spa_facility_page.dart b/comwell_key_app/lib/hotel_information/pages/spa_facility_page.dart
deleted file mode 100644
index bec3e2f9..00000000
--- a/comwell_key_app/lib/hotel_information/pages/spa_facility_page.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-import 'package:comwell_key_app/hotel_information/components/image_widget.dart';
-import 'package:comwell_key_app/hotel_information/components/structured_text.dart';
-import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:comwell_key_app/hotel_information/models/facilities.dart';
-import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:easy_localization/easy_localization.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
-
-class SpaFacilityPage extends StatelessWidget {
- final Facility spa;
- const SpaFacilityPage({super.key, required this.spa});
-
- @override
- Widget build(BuildContext context) {
- final cubit = context.read<HotelInformationCubit>();
- final isLoading = cubit.state.spaButtonIsLoading;
- final theme = Theme.of(context);
-
- return Scaffold(
- backgroundColor: Colors.white,
- body: Column(
- children: [
- ImageWidget(image: spa.headerImage ?? ""),
- Expanded(
- child: SingleChildScrollView(
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16.0, vertical: 26),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- StructuredText(blocks: spa.structuredText),
- const SizedBox(height: 100),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- bottomSheet: Builder(builder: (context) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Row(
- children: [
- Expanded(
- child: Container(
- color: Colors.white,
- child: Padding(
- padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 32.0, top: 16.0),
- child: ElevatedButton(
- onPressed: isLoading ? null : cubit.onBookSpaClicked,
- style: ButtonStyle(
- backgroundColor:
- WidgetStateProperty.resolveWith((states) {
- if (states.contains(WidgetState.disabled)) {
- return Colors.grey;
- }
- return sandColor[80];
- }),
- foregroundColor:
- const WidgetStatePropertyAll(Colors.white),
- ),
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 16.0),
- child: Builder(builder: (context) {
- if (isLoading) {
- return const CircularProgressIndicator();
- }
- return Text(
- "hotel_information_page_spa_button".tr(),
- style: theme.textTheme.bodyLarge?.copyWith(
- color: Colors.white,
- fontWeight: FontWeight.bold,
- ),
- );
- }),
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- ],
- );
- }),
- );
- }
-}
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index 850bbac7..596dd8e3 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -14,11 +14,8 @@ import 'package:comwell_key_app/find_booking/loading_page.dart';
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
import 'package:comwell_key_app/hotel_information/pages/facility_page.dart';
import 'package:comwell_key_app/hotel_information/pages/hotel_information_menu.dart';
-import 'package:comwell_key_app/hotel_information/pages/parking_facility_page.dart';
-import 'package:comwell_key_app/hotel_information/pages/spa_facility_page.dart';
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
import 'package:comwell_key_app/hotel_information/hotel_information_page.dart';
-import 'package:comwell_key_app/hotel_information/models/parking_info.dart';
import 'package:comwell_key_app/housekeeping/housekeeping_page.dart';
import 'package:comwell_key_app/key/key_page.dart';
import 'package:comwell_key_app/login/login_page.dart';
@@ -114,8 +111,16 @@ GoRouter goRouter() {
navigatorKey: _shellNavigatorKey,
parentNavigatorKey: _rootNavigatorKey,
pageBuilder: (context, state, child) {
+
return NoTransitionPage(
- child: HotelInformationPage(child: child),
+ child: BlocProvider(
+ create: (_) => HotelInformationCubit(
+ hotelInformationRepository: locator<HotelInformationRepository>(),
+ booking: state.extra as Booking,
+ culture: context.locale,
+ )..init(),
+ child: HotelInformationPage(child: child),
+ ),
);
},
routes: [
@@ -132,8 +137,8 @@ GoRouter goRouter() {
name:
"${AppRoutes.hotelInformation.name}/${AppRoutes.facility.name}",
builder: (context, state) {
- final facility = state.extra as Facility;
- return FacilityPage(facility: facility);
+
+ return FacilityPage(facility: state.extra as Facility);
}),
]),
GoRoute(
@@ -419,7 +424,7 @@ GoRouter goRouter() {
create: (context) =>
UpSalesCubit(upSaleRepository: locator<UpSalesRepository>())
..init(),
- child: UpSalesProcessingPage(),
+ child: const UpSalesProcessingPage(),
);
},
),
diff --git a/comwell_key_app/lib/up_sales/components/up_sales_bottom_button.dart b/comwell_key_app/lib/up_sales/components/up_sales_bottom_button.dart
index eacce688..7b995a0b 100644
--- a/comwell_key_app/lib/up_sales/components/up_sales_bottom_button.dart
+++ b/comwell_key_app/lib/up_sales/components/up_sales_bottom_button.dart
@@ -1,6 +1,5 @@
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
-import 'package:comwell_key_app/up_sales/components/confirm_up_sales_dialog.dart';
import 'package:comwell_key_app/up_sales/models/room_upgrade.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
diff --git a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
index c217731f..32de7196 100644
--- a/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
+++ b/comwell_key_app/lib/up_sales/pages/up_sale_confirmation_page.dart
@@ -8,7 +8,6 @@ import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:slider_button/slider_button.dart';
import 'package:url_launcher/url_launcher.dart';