Collapse notification cards on tap anywhere

Tapping a notification's body already toggled expand/collapse, but the
action area below it wasn't tappable. Wrap the whole card in an InkWell
so tapping anywhere (body or action row) toggles, while the buttons
still handle their own taps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-06-04 09:57:20 -04:00
co-authored by Claude Opus 4.8
parent fbd9ffd834
commit 2a6d480428
2 changed files with 101 additions and 29 deletions
+31 -29
View File
@@ -71,37 +71,39 @@ class _NotificationCardState extends State<NotificationCard> {
padding: const EdgeInsets.only(right: Insets.lg),
child: const Icon(Icons.done),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ListTile(
leading: Icon(
widget.item.notificationType.icon,
color: widget.item.isNew ? theme.colorScheme.primary : null,
child: InkWell(
onTap: () => setState(() => _expanded = !_expanded),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ListTile(
leading: Icon(
widget.item.notificationType.icon,
color: widget.item.isNew ? theme.colorScheme.primary : null,
),
title: Text(
'${widget.formatter.format(widget.item.createdOn)} - ${widget.item.title}',
style: widget.item.isNew
? const TextStyle(fontWeight: FontWeight.bold)
: null,
),
subtitle: Text(
widget.item.body,
maxLines: _expanded ? null : 2,
overflow: _expanded
? TextOverflow.visible
: TextOverflow.ellipsis,
),
),
title: Text(
'${widget.formatter.format(widget.item.createdOn)} - ${widget.item.title}',
style: widget.item.isNew
? const TextStyle(fontWeight: FontWeight.bold)
: null,
AnimatedSize(
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
child: _expanded
? _buildActions(context)
: const SizedBox.shrink(),
),
subtitle: Text(
widget.item.body,
maxLines: _expanded ? null : 2,
overflow: _expanded
? TextOverflow.visible
: TextOverflow.ellipsis,
),
onTap: () => setState(() => _expanded = !_expanded),
),
AnimatedSize(
duration: const Duration(milliseconds: 200),
curve: Curves.easeInOut,
child: _expanded
? _buildActions(context)
: const SizedBox.shrink(),
),
],
],
),
),
),
);