6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 0f2c0813
Changed files
comwell_key_app/assets/images/parking.png | Bin 0 -> 370283 bytes comwell_key_app/assets/translations/da-DK.json | 6 +- comwell_key_app/assets/translations/en-US.json | 6 +- .../hotel_information/models/facilities.g.dart | 1 - .../hotel_information/models/hotel.g.dart | 10 +- .../hotel_information/models/parking_info.g.dart | 2 - .../hotel_information/models/restaurant.g.dart | 10 +- .../.generated/hotel_information/models/spa.g.dart | 2 - .../.generated/services/models/bookings_dto.g.dart | 6 +- .../lib/booking_details/booking_details_page.dart | 3 +- .../lib/common/components/comwell_app_bar.dart | 2 +- .../components/hotel_list_item_view.dart | 2 +- .../components/hotel_information_list_tile.dart | 11 +- .../components/hotel_information_menu.dart | 70 +++++------ .../components/parking_facility_page.dart | 59 +++++++++ .../components/restaurant_page.dart | 137 ++++++++++++--------- .../components/spa_facility_page.dart | 102 ++++++++++----- .../cubit/hotel_information_cubit.dart | 21 +++- .../cubit/hotel_information_state.dart | 2 +- .../hotel_information/hotel_information_page.dart | 4 +- .../lib/hotel_information/models/facilities.dart | 14 +-- .../lib/hotel_information/models/hotel.dart | 10 +- .../lib/hotel_information/models/parking_info.dart | 4 +- .../lib/hotel_information/models/restaurant.dart | 13 +- .../lib/hotel_information/models/spa.dart | 4 +- .../repository/hotel_information_repository.dart | 113 +++++++++-------- comwell_key_app/lib/main.dart | 1 + .../components/balance_bottom_sheet.dart | 39 +++--- comwell_key_app/lib/overview/overview_page.dart | 4 +- comwell_key_app/lib/profile/profile_page.dart | 35 +++--- comwell_key_app/lib/routing/app_router.dart | 38 ++++-- .../lib/routing/go_router_observer.dart | 2 +- comwell_key_app/lib/services/api.dart | 10 +- 33 files changed, 456 insertions(+), 287 deletions(-)
Diff
diff --git a/comwell_key_app/assets/images/parking.png b/comwell_key_app/assets/images/parking.png
new file mode 100644
index 00000000..75fcf58e
Binary files /dev/null and b/comwell_key_app/assets/images/parking.png differ
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 6a096ded..069071ea 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -237,5 +237,9 @@
"share_booking": "Del ophold",
"total_charge": "I alt til betaling",
"early_checkin": "Tidlig check-in",
- "payed": "BETALT"
+ "payed": "BETALT",
+ "restaurant": "Restaurant",
+ "spa": "Spa",
+ "parking": "Parkering",
+ "go_to_payment": "Gå til betaling"
}
\ No newline at end of file
diff --git a/comwell_key_app/assets/translations/en-US.json b/comwell_key_app/assets/translations/en-US.json
index 77d0fa1e..56c1cf8f 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -237,6 +237,10 @@
"share_booking": "Share booking",
"total_charge": "I alt til betaling",
"early_checkin": "Early check-in",
- "payed": "PAYED"
+ "payed": "PAYED",
+ "restaurant": "Restaurant",
+ "spa": "Spa",
+ "parking": "Parking",
+ "go_to_payment": "Go to payment"
}
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 1538b704..e58271ec 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
@@ -9,6 +9,5 @@ part of '../../../hotel_information/models/facilities.dart';
Map<String, dynamic> _$FacilityToJson(Facility instance) => <String, dynamic>{
'type': instance.type,
'title': instance.title,
- 'subtitle': instance.subtitle,
'iconPath': instance.iconPath,
};
diff --git a/comwell_key_app/lib/.generated/hotel_information/models/hotel.g.dart b/comwell_key_app/lib/.generated/hotel_information/models/hotel.g.dart
index 103eae9b..62ae9caf 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/hotel.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/hotel.g.dart
@@ -7,24 +7,22 @@ part of '../../../hotel_information/models/hotel.dart';
// **************************************************************************
Hotel _$HotelFromJson(Map json) => Hotel(
- id: json['id'] as String,
- name: json['name'] as String,
+ hotelCode: json['hotelCode'] as String,
+ hotelName: json['hotelName'] as String,
address: json['address'] as String,
city: json['city'] as String,
country: json['country'] as String,
- starRating: (json['starRating'] as num).toInt(),
image: json['image'] as String,
facilities: (json['facilities'] as List<dynamic>)
.map((e) => Facility.fromJson(Map<String, dynamic>.from(e as Map))),
);
Map<String, dynamic> _$HotelToJson(Hotel instance) => <String, dynamic>{
- 'id': instance.id,
- 'name': instance.name,
+ 'hotelCode': instance.hotelCode,
+ 'hotelName': instance.hotelName,
'address': instance.address,
'city': instance.city,
'country': instance.country,
- 'starRating': instance.starRating,
'image': instance.image,
'facilities': instance.facilities.map((e) => e.toJson()).toList(),
};
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
index f083b85b..80bd5da4 100644
--- 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
@@ -8,7 +8,6 @@ part of '../../../hotel_information/models/parking_info.dart';
ParkingInfo _$ParkingInfoFromJson(Map json) => ParkingInfo(
title: json['title'] as String,
- subtitle: json['subtitle'] as String,
description: json['description'] as String,
electricCharging: json['electricCharging'] as bool,
electricChargingTitle: json['electricChargingTitle'] as String,
@@ -19,7 +18,6 @@ ParkingInfo _$ParkingInfoFromJson(Map json) => ParkingInfo(
Map<String, dynamic> _$ParkingInfoToJson(ParkingInfo instance) =>
<String, dynamic>{
'title': instance.title,
- 'subtitle': instance.subtitle,
'description': instance.description,
'electricCharging': instance.electricCharging,
'electricChargingTitle': instance.electricChargingTitle,
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
index 2c1ad32d..1073fc89 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/restaurant.g.dart
@@ -7,11 +7,10 @@ part of '../../../hotel_information/models/restaurant.dart';
// **************************************************************************
Restaurant _$RestaurantFromJson(Map json) => Restaurant(
- name: json['name'] as String,
+ title: json['title'] as String,
description: json['description'] as String,
- imageUrl: json['imageUrl'] as String,
+ image: json['image'] as String,
address: json['address'] as String,
- subtitle: json['subtitle'] as String,
openingHours: json['openingHours'] as String,
phoneNumber: json['phoneNumber'] as String,
email: json['email'] as String,
@@ -19,10 +18,9 @@ Restaurant _$RestaurantFromJson(Map json) => Restaurant(
Map<String, dynamic> _$RestaurantToJson(Restaurant instance) =>
<String, dynamic>{
- 'subtitle': instance.subtitle,
- 'name': instance.name,
+ 'title': instance.title,
'description': instance.description,
- 'imageUrl': instance.imageUrl,
+ 'image': instance.image,
'address': instance.address,
'openingHours': instance.openingHours,
'phoneNumber': instance.phoneNumber,
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
index 948ee666..7354d293 100644
--- a/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
+++ b/comwell_key_app/lib/.generated/hotel_information/models/spa.g.dart
@@ -8,14 +8,12 @@ part of '../../../hotel_information/models/spa.dart';
Spa _$SpaFromJson(Map json) => Spa(
title: json['title'] as String,
- subtitle: json['subtitle'] as String,
description: json['description'] as String,
image: json['image'] as String,
);
Map<String, dynamic> _$SpaToJson(Spa instance) => <String, dynamic>{
'title': instance.title,
- 'subtitle': instance.subtitle,
'description': instance.description,
'image': instance.image,
};
diff --git a/comwell_key_app/lib/.generated/services/models/bookings_dto.g.dart b/comwell_key_app/lib/.generated/services/models/bookings_dto.g.dart
index f0a66fd5..68206099 100644
--- a/comwell_key_app/lib/.generated/services/models/bookings_dto.g.dart
+++ b/comwell_key_app/lib/.generated/services/models/bookings_dto.g.dart
@@ -8,11 +8,11 @@ part of '../../../services/models/bookings_dto.dart';
BookingsDTO _$BookingsDTOFromJson(Map json) => BookingsDTO(
current: (json['current'] as List<dynamic>)
- .map((e) => BookingDTO.fromJson(Json.from(e as Map))),
+ .map((e) => BookingDTO.fromJson(Map<String, dynamic>.from(e as Map))),
past: (json['past'] as List<dynamic>)
- .map((e) => BookingDTO.fromJson(Json.from(e as Map))),
+ .map((e) => BookingDTO.fromJson(Map<String, dynamic>.from(e as Map))),
cancelled: (json['cancelled'] as List<dynamic>)
- .map((e) => BookingDTO.fromJson(Json.from(e as Map))),
+ .map((e) => BookingDTO.fromJson(Map<String, dynamic>.from(e as Map))),
);
Map<String, dynamic> _$BookingsDTOToJson(BookingsDTO instance) =>
diff --git a/comwell_key_app/lib/booking_details/booking_details_page.dart b/comwell_key_app/lib/booking_details/booking_details_page.dart
index 55f98239..2e95cc34 100644
--- a/comwell_key_app/lib/booking_details/booking_details_page.dart
+++ b/comwell_key_app/lib/booking_details/booking_details_page.dart
@@ -26,6 +26,7 @@ class BookingDetailsPage extends StatelessWidget {
return BlocConsumer<BookingDetailsBloc, BookingDetailsState>(
listener: (context, state) {},
builder: (context, state) {
+
final cubit = context.read<BookingDetailsBloc>();
print("Booking: ${cubit.booking}");
if (state.status == BookingDetailsStatus.initial) {
@@ -107,7 +108,7 @@ class BookingDetailsPage extends StatelessWidget {
.tr(),
onClick: () {
context.pushNamed(
- AppRoutes.hotelInformation.name);
+ AppRoutes.hotelInformation.name, extra: cubit.booking);
}),
),
),
diff --git a/comwell_key_app/lib/common/components/comwell_app_bar.dart b/comwell_key_app/lib/common/components/comwell_app_bar.dart
index e1eef311..a3e2f370 100644
--- a/comwell_key_app/lib/common/components/comwell_app_bar.dart
+++ b/comwell_key_app/lib/common/components/comwell_app_bar.dart
@@ -44,7 +44,7 @@ class ComwellAppBar extends StatelessWidget implements PreferredSizeWidget {
if (onBackPressed != null) {
onBackPressed!.call();
} else {
- Navigator.of(context).pop();
+ context.pop();
}
},
),
diff --git a/comwell_key_app/lib/find_booking/components/hotel_list_item_view.dart b/comwell_key_app/lib/find_booking/components/hotel_list_item_view.dart
index dd9084f1..a7cebe19 100644
--- a/comwell_key_app/lib/find_booking/components/hotel_list_item_view.dart
+++ b/comwell_key_app/lib/find_booking/components/hotel_list_item_view.dart
@@ -46,7 +46,7 @@ class HotelListItemView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- hotel.name,
+ hotel.hotelName,
style: theme.textTheme.headlineSmall,
),
diff --git a/comwell_key_app/lib/hotel_information/components/hotel_information_list_tile.dart b/comwell_key_app/lib/hotel_information/components/hotel_information_list_tile.dart
index 54eb59b9..7b147429 100644
--- a/comwell_key_app/lib/hotel_information/components/hotel_information_list_tile.dart
+++ b/comwell_key_app/lib/hotel_information/components/hotel_information_list_tile.dart
@@ -5,14 +5,12 @@ import 'package:flutter_svg/svg.dart';
class HotelInformationListTile extends StatelessWidget {
final String iconPath;
final String title;
- final String subtitle;
final Function onClick;
const HotelInformationListTile({
super.key,
required this.iconPath,
required this.title,
- required this.subtitle,
required this.onClick,
});
@@ -44,14 +42,7 @@ class HotelInformationListTile extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title),
- if (subtitle.isNotEmpty)
- Text(
- subtitle,
- style: Theme.of(context)
- .textTheme
- .bodySmall
- ?.copyWith(color: Colors.grey),
- ),
+
],
),
),
diff --git a/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart b/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
index cb491bfd..829de7f0 100644
--- a/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
+++ b/comwell_key_app/lib/hotel_information/components/hotel_information_menu.dart
@@ -12,51 +12,51 @@ class HotelInformationMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final height = MediaQuery.of(context).size.height;
final cubit = context.read<HotelInformationCubit>();
final hotel = cubit.hotel;
- return ListView(
- shrinkWrap: true,
+ final height = MediaQuery.of(context).size.height;
+ return Column(
children: [
- Image.asset(
+ Image.network(
hotel.image,
+ height: height * 0.5,
width: double.infinity,
- height: height * 0.4,
fit: BoxFit.cover,
),
- const SizedBox(height: 16),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(hotel.name,
- style: Theme.of(context).textTheme.headlineLarge),
- const SizedBox(height: 16),
- ...hotel.facilities.map((facility) {
- return Padding(
- padding: const EdgeInsets.only(bottom: 6.0),
- child: HotelInformationListTile(
- iconPath: facility.iconPath,
- title: facility.title,
- subtitle: facility.subtitle,
- onClick: () {
- context.pushNamed("${AppRoutes.hotelInformation.name}/${facility.type}", extra: facility);
- },
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(hotel.hotelName,
+ style: Theme.of(context).textTheme.headlineLarge),
+ const SizedBox(height: 16),
+ ...hotel.facilities.map((facility) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 6.0),
+ child: HotelInformationListTile(
+ iconPath: facility.iconPath,
+ title: facility.title,
+ onClick: () {
+ context.pushNamed(
+ "${AppRoutes.hotelInformation.name}/${facility.routeName}",
+ extra: facility);
+ },
+ ),
+ );
+ }),
+ HotelInformationListTile(
+ iconPath: "assets/icons/ic_info.svg",
+ title: "hotel_information_page_menu_other_info_title".tr(),
+ onClick: cubit.onMoreInformationClicked,
),
- );
- }),
- HotelInformationListTile(
- iconPath: "assets/icons/ic_info.svg",
- title: "hotel_information_page_menu_other_info_title".tr(),
- subtitle:
- "hotel_information_page_menu_other_info_subtitle".tr(),
- onClick: cubit.onMoreInformationClicked,
+ ],
),
- const SizedBox(height: 100)
- ],
+ ),
),
- )
+ ),
],
);
}
diff --git a/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
new file mode 100644
index 00000000..f5118ad4
--- /dev/null
+++ b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
@@ -0,0 +1,59 @@
+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) {
+ final height = MediaQuery.of(context).size.height;
+
+ return Column(
+ children: [
+ Image.asset(
+ 'assets/images/parking.png',
+ height: height * 0.45,
+ width: double.infinity,
+ fit: BoxFit.cover,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 26),
+ Text(
+ parkingInfo.title,
+ style: Theme.of(context).textTheme.headlineLarge,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ parkingInfo.description,
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ if (parkingInfo.electricCharging) ...[
+ const SizedBox(height: 40),
+ Text(
+ parkingInfo.electricChargingTitle,
+ style: Theme.of(context).textTheme.headlineMedium,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ parkingInfo.electricChargingDescription,
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ ],
+ const SizedBox(height: 100),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
index 05baff89..a4404336 100644
--- a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
@@ -2,6 +2,7 @@ import 'package:comwell_key_app/hotel_information/components/contact_hotel_butto
import 'package:comwell_key_app/hotel_information/models/restaurant.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:url_launcher/url_launcher.dart';
class RestaurantPage extends StatelessWidget {
final Restaurant restaurant;
@@ -10,70 +11,84 @@ class RestaurantPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return ListView(
+ final theme = Theme.of(context);
+ final height = MediaQuery.of(context).size.height;
+
+ return Column(
children: [
- Image.asset(restaurant.imageUrl, fit: BoxFit.fitWidth),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 26),
- Text(
- restaurant.name,
- style: Theme.of(context).textTheme.headlineLarge,
- ),
- const SizedBox(
- height: 20,
- ),
- Text(
- restaurant.description,
- style: Theme.of(context).textTheme.bodySmall,
- ),
- const SizedBox(height: 40),
- Text(
- "restaurant_page_practical_information".tr(),
- style: Theme.of(context).textTheme.headlineLarge,
- ),
- const SizedBox(height: 20),
- Text(
- "restaurant_page_address".tr(),
- style: Theme.of(context).textTheme.headlineMedium,
- ),
- Text(
- restaurant.address,
- style: Theme.of(context).textTheme.bodySmall,
- ),
- const SizedBox(height: 20),
- Text(
- "restaurant_page_opening_hours".tr(),
- style: Theme.of(context).textTheme.headlineMedium,
- ),
- Text(
- restaurant.openingHours,
- style: Theme.of(context).textTheme.bodySmall,
- ),
- const SizedBox(height: 40),
- Text(
- "restaurant_page_book_table".tr(),
- style: Theme.of(context).textTheme.headlineMedium,
+ Image.network(
+ restaurant.image,
+ height: height * 0.45,
+ width: double.infinity,
+ fit: BoxFit.cover,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 26),
+ Text(
+ restaurant.title,
+ style: theme.textTheme.headlineLarge,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ restaurant.description,
+ style: theme.textTheme.bodySmall,
+ ),
+ 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,
+ ),
+ Text(
+ restaurant.address,
+ style: theme.textTheme.bodySmall,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ "restaurant_page_opening_hours".tr(),
+ style: theme.textTheme.headlineMedium,
+ ),
+ Text(
+ restaurant.openingHours,
+ style: theme.textTheme.bodySmall,
+ ),
+ const SizedBox(height: 40),
+ Text(
+ "restaurant_page_book_table".tr(),
+ style: theme.textTheme.headlineMedium,
+ ),
+ const SizedBox(height: 20),
+ ContactHotelButton(
+ title: "call_us".tr(),
+ subtitle: restaurant.phoneNumber,
+ iconPath: "assets/icons/ic_telephone.svg",
+ onClick: () {
+ launchUrl(Uri.parse("tel:${restaurant.phoneNumber}"));
+ }),
+ const SizedBox(height: 6),
+ ContactHotelButton(
+ title: "restaurant_page_send_email".tr(),
+ subtitle: restaurant.email,
+ iconPath: "assets/icons/ic_send.svg",
+ onClick: () {
+ launchUrl(Uri.parse("mailto:${restaurant.email}"));
+ }),
+ const SizedBox(height: 100)
+ ],
),
- const SizedBox(height: 20),
- ContactHotelButton(
- title: "call_us".tr(),
- subtitle: restaurant.phoneNumber,
- iconPath: "assets/icons/ic_telephone.svg",
- onClick: () {}),
- const SizedBox(height: 6),
- ContactHotelButton(
- title: "restaurant_page_send_email".tr(),
- subtitle: restaurant.email,
- iconPath: "assets/icons/ic_send.svg",
- onClick: () {}),
- const SizedBox(height: 100)
- ],
+ ),
),
- )
+ ),
],
);
}
diff --git a/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart b/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
index 1621ebef..1f2818f8 100644
--- a/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/spa_facility_page.dart
@@ -1,51 +1,66 @@
import 'package:comwell_key_app/hotel_information/cubit/hotel_information_cubit.dart';
-import 'package:comwell_key_app/themes/dark_theme.dart';
+import 'package:comwell_key_app/hotel_information/models/spa.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 {
- const SpaFacilityPage({super.key});
+ final Spa 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);
+ final height = MediaQuery.of(context).size.height;
return Scaffold(
+ backgroundColor: Colors.white,
bottomSheet: Builder(builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const Divider(
- color: Colors.black12,
+ color: colorDivider,
height: 0,
),
Row(
children: [
Expanded(
- child: Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- onPressed: isLoading
- ? null
- : cubit.onBookSpaClicked,
- style: ButtonStyle(
- backgroundColor:
- WidgetStateProperty.resolveWith((states) {
- if (states.contains(WidgetState.disabled)) {
- return Colors.grey;
+ child: Container(
+ color: Colors.white,
+ child: Padding(
+ padding: const EdgeInsets.all(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 sandColor[80];
+ return Text(
+ "hotel_information_page_spa_button".tr(),
+ style: theme.textTheme.bodyLarge?.copyWith(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ );
}),
- 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("Book Spa ${cubit.state.spaButtonIsLoading}");
- }),
+ ),
),
),
),
@@ -55,10 +70,39 @@ class SpaFacilityPage extends StatelessWidget {
],
);
}),
- body: const Center(
- child: Column(
- children: [Text("Spa")],
- )),
+ body: Column(
+ children: [
+ Image.network(
+ spa.image,
+ height: height * 0.45,
+ width: double.infinity,
+ fit: BoxFit.cover,
+ ),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 26),
+ Text(
+ spa.title,
+ style: Theme.of(context).textTheme.headlineLarge,
+ ),
+ const SizedBox(height: 20),
+ Text(
+ spa.description,
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ const SizedBox(height: 100),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
);
}
}
diff --git a/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart b/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
index 66555edc..ac92e380 100644
--- a/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
+++ b/comwell_key_app/lib/hotel_information/cubit/hotel_information_cubit.dart
@@ -1,6 +1,7 @@
import 'package:bloc/bloc.dart';
import 'package:comwell_key_app/hotel_information/models/hotel.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/services/api.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
@@ -11,14 +12,28 @@ class HotelInformationCubit extends Cubit<HotelInformationState> {
final api = Api();
final HotelInformationRepository hotelInformationRepository;
late final Hotel hotel;
+ final Booking booking;
- HotelInformationCubit({required this.hotelInformationRepository})
+ HotelInformationCubit(
+ {required this.hotelInformationRepository, required this.booking})
: super(const HotelInformationState.initial());
- void fetchHotelInformation() async {
+ void init() async {
+ emit(state.hotelLoading());
try {
- hotel = await hotelInformationRepository.fetchHotelInformation();
+ print("fetching hotel information for ${booking.hotelCode}");
+ hotel = await hotelInformationRepository
+ .fetchHotelInformation(booking.hotelCode);
emit(state.hotelSuccess());
+ } catch (e) {
+ print("error fetching hotel information for ${booking.hotelCode}: $e");
+ emit(state.hotelError());
+ }
+ }
+
+ void fetchHotelInformation(String hotelCode) async {
+ try {
+ print("fetching hotel information for $hotelCode");
} catch (e) {
emit(state.hotelError());
}
diff --git a/comwell_key_app/lib/hotel_information/cubit/hotel_information_state.dart b/comwell_key_app/lib/hotel_information/cubit/hotel_information_state.dart
index 8c7cae00..0d70679d 100644
--- a/comwell_key_app/lib/hotel_information/cubit/hotel_information_state.dart
+++ b/comwell_key_app/lib/hotel_information/cubit/hotel_information_state.dart
@@ -16,7 +16,7 @@ class HotelInformationState extends Equatable {
HotelInformationState bookingSpa(bool spaButtonIsLoading) => _copyWith(spaButtonIsLoading: spaButtonIsLoading);
HotelInformationState hotelSuccess() => _copyWith(hotelState: HotelState.success);
HotelInformationState hotelError() => _copyWith(hotelState: HotelState.error);
-
+ HotelInformationState hotelLoading() => _copyWith(hotelState: HotelState.loading);
HotelInformationState _copyWith({
HotelState? hotelState,
bool? spaButtonIsLoading,
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 6da10f8b..11fc5ee8 100644
--- a/comwell_key_app/lib/hotel_information/hotel_information_page.dart
+++ b/comwell_key_app/lib/hotel_information/hotel_information_page.dart
@@ -1,5 +1,6 @@
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/overview/models/booking.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -12,8 +13,9 @@ class HotelInformationPage extends StatelessWidget {
return BlocBuilder<HotelInformationCubit, HotelInformationState>(
builder: (context, state) {
return Scaffold(
+ extendBodyBehindAppBar: true,
appBar: const ComwellAppBar(),
- backgroundColor: Theme.of(context).colorScheme.surface,
+ backgroundColor: Colors.white,
body: Builder(builder: (context) {
return switch (state.hotelState) {
HotelState.loading => const Center(child: CircularProgressIndicator()),
diff --git a/comwell_key_app/lib/hotel_information/models/facilities.dart b/comwell_key_app/lib/hotel_information/models/facilities.dart
index bf492bfb..227e7e3c 100644
--- a/comwell_key_app/lib/hotel_information/models/facilities.dart
+++ b/comwell_key_app/lib/hotel_information/models/facilities.dart
@@ -7,24 +7,24 @@ import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/facilities.g.dart';
@JsonSerializable(createFactory: false)
-class Facility {
+ class Facility {
final String type;
final String title;
- final String subtitle;
final String iconPath;
+ final String routeName;
Facility({
required this.type,
required this.title,
- required this.subtitle,
required this.iconPath,
+ required this.routeName,
});
factory Facility.fromJson(Json json) {
- return switch (json["type"] as String) {
- "restaurant" => Restaurant.fromJson(json),
- "spa" => Spa.fromJson(json),
- "parking" => ParkingInfo.fromJson(json),
+ return switch (json["\$type"] as String) {
+ "RestaurantFacility" => Restaurant.fromJson(json),
+ "SpaFacility" => Spa.fromJson(json),
+ "ParkingFacility" => ParkingInfo.fromJson(json),
_ => throw Exception("Unsupported facility type")
};
}
diff --git a/comwell_key_app/lib/hotel_information/models/hotel.dart b/comwell_key_app/lib/hotel_information/models/hotel.dart
index 8b184b74..2145d9ef 100644
--- a/comwell_key_app/lib/hotel_information/models/hotel.dart
+++ b/comwell_key_app/lib/hotel_information/models/hotel.dart
@@ -6,22 +6,20 @@ part '../../.generated/hotel_information/models/hotel.g.dart';
@JsonSerializable()
class Hotel {
- final String id;
- final String name;
+ final String hotelCode;
+ final String hotelName;
final String address;
final String city;
final String country;
- final int starRating;
final String image;
final Iterable<Facility> facilities;
Hotel({
- required this.id,
- required this.name,
+ required this.hotelCode,
+ required this.hotelName,
required this.address,
required this.city,
required this.country,
- required this.starRating,
required this.image,
required this.facilities,
});
diff --git a/comwell_key_app/lib/hotel_information/models/parking_info.dart b/comwell_key_app/lib/hotel_information/models/parking_info.dart
index 81ff1067..185f9319 100644
--- a/comwell_key_app/lib/hotel_information/models/parking_info.dart
+++ b/comwell_key_app/lib/hotel_information/models/parking_info.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
import 'package:comwell_key_app/utils/json.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/parking_info.g.dart';
@@ -13,12 +14,11 @@ class ParkingInfo extends Facility {
ParkingInfo({
required super.title,
- required super.subtitle,
required this.description,
required this.electricCharging,
required this.electricChargingTitle,
required this.electricChargingDescription,
- }) : super(type: "parking", iconPath: "assets/icons/ic_car.svg");
+ }) : super(type: "parking".tr(), iconPath: "assets/icons/ic_car.svg", routeName: "parking");
factory ParkingInfo.fromJson(Json json) =>
_$ParkingInfoFromJson(json);
diff --git a/comwell_key_app/lib/hotel_information/models/restaurant.dart b/comwell_key_app/lib/hotel_information/models/restaurant.dart
index 71190951..4ad9f709 100644
--- a/comwell_key_app/lib/hotel_information/models/restaurant.dart
+++ b/comwell_key_app/lib/hotel_information/models/restaurant.dart
@@ -1,29 +1,30 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
import 'package:comwell_key_app/utils/json.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/restaurant.g.dart';
@JsonSerializable()
class Restaurant extends Facility {
- final String name;
+ final String title;
final String description;
- final String imageUrl;
+ final String image;
final String address;
final String openingHours;
final String phoneNumber;
final String email;
+
Restaurant({
- required this.name,
+ required this.title,
required this.description,
- required this.imageUrl,
+ required this.image,
required this.address,
- required super.subtitle,
required this.openingHours,
required this.phoneNumber,
required this.email,
- }) : super(type: "restaurant", title: name, iconPath: "assets/icons/ic_chefs_hat.svg");
+ }) : super(type: "restaurant".tr(), title: title, iconPath: "assets/icons/ic_chefs_hat.svg", routeName: "restaurant");
factory Restaurant.fromJson(Json json) =>
_$RestaurantFromJson(json);
diff --git a/comwell_key_app/lib/hotel_information/models/spa.dart b/comwell_key_app/lib/hotel_information/models/spa.dart
index 68ab4389..9728cb51 100644
--- a/comwell_key_app/lib/hotel_information/models/spa.dart
+++ b/comwell_key_app/lib/hotel_information/models/spa.dart
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/hotel_information/models/facilities.dart';
import 'package:comwell_key_app/utils/json.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:json_annotation/json_annotation.dart';
part '../../.generated/hotel_information/models/spa.g.dart';
@@ -11,10 +12,9 @@ class Spa extends Facility {
Spa({
required super.title,
- required super.subtitle,
required this.description,
required this.image,
- }) : super(type: "spa", iconPath: "assets/icons/ic_spa.svg");
+ }) : super(type: "spa".tr(), iconPath: "assets/icons/ic_spa.svg", routeName: "spa");
factory Spa.fromJson(Json json) => _$SpaFromJson(json);
}
diff --git a/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart b/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
index 673a88d1..effdfe32 100644
--- a/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
+++ b/comwell_key_app/lib/hotel_information/repository/hotel_information_repository.dart
@@ -1,57 +1,66 @@
import 'package:comwell_key_app/hotel_information/models/hotel.dart';
-
-import 'package:comwell_key_app/hotel_information/models/parking_info.dart';
-import 'package:comwell_key_app/hotel_information/models/restaurant.dart';
-import 'package:comwell_key_app/hotel_information/models/spa.dart';
+import 'package:comwell_key_app/services/api.dart';
+import 'package:comwell_key_app/utils/json.dart';
class HotelInformationRepository {
- Future<Hotel> fetchHotelInformation() async {
- // Fetch hotel information
- return Hotel(
- id: '1',
- name: 'Comwell Hotel',
- address: 'Vesterbrogade 6C',
- city: 'Copenhagen',
- country: 'Denmark',
- starRating: 4,
- image: 'assets/images/current_room.png',
- facilities: [
- Restaurant(
- name: 'Restaurant Borupgaard',
- subtitle: "Læs om vores restaurant",
- description: 'Restaurant Linden på Comwell Borupgaard får du en udsøgt gourmetoplevelse, der er fyldt med både smag og styrke. Restauranten byder på ren idyl og hygge, samt en intim atmosfære med service i særklasse.',
- imageUrl: 'assets/images/restaurant_cover.png',
- address: 'Nørrevej 80, 3070 Snekkersten',
- openingHours: 'Restaurant Linden er åben alle dage kl. 12.00-14.00 og 18.00-22.30 (køkkenet lukket kl. 21.30)',
- phoneNumber: '+4528424242',
- email: 'email@comwell.com'),
- Restaurant(
- name: 'Restaurant 2',
- subtitle: "Visit",
- description: 'Description 1',
- imageUrl: 'assets/images/restaurant_cover.png',
- address: 'Address 2',
- openingHours: 'Opening Hours 2',
- phoneNumber: '+4528424242',
- email: 'email@comwell.com'),
- Spa(
- title: 'Spa 1',
- subtitle: "Visit",
- description: 'Description 1',
- image: 'assets/images/spa1.jpg'),
- Spa(
- title: 'Spa 2',
- subtitle: "Visit",
- description: 'Description 2',
- image: 'assets/images/spa2.jpg'),
- ParkingInfo(
- title: 'Parking',
- subtitle: "Park here",
- description: 'Description',
- electricCharging: true,
- electricChargingTitle: 'Electric Charging',
- electricChargingDescription: 'Electric Charging Description'),
- ],
- );
+ final api = Api();
+
+ Future<Hotel> fetchHotelInformation(String hotelCode) async {
+ try {
+ final response = await api.getHotelInfo(hotelCode);
+ final data = response.data as Json;
+ final hotelInfo = Hotel.fromJson(data);
+ return hotelInfo;
+ } catch (e) {
+ throw Exception(e);
+ }
}
}
+ // Fetch hotel information
+ // return Hotel(
+ // id: '1',
+ // name: 'Comwell Hotel',
+ // address: 'Vesterbrogade 6C',
+ // city: 'Copenhagen',
+ // country: 'Denmark',
+ // starRating: 4,
+ // image: 'assets/images/current_room.png',
+ // facilities: [
+ // Restaurant(
+ // name: 'Restaurant Borupgaard',
+ // subtitle: "Læs om vores restaurant",
+ // description: 'Restaurant Linden på Comwell Borupgaard får du en udsøgt gourmetoplevelse, der er fyldt med både smag og styrke. Restauranten byder på ren idyl og hygge, samt en intim atmosfære med service i særklasse.',
+ // imageUrl: 'assets/images/restaurant_cover.png',
+ // address: 'Nørrevej 80, 3070 Snekkersten',
+ // openingHours: 'Restaurant Linden er åben alle dage kl. 12.00-14.00 og 18.00-22.30 (køkkenet lukket kl. 21.30)',
+ // phoneNumber: '+4528424242',
+ // email: 'email@comwell.com'),
+ // Restaurant(
+ // name: 'Restaurant 2',
+ // subtitle: "Visit",
+ // description: 'Description 1',
+ // imageUrl: 'assets/images/restaurant_cover.png',
+ // address: 'Address 2',
+ // openingHours: 'Opening Hours 2',
+ // phoneNumber: '+4528424242',
+ // email: 'email@comwell.com'),
+ // Spa(
+ // title: 'Spa 1',
+ // subtitle: "Visit",
+ // description: 'Description 1',
+ // image: 'assets/images/spa1.jpg'),
+ // Spa(
+ // title: 'Spa 2',
+ // subtitle: "Visit",
+ // description: 'Description 2',
+ // image: 'assets/images/spa2.jpg'),
+ // ParkingInfo(
+ // title: 'Parking',
+ // subtitle: "Park here",
+ // description: 'Description',
+ // electricCharging: true,
+ // electricChargingTitle: 'Electric Charging',
+ // electricChargingDescription: 'Electric Charging Description'),
+ // ],
+ // );
+
diff --git a/comwell_key_app/lib/main.dart b/comwell_key_app/lib/main.dart
index 2c474b44..a30ff6bd 100644
--- a/comwell_key_app/lib/main.dart
+++ b/comwell_key_app/lib/main.dart
@@ -32,6 +32,7 @@ void runMainApp(FirebaseOptions firebaseOptions) async {
supportedLocales: const [Locale('en', 'US'), Locale('da', 'DK')],
path:
'assets/translations', // <-- change the path of the translation files
+ //TODO: What should the fallback locale be?
fallbackLocale: const Locale('da', 'DK'),
child: ComwellApp())));
}
diff --git a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
index b813a834..2f6d854c 100644
--- a/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
+++ b/comwell_key_app/lib/my_booking/components/balance_bottom_sheet.dart
@@ -24,7 +24,6 @@ class BalanceBottomSheet extends StatefulWidget {
}
class _BalanceBottomSheetState extends State<BalanceBottomSheet> {
-
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
@@ -39,10 +38,10 @@ class _BalanceBottomSheetState extends State<BalanceBottomSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
- padding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
+ padding:
+ const EdgeInsets.symmetric(vertical: 40.0, horizontal: 16),
child: Container(
- padding:
- const EdgeInsets.symmetric(vertical: 8),
+ padding: const EdgeInsets.symmetric(vertical: 8),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: colorDivider),
@@ -100,7 +99,8 @@ class _BalanceBottomSheetState extends State<BalanceBottomSheet> {
],
),
const SizedBox(height: 16),
- ...widget.items.map((item) => _buildBalanceItem(item, theme)),
+ ...widget.items
+ .map((item) => _buildBalanceItem(item, theme)),
const SizedBox(height: 24),
Container(
@@ -169,12 +169,24 @@ class _BalanceBottomSheetState extends State<BalanceBottomSheet> {
borderRadius: BorderRadius.circular(32),
),
),
- child: Text(
- 'Gå til betaling ${widget.balance.toInt()} kr.',
- style: const TextStyle(
- color: Colors.white,
- fontSize: 16,
- fontWeight: FontWeight.w500,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ 'go_to_payment'.tr(),
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ ),
+ ),
+ Text(
+ '${widget.balance.toInt()} kr.',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: Colors.white,
+ ),
+ ),
+ ],
),
),
),
@@ -219,10 +231,7 @@ class _BalanceBottomSheetState extends State<BalanceBottomSheet> {
color: Colors.grey[200],
borderRadius: BorderRadius.circular(2),
),
- child: Text(
- 'payed'.tr(),
- style: theme.textTheme.bodySmall
- ),
+ child: Text('payed'.tr(), style: theme.textTheme.bodySmall),
),
],
),
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index 81ef8930..b35998a1 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -111,8 +111,8 @@ class OverviewTabViewState extends State<OverviewPage>
],
OutlinedButton.icon(
onPressed: () async {
- throw Exception('This is test exception');
- //context.pushNamed(AppRoutes.findBooking.name);
+ //throw Exception('This is test exception');
+ context.pushNamed(AppRoutes.findBooking.name);
},
icon: Icon(Icons.search,
color: Theme.of(context).dividerColor),
diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index c7b40d8b..0dfdd7e6 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -47,7 +47,8 @@ class ProfilePage extends StatelessWidget {
Widget _buildProfilePage(ProfileCubit cubit, BuildContext context) {
final user = cubit.state.user;
- final isActive = cubit.state.user!.clubLevel != 'L1';
+ final isActive = cubit.state.user!.clubLevel != '';
+ final theme = Theme.of(context);
return SafeArea(
child: Column(
@@ -101,7 +102,8 @@ class ProfilePage extends StatelessWidget {
isScrollControlled: true,
backgroundColor: Colors.white,
builder: (context) =>
- ComwellClubSignupBottomSheet(user: user!),
+ ComwellClubSignupBottomSheet(
+ user: user!),
);
cubit.init();
},
@@ -195,7 +197,6 @@ class ProfilePage extends StatelessWidget {
child: Divider(color: colorDivider),
),
],
- const SizedBox(height: 10),
Center(
child: OutlinedButton(
style: OutlinedButton.styleFrom(
@@ -210,19 +211,8 @@ class ProfilePage extends StatelessWidget {
),
),
),
+ Expanded(child: _getVersion(context, theme)),
const SizedBox(height: 16),
- FutureBuilder<String>(
- future: context.read<ProfileCubit>().getVersion(),
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- return Text(snapshot.data!,
- style: TextStyle(color: Colors.grey[500]));
- }
- return const SizedBox.shrink();
- },
- ),
- const SizedBox(height: 20),
- const Spacer(),
],
),
),
@@ -232,6 +222,21 @@ class ProfilePage extends StatelessWidget {
);
}
+ Widget _getVersion(BuildContext context, ThemeData theme) {
+ return FutureBuilder<String>(
+ future: context.read<ProfileCubit>().getVersion(),
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ return Text(snapshot.data!,
+ style: theme.textTheme.bodySmall!.copyWith(
+ color: Colors.grey[500],
+ ));
+ }
+ return const SizedBox.shrink();
+ },
+ );
+ }
+
Future<AlertDialog?> showLogoutDialog(BuildContext context) {
return showDialog<AlertDialog>(
context: context,
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index c259cf67..57f0f309 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -9,10 +9,13 @@ import 'package:comwell_key_app/contact/contact_page.dart';
import 'package:comwell_key_app/find_booking/find_booking_page.dart';
import 'package:comwell_key_app/find_booking/loading_page.dart';
import 'package:comwell_key_app/hotel_information/components/hotel_information_menu.dart';
+import 'package:comwell_key_app/hotel_information/components/parking_facility_page.dart';
import 'package:comwell_key_app/hotel_information/components/restaurant_page.dart';
import 'package:comwell_key_app/hotel_information/components/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/hotel_information/models/spa.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';
@@ -98,16 +101,20 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
navigatorKey: _shellNavigatorKey,
parentNavigatorKey: _rootNavigatorKey,
pageBuilder: (context, state, child) {
+
return NoTransitionPage(
child: BlocProvider<HotelInformationCubit>(
create: (BuildContext context) => HotelInformationCubit(
hotelInformationRepository:
- locator<HotelInformationRepository>())
- ..fetchHotelInformation(),
+ locator<HotelInformationRepository>(),
+ booking: state.extra as Booking)
+ ..init(),
child:
BlocBuilder<HotelInformationCubit, HotelInformationState>(
builder: (context, state) {
- return HotelInformationPage(child: child);
+
+ return HotelInformationPage(
+ child: child);
}),
),
);
@@ -120,22 +127,29 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
return const HotelInformationMenu();
}),
GoRoute(
- path:
- "/${AppRoutes.hotelInformation.name}/${AppRoutes.spa.name}",
- name:
- "${AppRoutes.hotelInformation.name}/${AppRoutes.spa.name}",
+ path: "/${AppRoutes.hotelInformation.name}/${AppRoutes.spa.name}",
+ name: "${AppRoutes.hotelInformation.name}/${AppRoutes.spa.name}",
builder: (context, state) {
- return const SpaFacilityPage();
+ print("spa ${AppRoutes.spa}");
+ final spa = state.extra as Spa;
+ return SpaFacilityPage(spa: spa);
}),
GoRoute(
- path:
- "/${AppRoutes.hotelInformation.name}/${AppRoutes.restaurant.name}",
- name:
- "${AppRoutes.hotelInformation.name}/${AppRoutes.restaurant.name}",
+ path: "/${AppRoutes.hotelInformation.name}/restaurant",
+ name: "${AppRoutes.hotelInformation.name}/restaurant",
builder: (context, state) {
+ print("restaurant ${state.extra}");
final restaurant = state.extra as Restaurant;
return RestaurantPage(restaurant: restaurant);
}),
+ GoRoute(
+ path: "/${AppRoutes.hotelInformation.name}/parking",
+ name: "${AppRoutes.hotelInformation.name}/parking",
+ builder: (context, state) {
+ print("parking ${state.extra}");
+ final parking = state.extra as ParkingInfo;
+ return ParkingFacilityPage(parkingInfo: parking);
+ }),
]),
GoRoute(
path: '/${AppRoutes.contact.name}',
diff --git a/comwell_key_app/lib/routing/go_router_observer.dart b/comwell_key_app/lib/routing/go_router_observer.dart
index ae0296e0..065b67ff 100644
--- a/comwell_key_app/lib/routing/go_router_observer.dart
+++ b/comwell_key_app/lib/routing/go_router_observer.dart
@@ -48,7 +48,7 @@ String getPath(String routeName) {
case 'hotelInformation':
return '/overview/bookingsdetails/hotelInformation';
case 'restaurant':
- return '/overview/bookingsdetails/hotelInformation/restaurant';
+ return '/hotelInformation/restaurant';
case 'spa':
return '/overview/bookingsdetails/hotelInformation/spa';
case 'parking':
diff --git a/comwell_key_app/lib/services/api.dart b/comwell_key_app/lib/services/api.dart
index 98c3e254..bace4d96 100644
--- a/comwell_key_app/lib/services/api.dart
+++ b/comwell_key_app/lib/services/api.dart
@@ -9,6 +9,7 @@ import 'package:comwell_key_app/services/models/bookings_dto.dart';
import 'package:comwell_key_app/services/models/user_dto.dart';
import 'package:comwell_key_app/utils/json.dart';
import 'package:dio/dio.dart';
+import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'adyen/stored_payment_methods_response.dart';
@@ -54,8 +55,7 @@ class Api {
Json paymentResult, String shopperReference) async {
final Json headers = {
"content-type": "application/json",
- "x-API-key":
- "AQEohmfuXNWTK0Qc+iSTnWkvouiXYIRZCJ9ZsI49DtvZ0d3gjdIA7pissxDBXVsNvuR83LVYjEgiTGAH-4HQnMZXxLZfhge7EdwYZZW0ynntChj41ziiKl6D1Glo=-.\$>;9&L_t@^g7[IR"
+ "x-API-key": dotenv.env["ADYEN_TEST_KEY"]
};
final Map<String, dynamic> data = {
"shopperReference": "Test reference",
@@ -148,6 +148,12 @@ class Api {
return response;
}
+ Future<dynamic> getHotelInfo(String hotelCode) async {
+ print("fetching hotel info for $hotelCode");
+ final response = await dio.get<Json>('/Content/v1/api/v1/hotel?hotelCode=$hotelCode');
+ return response;
+ }
+
// Check in
Future<void> checkIn(String confirmationId) async {
await dio.post<void>("/booking/v1/CheckIn",