Flutterは強力で柔軟なアニメーションサポートを備えており、シンプルな暗黙的アニメーションから完全に制御可能な明示的アニメーションまで対応しています。アニメーションはスムーズなトランジションとモーションでUXを向上させ、Flutterのウィジェットベースのシステムにより実装が容易です。
暗黙的アニメーション(簡単な方法)
// implicitly-animated widgets animate AUTOMATICALLY when their properties change
AnimatedContainer(
duration: Duration(milliseconds: 300),
width: _expanded ? 200 : 100, // change width → it animates smoothly
height: _expanded ? 200 : 100,
color: _expanded ? Colors.blue : Colors.red,
)
// just change the value (with setState) → Flutter animates the transition
// others: AnimatedOpacity, AnimatedPadding, AnimatedPositioned, etc.
暗黙的アニメーション(、など)は、プロパティが変更されると自動的にアニメーションします — アニメーションを追加する最も簡単な方法です。
