Flutter มีการรองรับ animation ที่ทรงพลังและยืดหยุ่น — ตั้งแต่ implicit animation ที่เรียบง่ายไปจนถึง explicit animation ที่ควบคุมได้เต็มที่ animation ช่วยยกระดับ UX ด้วยทรานซิชันและการเคลื่อนไหวที่ราบรื่น และระบบที่อิงกับ widget ของ Flutter ทำให้มันเข้าถึงได้ง่าย
implicit animation (วิธีที่ง่าย)
// 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.
implicit animation (, เป็นต้น) animate โดยอัตโนมัติเมื่อ property ของพวกมันเปลี่ยน — วิธีที่ง่ายที่สุดในการเพิ่ม animation
