v0.5.0scroll_pos
Provides some additional functions to ScrollController to define item position relative to the screen.
75Likes 194K30-day downloads160Pub points
AndroidiOSWebmacOSWindowsLinux
Provides some additional functions to ScrollController to define item position relative to the screen.
English project snapshot. Visit GitHub for the latest content.
Provides some additional functions to ScrollController to define item position relative to the screen.
A live version is available here.
Note: this works on condition that all items have the same height !
// Create a ScrollPosController (don't forget to set and update itemCount !)
final controller = ScrollPosController(itemCount: itemCount);
// Assign the controller to a scrollable item (like an ListView)
ListView(
controller: controller,
children: [
...
];
);
// Control the controller
TextButton(
child: Text('To item'),
onPressed: () {
setState(() {
controller.scrollToItem(index);
});
},
);
void scrollTop({bool? animate}) : Go to the first itemvoid scrollBottom({bool? animate}) : Go to the last itemvoid scrollToItem(int index, {bool? animate, bool center = false}) : Makes the item visible on the screenDependency list 3 items
{"sdk":"flutter"}{"sdk":"flutter"}^1.0.0Start with your use case, compare repository activity, and check the original project before adopting it.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗