Skip to content

Commit 07d60a7

Browse files
committed
compose [nfc]: Refactor outer vertical padding on label in _Banner
Move vertical padding so it won't wrap the trailing element, when present (as a `buildTrailing` that returns non-null). When we add the "Cancel" and "Save" buttons for the edit-message banner, those will want to control their own outer vertical padding to make it respond to taps, because the painted button is supposed to be just 28px tall, which is too small for a touch target; see discussion linked in dartdoc. NFC because `buildTrailing` on _Banner's only subclass, _ErrorBanner, returns null.
1 parent d5d0ea8 commit 07d60a7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/widgets/compose_box.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,13 @@ abstract class _Banner extends StatelessWidget {
14001400
Color getLabelColor(DesignVariables designVariables);
14011401
Color getBackgroundColor(DesignVariables designVariables);
14021402

1403-
/// A trailing element, with no outer padding for spacing/positioning.
1403+
/// A trailing element, with vertical but not horizontal outer padding
1404+
/// for spacing/positioning.
1405+
///
1406+
/// An interactive element's touchable area should have height at least 44px,
1407+
/// with some of that as "slop" vertical outer padding above and below
1408+
/// what gets painted:
1409+
/// https://github.com/zulip/zulip-flutter/pull/1432#discussion_r2023907300
14041410
///
14051411
/// To control the element's distance from the end edge, override [padEnd].
14061412
Widget? buildTrailing(BuildContext context);
@@ -1431,12 +1437,12 @@ abstract class _Banner extends StatelessWidget {
14311437
// (SafeArea.minimum doesn't take an EdgeInsetsDirectional)
14321438
.resolve(Directionality.of(context)),
14331439
child: Padding(
1434-
padding: const EdgeInsetsDirectional.fromSTEB(8, 5, 0, 5),
1440+
padding: const EdgeInsetsDirectional.only(start: 8),
14351441
child: Row(
14361442
children: [
14371443
Expanded(
14381444
child: Padding(
1439-
padding: const EdgeInsets.symmetric(vertical: 4),
1445+
padding: const EdgeInsets.symmetric(vertical: 9),
14401446
child: Text(
14411447
style: labelTextStyle,
14421448
textScaler: MediaQuery.textScalerOf(context).clamp(maxScaleFactor: 1.5),

0 commit comments

Comments
 (0)