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

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-06-05 15:23:29 +0200
fixed some missed bugs and added maps functionality to restaurant

Changed files

.../components/maps_bottom_modal.dart              | 67 ++++++++++++++++++++++
 .../components/restaurant_page.dart                | 17 +++++-
 .../components/spa_facility_page.dart              |  6 +-
 3 files changed, 85 insertions(+), 5 deletions(-)

Diff

diff --git a/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart b/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart
new file mode 100644
index 00000000..0142d351
--- /dev/null
+++ b/comwell_key_app/lib/hotel_information/components/maps_bottom_modal.dart
@@ -0,0 +1,67 @@
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:flutter/material.dart';
+import 'package:url_launcher/url_launcher.dart';
+import 'dart:io' show Platform;
+
+class MapsBottomModal extends StatelessWidget {
+ final String address;
+
+ const MapsBottomModal({
+ super.key,
+ required this.address,
+ });
+
+ static void show(BuildContext context, String address) {
+ showModalBottomSheet<void>(
+ context: context,
+ builder: (BuildContext context) {
+ return MapsBottomModal(
+ address: address,
+ );
+ },
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+ return Container(
+ height: 150,
+ decoration: const BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.only(
+ topLeft: Radius.circular(20),
+ topRight: Radius.circular(20),
+ ),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ ListTile(
+ leading: const Icon(Icons.map),
+ title: Text('Google Maps', style: theme.textTheme.bodyMedium),
+ onTap: () async {
+ Navigator.pop(context);
+ final googleMapsUrl = Uri.parse('https://www.google.com/maps/search/?api=1&query=$address');
+ if (await canLaunchUrl(googleMapsUrl)) {
+ await launchUrl(googleMapsUrl, mode: LaunchMode.externalApplication);
+ }
+ },
+ ),
+ if (Platform.isIOS)
+ ListTile(
+ leading: const Icon(Icons.map_outlined),
+ title: Text('Apple Maps', style: theme.textTheme.bodyMedium),
+ onTap: () async {
+ Navigator.pop(context);
+ final appleMapsUrl = Uri.parse('https://maps.apple.com/?q=$address');
+ if (await canLaunchUrl(appleMapsUrl)) {
+ await launchUrl(appleMapsUrl, mode: LaunchMode.externalApplication);
+ }
+ },
+ ),
+ ],
+ ),
+ );
+ }
+}
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 d0937ced..cf359513 100644
--- a/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
+++ b/comwell_key_app/lib/hotel_information/components/restaurant_page.dart
@@ -1,14 +1,18 @@
import 'package:comwell_key_app/hotel_information/components/contact_hotel_button.dart';
+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/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
+import 'dart:io' show Platform;
class RestaurantPage extends StatelessWidget {
final Restaurant restaurant;
const RestaurantPage({super.key, required this.restaurant});
+
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
@@ -61,9 +65,16 @@ class RestaurantPage extends StatelessWidget {
"restaurant_page_address".tr(),
style: theme.textTheme.headlineMedium,
),
- Text(
- restaurant.address,
- style: theme.textTheme.bodySmall,
+ GestureDetector(
+ onTap: () => MapsBottomModal.show(context, restaurant.address),
+ child: Text(
+ restaurant.address,
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: sandColor,
+ decoration: TextDecoration.underline,
+ decorationColor: sandColor,
+ ),
+ ),
),
const SizedBox(height: 20),
Text(
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 a50f3b87..d73098fa 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
@@ -100,8 +100,10 @@ class SpaFacilityPage extends StatelessWidget {
child: Text(
block.data,
style: block.type == "headerBlock"
- ? theme.textTheme.headlineSmall
- : theme.textTheme.bodySmall,
+ ? theme.textTheme.headlineMedium
+ : theme.textTheme.bodySmall?.copyWith(
+ color: Colors.black.withValues(alpha: 0.65),
+ ),
),
);
}).toList(),