smart_views is a Flutter package that provides smart wrappers around common Flutter widgets like ListView, GridView, and PageView.
It automatically handles empty states (via emptyWidget) and adds optional animations for a smoother user experience.
- ✅
SmartListView→ replacement forListViewwith empty state handling. - ✅
SmartGridView→ replacement forGridViewwith empty state handling. - ✅
SmartPageView→ replacement forPageViewwith empty state handling. - ✅
SmartAnimatedListView→ list view with animated items. - ✅
SmartAnimatedGridView→ grid view with animated items. - ✅
SmartAnimatedPageView→ page view with page transition animations.
Add this to your pubspec.yaml:
dependencies:
smart_views: ^1.0.0Then run:
flutter pub getSmartListView.builder(
itemCount: items.length,
emptyWidget: Center(child: Text("No items found")),
itemBuilder: (context, index) {
return ListTile(
title: Text("Item ${items[index]}"),
);
},
)SmartGridView.count(
crossAxisCount: 2,
emptyWidget: Center(child: Text("No items found")),
children: items.map((e) => Card(child: Center(child: Text(e)))).toList(),
)SmartPageView(
items: ["Page 1", "Page 2", "Page 3"],
emptyWidget: Center(child: Text("No pages available")),
itemBuilder: (context, index) => Center(
child: Text("This is page ${index + 1}"),
),
)SmartAnimatedListView(
items: items,
emptyWidget: Center(child: Text("Empty list")),
itemBuilder: (context, index) {
return ListTile(title: Text("Animated Item $index"));
},
animationType: AnimationType.fade, // or slide, scale
)SmartAnimatedGridView.count(
crossAxisCount: 2,
items: items,
emptyWidget: Center(child: Text("Nothing here")),
itemBuilder: (context, index) => Card(child: Text("Animated $index")),
animationType: AnimationType.slide,
)SmartAnimatedPageView(
items: items,
emptyWidget: Center(child: Text("No pages")),
itemBuilder: (context, index) => Center(child: Text("Page $index")),
animationType: AnimationType.scale,
)flutter testTests cover:
- Empty state rendering
- Items rendering
- Animation behavior
- Add customizable animation durations
- Add staggered animations
- Add infinite scroll support
Contributions are welcome! Feel free to open issues and PRs on GitHub.
MIT License © 2025