6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit c78e5bd0
Changed files
comwell_key_app/lib/main.dart | 17 ++- .../components/communications_list.dart | 72 ++++++----- .../lib/notifications/notifications_page.dart | 138 ++++++++++++--------- 3 files changed, 137 insertions(+), 90 deletions(-)
Diff
diff --git a/comwell_key_app/lib/main.dart b/comwell_key_app/lib/main.dart
index 64b2a446..a9fcd426 100644
--- a/comwell_key_app/lib/main.dart
+++ b/comwell_key_app/lib/main.dart
@@ -41,8 +41,7 @@ void runMainApp(FirebaseOptions firebaseOptions) async {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
setupLocator();
await SentryFlutter.init((options) {
- options.dsn =
- ''; // Add your Sentry DSN to your .env file.
+ options.dsn = ''; // Add your Sentry DSN to your .env file.
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
@@ -51,6 +50,20 @@ void runMainApp(FirebaseOptions firebaseOptions) async {
options.profilesSampleRate = 1.0;
options.environment = appFlavor;
});
+
+ //Setting SysemUIOverlay
+ SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ statusBarBrightness: Brightness.dark,
+ systemStatusBarContrastEnforced: true,
+ systemNavigationBarColor: Colors.transparent,
+ systemNavigationBarDividerColor: Colors.transparent,
+ systemNavigationBarIconBrightness: Brightness.dark,
+ statusBarIconBrightness: Brightness.dark));
+
+ //Setting SystmeUIMode to edgeToEdge
+ SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge,
+ overlays: [SystemUiOverlay.top]);
runApp(SentryWidget(
child: EasyLocalization(
supportedLocales: const [Locale('en', 'US'), Locale('da', 'DK')],
diff --git a/comwell_key_app/lib/notifications/components/communications_list.dart b/comwell_key_app/lib/notifications/components/communications_list.dart
index e8359985..41bdb3e5 100644
--- a/comwell_key_app/lib/notifications/components/communications_list.dart
+++ b/comwell_key_app/lib/notifications/components/communications_list.dart
@@ -14,39 +14,47 @@ class CommunicationsList extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return SingleChildScrollView(
- child: ListView.builder(
- shrinkWrap: true,
- itemCount: notificationPermissions.length,
- itemBuilder: (context, index) {
- return SwitchListTile(
- activeColor: sandColor,
- inactiveTrackColor: Colors.grey[200],
- inactiveThumbColor: Colors.white,
- trackOutlineColor: const WidgetStatePropertyAll(Colors.white),
- title: Text(
- notificationPermissions.elementAt(index).name,
- style: const TextStyle(fontSize: 16),
- ),
- subtitle: Text(
- notificationPermissions
- .elementAt(index)
- .notificationPermissionDescription ??
- '',
- style: const TextStyle(
- fontSize: 12,
- color: Colors.grey,
- fontWeight: FontWeight.w400,
- ),
- ),
- value: notificationPermissions.elementAt(index).allowed,
- onChanged: (bool value) {
- valueChanged(notificationPermissions.elementAt(index).name);
+ final theme = Theme.of(context);
+ return Column(
+ children: [
+ Expanded(
+ child: ListView.builder(
+ shrinkWrap: true,
+ itemCount: notificationPermissions.length,
+ itemBuilder: (context, index) {
+ return SwitchListTile(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor: const WidgetStatePropertyAll(Colors.white),
+ title: Text(
+ notificationPermissions.elementAt(index).name,
+ style: theme.textTheme.titleMedium?.copyWith(
+ color: Colors.black,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ subtitle: Text(
+ notificationPermissions
+ .elementAt(index)
+ .notificationPermissionDescription ??
+ '',
+ style: theme.textTheme.bodySmall?.copyWith(
+ color: Colors.black.withOpacity(0.65),
+ fontSize: 12,
+ fontWeight: FontWeight.w400,
+ ),
+ ),
+ value: notificationPermissions.elementAt(index).allowed,
+ onChanged: (bool value) {
+ valueChanged(notificationPermissions.elementAt(index).name);
+ },
+ contentPadding: EdgeInsets.zero,
+ );
},
- contentPadding: EdgeInsets.zero,
- );
- },
- ),
+ ),
+ ),
+ ],
);
}
}
diff --git a/comwell_key_app/lib/notifications/notifications_page.dart b/comwell_key_app/lib/notifications/notifications_page.dart
index 6105aefc..c07d125c 100644
--- a/comwell_key_app/lib/notifications/notifications_page.dart
+++ b/comwell_key_app/lib/notifications/notifications_page.dart
@@ -38,68 +38,94 @@ class NotificationsPage extends StatelessWidget {
Widget _buildNotificationsPage(NotificationsCubit cubit) {
return 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),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ 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),
+ Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Switch(
+ activeColor: sandColor,
+ inactiveTrackColor: Colors.grey[200],
+ inactiveThumbColor: Colors.white,
+ trackOutlineColor: const WidgetStatePropertyAll(Colors.white),
+ value: cubit.state.allNotifications.every((e) => e.allowed),
+ onChanged: (bool value) {
+ cubit.updateAllPermissionsUI(value);
+ },
+ ),
+ const SizedBox(width: 8),
+ Text(
+ 'subscribe_all'.tr(),
+ style: const TextStyle(fontSize: 16),
+ ),
+ ],
+ ),
+ Expanded(
+ child: CommunicationsList(
+ notificationPermissions: cubit.state.allNotifications,
+ valueChanged: (String name) {
+ cubit.onNotificationPermissionClicked(name);
+ },
+ ),
+ ),
+ ],
),
- value: cubit.state.allNotifications.every((e) => e.allowed),
- onChanged: (bool value) {
- cubit.updateAllPermissionsUI(value);
- },
- contentPadding: EdgeInsets.zero,
),
- const Divider(),
- Expanded(
- child: CommunicationsList(
- notificationPermissions: cubit.state.allNotifications,
- valueChanged: (String name) {
- cubit.onNotificationPermissionClicked(name);
- },
+ ),
+ Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const Divider(
+ color: Colors.black12,
+ thickness: 1,
+ height: 0,
),
- ),
- SizedBox(
- width: double.infinity,
- height: 50,
- child: ElevatedButton(
- onPressed: () {
- cubit.updatePreferences(
- cubit.state.allNotifications, cubit.user.id);
- },
- style: ElevatedButton.styleFrom(
- backgroundColor: sandColor,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(8),
- ),
- ),
- child: Text(
- 'save'.tr(),
- style: const TextStyle(
- color: Colors.white,
- fontSize: 16,
+ const SizedBox(height: 16),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: SizedBox(
+ width: double.infinity,
+ height: 50,
+ child: ElevatedButton(
+ onPressed: () {
+ cubit.updatePreferences(
+ cubit.state.allNotifications, cubit.user.id);
+ },
+ style: ElevatedButton.styleFrom(
+ backgroundColor: sandColor,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(30),
+ ),
+ ),
+ child: Text(
+ 'save'.tr(),
+ style: const TextStyle(
+ color: Colors.white,
+ fontSize: 16,
+ ),
+ ),
),
),
),
- ),
- ],
- ),
+ const SizedBox(height: 16),
+ ],
+ ),
+ ],
),
);
}