Flutter : How to add scroll indicator in ListView
Is there any way to show the scroll indicator on the ListView
?
Here is my basic code:
ListView.builder(
itemCount: 50,
itemBuilder: (context, index) => ListTile(title: Text("Item= ${index + 1}"),),
)
Thanks to Günter Zöchbauer.
You can wrap your ListView
in Scrollbar
Scrollbar(
child: ListView.builder(
itemCount: 50,
itemBuilder: (context, index) => ListTile(title: Text("Item= ${index + 1}"),),),
)
I think better to use CupertinoScrollbar
instead of Scrollbar
. CupertinoScrollbar
is can touch and scroll to the bottom..
Ex:
CupertinoScrollbar(
child: ListView.builder(...),
Or
Scrollbar(
child: ListView.builder(...),
In this code: An example of how to show in ListView
child: Scrollbar(
child: ListView.builder(
padding: EdgeInsets.all(5),
itemCount: snapshot.data.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
return generateColum(snapshot.data[index], index);
}),
),
You can implement this designer scrollbar library :
draggable_scrollbar
alphabet scrolling
OR
You can wrap ListView in Scrollbar
widget
Scrollbar(
child: ListView.builder(...),
)