Skip to content

Commit bc2e58e

Browse files
committed
emoji_reaction [nfc]: Use EmojiWidget in view-reactions header
1 parent a0ddada commit bc2e58e

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

lib/widgets/emoji_reaction.dart

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -843,22 +843,19 @@ class _ViewReactionsEmojiItem extends StatelessWidget {
843843
emojiType: reactionWithVotes.reactionType,
844844
emojiCode: reactionWithVotes.emojiCode,
845845
emojiName: emojiName);
846+
// (Not calling EmojiDisplay.resolve. For expediency, rather than design a
847+
// reasonable layout for [Emojiset.text], in this case we just override that
848+
// setting and show the emoji anyway.)
846849

847-
// Don't use a :text_emoji:-style display here.
848-
final placeholder = SizedBox.square(dimension: emojiSize);
849-
850-
// TODO make a helper widget for this
851-
final emoji = switch (emojiDisplay) {
852-
UnicodeEmojiDisplay() => UnicodeEmojiWidget(
853-
size: emojiSize,
854-
emojiDisplay: emojiDisplay),
855-
ImageEmojiDisplay() => ImageEmojiWidget(
856-
size: emojiSize,
857-
emojiDisplay: emojiDisplay,
858-
// If image emoji fails to load, show nothing.
859-
errorBuilder: (_, _, _) => placeholder),
860-
TextEmojiDisplay() => placeholder,
861-
};
850+
final emoji = EmojiWidget(
851+
emojiDisplay: emojiDisplay,
852+
squareDimension: emojiSize,
853+
buildCustomTextEmoji: () =>
854+
// Invoked when an image emoji's URL didn't parse; see
855+
// EmojiStore.emojiDisplayFor. Don't show text, just an empty square.
856+
// TODO(design) refine?; offer a visible touch target with tooltip?
857+
SizedBox.square(dimension: emojiSize),
858+
);
862859

863860
Widget result = Tooltip(
864861
message: emojiName,

0 commit comments

Comments
 (0)