Flutter – Scrollbar

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



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム