-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
We had an issued filed with the Flare-Flutter library reporting animations disappearing when they are paused:
2d-inc/Flare-Flutter#286
It turns out this only happens in a Stack (although there is some flickering in Row/Column too). Has Flutter introduced some view/widget caching that could be acting too aggressively?
We've traced through the paint calls and it seems like Flare is drawing when requested to draw. When the ListView in the stack is dragged, the Flare widget above it in the Stack no longer gets a paint call. This is when the animation disappears. Flare won't call "markNeedsPaint" until the animation changes, assuming Flutter will draw the widget on demand if it needs to repaint for external reasons (this is the behavior we used to see).
Furthermore, it seems like the issue resolves if we wrap the Flare widget in a ColoredBox with a non-transparent background (which is odd as the framework seems to make no distinction at the Flutter level if the ColoredBox has a transparent background or not). Video here. We're wondering if there are some under the hood caching heuristics that Flare is tripping up...or somehow Flare is making Flutter think it has no content?
Doctor:
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
[!] Android Studio (version 4.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
We attempted to reproduce this in isolation (without Flare/Rive 1's painting) but weren't able to reproduce the issue. It seems like there's a specific combination of events that's making Flutter cache an old/empty state for this widget and we're hoping the Flutter team has insight as to what it could be.