scrollable_positioned_list_extended

Creator: coderz1093

Last updated:

Add to Cart

Description:

scrollable positioned list extended

scrollable_positioned_list_extended #
A flutter list that allows scrolling to a specific item in the list.
Also allows determining what items are currently visible.
New ❇️ #
The package has recently got abilities of scroll_to_index. One can access AutoScrollController, but with certain
limitations.
Note #
This is an extension of scrollable_positioned_list, which exposes helper methods like scrollToMax extent, jumpToMax extent and also scrollListener to listen notifications which has not implemented in that yet.
Added Features #

scrollToMax For scrolling to maximum extent.
jumpToMax For jumping to maximum extent.
scrollToMin For scrolling to minimum extent.
jumpToMin For jumping to minimum extent.
scrollListener For listening ScrollNotifications like current offset ScrollPostition here.
Access AutoScrollController() with ItemScrollController.getAutoScrollController. This method must be called after ensuring ItemScrollController.isAttached == true.

AutoScrollController? _autoScrollController;
...
if ( itemScrollController.isAttached ){
_autoScrollController = itemScrollController.getAutoScrollController;
}
...
copied to clipboard
Usage #
A ScrollablePositionedList works much like the builder version of ListView
except that the list can be scrolled or jumped to a specific item.
Example #
A ScrollablePositionedList can be created with:
final ItemScrollController itemScrollController = ItemScrollController();
final ItemPositionsListener itemPositionsListener = ItemPositionsListener.create();

ScrollablePositionedList.builder(
itemCount: 500,
itemBuilder: (context, index) => Text('Item $index'),
itemScrollController: itemScrollController,
itemPositionsListener: itemPositionsListener,
);
copied to clipboard
One then can scroll to a particular item with:
itemScrollController.scrollTo(
index: 150,
duration: Duration(seconds: 2),
curve: Curves.easeInOutCubic);
copied to clipboard
or jump to a particular item with:
itemScrollController.jumpTo(index: 150);
copied to clipboard
One can monitor what items are visible on screen with:
itemPositionsListener.itemPositions.addListener(() => ...);
copied to clipboard
One can listen to scrollNotifications of primary ScrollController
itemScrollController.scrollListener(
(notification) {
debugPrint(notification.position.maxScrollExtent.toString());
/// do with notification
},
);
copied to clipboard
One can scroll to max
itemScrollController.scrollToMax(
duration: Duration(seconds: 2),
curve: Curves.easeInOutCubic);
copied to clipboard
or jump to maxExtent:
itemScrollController.jumpToMax();
copied to clipboard
One can scroll to min
itemScrollController.scrollToMin(
duration: Duration(seconds: 2),
curve: Curves.easeInOutCubic);
copied to clipboard
or jump to minExtent:
itemScrollController.jumpToMin();
copied to clipboard
limitations #


ItemScrollController.getAutoScrollController doesn't works with below methods.

highlight().
cancelAllHighlights().
jumpTo().




A full example can be found in the example folder.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.