lazy_scroll_view 1.0.0+2 copy "lazy_scroll_view: ^1.0.0+2" to clipboard
lazy_scroll_view: ^1.0.0+2 copied to clipboard

A Flutter package that provides lazy-loading functionality for ListView and GridView

Lazy Scroll View #

A Flutter package that provides lazy-loading functionality for ListView and GridView widgets with built-in scroll detection and loading states.

Features #

  • 🔄 Automatic load-more detection
  • 📜 Supports both ListView and GridView
  • 🎯 Custom loading indicators

Usage #

LazyListView #

LazyListView.builder(
  itemCount: items.length,
  itemBuilder: (context, index) => ListTile(
    title: Text('Item ${items[index]}'),
  ),
  onLoad: () async {
    // Load more data here
    await fetchMoreItems();
  },
  isFinished: items.length >= totalItems,
);

LazyGridView #

LazyGridView.builder(
  itemCount: items.length,
  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
    crossAxisCount: 2,
    mainAxisSpacing: 8,
    crossAxisSpacing: 8,
  ),
  itemBuilder: (context, index) => Card(
    child: Center(child: Text('Item ${items[index]}')),
  ),
  onLoad: () async {
    // Load more data here
    await fetchMoreItems();
  },
  isFinished: items.length >= totalItems,
);

Properties #

Common Properties #

  • onLoad: Callback function triggered when more data should be loaded
  • isFinished: Boolean flag indicating if all data has been loaded
  • loadingIndicator: Custom widget to show while loading
  • controller: ScrollController for manual scroll control
  • scrollDirection: Axis of scrolling (vertical/horizontal)
  • reverse: Whether to reverse the scroll direction
  • physics: ScrollPhysics for customizing scroll behavior
  • padding: EdgeInsets for content padding

Additional Features #

Separated List

LazyListView.separated(
  itemCount: items.length,
  itemBuilder: (context, index) => ListTile(
    title: Text('Item ${items[index]}'),
  ),
  separatorBuilder: (context, index) => Divider(),
  onLoad: () async {
    await fetchMoreItems();
  },
);

Grid with Fixed Count

LazyGridView.count(
  crossAxisCount: 3,
  children: items.map((item) => ItemWidget(item)).toList(),
  onLoad: () async {
    await fetchMoreItems();
  },
);

Screenshots #

LazyListView Demo

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
160
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides lazy-loading functionality for ListView and GridView

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, rxdart

More

Packages that depend on lazy_scroll_view