Skip to content

Commit 536aa99

Browse files
chrisbobbegnprice
authored andcommitted
action_sheet: Increase line spacing in bottom-sheet title
It turns out we can do this without wasting space with extra margin above or below the title, using TextHeightBehavior.
1 parent 1a43fe2 commit 536aa99

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/widgets/action_sheet.dart

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,30 @@ class BottomSheetHeader extends StatelessWidget {
175175

176176
final baseTitleStyle = TextStyle(
177177
fontSize: 20,
178-
height: 20 / 20,
178+
// More height than in Figma, but it was looking too tight:
179+
// https://github.com/zulip/zulip-flutter/pull/1877#issuecomment-3379664807
180+
// (See use of TextHeightBehavior below.)
181+
height: 24 / 20,
179182
color: designVariables.title,
180183
).merge(weightVariableTextStyle(context, wght: 600));
181184

182-
final effectiveTitle = switch ((buildTitle, title)) {
185+
Widget? effectiveTitle = switch ((buildTitle, title)) {
183186
(final build?, null) => build(baseTitleStyle),
184187
(null, final data?) => Text(style: baseTitleStyle, data),
185188
_ => null,
186189
};
187190

191+
if (effectiveTitle != null) {
192+
effectiveTitle = DefaultTextHeightBehavior(
193+
textHeightBehavior: TextHeightBehavior(
194+
// We want some breathing room between lines,
195+
// without adding margin above or below the title.
196+
applyHeightToFirstAscent: false,
197+
applyHeightToLastDescent: false,
198+
),
199+
child: effectiveTitle);
200+
}
201+
188202
final baseMessageStyle = TextStyle(
189203
color: designVariables.labelTime,
190204
fontSize: 17,

0 commit comments

Comments
 (0)