smart_views 0.0.5
smart_views: ^0.0.5 copied to clipboard
Smart List/Grid views with automatic empty states and simple item animations.
๐ฆ smart_views #
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.
โจ Features #
- โ
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.
๐ Installation #
Add this to your pubspec.yaml:
dependencies:
smart_views: ^1.0.0
Then run:
flutter pub get
๐ Usage #
SmartListView #
SmartListView.builder(
itemCount: items.length,
emptyWidget: Center(child: Text("No items found")),
itemBuilder: (context, index) {
return ListTile(
title: Text("Item ${items[index]}"),
);
},
)
SmartGridView #
SmartGridView.count(
crossAxisCount: 2,
emptyWidget: Center(child: Text("No items found")),
children: items.map((e) => Card(child: Center(child: Text(e)))).toList(),
)
SmartPageView #
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 #
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 #
SmartAnimatedGridView.count(
crossAxisCount: 2,
items: items,
emptyWidget: Center(child: Text("Nothing here")),
itemBuilder: (context, index) => Card(child: Text("Animated $index")),
animationType: AnimationType.slide,
)
SmartAnimatedPageView #
SmartAnimatedPageView(
items: items,
emptyWidget: Center(child: Text("No pages")),
itemBuilder: (context, index) => Center(child: Text("Page $index")),
animationType: AnimationType.scale,
)
๐งช Running Tests #
flutter test
Tests cover:
- Empty state rendering
- Items rendering
- Animation behavior
๐ Roadmap #
- โ Add customizable animation durations
- โ Add staggered animations
- โ Add infinite scroll support
๐ค Contributing #
Contributions are welcome! Feel free to open issues and PRs on GitHub.
๐ License #
MIT License ยฉ 2025