Skip to content

Commit b370b2b

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 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 4044d26 commit b370b2b

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

lib/widgets/recent_dm_conversations.dart

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
9191
final zulipLocalizations = ZulipLocalizations.of(context);
9292
final sorted = model!.sorted;
9393

94+
// This value will be zero when this page is used in the context of
95+
// home-page, see comment on `bottom: false` arg in use of `SafeArea`
96+
// below.
97+
final bottomInsets = MediaQuery.paddingOf(context).bottom;
98+
9499
return Stack(
95100
alignment: Alignment.bottomCenter,
96101
clipBehavior: Clip.none,
@@ -99,9 +104,21 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
99104
PageBodyEmptyContentPlaceholder(
100105
message: zulipLocalizations.recentDmConversationsEmptyPlaceholder)
101106
else
102-
SafeArea( // horizontal insets
107+
SafeArea(
108+
// Don't pad the bottom here; we want the list content to do that.
109+
//
110+
// When this page is used in the context of the home page, this
111+
// param and the below use of `MediaQuery.paddingOf(context).bottom`
112+
// via `bottomInsets` would be noop, because
113+
// `Scaffold.bottomNavigationBar` in the home page handles that for
114+
// us. But this page is planned to be used for share-to-zulip page,
115+
// so we need this to be handled here.
116+
//
117+
// Other *PageBody widgets don't handle this because they aren't
118+
// planned to be (re-)used outside the context of the home page.
119+
bottom: false,
103120
child: ListView.builder(
104-
padding: EdgeInsets.only(bottom: 90),
121+
padding: EdgeInsets.only(bottom: bottomInsets + 90),
105122
itemCount: sorted.length,
106123
itemBuilder: (context, index) {
107124
final narrow = sorted[index];
@@ -125,7 +142,7 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
125142
onDmSelect: _handleDmSelect);
126143
})),
127144
Positioned(
128-
bottom: 21,
145+
bottom: bottomInsets + 21,
129146
child: _NewDmButton(onDmSelect: _handleDmSelectForNewDms)),
130147
]);
131148
}

pubspec.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,26 +1079,26 @@ packages:
10791079
dependency: "direct dev"
10801080
description:
10811081
name: test
1082-
sha256: "65e29d831719be0591f7b3b1a32a3cda258ec98c58c7b25f7b84241bc31215bb"
1082+
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
10831083
url: "https://pub.dev"
10841084
source: hosted
1085-
version: "1.26.2"
1085+
version: "1.26.3"
10861086
test_api:
10871087
dependency: "direct dev"
10881088
description:
10891089
name: test_api
1090-
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
1090+
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
10911091
url: "https://pub.dev"
10921092
source: hosted
1093-
version: "0.7.6"
1093+
version: "0.7.7"
10941094
test_core:
10951095
dependency: transitive
10961096
description:
10971097
name: test_core
1098-
sha256: "80bf5a02b60af04b09e14f6fe68b921aad119493e26e490deaca5993fef1b05a"
1098+
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
10991099
url: "https://pub.dev"
11001100
source: hosted
1101-
version: "0.6.11"
1101+
version: "0.6.12"
11021102
timing:
11031103
dependency: transitive
11041104
description:

0 commit comments

Comments
 (0)