Skip to content

Commit ec4a21f

Browse files
committed
reactions [nfc]: Refactor text-emoji minimum height
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.
1 parent db766d2 commit ec4a21f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/widgets/emoji_reaction.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,15 @@ class ReactionChip extends StatelessWidget {
159159
mainAxisSize: MainAxisSize.min,
160160
crossAxisAlignment: CrossAxisAlignment.center,
161161
children: [
162-
// So text-emoji chips are at least as tall as square-emoji
163-
// ones (probably a good thing).
164-
// 2 is for the `vertical: 1` padding around `emoji`.
165-
SizedBox(height: _squareEmojiScalerClamped(context).scale(_squareEmojiSize) + 2),
166162
Flexible( // [Flexible] to let text emojis expand if they can
167163
child: Padding(padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 1),
168-
child: emoji)),
164+
child: ConstrainedBox(
165+
constraints: BoxConstraints(
166+
// minHeight so text-emoji chips are at least as tall
167+
// as square-emoji ones (probably a good thing).
168+
minHeight: _squareEmojiScalerClamped(context).scale(_squareEmojiSize)),
169+
child: Center(widthFactor: 1,
170+
child: emoji)))),
169171
// Added vertical: 1 to give some space when the label is
170172
// taller than the emoji (e.g. because it needs multiple lines)
171173
Padding(padding: const EdgeInsets.symmetric(horizontal: 3, vertical: 1),

0 commit comments

Comments
 (0)