Scrollbar Widget For Flutter Application

The Scrollbar widget is used for long lengths of content in application like a list of records. For case, when we work with ListView() Widget at that point list length may be long, as regularly we see only those records which according to the given Container height.

In Flutter, ListView not provide the in-build facility to show data with scroll. We can scroll data using other widgets.

Scrollbar Widget in Flutter for mobile application, web Application or Desktop Application
Scrollbar Widget in Flutter

Scrolling Widgets in Flutters

CustomScrollView

We can create custom for scroll effects on page using slivers.

A CustomScrollView lets you supply slivers directly to create various scrolling effects, for more details of CustomScrollView Click Here.

GridView Scroller

GrideView Scroller uses for scrollable for a 2D array of Widgets, normally it's used for showing images in grid view with scrolling or Container.

A grid list consists of a repeated pattern of cells arrayed in a vertical and horizontal layout. The GridView widget implements this component.

GridView.count(
primary: false,
padding: const EdgeInsets.all(20),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
crossAxisCount: 2,
children: <Widget>[
Container(
padding: const EdgeInsets.all(8),
child: const Text("He'd have you all unravel at the"),
color: Colors.teal[100],
),
Container(
padding: const EdgeInsets.all(8),
child: const Text('Heed not the rabble'),
color: Colors.teal[200],
),
],
)


ListView Scroller

When we have more data on the List then we need to show data on the list. We use ListView Widgets. It's a scrollable, linear list of widgets. It displays its children one after another in the scroll direction.

ListView is the most commonly used scrolling widget. It displays its children one after another in the scroll direction. In the cross axis, the children are required to fill the ListView.

NestedScrollView class

A Scrolling view inside of which can use other scrolling on widgets.  with their scroll positions being intrinsically linked.

The foremost common utilize case for this widget may be a scrollable see with a flexible SliverAppBar containing a TabBar within the header (built by headerSliverBuilder, and with a TabBarView within the body, such that the scrollable view's contents vary based on which tab is visible.

NotificationListener

Some Widgets dispatch notifications. For instance, scrollable widgets, like ListView dispatch ScrollNotifications. Notification bubble up the tree, visiting each ancestor widget unless they're handled somewhere along the way. You might need to handle notifications if you're using a widget that has a Scrollable in it, but it doesn't expose callbacks.

How can Listen to Notifications?

Take a Widget that dispatches notifications and wrap it with NotificationListener. It doesn't have to be the parent, just, and ancestor. Then specify the type of notification you want to handle using the generic type parameter. Finally, add the on notification callback.

Returning true means the notification has been handled and it will stop bubbling up the tree. You can also extend the Notification class to dispatch your own notifications.

PageView

We create screen multi pages in applications then we need to scroll page, It can be scroll vertical or horizontal. Check here for PageView Class with Example.

ScrollConfiguration

The scroll configuration determines the ScrollPhysics and viewport decorations used by descendants of child. for more details of ScrollConfiguration check here.

Scrollable

Scrollable implements the interaction model for a scrollable widget, including gesture recognition, but does not have an opinion about how the viewport, which actually displays the children, is constructed.

Scrollbar

Scrollbar is a widget for scroll pages,

A scrollbar indicates which portion of a Scrollable widget is actually visible.

Dynamically changes to an iOS-style scrollbar that looks like CupertinoScrollbar on the iOS platform. It's also we can use in Android applications

SingleChildScrollView

SingleChildScrollView is very useful widget for scroll screen, if we wrap a container, it's mean after container height may be long but now showing screen overflow, because screen will be scroll.

It's widget best for example a clock face in a time picker, but you need to make sure it can be scrolled if the container gets too small in one axis (the scroll direction).

It is also useful if you need to shrink-wrap in both axes (the main scrolling direction as well as the cross axis)

Previous
Next Post »