What you'll learn
Use implicit and explicit animation, transitions, heroes, sequences, and gestures to communicate change without harming accessibility. The lesson turns the APIs into a repeatable engineering workflow instead of a collection of isolated snippets.
By the end of this lesson, you'll be able to:
- Apply Implicit animation in a production-shaped Flutter feature
- Apply Controllers and tweens in a production-shaped Flutter feature
- Apply Transitions in a production-shaped Flutter feature
- Apply Hero in a production-shaped Flutter feature
Core mental model
Connect each API to the decision it supports. Flutter code stays maintainable when state, ownership, lifecycle, and platform boundaries are explicit.
| Concept | What it means | Decision rule |
|---|---|---|
| Implicit animation | A widget animates automatically between changed property values | Use for simple local transitions with one target state |
| AnimationController | An owned timeline for explicit coordination | Dispose it and use only when timing or direction needs control |
| Reduced motion | A user preference to minimize nonessential movement | Remove large spatial motion while preserving state feedback |
Professional workflow
Work in small vertical slices and keep behavior observable from the first iteration.
- Define the accessible state transition boundary: user goal, inputs, visible states, ownership, and expected failures.
- Build the smallest working vertical slice with typed data and explicit dependencies.
- Represent loading, empty, success, and failure behavior where the feature can encounter them.
- Verify logic away from the UI, then exercise the rendered behavior at its public boundary.
- Inspect lifecycle, accessibility, performance, security, and platform behavior before widening the feature.
- Refactor only after behavior is protected by repeatable evidence.
Protect the frame
Guided Flutter lab
Build a focused accessible state transition slice
This compact example keeps the important ownership and data-flow decisions visible so the behavior is easy to extend and test.
class CompletionBadge extends StatelessWidget {
const CompletionBadge({super.key, required this.complete});
final bool complete;
@override
Widget build(BuildContext context) {
final reduceMotion = MediaQuery.disableAnimationsOf(context);
return AnimatedContainer(
duration: reduceMotion ? Duration.zero : const Duration(milliseconds: 220),
curve: Curves.easeOut,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: complete ? Colors.green.shade700 : Colors.grey.shade700,
borderRadius: BorderRadius.circular(999),
),
child: Text(complete ? 'Complete' : 'In progress'),
);
}
}Production practice
Contract
Define the accessible state transition inputs, outputs, owner, lifecycle, visible states, and platform assumptions before selecting APIs or packages.
Verification
Protect pure rules with unit tests and the rendered public contract with widget or integration evidence; include one unavailable or failure case.
Operations
Keep dependencies replaceable, log actionable context without user secrets, and measure user-visible behavior before optimizing.
Common failure mode
Independent workshop
Extend the guided lab into a review-ready accessible state transition feature that fits the running course portfolio app.
Your finished workshop must include:
- Implicit animation
- Controllers and tweens
- Transitions
- Hero
- Staggered motion
- Automated verification and a short design note
Definition of done
Recap & quick check
Key takeaways
- Implicit animation: Use for simple local transitions with one target state
- AnimationController: Dispose it and use only when timing or direction needs control
- Reduced motion: Remove large spatial motion while preserving state feedback
Quick check
1. Which rule best applies to Implicit animation?
2. Which rule best applies to AnimationController?
3. Which rule best applies to Reduced motion?
Next: Custom Painting & Advanced Graphics