smart_views 0.0.1
smart_views: ^0.0.1 copied to clipboard
Smart List/Grid views with automatic empty states and simple item animations.
Perfect π since youβre making a smart_views package, a good README.md should explain what it is, how to install, and give code examples.
Hereβs a clean version you can drop into your repo:
π¦ 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