Skip to content

Commit

Permalink
msglist [nfc]: Give MessageItem the SizedBox for trailing whitespace
Browse files Browse the repository at this point in the history
Instead of having its caller make the SizedBox.

This way, the whitespace will be naturally included when we give the
whole message list's white background color to the individual
MessageItems, coming next.
  • Loading branch information
chrisbobbe authored and gnprice committed Nov 20, 2023
1 parent 56ab395 commit c8fe66e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
case MessageListMessageItem():
return MessageItem(
key: ValueKey(data.message.id),
trailing: i == 1 ? const SizedBox(height: 8) : const SizedBox(height: 11),
trailingWhitespace: i == 1 ? 8 : 11,
item: data);
}
});
Expand Down Expand Up @@ -450,11 +450,11 @@ class MessageItem extends StatelessWidget {
const MessageItem({
super.key,
required this.item,
this.trailing,
this.trailingWhitespace,
});

final MessageListMessageItem item;
final Widget? trailing;
final double? trailingWhitespace;

@override
Widget build(BuildContext context) {
Expand All @@ -466,7 +466,7 @@ class MessageItem extends StatelessWidget {
isRead: message.flags.contains(MessageFlag.read),
child: Column(children: [
MessageWithPossibleSender(item: item),
if (trailing != null && item.isLastInBlock) trailing!,
if (trailingWhitespace != null && item.isLastInBlock) SizedBox(height: trailingWhitespace!),
])));
}
}
Expand Down

0 comments on commit c8fe66e

Please sign in to comment.