Skip to content

Commit 26ac403

Browse files
committed
emoji_reaction [nfc]: Use EmojiWidget in view-reactions header
1 parent 329c335 commit 26ac403

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
@@ -849,22 +849,19 @@ class _ViewReactionsEmojiItem extends StatelessWidget {
849849
emojiType: reactionWithVotes.reactionType,
850850
emojiCode: reactionWithVotes.emojiCode,
851851
emojiName: emojiName);
852+
// (Not calling EmojiDisplay.resolve. For expediency, rather than design a
853+
// reasonable layout for [Emojiset.text], in this case we just override that
854+
// setting and show the emoji anyway.)
852855

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

869866
Widget result = Tooltip(
870867
message: emojiName,

0 commit comments

Comments
 (0)