Flutter – Scrollbar
- 2021年9月03日
- 技術情報

This week I would like to share about scrollbar widget and how to use it. Let’s go and start code!
By default scrollbar widget in flutter don’t show a scrollbar. But that’s fine in many cases but in others, you do want to display a scrollbar. Scrollbars show the users how far they’ve scrolled, and they allow things like jumping to a particular point in the list.
To show scrollbar use the widget called Scrollbar!
Make sure the scrollbar widget is finite. For example, it’s a ListView.builder, make sure itemCount is defined.
return MaterialApp(
home: Scaffold(
body: Center(
child: Scrollbar(
child: ListView.builder(
itemCount: 20,
itemBuilder: (context, index) {
return Card(
child : ListTile(
title: Text("Item: ${index + 1}"),
)
);
}
)
),
)
)
);
Hoped you enjoyed this article!
By Ami
asahi at 2021年09月03日 10:00:13