Skip to content

Commit 807f165

Browse files
committed
sticky_header: Rewrite sticky headers completely
In particular this gives us two features we'll want in the Zulip message list when we go to make recipient headers appear only where needed (#174): * An item's header now gets built (and laid out and painted) only if the item is actually the one at the relevant edge of the viewport such that the stickiness comes into play. This lets us attach a sticky header to every message, even when it shares a recipient header with the message that comes before it. * An item can now (optionally) allow the header's stickiness at the edge of the viewport to take precedence over the header's confinement within the item's own bounds. We'll use this to let the header stay pinned when scrolling between items that share a recipient header.
1 parent 8a40118 commit 807f165

File tree

4 files changed

+592
-186
lines changed

4 files changed

+592
-186
lines changed

lib/widgets/message_list.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,11 @@ class MessageItem extends StatelessWidget {
382382
shape: Border(
383383
left: recipientBorder, bottom: restBorder, right: restBorder));
384384

385+
final recipientHeader = RecipientHeader(message: message);
385386
return StickyHeaderItem(
386-
header: RecipientHeader(message: message),
387-
content: Column(children: [
387+
header: recipientHeader,
388+
child: Column(children: [
389+
recipientHeader,
388390
DecoratedBox(
389391
decoration: borderDecoration,
390392
child: MessageWithSender(message: message, content: item.content)),

0 commit comments

Comments
 (0)