Repository navigation
Commit 89d59da
authored
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 #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 #175516
Partial fix for #130976
Fixes Google b/4196053271 parent 90f26f5 commit 89d59da
2 files changed
Lines changed: 947 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
285 | 304 | | |
286 | 305 | | |
287 | 306 | | |
| |||
1101 | 1120 | | |
1102 | 1121 | | |
1103 | 1122 | | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1104 | 1128 | | |
1105 | 1129 | | |
1106 | 1130 | | |
| |||
1124 | 1148 | | |
1125 | 1149 | | |
1126 | 1150 | | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1130 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
1131 | 1157 | | |
1132 | 1158 | | |
1133 | 1159 | | |
| |||
1144 | 1170 | | |
1145 | 1171 | | |
1146 | 1172 | | |
| 1173 | + | |
1147 | 1174 | | |
1148 | 1175 | | |
1149 | 1176 | | |
| |||
1220 | 1247 | | |
1221 | 1248 | | |
1222 | 1249 | | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1223 | 1253 | | |
1224 | 1254 | | |
1225 | 1255 | | |
| |||
1233 | 1263 | | |
1234 | 1264 | | |
1235 | 1265 | | |
1236 | | - | |
1237 | | - | |
1238 | | - | |
1239 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
1240 | 1272 | | |
1241 | 1273 | | |
1242 | 1274 | | |
| |||
1275 | 1307 | | |
1276 | 1308 | | |
1277 | 1309 | | |
| 1310 | + | |
1278 | 1311 | | |
1279 | 1312 | | |
1280 | 1313 | | |
1281 | | - | |
1282 | | - | |
1283 | 1314 | | |
1284 | 1315 | | |
1285 | 1316 | | |
| |||
0 commit comments