expandable_tile 1.0.2
expandable_tile: ^1.0.2 copied to clipboard
A simple and customizable Flutter widget that expands or collapses when tapped.Perfect for showing and hiding content dynamically with a clean, interactive UI.
โ Buy Me a Coffee #
๐ฝ Expandable Tile (Flutter) #
A Flutter package that helps you expand or collapse widgets to show/hide content with customizable animations. It supports both horizontal and vertical directions and allows flexible customization to fit different UI needs.
๐ฌ Demo Video #
[Demo]
๐ฑ Use Cases #
- Expandable sections in forms or FAQs.
- Slide-in side menus or horizontal drawers.
- Toggle content areas with smooth transitions.
- Build custom accordion or collapsible lists.
โจ Features #
- Show/hide widgets with various animation styles.
- Supports vertical and horizontal expansion.
- Support some animation types.
- Support change color, style title
- Change width title or use fit width base on length title
- Easily customizable animation types.
- Clean API for integration in different widget trees.
- Lightweight and fast.
๐๏ธ Architecture & Technologies #
| Component | Description |
|---|---|
ExpandableTileView |
Main widget to expand/collapse content with animation |
ExpandableAnimation |
Enum to select animation type (e.g., size, fade, scale, def) |
AxisExpand |
Enum to control direction of expansion (horizontal or vertical) |
ExpandTileController |
Main controller to control state of expand (isExpand,axis,...) |
๐งพ Constructor Parameters #
| Field | Type | Default | Description |
|---|---|---|---|
title |
String |
required | The widget displayed as the expandable tile's title. |
child |
Widget |
required | The content widget shown when expanded. |
width |
double? |
null |
The width of the entire tile. If null, it adapts to the content. |
axis |
AxisExpand |
AxisExpand.vertical |
The direction of expansion: vertical or horizontal. |
titleBGColor |
Color? |
null |
Background color for the title section. |
titleTextStyle |
TextStyle? |
null |
Text style for the title (if it's a Text widget). |
widthFill |
bool |
true |
If true, the total width of the ExpandableTile will fit title and child |
posHorizontal |
bool |
false |
Applies only if axis is horizontal. If true, title on left, child on right. |
๐ Usage #
โ Basic Usage #
๐ Default Size Animation
Child Horizontally
ExpandableTileView.animatedDef(
title: "Animation default horizontal",
axis: AxisExpand.horizontal,
posHorizontal: true,
child: Text("his is demo for expand text vertical. The Child is Text."),
)
Child Vertically
ExpandableTileView.animatedDef(
title: "Animation default horizontal",
axis: AxisExpand.horizontal,
child: Text("his is demo for expand text vertical. The Child is Text."),
)
๐ซ๏ธ Fade Animation
ExpandableTileView.animatedFade(
title: "Animation fade",
child: Text("Fading in and out!"),
)
๐ Scale Animation
ExpandableTileView.animatedScale(
title: Text("Animation scale"),
child: Text("Scaling animation!"),
)
โ๏ธ Setup #
To install the expandable_tile package, add the following to your pubspec.yaml file:
dependencies:
expandable_tile: ^1.0.2
๐ฆ Supported SDKs #
- Flutter: Stable channel
- Android: SDK 21+
- iOS: iOS 9+
๐ Contributions #
Feel free to open issues or pull requests on GitHub.
๐ License #
MIT License. See LICENSE for details.
