Skip to content

Commit

Permalink
reactions [nfc]: Refactor text-emoji minimum height
Browse files Browse the repository at this point in the history
This seems to do the job more transparently, and it does it without
needing to use the heard-coded value 2 and explain what it means.
But I've separated this from the previous commit because it's a less
minimal change from the status quo.
  • Loading branch information
chrisbobbe committed Dec 6, 2023
1 parent db766d2 commit ec4a21f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/widgets/emoji_reaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ class ReactionChip extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// So text-emoji chips are at least as tall as square-emoji
// ones (probably a good thing).
// 2 is for the `vertical: 1` padding around `emoji`.
SizedBox(height: _squareEmojiScalerClamped(context).scale(_squareEmojiSize) + 2),
Flexible( // [Flexible] to let text emojis expand if they can
child: Padding(padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 1),
child: emoji)),
child: ConstrainedBox(
constraints: BoxConstraints(
// minHeight so text-emoji chips are at least as tall
// as square-emoji ones (probably a good thing).
minHeight: _squareEmojiScalerClamped(context).scale(_squareEmojiSize)),
child: Center(widthFactor: 1,
child: emoji)))),
// Added vertical: 1 to give some space when the label is
// taller than the emoji (e.g. because it needs multiple lines)
Padding(padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 1),
Expand Down

0 comments on commit ec4a21f

Please sign in to comment.