Closed fly-qp closed 10 months ago
Did you find any solution for that?
Same situation
Hi.
The solution : add if(!child.debugDisposed)
in local_hero_layer.dart before markNeedsPaint();
void _onAnimationStatusChanged(AnimationStatus status) {
if (status == AnimationStatus.completed ||
status == AnimationStatus.dismissed) {
if(!child.debugDisposed) markNeedsPaint();
}
}
@pbouttier
It getting build fail. can you describe with more information.
This solution works for me in flutter 2.5.3, with only this fix.
My usage : hero between two listview childrens.
Maybe in other cases, lattest stable this is different.
I am guessing that the animation completed, and the layer was removed. In that case, marking it for paint does not make sense. Haven't tested it (yet), but I think the whole line is redundant.
It seems to be linguistically. If the overlay is removed, when the animation is done, there is nothing to repaint. i've assumed that it is null when it was disposed. Flutter docs say, however, that it is null when assertions are disabled - so to me it seems not the best way to check for it, anyway.
Also, for null-safety the line is a little different
void _onAnimationStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) { if(!child.debugDisposed ?? true) markNeedsPaint(); } }
Hi.
The solution : add
if(!child.debugDisposed)
in local_hero_layer.dart beforemarkNeedsPaint();
void _onAnimationStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) { if(!child.debugDisposed) markNeedsPaint(); } }
Be careful, this might break the animation in release mode (debug mode works fine though)
It's work, thanks
Hi, I ran into the same issue.
The solution with the debugDisposed
check will not work in a release build because debug variables should not be used outside of assert
statements.
Instead, a check for the attached
property should solve the issue:
// in 'lib/src/rendering/local_hero_layer.dart'
void _onAnimationStatusChanged(AnimationStatus status) {
if (!attached) {
return;
}
if (status == AnimationStatus.completed ||
status == AnimationStatus.dismissed) {
markNeedsPaint();
}
}
The animation works just fine but in the logs it looks very bad. Don't know what to do. Can I leave It like that.