Skip to content

Commit 11644d4

Browse files
recent dms [nfc]: Handle bottom insets explicitly in recent DMs page
This reverts part of 742320c for RecentDmConversationsPageBody, and also handles bottom insets for the list view and the new DMs button. As this widget is planned to be used outside the context of home page, specifically for the upcoming share page.
1 parent cdd9a8c commit 11644d4

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/widgets/recent_dm_conversations.dart

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,20 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
8989
PageBodyEmptyContentPlaceholder(
9090
message: zulipLocalizations.recentDmConversationsEmptyPlaceholder)
9191
else
92-
SafeArea( // horizontal insets
92+
SafeArea(
93+
// Don't pad the bottom here; we want the list content to do that.
94+
//
95+
// When this page is used in the context of the home page, this
96+
// param and the below use of `MediaQuery.paddingOf(context).bottom`
97+
// would be noop, because `Scaffold.bottomNavigationBar` in the
98+
// home page handles that for us. But this page is planned to be
99+
// used for share-to-zulip page, so we need this to be handled here.
100+
//
101+
// Other *PageBody widgets don't handle this because they aren't
102+
// planned to be (re-)used outside the context of the home page.
103+
bottom: false,
93104
child: ListView.builder(
94-
padding: EdgeInsets.only(bottom: 90),
105+
padding: EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 90),
95106
itemCount: sorted.length,
96107
itemBuilder: (context, index) {
97108
final narrow = sorted[index];
@@ -115,7 +126,7 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
115126
onDmSelect: widget.onDmSelect ?? _handleDmSelect);
116127
})),
117128
Positioned(
118-
bottom: 21,
129+
bottom: MediaQuery.paddingOf(context).bottom + 21,
119130
child: _NewDmButton(onDmSelect: (narrow) {
120131
if (widget.onDmSelect case final onDmSelect?) {
121132
// Pop the new DMs action sheet.

0 commit comments

Comments
 (0)