Skip to content

Commit 2f9faa7

Browse files
committed
emoji [nfc]: Add ImageEmojiWidget.neverAnimate
1 parent 479d323 commit 2f9faa7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/widgets/emoji.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class ImageEmojiWidget extends StatelessWidget {
8989
required this.size,
9090
this.textScaler = TextScaler.noScaling,
9191
this.errorBuilder,
92+
this.neverAnimate = false,
9293
});
9394

9495
final ImageEmojiDisplay emojiDisplay;
@@ -105,13 +106,20 @@ class ImageEmojiWidget extends StatelessWidget {
105106

106107
final ImageErrorWidgetBuilder? errorBuilder;
107108

109+
/// Whether to show an animated emoji in its "still (non-animated)" variant
110+
/// only, even if device settings permit animation.
111+
///
112+
/// Defaults to false.
113+
final bool neverAnimate;
114+
108115
@override
109116
Widget build(BuildContext context) {
110117
// Some people really dislike animated emoji.
111118
final doNotAnimate =
119+
neverAnimate
112120
// From reading code, this doesn't actually get set on iOS:
113121
// https://github.com/zulip/zulip-flutter/pull/410#discussion_r1408522293
114-
MediaQuery.disableAnimationsOf(context)
122+
|| MediaQuery.disableAnimationsOf(context)
115123
|| (defaultTargetPlatform == TargetPlatform.iOS
116124
// TODO(upstream) On iOS 17+ (new in 2023), there's a more closely
117125
// relevant setting than "reduce motion". It's called "auto-play

0 commit comments

Comments
 (0)