6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit da90c768

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-06-10 13:33:00 +0200
mid commit

Changed files

.../lib/hotel_information/components/address.dart  |   3 +-
 .../components/opening_hours.dart                  |   1 -
 .../pages/restaurant_facility_page.dart            | 125 +++++++++++++++++++++
 .../hotel_information/pages/restaurant_page.dart   | 102 -----------------
 comwell_key_app/lib/routing/app_router.dart        |   8 +-
 5 files changed, 130 insertions(+), 109 deletions(-)

Diff

diff --git a/comwell_key_app/lib/hotel_information/components/address.dart b/comwell_key_app/lib/hotel_information/components/address.dart
index dd09f7dc..b026eb77 100644
--- a/comwell_key_app/lib/hotel_information/components/address.dart
+++ b/comwell_key_app/lib/hotel_information/components/address.dart
@@ -27,8 +27,7 @@ class Address extends StatelessWidget {
decorationColor: sandColor,
),
),
- ),
- const SizedBox(height: 20),
+ )
],
);
}
diff --git a/comwell_key_app/lib/hotel_information/components/opening_hours.dart b/comwell_key_app/lib/hotel_information/components/opening_hours.dart
index 63e48156..4cccc0b6 100644
--- a/comwell_key_app/lib/hotel_information/components/opening_hours.dart
+++ b/comwell_key_app/lib/hotel_information/components/opening_hours.dart
@@ -20,7 +20,6 @@ class OpeningHours extends StatelessWidget {
openingHours,
style: theme.textTheme.bodySmall,
),
- const SizedBox(height: 20),
],
);
}
diff --git a/comwell_key_app/lib/hotel_information/pages/restaurant_facility_page.dart b/comwell_key_app/lib/hotel_information/pages/restaurant_facility_page.dart
new file mode 100644
index 00000000..bfd09c69
--- /dev/null
+++ b/comwell_key_app/lib/hotel_information/pages/restaurant_facility_page.dart
@@ -0,0 +1,125 @@
+import 'package:comwell_key_app/hotel_information/components/contact_hotel_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/components/address.dart';
+import 'package:comwell_key_app/hotel_information/components/opening_hours.dart';
+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 RestaurantFacilityPage extends StatelessWidget {
+ final Restaurant restaurant;
+
+ const RestaurantFacilityPage({super.key, required this.restaurant});
+
+ List<Widget> _buildDynamicContent(BuildContext context) {
+ final theme = Theme.of(context);
+ final Map<String, dynamic> restaurantData = restaurant.toJson();
+ final List<Widget> widgets = [];
+
+
+ restaurantData.forEach((key, value) {
+
+ switch (key) {
+ case 'title':
+ widgets.add(Text(
+ value as String,
+ style: theme.textTheme.headlineLarge,
+ ));
+ widgets.add(const SizedBox(height: 20));
+ break;
+
+ case 'structuredText':
+ widgets.add(StructuredText(blocks: restaurant.structuredTextBlocks));
+ widgets.add(const SizedBox(height: 20));
+ break;
+
+ case 'address':
+ widgets.add(Address(address: value as String));
+ widgets.add(const SizedBox(height: 20));
+ break;
+
+ case 'openingHours':
+ widgets.add(OpeningHours(openingHours: value as String));
+ widgets.add(const SizedBox(height: 20));
+ break;
+
+ case 'phoneNumber':
+ widgets.add(Text(
+ "restaurant_page_book_table".tr(),
+ style: theme.textTheme.headlineMedium,
+ ));
+ widgets.add(const SizedBox(height: 20));
+ widgets.add(ContactHotelButton(
+ title: "call_us".tr(),
+ subtitle: value as String,
+ iconPath: "assets/icons/ic_telephone.svg",
+ onClick: () async {
+ final cleanPhoneNumber = value.replaceAll(' ', '');
+ final Uri phoneUri = Uri.parse("tel:$cleanPhoneNumber");
+ if (await canLaunchUrl(phoneUri)) {
+ await launchUrl(phoneUri);
+ } else {
+ if (context.mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(content: Text("Could not launch phone call")),
+ );
+ }
+ }
+ },
+ ));
+ widgets.add(const SizedBox(height: 6));
+ break;
+
+ case 'email':
+ widgets.add(ContactHotelButton(
+ title: "restaurant_page_send_email".tr(),
+ subtitle: value as String,
+ iconPath: "assets/icons/ic_send.svg",
+ onClick: () async {
+ final Uri emailUri = Uri.parse("mailto:$value");
+ print("emailUri=$emailUri");
+ if (await canLaunchUrl(emailUri)) {
+ await launchUrl(emailUri, mode: LaunchMode.externalApplication);
+ } else {
+ if (context.mounted) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(content: Text("Could not launch email client")),
+ );
+ }
+ }
+ },
+ ));
+ widgets.add(const SizedBox(height: 20));
+ break;
+ }
+ });
+
+ widgets.add(const SizedBox(height: 100));
+ return widgets;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ backgroundColor: Colors.white,
+ body: Column(
+ children: [
+ ImageWidget(image: restaurant.image),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 26),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: _buildDynamicContent(context),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/hotel_information/pages/restaurant_page.dart b/comwell_key_app/lib/hotel_information/pages/restaurant_page.dart
deleted file mode 100644
index 39247041..00000000
--- a/comwell_key_app/lib/hotel_information/pages/restaurant_page.dart
+++ /dev/null
@@ -1,102 +0,0 @@
-import 'package:comwell_key_app/hotel_information/components/contact_hotel_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/components/address.dart';
-import 'package:comwell_key_app/hotel_information/components/opening_hours.dart';
-import 'package:comwell_key_app/hotel_information/models/restaurant.dart';
-import 'package:comwell_key_app/themes/light_theme.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;
-
- const RestaurantPage({super.key, required this.restaurant});
-
- List<Widget> _buildDynamicContent(BuildContext context) {
- final theme = Theme.of(context);
- final Map<String, dynamic> restaurantData = restaurant.toJson();
- final List<Widget> widgets = [];
-
-
- restaurantData.forEach((key, value) {
-
- switch (key) {
- case 'title':
- widgets.add(Text(
- value as String,
- style: theme.textTheme.headlineLarge,
- ));
- widgets.add(const SizedBox(height: 20));
- break;
-
- case 'structuredText':
- widgets.add(StructuredText(blocks: restaurant.structuredTextBlocks));
- widgets.add(const SizedBox(height: 20));
- break;
-
- case 'address':
- widgets.add(Address(address: value as String));
- widgets.add(const SizedBox(height: 20));
- break;
-
- case 'openingHours':
- widgets.add(OpeningHours(openingHours: value as String));
- widgets.add(const SizedBox(height: 20));
- break;
-
- case 'phoneNumber':
- widgets.add(Text(
- "restaurant_page_book_table".tr(),
- style: theme.textTheme.headlineMedium,
- ));
- widgets.add(const SizedBox(height: 20));
- widgets.add(ContactHotelButton(
- title: "call_us".tr(),
- subtitle: value as String,
- iconPath: "assets/icons/ic_telephone.svg",
- onClick: () => launchUrl(Uri.parse("tel:$value")),
- ));
- widgets.add(const SizedBox(height: 6));
- break;
-
- case 'email':
- widgets.add(ContactHotelButton(
- title: "restaurant_page_send_email".tr(),
- subtitle: value as String,
- iconPath: "assets/icons/ic_send.svg",
- onClick: () => launchUrl(Uri.parse("mailto:$value")),
- ));
- widgets.add(const SizedBox(height: 20));
- break;
- }
- });
-
- widgets.add(const SizedBox(height: 100));
- return widgets;
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- body: Column(
- children: [
- ImageWidget(image: restaurant.image),
- Expanded(
- child: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 26),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: _buildDynamicContent(context),
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-}
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index dd62e90b..87e07314 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -13,7 +13,7 @@ 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/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/restaurant_page.dart';
+import 'package:comwell_key_app/hotel_information/pages/restaurant_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';
@@ -140,11 +140,11 @@ GoRouter goRouter() {
return SpaFacilityPage(spa: spa);
}),
GoRoute(
- path: "/${AppRoutes.hotelInformation.name}/restaurant",
- name: "${AppRoutes.hotelInformation.name}/restaurant",
+ path: "/${AppRoutes.hotelInformation.name}/${AppRoutes.restaurant.name}",
+ name: "${AppRoutes.hotelInformation.name}/${AppRoutes.restaurant.name}",
builder: (context, state) {
final restaurant = state.extra as Restaurant;
- return RestaurantPage(restaurant: restaurant);
+ return RestaurantFacilityPage(restaurant: restaurant);
}),
GoRoute(
path: "/${AppRoutes.hotelInformation.name}/parking",