Flutter_say_what
Flutter_say_what

Reputation: 93

How to remove Scrollbar from a widgets scrolling children

I have a ScrollBar surrounding a CupertinoPageScaffold child Widget.

Inside this contains a few horizontal scrolling ListViews which should not show scrollbars but due the parent ScrollBar being present, every scrolling widget below has a scroll bar attached to it.

Is there a Widget to wrap scrolling Widgets that removes the scrollbar?

I've looked for Widgets that may be called NoScrollbar but these don't exist.

If I remove the parent ScrollBar then the scrollbars are removed

Upvotes: 2

Views: 2143

Answers (2)

Gowthamaan
Gowthamaan

Reputation: 55

You can use ScrollConfiguration to hide the scrollbars.

    ScrollConfiguration(
            behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
            child: ListView(....)
       )

You can use this with any scrollable widget.

Upvotes: 1

Tom Robinson
Tom Robinson

Reputation: 591

If you wrap the ListViews for which you don't want scroll bars for in a NotificationListener in the following manner:

NotificationListener<ScrollNotification>(
                onNotification: (_) => true,
                child: ListView(....)
           )

I think those ListViews will not have scrollbars.

Upvotes: 1

Related Questions