
"Expandable widget" means two different things in Flutter. ExpansionTile and accordion
packages grow a widget inline, pushing the content below it down. ExpandableAnimation
does the other thing: it lifts a widget out of the layout and expands it into a separate, larger
view — fullscreen, a centered panel or a bottom sheet.
When to use which
| You want | Use |
|---|---|
| A section that reveals more lines in place | ExpansionTile, AnimatedSize |
| A card that becomes a detail page | ExpandableAnimation (fullscreen) |
| A tile that opens a focused panel | ExpandableAnimation (dialog) |
| A banner that opens actions from the bottom | ExpandableAnimation (sheet) |
Expand any widget
ExpandableAnimation(
mode: const ExpandableAnimationMode.sheet(heightFactor: 0.55),
borderRadius: BorderRadius.circular(20),
expandedBorderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
expandedBuilder: (context) => NotificationSheet(notification: item),
child: NotificationBanner(notification: item),
)
The child can be anything: a Container, an image, a list tile, a chart. The package does not
care what it contains; it measures the child's bounds and morphs from there.
Trigger it your way
final controller = ExpandableAnimationController();
ExpandableAnimation(
controller: controller,
expandOnTap: false, // only expand from code
expandedBuilder: (context) => const StatsDetails(),
child: const StatsTile(),
);
// Later, for example from a menu item:
controller.expand();
Try it
The notifications demo uses sheet mode and the profile demo uses dialog mode. See the modes reference for all options.