An implicit animation describes the new visual target; Flutter interpolates supported properties from the previous value. This is useful for a selection indicator, expanding panel or simple size transition.
Animate a state transition
The example toggles a visual region between two sizes. The application state is the boolean, not the intermediate width produced during the transition.
Worked example
This is a complete example. Open it with Run example, then use Run inside DartPad.
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: PreviewPanel()));
class PreviewPanel extends StatefulWidget {
const PreviewPanel({super.key});
@override
State<PreviewPanel> createState() => _PreviewPanelState();
}
class _PreviewPanelState extends State<PreviewPanel> {
bool expanded = false;
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('A visual transition')),
body: Center(child: Column(mainAxisSize: MainAxisSize.min, children: [
AnimatedContainer(duration: const Duration(milliseconds: 250),
curve: Curves.easeOut, width: expanded ? 240 : 120, height: 100,
color: expanded ? Colors.indigo : Colors.teal),
const SizedBox(height: 20),
FilledButton(onPressed: () => setState(() => expanded = !expanded),
child: const Text('Toggle preview')),
])),
);
}Read the result
The same control can toggle again before the previous transition ends. Avoid tying a business operation to the assumption that an animation always completes. A reduced-motion preference may justify shortening or removing nonessential motion.
Identify the target state before the intermediate frames
The boolean changes the desired width and color. AnimatedContainer interpolates the visual properties between their old and new targets. Those intermediate widths are presentation, not additional business states that need to be saved.
Quick repeated taps can select another target before the current transition completes. That should remain safe because the meaningful state is still the latest boolean, not a fragile chain of completion callbacks.
Choose an explicit controller when playback, reversing or sequencing is an actual requirement. Otherwise keep the smaller implicit API and check how the motion behaves with reduced-motion and accessibility needs.
Practice and verification
Change one property at a time, then test quick repeated taps. Explain which values are actual state and which are interpolated presentation.