improved push notification settings with health indicators and optimized notification dismissal

This commit is contained in:
2026-07-16 22:40:33 +02:00
parent 8128cede21
commit e625216a90
5 changed files with 223 additions and 49 deletions
@@ -20,11 +20,11 @@ import '../../../../widget/details_bottom_sheet.dart';
/// verbatim error), a manual re-register action and — once the chain is
/// operational — a test notification. Loads once on open; the refresh action
/// re-collects on demand (no polling).
void showPushStatusSheet(BuildContext context) {
Future<void> showPushStatusSheet(BuildContext context) {
// Captured here: the sheet outlives this build context's element tree.
final settings = context.read<SettingsCubit>();
final capabilities = context.read<CapabilitiesCubit>();
showDetailsBottomSheet(
return showDetailsBottomSheet(
context,
header: const ListTile(
leading: Icon(Icons.monitor_heart_outlined),
@@ -14,29 +14,39 @@ class SettingsCheckboxTile extends StatelessWidget {
final bool value;
final ValueChanged<bool> onChanged;
/// Optional widget rendered just before the checkbox (e.g. a status icon).
final Widget? beforeCheckbox;
const SettingsCheckboxTile({
required this.icon,
required this.title,
required this.value,
required this.onChanged,
this.subtitle,
this.beforeCheckbox,
super.key,
});
@override
Widget build(BuildContext context) {
final leadingIcon = Icon(icon);
final checkbox = Checkbox(
value: value,
onChanged: (e) {
Haptics.selection();
onChanged(e ?? false);
},
);
return ListTile(
leading: subtitle == null ? leadingIcon : CenteredLeading(leadingIcon),
title: Text(title),
subtitle: subtitle == null ? null : Text(subtitle!),
trailing: Checkbox(
value: value,
onChanged: (e) {
Haptics.selection();
onChanged(e ?? false);
},
),
trailing: beforeCheckbox == null
? checkbox
: Row(
mainAxisSize: MainAxisSize.min,
children: [beforeCheckbox!, checkbox],
),
);
}
}