Skip to content

Commit 672f09f

Browse files
committed
action_sheet: Constrain height of group-DM pills to 4-ish lines, not 6-ish
1 parent 5f3e467 commit 672f09f

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/widgets/action_sheet.dart

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ void _showActionSheet(
4747
BuildContext pageContext, {
4848
Widget? header,
4949
bool headerScrollable = true,
50+
bool shorterScrollableMaxHeight = false,
5051
required List<List<Widget>> buttonSections,
5152
}) {
5253
assert(header is! BottomSheetHeader || !header.outerVerticalPadding);
54+
assert(headerScrollable || !shorterScrollableMaxHeight);
5355

5456
// Could omit this if we need _showActionSheet outside a per-account context.
5557
final accountId = PerAccountStoreWidget.accountIdOf(pageContext);
@@ -76,12 +78,20 @@ void _showActionSheet(
7678
// Needs support for separate properties like `flex-grow`
7779
// and `flex-shrink`.
7880
flex: 1,
79-
child: InsetShadowBox(
80-
top: 8, bottom: 8,
81-
color: designVariables.bgContextMenu,
82-
child: SingleChildScrollView(
83-
padding: EdgeInsets.symmetric(vertical: 8),
84-
child: header)))
81+
child: ConstrainedBox(
82+
constraints: BoxConstraints(
83+
maxHeight: shorterScrollableMaxHeight
84+
// Chosen so we show "4-ish lines rather than 6-ish" in the
85+
// DM action sheet header with group participant pills:
86+
// https://chat.zulip.org/#narrow/channel/48-mobile/topic/abbreviated.20headings/near/2371840
87+
? 160
88+
: double.infinity),
89+
child: InsetShadowBox(
90+
top: 8, bottom: 8,
91+
color: designVariables.bgContextMenu,
92+
child: SingleChildScrollView(
93+
padding: EdgeInsets.symmetric(vertical: 8),
94+
child: header))))
8595
: Padding(
8696
padding: EdgeInsets.only(top: 16, bottom: 4),
8797
child: header);
@@ -1095,9 +1105,11 @@ void showDmActionSheet(BuildContext context, {required DmNarrow narrow}) {
10951105
ProfilePage.buildRoute(context: context, userId: userId)))).toList())
10961106
: null);
10971107

1108+
final headerScrollable = narrow.otherRecipientIds.length > 1;
10981109
_showActionSheet(pageContext,
10991110
header: header,
1100-
headerScrollable: narrow.otherRecipientIds.length > 1,
1111+
headerScrollable: headerScrollable,
1112+
shorterScrollableMaxHeight: headerScrollable,
11011113
buttonSections: buttonSections);
11021114
}
11031115

0 commit comments

Comments
 (0)