smart_views 0.0.1 copy "smart_views: ^0.0.1" to clipboard
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 for ListView with empty state handling.
  • βœ… SmartGridView β†’ replacement for GridView with empty state handling.
  • βœ… SmartPageView β†’ replacement for PageView with 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


5
likes
0
points
29
downloads

Publisher

unverified uploader

Weekly Downloads

Smart List/Grid views with automatic empty states and simple item animations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on smart_views