expandable
5.0.1, released 6 years ago by an unverified publisher
A Flutter widget that expands or collapses content with optional header and icon.
What it does
Provides a reusable expandable panel and low‑level expandable widgets that can be customized via themes. It supports automatic scrolling, custom icons, and theming for animation and appearance.
AI-written summary of version 5.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a collapsible section in a list or card
- You want consistent expand/collapse behavior across the app
- You need automatic scrolling into view when expanding
Skip it when
- You need complex state management beyond simple expand/collapse
- You are building a highly custom animation that requires low‑level control
Strengths
- Easy to use with minimal boilerplate
- Theme support for consistent styling
- Automatic scrolling with ScrollOnExpand
- Null safety and modern API
Weaknesses
- Limited to expand/collapse; not a full state‑management solution
- No built‑in support for nested or multi‑level expandables
- Requires manual integration for custom animations
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add dependency to pubspec and import package; no special permissions or build_runner needed
```dart
import 'package:expandable/expandable.dart';
class ArticleWidget extends StatelessWidget {
final Article article;
ArticleWidget(this.article);
@override
Widget build(BuildContext context) {
return ExpandablePanel(
header: Text(article.title),
collapsed: Text(article.body, maxLines: 2, overflow: TextOverflow.ellipsis),
expanded: Text(article.body),
tapHeaderToExpand: true,
hasIcon: true,
);
}
}
```Alternatives
Packages that do the same job and could replace expandable.
- accordion
An expandable and collapsible accordion list widget for Flutter.
50Compare - app_badge_plus
Flutter plugin to set numeric badges on app icons for iOS, Android, and macOS
84Compare - iconsax_flutter
Flutter package providing a collection of Iconsax icons in multiple styles.
52Compare - sliver_snap
Provides collapsible and expandable app bars with automatic snapping behaviors.
62Compare
Works with
Packages commonly used together with expandable: ones it builds on, ones built on it, and its own family.