Skip to content

Decrease whitespace at end of message feed #1628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat

final itemIndex = totalItems - 1 - (childIndex + bottomItems);
final data = model.items[itemIndex];
final item = _buildItem(data);
final item = _buildItem(data, isLastInFeed: itemIndex == totalItems - 1);
return item;
}));

Expand Down Expand Up @@ -1113,7 +1113,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat

final itemIndex = topItems + childIndex;
final data = model.items[itemIndex];
return _buildItem(data);
return _buildItem(data, isLastInFeed: itemIndex == totalItems - 1);
}));

if (!ComposeBox.hasComposeBox(widget.narrow)) {
Expand Down Expand Up @@ -1167,8 +1167,8 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
// TODO perhaps offer mark-as-read even when not done fetching?
MarkAsReadWidget(narrow: widget.narrow),
// To reinforce that the end of the feed has been reached:
// https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/flutter.3A.20Mark-as-read/near/1680603
const SizedBox(height: 36),
// https://chat.zulip.org/#narrow/channel/48-mobile/topic/space.20at.20end.20of.20thread/near/2203391
const SizedBox(height: 12),
]);
} else if (model.busyFetchingMore) {
// See [_buildStartCap] for why this condition shows a loading indicator.
Expand All @@ -1178,7 +1178,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
}
}

Widget _buildItem(MessageListItem data) {
Widget _buildItem(MessageListItem data, {required bool isLastInFeed}) {
switch (data) {
case MessageListRecipientHeaderItem():
final header = RecipientHeader(message: data.message, narrow: widget.narrow);
Expand All @@ -1195,12 +1195,14 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
key: ValueKey(data.message.id),
narrow: widget.narrow,
header: header,
isLastInFeed: isLastInFeed,
item: data);
case MessageListOutboxMessageItem():
final header = RecipientHeader(message: data.message, narrow: widget.narrow);
return MessageItem(
narrow: widget.narrow,
header: header,
isLastInFeed: isLastInFeed,
item: data);
}
}
Expand Down Expand Up @@ -1527,11 +1529,13 @@ class MessageItem extends StatelessWidget {
required this.narrow,
required this.item,
required this.header,
required this.isLastInFeed,
});

final Narrow narrow;
final MessageListMessageBaseItem item;
final Widget header;
final bool isLastInFeed;

@override
Widget build(BuildContext context) {
Expand All @@ -1547,9 +1551,11 @@ class MessageItem extends StatelessWidget {
item: item),
MessageListOutboxMessageItem() => OutboxMessageWithPossibleSender(item: item),
},
// TODO refine this padding; discussion:
// https://github.com/zulip/zulip-flutter/pull/1453#discussion_r2106526985
if (item.isLastInBlock) const SizedBox(height: 11),
// TODO write tests for this padding logic
if (isLastInFeed)
const SizedBox(height: 5)
else if (item.isLastInBlock)
const SizedBox(height: 11),
]));
if (item case MessageListMessageItem(:final message)) {
child = _UnreadMarker(
Expand Down