Skip to content

Commit 9bd21e6

Browse files
chrisbobbegnprice
authored andcommitted
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 255fff3 commit 9bd21e6

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/widgets/message_list.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ 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+
// TODO(#311) If we have a bottom nav, it will pad the bottom
68+
// inset, and this should always be true.
69+
removeBottom: widget.narrow is! AllMessagesNarrow,
6670

6771
child: Expanded(
6872
child: MessageList(narrow: widget.narrow))),
@@ -228,6 +232,13 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
228232
color: Colors.white,
229233
// Pad the left and right insets, for small devices in landscape.
230234
child: SafeArea(
235+
// Don't let this be the place we pad the bottom inset. When there's
236+
// no compose box, we want to let the message-list content pad it.
237+
// TODO(#311) Remove as unnecessary if we do a bottom nav.
238+
// The nav will pad the bottom inset, and an ancestor of this widget
239+
// will have a `MediaQuery.removePadding` with `removeBottom: true`.
240+
bottom: false,
241+
231242
child: Center(
232243
child: ConstrainedBox(
233244
constraints: const BoxConstraints(maxWidth: 760),

0 commit comments

Comments
 (0)