Skip to content

Commit 0d68853

Browse files
committed
emoji [nfc]: Pull out some tricky logic about showing emoji names
1 parent badeafa commit 0d68853

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/widgets/emoji_reaction.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ class _TextEmoji extends StatelessWidget {
427427

428428
@override
429429
Widget build(BuildContext context) {
430+
// Encourage line breaks before "_" (common in these), but try not
431+
// to leave a colon alone on a line. See:
432+
// <https://github.com/flutter/flutter/issues/61081#issuecomment-1103330522>
433+
final text = ':\ufeff${emojiName.replaceAll('_', '\u200b_')}\ufeff:';
434+
430435
final reactionTheme = EmojiReactionTheme.of(context);
431436
return Text(
432437
textAlign: TextAlign.end,
@@ -438,9 +443,6 @@ class _TextEmoji extends StatelessWidget {
438443
color: selected ? reactionTheme.textSelected : reactionTheme.textUnselected,
439444
).merge(weightVariableTextStyle(context,
440445
wght: selected ? 600 : null)),
441-
// Encourage line breaks before "_" (common in these), but try not
442-
// to leave a colon alone on a line. See:
443-
// <https://github.com/flutter/flutter/issues/61081#issuecomment-1103330522>
444-
':\ufeff${emojiName.replaceAll('_', '\u200b_')}\ufeff:');
446+
text);
445447
}
446448
}

0 commit comments

Comments
 (0)