Skip to content

Commit 48dddbe

Browse files
committed
feat(push-notification): add description to delivery type switcher
- Implement _getDeliveryTypeDescription method to provide descriptions for different delivery types - Update _buildDeliveryTypesSection to include subtitle with delivery type description
1 parent 33a3ffa commit 48dddbe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/app_configuration/widgets/push_notification_settings_form.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ class PushNotificationSettingsForm extends StatelessWidget {
103103
);
104104
}
105105

106+
String _getDeliveryTypeDescription(
107+
BuildContext context,
108+
PushNotificationSubscriptionDeliveryType type,
109+
) {
110+
final l10n = AppLocalizationsX(context).l10n;
111+
switch (type) {
112+
case PushNotificationSubscriptionDeliveryType.breakingOnly:
113+
return l10n.pushNotificationDeliveryTypeBreakingOnlyDescription;
114+
case PushNotificationSubscriptionDeliveryType.dailyDigest:
115+
return l10n.pushNotificationDeliveryTypeDailyDigestDescription;
116+
case PushNotificationSubscriptionDeliveryType.weeklyRoundup:
117+
return l10n.pushNotificationDeliveryTypeWeeklyRoundupDescription;
118+
}
119+
}
120+
106121
Widget _buildDeliveryTypesSection(
107122
BuildContext context,
108123
AppLocalizations l10n,
@@ -128,6 +143,7 @@ class PushNotificationSettingsForm extends StatelessWidget {
128143
.map(
129144
(type) => SwitchListTile(
130145
title: Text(type.l10n(context)),
146+
subtitle: Text(_getDeliveryTypeDescription(context, type)),
131147
value: pushConfig.deliveryConfigs[type] ?? false,
132148
onChanged: (value) {
133149
final newDeliveryConfigs =

0 commit comments

Comments
 (0)