Skip to content

Commit

Permalink
compose: Shrink "send" button to match content-input height, like bef…
Browse files Browse the repository at this point in the history
…ore M3

The way to get the smaller IconButton height we want has changed.
After migrating to Material Design 3, in zulip#380, we have to do this
different thing.

Fixes: zulip#398
  • Loading branch information
chrisbobbe committed Nov 20, 2023
1 parent 640caef commit b47873f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/widgets/compose_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,18 @@ class _SendButtonState extends State<_SendButton> {
),
child: IconButton(
tooltip: zulipLocalizations.composeBoxSendTooltip,

// Match the height of the content input. Zeroing the padding lets the
// constraints take over.
constraints: const BoxConstraints(minWidth: _sendButtonSize, minHeight: _sendButtonSize),
padding: const EdgeInsets.all(0),

style: const ButtonStyle(
// Match the height of the content input. Empirically, setting
// [MaterialTapTargetSize.shrinkWrap] seems necessary to let the size
// be smaller than 48px square (at least without messing with
// [visualDensity]). So do that. It would be nice if the touch target
// extended invisibly out from the button, to make a 48px square,
// but I can't easily check that in the inspector. It might be the
// behavior, from reading docs, but the docs aren't clear enough
// to rely on.
minimumSize: MaterialStatePropertyAll(Size.square(_sendButtonSize)),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
color: foregroundColor,
icon: const Icon(Icons.send),
onPressed: _send));
Expand Down

0 comments on commit b47873f

Please sign in to comment.