lazy_wrap 0.1.1 copy "lazy_wrap: ^0.1.1" to clipboard
lazy_wrap: ^0.1.1 copied to clipboard

A Flutter widget that mimics Wrap layout behavior with lazy rendering using ListView.builder.

lazy_wrap #

A Flutter widget that combines the layout behavior of Wrap with the performance of ListView.builder.

Perfect for displaying cards or widgets in multiple columns with efficient vertical or horizontal scrolling.

🚀 Quick Example #

// Fixed-size version (better performance, no layout jumps)
// Now with scrollDirection: Axis.horizontal for horizontal grids!
LazyWrap.fixed(
  itemCount: items.length,
  estimatedItemWidth: 120,
  estimatedItemHeight: 100,
  itemBuilder: (context, index) => ProductCard(item: items[index]),
  spacing: 8,
  runSpacing: 8,
  padding: EdgeInsets.all(12),
  scrollDirection: Axis.vertical,   // or Axis.horizontal
)

// Dynamic-size version (auto-measures height, good for complex UIs)
LazyWrap.dynamic(
  itemCount: items.length,
  itemBuilder: (context, index) => ProductCard(item: items[index]),
  spacing: 8,
  runSpacing: 8,
  padding: EdgeInsets.all(12),
  batchSize: 500,
  scrollDirection: Axis.horizontal, // horizontal example
)

🎯 Features #

  • Lazy scroll (only renders visible items)
  • Wrap-style layout with efficient memory usage
  • Responsive to available width
  • Customizable spacing, padding, and alignment
  • Supports both fixed and dynamic size measurement
  • Supports both vertical and horizontal scroll direction
  • Clean animation and styling ready

📦 Installation #

Add it to your pubspec.yaml:

dependencies:
  lazy_wrap: ^0.1.1

🛠 Usage Tip #

Use LazyWrap.fixed to eliminate layout jumps and maximize performance.

For widgets with highly variable size, use LazyWrap.dynamic and optionally apply chunked rendering or resize smoothing techniques.

🌀 Example #

LazyWrap Demo

💻 Live Demo #

Check it out in action:
👉 lazy-wrap-demo.pages.dev

💡 Inspired by #

This package was built to fill the gap between Wrap layout and ListView.builder efficiency.

☕ Support & Donate #

If this package helps you or your business, consider buying me a coffee!

ko-fi

📣 Maintainer #

Hey, I'm Hensell.
Check out my GitHub profile or visit hensell.dev for more projects and updates.

Contributors #

18
likes
160
points
40
downloads

Publisher

verified publisherhensell.dev

Weekly Downloads

A Flutter widget that mimics Wrap layout behavior with lazy rendering using ListView.builder.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, very_good_analysis

More

Packages that depend on lazy_wrap