From b43122d3dc979bbf01f2341e80c78b2fe333801a Mon Sep 17 00:00:00 2001 From: reasje Date: Wed, 10 Jul 2024 13:56:29 +0330 Subject: [PATCH] feat: notifications page blueberry ring switches --- .../notifications/notificaitons_page.dart | 206 ++++-------------- 1 file changed, 41 insertions(+), 165 deletions(-) diff --git a/lib/features/settings/subfeatures/notifications/notificaitons_page.dart b/lib/features/settings/subfeatures/notifications/notificaitons_page.dart index 0b010ee1..dbc3f776 100644 --- a/lib/features/settings/subfeatures/notifications/notificaitons_page.dart +++ b/lib/features/settings/subfeatures/notifications/notificaitons_page.dart @@ -297,30 +297,7 @@ class NotificationsPage extends HookConsumerWidget { onChanged: notificationsPresenter.changeActivityReminderEnabled, enabled: isSettingsChangeEnabled, textTrailingWidget: MXCInformationButton( - texts: [ - TextSpan( - text: - FlutterI18n.translate(context, 'experiencing_issues'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate(context, - 'blueberry_background_notifications_requirements_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate(context, - 'blueberry_background_notifications_requirements_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - ], + texts: getBlueberryRingServiceInfo(context), ), titleStyle: FontTheme.of(context).h6(), ), @@ -332,53 +309,7 @@ class NotificationsPage extends HookConsumerWidget { onChanged: notificationsPresenter.changeSleepInsightEnabled, enabled: isSettingsChangeEnabled, textTrailingWidget: MXCInformationButton( - texts: [ - TextSpan( - text: - FlutterI18n.translate(context, 'experiencing_issues'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'need_further_assistant'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - ], + texts: getBlueberryRingServiceInfo(context), ), titleStyle: FontTheme.of(context).h6(), ), @@ -389,53 +320,7 @@ class NotificationsPage extends HookConsumerWidget { onChanged: notificationsPresenter.changeHeartAlertEnabled, enabled: isSettingsChangeEnabled, textTrailingWidget: MXCInformationButton( - texts: [ - TextSpan( - text: - FlutterI18n.translate(context, 'experiencing_issues'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'need_further_assistant'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - ], + texts: getBlueberryRingServiceInfo(context), ), titleStyle: FontTheme.of(context).h6(), ), @@ -446,53 +331,7 @@ class NotificationsPage extends HookConsumerWidget { onChanged: notificationsPresenter.changeLowBatteryEnabled, enabled: isSettingsChangeEnabled, textTrailingWidget: MXCInformationButton( - texts: [ - TextSpan( - text: - FlutterI18n.translate(context, 'experiencing_issues'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_1_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_title'), - style: FontTheme.of(context) - .subtitle2() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - TextSpan( - text: FlutterI18n.translate( - context, 'background_service_solution_2_text'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - const TextSpan(text: '\n\n'), - TextSpan( - text: FlutterI18n.translate( - context, 'need_further_assistant'), - style: FontTheme.of(context) - .subtitle1() - .copyWith(color: ColorsTheme.of(context).textPrimary), - ), - ], + texts: getBlueberryRingServiceInfo(context), ), titleStyle: FontTheme.of(context).h6(), ), @@ -522,3 +361,40 @@ class NotificationsPage extends HookConsumerWidget { ); } } + +List getBlueberryRingServiceInfo( + BuildContext context, +) { + return [ + TextSpan( + text: FlutterI18n.translate(context, 'experiencing_issues'), + style: FontTheme.of(context) + .subtitle2() + .copyWith(color: ColorsTheme.of(context).textPrimary), + ), + const TextSpan(text: '\n\n'), + TextSpan( + text: FlutterI18n.translate( + context, 'blueberry_background_notifications_requirements_title'), + style: FontTheme.of(context) + .subtitle2() + .copyWith(color: ColorsTheme.of(context).textPrimary), + ), + const TextSpan(text: '\n\n'), + TextSpan( + text: FlutterI18n.translate( + context, 'blueberry_background_notifications_requirements_text_1'), + style: FontTheme.of(context) + .subtitle1() + .copyWith(color: ColorsTheme.of(context).textPrimary), + ), + const TextSpan(text: '\n\n'), + TextSpan( + text: FlutterI18n.translate( + context, 'blueberry_background_notifications_requirements_text_2'), + style: FontTheme.of(context) + .subtitle1() + .copyWith(color: ColorsTheme.of(context).textPrimary), + ), + ]; +}