carlmagnus
carlmagnus

Reputation: 55

How to stop elevation animating when changed in flutter?

I found that when changing the elevation of a card widget, it will animate it to the new value. In the docs I found this https://api.flutter.dev/flutter/material/Material/elevation.html which told me this is the expected behaviour. However, I want it to change instantly and not animate. How can I remove the animation?

Upvotes: 0

Views: 269

Answers (1)

diegoveloper
diegoveloper

Reputation: 103421

Set animationDuration property to zero ,

  Material(
       ...
       animationDuration: Duration.zero,
     );

Use PhysicalModel instead of Card widget

Upvotes: 1

Related Questions