Skip to content

Commit 3df6507

Browse files
committed
emoji [nfc]: Add ImageEmojiWidget.neverAnimate
1 parent dc686ef commit 3df6507

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
@@ -98,6 +98,7 @@ class ImageEmojiWidget extends StatelessWidget {
9898
required this.size,
9999
this.textScaler = TextScaler.noScaling,
100100
this.errorBuilder,
101+
this.neverAnimate = false,
101102
});
102103

103104
final ImageEmojiDisplay emojiDisplay;
@@ -114,13 +115,20 @@ class ImageEmojiWidget extends StatelessWidget {
114115

115116
final ImageErrorWidgetBuilder? errorBuilder;
116117

118+
/// Whether to show an animated emoji in its still (non-animated) variant
119+
/// only, even if device settings permit animation.
120+
///
121+
/// Defaults to false.
122+
final bool neverAnimate;
123+
117124
@override
118125
Widget build(BuildContext context) {
119126
// Some people really dislike animated emoji.
120127
final doNotAnimate =
128+
neverAnimate
121129
// From reading code, this doesn't actually get set on iOS:
122130
// https://github.com/zulip/zulip-flutter/pull/410#discussion_r1408522293
123-
MediaQuery.disableAnimationsOf(context)
131+
|| MediaQuery.disableAnimationsOf(context)
124132
|| (defaultTargetPlatform == TargetPlatform.iOS
125133
// TODO(upstream) On iOS 17+ (new in 2023), there's a more closely
126134
// relevant setting than "reduce motion". It's called "auto-play

0 commit comments

Comments
 (0)