6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 979249c0
Changed files
comwell_key_app/assets/translations/da-DK.json | 4 +- comwell_key_app/assets/translations/en-US.json | 4 +- .../components/choose_room_widget.dart | 141 +++++++++++++++++++++ comwell_key_app/lib/overview/overview_page.dart | 35 ++++- 4 files changed, 181 insertions(+), 3 deletions(-)
Diff
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 40746223..9845e8e7 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -288,5 +288,7 @@
"email_launch_error": "Kunne ikke åbne email klient",
"phone_launch_error": "Kunne ikke åbne telefon",
"balance": "SALDO",
- "new_booking": "Book nyt ophold"
+ "new_booking": "Book nyt ophold",
+ "error_opening_website": "Kunne ikke åbne hjemmesiden. Prøv igen senere.",
+ "error_opening_website_title": "Fejl"
}
\ 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 bb2d9f1e..ec3104d9 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -287,6 +287,8 @@
"email_launch_error": "Could not launch email client",
"phone_launch_error": "Could not launch phone call",
"balance": "BALANCE",
- "new_booking": "Make a new booking"
+ "new_booking": "Make a new booking",
+ "error_opening_website": "Failed to open the website. Please try again later.",
+ "error_opening_website_title": "Error"
}
diff --git a/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart b/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart
new file mode 100644
index 00000000..b40e97a2
--- /dev/null
+++ b/comwell_key_app/lib/choose_share_room/components/choose_room_widget.dart
@@ -0,0 +1,141 @@
+import 'package:comwell_key_app/routing/app_routes.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:go_router/go_router.dart';
+
+class ChooseRoomWidget extends StatelessWidget {
+ final String roomName;
+ final String description;
+ final int guests;
+ final String imageAsset;
+ final String? extraInfo;
+ final VoidCallback onSelect;
+
+ const ChooseRoomWidget({
+ super.key,
+ required this.roomName,
+ required this.description,
+ required this.guests,
+ required this.imageAsset,
+ this.extraInfo,
+ required this.onSelect,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final theme = Theme.of(context);
+ return Container(
+ margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 0),
+ decoration: BoxDecoration(
+ border: Border.all(color: colorDivider),
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ roomName,
+ style: theme.textTheme.headlineSmall,
+ ),
+ const SizedBox(height: 2),
+ Text(
+ description,
+ style: theme.textTheme.bodySmall,
+ ),
+ const SizedBox(height: 12),
+ Row(
+ children: [
+ SvgPicture.asset("assets/icons/user-circle.svg", width: 20, height: 20),
+ const SizedBox(width: 4),
+ Text(
+ guests == 1 ? '1 voksen' : '$guests voksne',
+ style: theme.textTheme.bodySmall,
+ ),
+ const SizedBox(width: 8),
+ const VerticalDivider(),
+ GestureDetector(
+ onTap: () {
+ //context.pushNamed(AppRoutes.roomDetails.name);
+ },
+ child: Text(
+ 'read_more'.tr(),
+ style: theme.textTheme.bodySmall?.copyWith(
+ decoration: TextDecoration.underline,
+ ),
+ ),
+ ),
+
+
+ ],
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: 8),
+ ClipRRect(
+ borderRadius: BorderRadius.circular(12),
+ child: Image.asset(
+ imageAsset,
+ width: 72,
+ height: 72,
+ fit: BoxFit.cover,
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (extraInfo != null) ...[
+ const SizedBox(height: 8),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Text(
+ 'Tilkøbt på værelse',
+ style: theme.textTheme.bodySmall,
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Text(
+ extraInfo!,
+ style: theme.textTheme.bodySmall
+ ?.copyWith(fontWeight: FontWeight.bold),
+ ),
+ ),
+ const SizedBox(height: 8),
+ ],
+ Column(
+ children: [
+ const Divider(color: colorDivider),
+ Padding(
+ padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0, bottom: 16.0),
+ child: SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 0,
+ foregroundColor: Colors.white,
+ ),
+ onPressed: onSelect,
+ child: const Text('Vælg værelse'),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index 5dd5d19c..97b56877 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -115,7 +115,40 @@ class OverviewTabViewState extends State<OverviewPage>
left: 18.0, right: 18.0, bottom: 32.0, top: 18.0),
child: ElevatedButton(
onPressed: () async {
- launchUrl(Uri.parse(ComwellUrls.comwellWebsite));
+ bool success = await launchUrl(
+ Uri.parse(ComwellUrls.comwellWebsite));
+ if (!success) {
+ if (context.mounted) {
+ showDialog<void>(
+ context: context,
+ builder: (BuildContext context) {
+ return AlertDialog(
+ backgroundColor: Colors.white,
+ contentPadding: const EdgeInsets.all(24),
+ title: Text(
+ 'error_opening_website_title'.tr(),
+ style: theme.textTheme.headlineMedium,
+ textAlign: TextAlign.center),
+ content: Text('error_opening_website'.tr(),
+ style: theme.textTheme.bodySmall,
+ textAlign: TextAlign.center),
+ actions: [
+ Center(
+ child: ElevatedButton(
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ style: ElevatedButton.styleFrom(
+ foregroundColor: Colors.white),
+ child: Text('generic_ok'.tr()),
+ ),
+ ),
+ ],
+ );
+ },
+ );
+ }
+ }
},
style:
Theme.of(context).elevatedButtonTheme.style?.copyWith(