6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 0027277c

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-04-16 09:23:34 +0200
1515: Started working on communication preferences. UI is finished.

Changed files

comwell_key_app/.metadata                          |  12 +-
 comwell_key_app/assets/translations/da-DK.json     |  12 +-
 comwell_key_app/assets/translations/en-US.json     |  14 +-
 .../notifications/cubit/notifications_cubit.dart   |   0
 .../notifications/cubit/notifications_state.dart   |   0
 .../lib/notifications/notifications_page.dart      | 210 +++++++++++++++++++++
 comwell_key_app/lib/profile/profile_page.dart      |   6 +-
 comwell_key_app/lib/routing/app_router.dart        |   8 +
 comwell_key_app/lib/routing/app_routes.dart        |   1 +
 9 files changed, 251 insertions(+), 12 deletions(-)

Diff

diff --git a/comwell_key_app/.metadata b/comwell_key_app/.metadata
index 72aedebf..4212cc82 100644
--- a/comwell_key_app/.metadata
+++ b/comwell_key_app/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
+ revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf"
channel: "stable"
project_type: app
@@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
- create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- - platform: web
- create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ - platform: ios
+ create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
+ base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf
# User provided section
diff --git a/comwell_key_app/assets/translations/da-DK.json b/comwell_key_app/assets/translations/da-DK.json
index 45dfa7c6..5a7257ea 100644
--- a/comwell_key_app/assets/translations/da-DK.json
+++ b/comwell_key_app/assets/translations/da-DK.json
@@ -198,5 +198,15 @@
"remove_guest": "Fjern gæst",
"remove_guests": "Fjern gæster",
"are_you_sure": "Er du sikker?",
- "guest_removal_responsibility": "Du vil være ansvarlig for alle køb på værelset ved udtjekning (316 kr.)"
+ "guest_removal_responsibility": "Du vil være ansvarlig for alle køb på værelset ved udtjekning (316 kr.)",
+ "notifications_page_title": "Notifikationer",
+ "subscribe_all": "Tilmeld alle notifikationer",
+ "company_deal": "Virksomheds aftale",
+ "company_deal_subtitle": "Ja, jeg vil gerne modtage relevant information relateret til virksomheds aftalen fra Comwell A/S via email og SMS. Du kan til enhver tid afslutte din tilmelding ved at klikke på afslut linket nederst i emailen.",
+ "club_newsletter": "Comwell Club nyhedsbrev",
+ "club_newsletter_subtitle": "Ja, jeg vil gerne modtage e-mails med spændende tilbud om hotelophold og events hos Comwell Hotels. Jeg kan til enhver tid, afslutte min tilmelding.",
+ "digital_media": "Digital media",
+ "digital_media_subtitle": "Ja, jeg vil gerne se personligt tilpassede digitale reklamer med nyheder, inspiration og invitationer til events. Jeg kan til enhver tid, afslutte min tilmelding.",
+ "sms": "SMS",
+ "sms_subtitle": "Ja, jeg vil gerne modtage SMS med nyheder, inspiration og invitationer til events. Jeg kan til enhver tid, afslutte min tilmelding."
}
\ 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 51ea23dc..3ec77278 100644
--- a/comwell_key_app/assets/translations/en-US.json
+++ b/comwell_key_app/assets/translations/en-US.json
@@ -198,5 +198,15 @@
"remove_guest": "Remove guest",
"remove_guests": "Remove guests",
"are_you_sure": "Are you sure?",
- "guest_removal_responsibility": "You will be responsible for all things purchased on the room at checkout "
-}
\ No newline at end of file
+ "guest_removal_responsibility": "You will be responsible for all things purchased on the room at checkout ",
+ "notifications_page_title": "Notifications",
+ "subscribe_all": "Subscribe to all notifications",
+ "company_deal": "Company deal",
+ "company_deal_subtitle": "Yes, I would like to receive relevant information related to the company agreement from Comwell A/S via email and SMS. You can unsubscribe at any time by clicking the unsubscribe link at the bottom of the email.",
+ "club_newsletter": "Club newsletter",
+ "club_newsletter_subtitle": "Yes, I would like to recieve e-mails with exiciting offers regarding hotel stays and events at Comwell. I can at any time, unsubscribe.",
+ "digital_media": "Digital media",
+ "digital_media_subtitle": "Yes, I would like see personalized digital media advertising with news, inspiration and invitations to events. I can at any time, unsubscribe.",
+ "sms": "SMS",
+ "sms_subtitle": "Yes, I would like to recieve SMS with news, inspiration and invitations to events. I can at any time, unsubscribe."
+}
diff --git a/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart b/comwell_key_app/lib/notifications/cubit/notifications_cubit.dart
new file mode 100644
index 00000000..e69de29b
diff --git a/comwell_key_app/lib/notifications/cubit/notifications_state.dart b/comwell_key_app/lib/notifications/cubit/notifications_state.dart
new file mode 100644
index 00000000..e69de29b
diff --git a/comwell_key_app/lib/notifications/notifications_page.dart b/comwell_key_app/lib/notifications/notifications_page.dart
new file mode 100644
index 00000000..f9858527
--- /dev/null
+++ b/comwell_key_app/lib/notifications/notifications_page.dart
@@ -0,0 +1,210 @@
+import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
+import 'package:comwell_key_app/themes/light_theme.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+
+class NotificationsPage extends StatefulWidget {
+ const NotificationsPage({super.key});
+
+ @override
+ State<NotificationsPage> createState() => _NotificationsPageState();
+}
+
+class _NotificationsPageState extends State<NotificationsPage> {
+ bool allNotifications = false;
+ bool smsNotifications = false;
+ bool personalOffers = false;
+ bool clubNewsletter = false;
+ bool companyDeal = false;
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ backgroundColor: Colors.white,
+ appBar: const ComwellAppBar(),
+ body: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'notifications_page_title'.tr(),
+ style: const TextStyle(
+ fontSize: 28,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ const SizedBox(height: 20),
+ SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor: const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ 'subscribe_all'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ value: allNotifications,
+ onChanged: (bool value) {
+ setState(() {
+ allNotifications = value;
+ smsNotifications = value;
+ personalOffers = value;
+ clubNewsletter = value;
+ companyDeal = value;
+ });
+ },
+ contentPadding: EdgeInsets.zero,
+ ),
+ const Divider(),
+ Expanded(
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor:
+ const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ 'club_newsletter'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ subtitle: Text(
+ 'club_newsletter_subtitle'.tr(),
+ style: const TextStyle(
+ fontSize: 12,
+ color: Colors.grey,
+ fontWeight: FontWeight.w400),
+ ),
+ value: clubNewsletter,
+ onChanged: (bool value) {
+ setState(() {
+ clubNewsletter = value;
+ _updateAllNotificationsState();
+ });
+ },
+ contentPadding: EdgeInsets.zero,
+ ),
+ SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor:
+ const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ 'digital_media'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ subtitle: Text(
+ 'digital_media_subtitle'.tr(),
+ style: const TextStyle(
+ fontSize: 12,
+ color: Colors.grey,
+ fontWeight: FontWeight.w400),
+ ),
+ value: personalOffers,
+ onChanged: (bool value) {
+ setState(() {
+ personalOffers = value;
+ _updateAllNotificationsState();
+ });
+ },
+ contentPadding: EdgeInsets.zero,
+ ),
+ SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor:
+ const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ 'sms'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ subtitle: Text(
+ 'sms_subtitle'.tr(),
+ style: const TextStyle(
+ fontSize: 12,
+ color: Colors.grey,
+ fontWeight: FontWeight.w400),
+ ),
+ value: smsNotifications,
+ onChanged: (bool value) {
+ setState(() {
+ smsNotifications = value;
+ _updateAllNotificationsState();
+ });
+ },
+ contentPadding: EdgeInsets.zero,
+ ),
+ SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor:
+ const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ 'company_deal'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ subtitle: Text(
+ 'company_deal_subtitle'.tr(),
+ style: const TextStyle(
+ fontSize: 12,
+ color: Colors.grey,
+ fontWeight: FontWeight.w400),
+ ),
+ value: companyDeal,
+ onChanged: (bool value) {
+ setState(() {
+ companyDeal = value;
+ _updateAllNotificationsState();
+ });
+ },
+ contentPadding: EdgeInsets.zero,
+ ),
+ ],
+ ),
+ ),
+ ),
+ SizedBox(
+ width: double.infinity,
+ height: 50,
+ child: ElevatedButton(
+ onPressed: () {
+ // Handle save action
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: const Color(0xFFB39B7D),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ child: Text(
+ 'save'.tr(),
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ void _updateAllNotificationsState() {
+ if (smsNotifications && personalOffers && clubNewsletter) {
+ allNotifications = true;
+ } else {
+ allNotifications = false;
+ }
+ }
+}
diff --git a/comwell_key_app/lib/profile/profile_page.dart b/comwell_key_app/lib/profile/profile_page.dart
index 88e7af32..ed9822e4 100644
--- a/comwell_key_app/lib/profile/profile_page.dart
+++ b/comwell_key_app/lib/profile/profile_page.dart
@@ -14,10 +14,10 @@ class ProfilePage extends StatelessWidget {
final SecureStorage secureStorage = SecureStorage();
ProfilePage({super.key});
-
@override
Widget build(BuildContext context) {
context.read<ProfileCubit>().sendPageViewEvent();
+
return Scaffold(
backgroundColor: sandColor[20],
body: SafeArea(
@@ -153,7 +153,7 @@ class ProfilePage extends StatelessWidget {
trailingIcon: Icons.chevron_right,
text: 'notifications_profile_menu'.tr(),
onTap: () {
- // Navigate to notifications
+ context.pushNamed(AppRoutes.notifications.name);
},
),
const Padding(
@@ -171,7 +171,7 @@ class ProfilePage extends StatelessWidget {
},
child: Text(
'logout_profile_menu'.tr(),
- style: const TextStyle(color: colorDivider),
+ style: TextStyle(color: Colors.grey[600]),
),
),
),
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index 600763fd..f56c9b9b 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -15,6 +15,7 @@ import 'package:comwell_key_app/hotel_information/hotel_information_page.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';
+import 'package:comwell_key_app/notifications/notifications_page.dart';
import 'package:comwell_key_app/overview/models/booking.dart';
import 'package:comwell_key_app/overview/overview_page.dart';
import 'package:comwell_key_app/overview/past_cancelled_booking_detail_page.dart';
@@ -283,6 +284,13 @@ GoRouter goRouter(AuthenticationBloc authBloc) {
}));
},
),
+ GoRoute(
+ path: "/${AppRoutes.notifications.name}",
+ name: AppRoutes.notifications.name,
+ builder: (context, state) {
+ return const NotificationsPage();
+ },
+ ),
/* GoRoute(
path: "/keys",
diff --git a/comwell_key_app/lib/routing/app_routes.dart b/comwell_key_app/lib/routing/app_routes.dart
index f79645df..80ddb010 100644
--- a/comwell_key_app/lib/routing/app_routes.dart
+++ b/comwell_key_app/lib/routing/app_routes.dart
@@ -26,4 +26,5 @@ enum AppRoutes {
checkOut,
paymentCards,
shareBooking,
+ notifications,
}