Minor bug: avoid showing empty dialog when notifications tapped (#2250)

This commit is contained in:
Imran Remtulla
2025-04-20 19:01:14 -04:00
parent 3e41913153
commit b62b60d9df

View File

@ -197,26 +197,28 @@ class NotificationsProvider {
} }
_showNotificationPayload(String? payload, {bool doublePop = false}) { _showNotificationPayload(String? payload, {bool doublePop = false}) {
var title = (payload ?? '\n\n').split('\n').first; if (payload?.isNotEmpty == true) {
var content = (payload ?? '\n\n').split('\n').sublist(1).join('\n'); var title = (payload ?? '\n\n').split('\n').first;
globalNavigatorKey.currentState?.push( var content = (payload ?? '\n\n').split('\n').sublist(1).join('\n');
PageRouteBuilder( globalNavigatorKey.currentState?.push(
pageBuilder: (context, _, __) => AlertDialog( PageRouteBuilder(
title: Text(title), pageBuilder: (context, _, __) => AlertDialog(
content: Text(content), title: Text(title),
actions: [ content: Text(content),
TextButton( actions: [
onPressed: () { TextButton(
Navigator.of(context).pop(null); onPressed: () {
if (doublePop) {
Navigator.of(context).pop(null); Navigator.of(context).pop(null);
} if (doublePop) {
}, Navigator.of(context).pop(null);
child: Text(tr('ok'))), }
], },
child: Text(tr('ok'))),
],
),
), ),
), );
); }
} }
Future<void> cancel(int id) async { Future<void> cancel(int id) async {