Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

lazy load a scrollview

a wrapper for a scrollview that will enable lazy loading.

usage

add lazy_load_scrollview dependency to your pubspec.yaml:

dependencies:
  lazy_load_scrollview: 1.2.0

in your dart code, import package:lazy_load_scrollview/lazy_load_scrollview.dart
then you can wrap your listview, gridview, refreshindicator etc with the lazyloadscrollview.
make sure you add an endofpagelistener which will receive the call when the bottom of the list has been reached.

import 'package:lazy_load_scrollview/lazy_load_scrollview.dart';


@override
widget build(buildcontext context) {
    return scaffold(
      appbar: appbar(
        title: text(widget.title),
      ),
      body: lazyloadscrollview(
        onendofpage: () => loadmore(),
        child: listview.builder(
          itemcount: data.length,
          itembuilder: (context, position) {
            return text("position $position");
          },
        ),
      ),
    );
}

class definition


lazyloadscrollview(
  endofpagelistener: () => loadmore(), // the callback when reaching the end of the list
  scrolloffset: 100 // pixels from the bottom that should trigger a callback 
  child: widget, // a subclass of `scrollview`
);


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.