You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an Image.asset() widget is a descendant of a TickerMode widget, the image will not load if the TickerMode widget's enabled property is set to false. Additionally, if the TickerMode widget is disabled after the image is loaded, then there is some weird behavior when the app is backgrounded and then brought back into the foreground. This foregrounding behavior is different between iOS and Android.
On iOS, if the TickerMode.enabled property is set to false after the image has loaded and then you background and foreground the app, the image will disappear. If the enabled property is then set to true, the image will reload. While the app is in the foreground and the image has been loaded, you can turn the enabled property on and off repeatedly without affecting the image. See the attached iOSBehavior.mp4 video for a demonstration.
On Android, if you set the enabled property to false, background the app, and then foreground it again, the image will still be visible. However, if you then set the enabled property to true, the image will flicker as it briefly disappears and reappears. Also, if the TickerMode.enabled property is true when the app is backgrounded and foregrounded, and then you set enabled to false, the image will disappear. Except for the first time after foregrounding, you can enable and disable the TickerMode widget without affecting the rendering of the image. See the attached AndroidBehavior.mp4 video for a demonstration.
Steps to Reproduce
An example app that demonstrates the problem can be found in this repository:
The app has an Image.asset widget inside a TickerMode widget, along with a Switch widget (outside the TickerMode) that is used to enable/disable the TickerMode. The TickerMode is initially disabled.
For both iOS and Android:
Launch the example app
See that the image has not loaded.
Turn on the Switch widget
See that the image has loaded
Repeatedly toggle the Switch widget
See that the image remains visible.
For iOS behavior:
7. After the image is visible, turn the Switch widget off.
8. See that the image remains visible
9. Background and foreground the app
10. See that the image has disappeared
11. Turn the Switch widget on
12. See that the image has appeared.
For Android Behavior:
7. After the image is visible, turn the Switch widget off.
8. See that the image remains visible
9. Background and foreground the app
10. See that the image remains visible
11. Turn the Switch widget on.
12. See the image flicker as it briefly disappears and reappears.
13. With the Switch widget on, background and foreground the app
14. See that the image remains visible
15. Turn the Switch widget off
16. See that the image disappears
Code Example
The following is the app code contained in the example app. Reproducing the issue requires an image asset, so it is recommended to clone the following repository:
The app has an Image.asset widget inside a TickerMode widget, along with a Switch widget (outside the TickerMode) that is used to enable/disable the TickerMode. The TickerMode is initially disabled.
When an
Image.asset()widget is a descendant of aTickerModewidget, the image will not load if theTickerModewidget'senabledproperty is set tofalse. Additionally, if theTickerModewidget is disabled after the image is loaded, then there is some weird behavior when the app is backgrounded and then brought back into the foreground. This foregrounding behavior is different between iOS and Android.On iOS, if the
TickerMode.enabledproperty is set tofalseafter the image has loaded and then you background and foreground the app, the image will disappear. If theenabledproperty is then set totrue, the image will reload. While the app is in the foreground and the image has been loaded, you can turn theenabledproperty on and off repeatedly without affecting the image. See the attachediOSBehavior.mp4video for a demonstration.On Android, if you set the
enabledproperty tofalse, background the app, and then foreground it again, the image will still be visible. However, if you then set theenabledproperty totrue, the image will flicker as it briefly disappears and reappears. Also, if theTickerMode.enabledproperty is true when the app is backgrounded and foregrounded, and then you setenabledtofalse, the image will disappear. Except for the first time after foregrounding, you can enable and disable theTickerModewidget without affecting the rendering of the image. See the attachedAndroidBehavior.mp4video for a demonstration.Steps to Reproduce
An example app that demonstrates the problem can be found in this repository:
https://github.com/champeauxr/image_tickermode
The app has an
Image.assetwidget inside aTickerModewidget, along with aSwitchwidget (outside theTickerMode) that is used to enable/disable theTickerMode. TheTickerModeis initially disabled.For both iOS and Android:
SwitchwidgetSwitchwidgetFor iOS behavior:
7. After the image is visible, turn the
Switchwidget off.8. See that the image remains visible
9. Background and foreground the app
10. See that the image has disappeared
11. Turn the
Switchwidget on12. See that the image has appeared.
For Android Behavior:
7. After the image is visible, turn the
Switchwidget off.8. See that the image remains visible
9. Background and foreground the app
10. See that the image remains visible
11. Turn the
Switchwidget on.12. See the image flicker as it briefly disappears and reappears.
13. With the
Switchwidget on, background and foreground the app14. See that the image remains visible
15. Turn the
Switchwidget off16. See that the image disappears
Code Example
The following is the app code contained in the example app. Reproducing the issue requires an image asset, so it is recommended to clone the following repository:
https://github.com/champeauxr/image_tickermode
The app has an
Image.assetwidget inside aTickerModewidget, along with aSwitchwidget (outside theTickerMode) that is used to enable/disable theTickerMode. TheTickerModeis initially disabled.flutter analyze
flutter doctor -v
iOSBehavior.mp4
AndroidBehavior.mp4