Skip to content

Commit eabc496

Browse files
committed
action_sheet: Constrain height of group-DM pills to 4-ish lines, not 6-ish
1 parent 00f1799 commit eabc496

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);
@@ -1155,9 +1165,11 @@ void showDmActionSheet(BuildContext context, {required DmNarrow narrow}) {
11551165
ProfilePage.buildRoute(context: context, userId: userId)))).toList())
11561166
: null);
11571167

1168+
final headerScrollable = otherRecipientIds.length > 1;
11581169
_showActionSheet(pageContext,
11591170
header: header,
1160-
headerScrollable: otherRecipientIds.length > 1,
1171+
headerScrollable: headerScrollable,
1172+
shorterScrollableMaxHeight: headerScrollable,
11611173
buttonSections: buttonSections);
11621174
}
11631175

0 commit comments

Comments
 (0)