From 0c1aa9c79134457495d2c17083f2ff2bfd0ece29 Mon Sep 17 00:00:00 2001 From: "Vicente J. Ruiz Jurado" Date: Fri, 3 Aug 2018 08:46:52 +0200 Subject: [PATCH] List notif even without subsId --- lib/fireNotificationList.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/fireNotificationList.dart b/lib/fireNotificationList.dart index 4113d27..626615a 100644 --- a/lib/fireNotificationList.dart +++ b/lib/fireNotificationList.dart @@ -59,11 +59,18 @@ class _FireNotificationListState extends State { Widget _buildRow(BuildContext context, List yourLocations, FireNotification notif, onDeleted, onTap) { - YourLocation yl = yourLocations.singleWhere((yl) => yl.id == notif.subsId); + String prefix = ""; + + if (notif.subsId != null) { + YourLocation yl = + yourLocations.singleWhere((yl) => yl.id == notif.subsId); + prefix = '${yl.description}. '; + } + return new ListTile( dense: true, leading: const Icon(Icons.whatshot), - title: new Text('${yl.description}. ${notif.description}', + title: new Text('${prefix}${notif.description}', style: new TextStyle( fontWeight: notif.read ? FontWeight.normal : FontWeight.bold)), subtitle: new Text(Moment.now().from(context, notif.when)),