OnScrollBuilder constructor
OnScrollBuilder({
- Key? key,
- required InjectedScrolling listenTo,
- required Widget builder(),
Listen to an InjectedScrolling state.
The builder method is invoked when scrolling start, while scrolling and when scrolling ends.
OnScrollBuilder(
listenTo: scroll,
builder: (scroll) {
if (scroll.hasReachedMinExtent) {
return Text('isTop');
}
if (scroll.hasReachedMaxExtent) {
return Text('isBottom');
}
if (scroll.hasStartedScrollingReverse) {
return Text('hasStartedUp');
}
if (scroll.hasStartedScrollingForward) {
return Text('hasStartedDown');
}
if (scroll.hasStartedScrolling) {
return Text('hasStarted');
}
if (scroll.isScrollingReverse) {
return Text('isScrollingUp');
}
if (scroll.isScrollingForward) {
return Text('isScrollingDown');
}
if (scroll.isScrolling) {
return Text('isScrolling');
}
if (scroll.hasEndedScrolling) {
return Text('hasEnded');
}
return Text('NAN');
},
),
Implementation
OnScrollBuilder({
Key? key,
required this.listenTo,
required Widget Function(InjectedScrolling) builder,
}) : super(
key: key,
observers: (_) => [listenTo as ReactiveModelImp],
builder: (_, __, ___) => builder(listenTo));