6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit ae8c196b
Changed files
.../hotel_information/models/facilities.g.dart | 2 + .../hotel_information/models/parking_info.g.dart | 4 +- .../hotel_information/models/restaurant.g.dart | 4 +- .../.generated/hotel_information/models/spa.g.dart | 20 ++- .../components/parking_facility_page.dart | 2 +- .../components/restaurant_page.dart | 149 +++++++++++---------- .../components/spa_facility_page.dart | 4 +- .../lib/hotel_information/models/facilities.dart | 17 ++- .../lib/hotel_information/models/parking_info.dart | 33 ++++- .../lib/hotel_information/models/restaurant.dart | 41 ++++-- .../lib/hotel_information/models/spa.dart | 48 ++++++- 11 files changed, 219 insertions(+), 105 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 e58271ec..72018c49 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
@@ -10,4 +10,6 @@ Map<String, dynamic> _$FacilityToJson(Facility instance) => <String, dynamic>{
'type': instance.type,
'title': instance.title,
'iconPath': instance.iconPath,
+ 'routeName': instance.routeName,
+ 'value': instance.value,
};
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 80bd5da4..63018362 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,18 +8,18 @@ part of '../../../hotel_information/models/parking_info.dart';
ParkingInfo _$ParkingInfoFromJson(Map json) => ParkingInfo(
title: json['title'] as String,
- description: json['description'] as String,
electricCharging: json['electricCharging'] as bool,
electricChargingTitle: json['electricChargingTitle'] as String,
electricChargingDescription:
json['electricChargingDescription'] as String,
+ structedText: Map<String, dynamic>.from(json['structedText'] as Map),
);
Map<String, dynamic> _$ParkingInfoToJson(ParkingInfo instance) =>
<String, dynamic>{
'title': instance.title,
- 'description': instance.description,
'electricCharging': instance.electricCharging,
'electricChargingTitle': instance.electricChargingTitle,
'electricChargingDescription': instance.electricChargingDescription,
+ 'structedText': instance.structedText,
};
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 1073fc89..86ffb2e2 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
@@ -8,21 +8,21 @@ part of '../../../hotel_information/models/restaurant.dart';
Restaurant _$RestaurantFromJson(Map json) => Restaurant(
title: json['title'] as String,
- description: json['description'] as String,
image: json['image'] as String,
address: json['address'] as String,
openingHours: json['openingHours'] as String,
phoneNumber: json['phoneNumber'] as String,
email: json['email'] as String,
+ structedText: Map<String, dynamic>.from(json['structedText'] as Map),
);
Map<String, dynamic> _$RestaurantToJson(Restaurant instance) =>
<String, dynamic>{
'title': instance.title,
- 'description': instance.description,
'image': instance.image,
'address': instance.address,
'openingHours': instance.openingHours,
'phoneNumber': instance.phoneNumber,
'email': instance.email,
+ 'structedText': instance.structedText,
};
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 7354d293..df1cd3f0 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,12 +8,28 @@ part of '../../../hotel_information/models/spa.dart';
Spa _$SpaFromJson(Map json) => Spa(
title: json['title'] as String,
- description: json['description'] as String,
image: json['image'] as String,
+ spaBookingLink: SpaBookingLink.fromJson(
+ Map<String, dynamic>.from(json['spaBookingLink'] as Map)),
+ structedText: Map<String, dynamic>.from(json['structedText'] as Map),
);
Map<String, dynamic> _$SpaToJson(Spa instance) => <String, dynamic>{
'title': instance.title,
- 'description': instance.description,
'image': instance.image,
+ 'spaBookingLink': instance.spaBookingLink.toJson(),
+ 'structedText': instance.structedText,
+ };
+
+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/parking_facility_page.dart b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
index f5118ad4..d689d211 100644
--- a/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/parking_facility_page.dart
@@ -32,7 +32,7 @@ class ParkingFacilityPage extends StatelessWidget {
),
const SizedBox(height: 20),
Text(
- parkingInfo.description,
+ parkingInfo.structedText.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
if (parkingInfo.electricCharging) ...[
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 a4404336..9d1f8db1 100644
--- a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
@@ -14,82 +14,85 @@ class RestaurantPage extends StatelessWidget {
final theme = Theme.of(context);
final height = MediaQuery.of(context).size.height;
- return Column(
- children: [
- 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)
- ],
+ return Scaffold(
+ backgroundColor: Colors.white,
+ bottomSheet: Column(
+ children: [
+ 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.structedText.toString(),
+ 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)
+ ],
+ ),
),
),
),
- ),
- ],
+ ],
+ ),
);
}
}
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 1f2818f8..f6a18f26 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
@@ -51,7 +51,7 @@ class SpaFacilityPage extends StatelessWidget {
child: Builder(builder: (context) {
if (isLoading) {
return const CircularProgressIndicator();
- }
+ }
return Text(
"hotel_information_page_spa_button".tr(),
style: theme.textTheme.bodyLarge?.copyWith(
@@ -92,7 +92,7 @@ class SpaFacilityPage extends StatelessWidget {
),
const SizedBox(height: 20),
Text(
- spa.description,
+ spa.structedText.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 100),
diff --git a/comwell_key_app/lib/hotel_information/models/facilities.dart b/comwell_key_app/lib/hotel_information/models/facilities.dart
index b12e8061..b8407441 100644
--- a/comwell_key_app/lib/hotel_information/models/facilities.dart
+++ b/comwell_key_app/lib/hotel_information/models/facilities.dart
@@ -7,25 +7,30 @@ 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 iconPath;
final String routeName;
+ final Json value;
Facility({
required this.type,
required this.title,
required this.iconPath,
required this.routeName,
+ required this.value,
});
factory Facility.fromJson(Json json) {
- return switch (json["type"] as String) {
- "RestaurantFacility" => Restaurant.fromJson(json),
- "SpaFacility" => Spa.fromJson(json),
- "ParkingFacility" => ParkingInfo.fromJson(json),
- _ => throw Exception("Unsupported facility type")
+ final facilityType = json["type"] as String;
+ final valueJson = json["value"] as Json;
+
+ return switch (facilityType) {
+ "Spa" => Spa.fromJson({...json, "value": valueJson}),
+ "Restaurant" => Restaurant.fromJson({...json, "value": valueJson}),
+ "ParkingInfo" => ParkingInfo.fromJson({...json, "value": valueJson}),
+ _ => throw Exception("Unsupported facility type: $facilityType")
};
}
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 185f9319..f74637e6 100644
--- a/comwell_key_app/lib/hotel_information/models/parking_info.dart
+++ b/comwell_key_app/lib/hotel_information/models/parking_info.dart
@@ -7,19 +7,42 @@ part '../../.generated/hotel_information/models/parking_info.g.dart';
@JsonSerializable()
class ParkingInfo extends Facility {
- final String description;
final bool electricCharging;
final String electricChargingTitle;
final String electricChargingDescription;
+ final Json structedText;
ParkingInfo({
required super.title,
- required this.description,
required this.electricCharging,
required this.electricChargingTitle,
required this.electricChargingDescription,
- }) : super(type: "parking".tr(), iconPath: "assets/icons/ic_car.svg", routeName: "parking");
+ required this.structedText,
+ }) : super(
+ type: "Parking",
+ iconPath: "assets/icons/ic_car.svg",
+ routeName: "parking",
+ value: {
+ "\$type": "ParkingFacility",
+ "title": title,
+ "electricCharging": electricCharging,
+ "electricChargingTitle": electricChargingTitle,
+ "electricChargingDescription": electricChargingDescription,
+ "structedText": structedText,
+ },
+ );
- factory ParkingInfo.fromJson(Json json) =>
- _$ParkingInfoFromJson(json);
+ factory ParkingInfo.fromJson(Json json) {
+ final value = json["value"] as Json;
+ return ParkingInfo(
+ title: value["title"] as String,
+ electricCharging: value["electricCharging"] as bool,
+ electricChargingTitle: value["electricChargingTitle"] as String,
+ electricChargingDescription: value["electricChargingDescription"] as String,
+ structedText: value["structedText"] as Json,
+ );
+ }
+
+ @override
+ 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
index 4ad9f709..4bef1ad6 100644
--- a/comwell_key_app/lib/hotel_information/models/restaurant.dart
+++ b/comwell_key_app/lib/hotel_information/models/restaurant.dart
@@ -7,25 +7,50 @@ part '../../.generated/hotel_information/models/restaurant.g.dart';
@JsonSerializable()
class Restaurant extends Facility {
- final String title;
- final String description;
final String image;
final String address;
final String openingHours;
final String phoneNumber;
final String email;
-
+ final Json structedText;
Restaurant({
- required this.title,
- required this.description,
+ required super.title,
required this.image,
required this.address,
required this.openingHours,
required this.phoneNumber,
required this.email,
- }) : super(type: "restaurant".tr(), title: title, iconPath: "assets/icons/ic_chefs_hat.svg", routeName: "restaurant");
+ required this.structedText,
+ }) : super(
+ type: "Restaurant",
+ iconPath: "assets/icons/ic_chefs_hat.svg",
+ routeName: "restaurant",
+ value: {
+ "\$type": "RestaurantFacility",
+ "image": image,
+ "title": title,
+ "address": address,
+ "openingHours": openingHours,
+ "phoneNumber": phoneNumber,
+ "email": email,
+ "structedText": structedText,
+ },
+ );
+
+ factory Restaurant.fromJson(Json json) {
+ final value = json["value"] as Json;
+ return Restaurant(
+ title: value["title"] as String,
+ image: value["image"] as String,
+ address: value["address"] as String,
+ openingHours: value["openingHours"] as String,
+ phoneNumber: value["phoneNumber"] as String,
+ email: value["email"] as String,
+ structedText: value["structedText"] as Json,
+ );
+ }
- factory Restaurant.fromJson(Json json) =>
- _$RestaurantFromJson(json);
+ @override
+ 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
index 9728cb51..b3dcb291 100644
--- a/comwell_key_app/lib/hotel_information/models/spa.dart
+++ b/comwell_key_app/lib/hotel_information/models/spa.dart
@@ -7,14 +7,54 @@ part '../../.generated/hotel_information/models/spa.g.dart';
@JsonSerializable()
class Spa extends Facility {
- final String description;
final String image;
+ final SpaBookingLink spaBookingLink;
+ final Json structedText;
Spa({
required super.title,
- required this.description,
required this.image,
- }) : super(type: "spa".tr(), iconPath: "assets/icons/ic_spa.svg", routeName: "spa");
+ required this.spaBookingLink,
+ required this.structedText,
+ }) : super(
+ type: "Spa",
+ iconPath: "assets/icons/ic_spa.svg",
+ routeName: "spa",
+ value: {
+ "\$type": "SpaFacility",
+ "image": image,
+ "spaBookingLink": spaBookingLink.toJson(),
+ "title": title,
+ "structedText": structedText,
+ },
+ );
- factory Spa.fromJson(Json json) => _$SpaFromJson(json);
+ factory Spa.fromJson(Json json) {
+ final value = json["value"] as Json;
+ return Spa(
+ title: value["title"] as String,
+ image: value["image"] as String,
+ spaBookingLink: SpaBookingLink.fromJson(value["spaBookingLink"] as Json),
+ structedText: value["structedText"] as Json,
+ );
+ }
+
+ @override
+ 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);
}