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
{{ message }}
Repository navigation
Material should have a non-animating constructor #45577
Currently, the Material widget animates all changes to any of its properties. For some use cases it would be cool to turn those implicit animations off (e.g. when the animation is actually driven from the outside, see https://github.com/flutter/packages/pull/30/files#r349369211).
A Material widget that does not implicitly animate properties could build a relatively simple widget tree. That would be helpful in cases where the app doesn't want the animation, or is doing it's own animation at a higher level.
Workaround: You can currently achieve a non-animating material by setting its duration property to Duration.zero.
However, as Hans pointed out, we could probably build a simpler widget tree in that case since setting the Duration to zero still builds all the implicit animation cruft.
Another solution is just to set a Key on the widget when you replace it, that'll cause the old one to be thrown away and a new one created without animating.
Given that there are numerous solutions, I'm going to close this bug.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
HansMuller commentedon Jan 3, 2020
A Material widget that does not implicitly animate properties could build a relatively simple widget tree. That would be helpful in cases where the app doesn't want the animation, or is doing it's own animation at a higher level.
goderbauer commentedon Jan 3, 2020
Workaround: You can currently achieve a non-animating material by setting its duration property to Duration.zero.
However, as Hans pointed out, we could probably build a simpler widget tree in that case since setting the Duration to zero still builds all the implicit animation cruft.
micimize commentedon Jan 4, 2020
One way we could expose this in a backwards-compatible way is by adding an
animated (default true)that just toggles the use of_MaterialInterior:Another option would be to make another widget
MotionlessMaterial, which notably could be done in userland fairly easilyHixie commentedon Mar 18, 2023
Another solution is just to set a Key on the widget when you replace it, that'll cause the old one to be thrown away and a new one created without animating.
Given that there are numerous solutions, I'm going to close this bug.
github-actions commentedon Apr 1, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.