All 7 Implicit vs Explicit Animations questions
More in Implicit vs Explicit Animations
Advertisement
Back to results for “Implicit vs Explicit Animations”
Flutter › Implicit vs Explicit Animations

What are implicit animations in Flutter, and how do widgets such as AnimatedContainer and AnimatedOpacity let you achieve a genuinely smooth animation with genuinely minimal required code?

Beginner

Answer

Implicit animations are widgets that automatically and properly animate a genuine smooth transition between an old value and a new value whenever one of their own specific properties actually changes, entirely without requiring you to manually manage any underlying AnimationController yourself, and widgets such as AnimatedContainer, which smoothly animates changes to properties like width, height, or color, and AnimatedOpacity, which smoothly animates a fade transition, let you achieve a genuinely smooth, polished animation simply by changing a given property's own value and letting Flutter itself automatically handle the entire actual underlying animation completely for you.
AnimatedOpacity(
  opacity: isVisible ? 1.0 : 0.0,
  duration: Duration(milliseconds: 300),
  child: MyWidget(),
)
Real-world example A notification banner uses AnimatedOpacity to smoothly fade itself in when it first appears and smoothly fade back out again when it is genuinely dismissed, achieving a genuinely polished visual effect using just a single simple property change.

Common follow-ups: What genuinely other implicit animation widgets besides AnimatedContainer and AnimatedOpacity does Flutter already provide?;What genuinely happens if you change an implicit animation's target value again while it is still actively mid animation?