Implicit Flutter Animations
Oct 4 2022 Dart 2.17, Flutter 3.0, Visual Studio Code 1.7
Part 1: Animation Fundamentals
3. Add Realistic Motions with Curves
The student materials have been reviewed and are updated as of August 2022.
The updated material uses null safety and also deploys the use of const keyword with constant constructors as per the Flutter lint rules that is used to encourage good coding practises.
Let’s take a look at this animation: If you notice, the slide animation animates linearly. Which means it increases at a steady rate and does not really mimic a real world movement.
AnimatedPositioned( ... curve: Curves.bounceOut ... )
AnimatedPositioned( ... curve: Curves.easeIn ... )
AnimatedPositioned( ... curve: Curves.easeInOutQuint ... )
... bool _showBox = false; ... body: Center( child: AnimatedContainer( duration: const Duration(milliseconds: 1000), curve: Curves.bounceOut, width: _showBox ? 200 : 100, height: _showBox ? 200 : 100, color: _showBox ? Colors.orange : Colors.green, ), )
[Browser Window] Curves Page
Here you have different curves. Playing them shows how the animation progresses from 0.0 to 1.0 lifespan of an animation. By the side, you have a visual feel of how each curve affects different animation effects.