Skip to content

Commit af94f47

Browse files
committed
msglist: Have content pad bottom inset when the compose box isn't shown
This takes advantage of some of StickyHeaderListView's default behavior (inherited from ListView). From the doc on ListView: https://api.flutter.dev/flutter/widgets/ListView-class.html > By default, ListView will automatically pad the list's scrollable > extremities to avoid partial obstructions indicated by > MediaQuery's padding. To avoid this behavior, override with a zero > padding property. The code changes here are just to arrange for that default behavior to help us out: we let the real height of the bottom inset propagate down to the StickyHeaderListView, with the MediaQuery mechanism.
1 parent e7fe06c commit af94f47

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/widgets/message_list.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ class _MessageListPageState extends State<MessageListPage> {
6161
// MediaQuery.removePadding with `removeTop: true`.
6262
context: context,
6363

64-
// The compose box pads the bottom inset.
65-
removeBottom: true,
64+
// The compose box, when present, pads the bottom inset.
65+
// TODO this copies the details of when the compose box is shown;
66+
// if those details get complicated, refactor to avoid copying.
67+
removeBottom: widget.narrow != const AllMessagesNarrow(),
6668

6769
child: Expanded(
6870
child: MessageList(narrow: widget.narrow))),
@@ -228,6 +230,10 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
228230
color: Colors.white,
229231
// Pad the left and right insets, for small devices in landscape.
230232
child: SafeArea(
233+
// Don't let this be the place we pad the bottom inset. When there's
234+
// no compose box, we want to let the message-list content pad it.
235+
bottom: false,
236+
231237
child: Center(
232238
child: ConstrainedBox(
233239
constraints: const BoxConstraints(maxWidth: 760),

0 commit comments

Comments
 (0)