Justin McCandless 89d59da9ea
Image GIF pausing (#176492)
Flutter needs a strong story around pausing animated GIFs because it
affects accessibility via
[MediaQueryData.disableAnimations](https://main-api.flutter.dev/flutter/widgets/MediaQueryData/disableAnimations.html).
See https://github.com/flutter/flutter/issues/175516.

### Today

Currently, it's possible to pause a gif using TickerProvider. However,
if paused on initial load, the first frame will never display, and I
believe that's a bug.

```dart
TickerMode(
  // Pauses the gif, but if set to false on first load, the first frame never loads.
  enabled: false,
  child: Image(image: myAnimatedGif),
),
```

Currently `disableAnimations` has no effect:

```dart
MediaQuery(
  // Currently has no effect on the Image, until this PR.
  data: MediaQueryData(disableAnimations: true),
  child: Image(image: myAnimatedGif),
),
```

### With this PR

* MediaQueryData.disableAnimations can be used to pause a gif in the
same way that TickerMode can be used today.
* If either MediaQuery.disableAnimations or TickerMode cause a gif to be
paused on first load, it will show its first frame before pausing. This
is potentially a breaking change.
  * The docs clearly explain this behavior and how to pause a gif.

Fixes https://github.com/flutter/flutter/issues/175516
Partial fix for https://github.com/flutter/flutter/issues/130976
Fixes Google b/419605327
2025-11-13 18:34:51 +00:00
..
2025-11-13 18:34:51 +00:00