Keep notification cards collapsed when a sibling is removed

SliverList recycles State objects by index, so when an expanded
notification was marked as read and dropped from the filtered list, the
next notification inherited the expanded state. Give each card a
ValueKey(id) so its expand/collapse state is matched by notification,
not by list position.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-04 10:02:57 -04:00
co-authored by Claude Opus 4.8
parent 2a6d480428
commit aa5a29271b
2 changed files with 58 additions and 0 deletions
@@ -309,6 +309,7 @@ class _NotificationsListState extends State<NotificationsList>
itemBuilder: (context, index) {
final item = _items[index];
return NotificationCard(
key: ValueKey(item.id),
item: item,
formatter: formatter,
onSetRead: (read) => _setRead(item, read),