RawScrollbar class Null safety

An extendable base class for building scrollbars that fade in and out.

To add a scrollbar to a ScrollView, like a ListView or a CustomScrollView, wrap the scroll view widget in a RawScrollbar widget.

A scrollbar thumb indicates which portion of a ScrollView is actually visible.

By default, the thumb will fade in and out as the child scroll view scrolls. When isAlwaysShown is true, the scrollbar thumb will remain visible without the fade animation. This requires that the ScrollController associated with the Scrollable widget is provided to controller, or that the PrimaryScrollController is being used by that Scrollable widget.

If the scrollbar is wrapped around multiple ScrollViews, it only responds to the nearest scrollView and shows the corresponding scrollbar thumb by default. The notificationPredicate allows the ability to customize which ScrollNotifications the Scrollbar should listen to.

Scrollbars are interactive and will also use the PrimaryScrollController if a controller is not set. Scrollbar thumbs can be dragged along the main axis of the ScrollView to change the ScrollPosition. Tapping along the track exclusive of the thumb will trigger a ScrollIncrementType.page based on the relative position to the thumb.

If the child ScrollView is infinitely long, the RawScrollbar will not be painted. In this case, the scrollbar cannot accurately represent the relative location of the visible area, or calculate the accurate delta to apply when dragging on the thumb or tapping on the track.

Scrollbars are added to most Scrollable widgets by default on Desktop platforms in ScrollBehavior.buildScrollbar as part of an app's ScrollConfiguration. Scrollable widgets that do not have automatically applied Scrollbars include

See also:

  • ListView, which displays a linear, scrollable list of children.
  • GridView, which displays a 2 dimensional, scrollable array of children.


RawScrollbar({Key? key, required Widget child, ScrollController? controller, bool? isAlwaysShown, Radius? radius, double? thickness, Color? thumbColor, Duration fadeDuration, Duration timeToFade, Duration pressDuration, ScrollNotificationPredicate notificationPredicate, bool? interactive})
Creates a basic raw scrollbar that wraps the given child. [...]


child Widget
The widget below this widget in the tree. [...]
controller ScrollController?
The ScrollController used to implement Scrollbar dragging. [...]
fadeDuration Duration
The Duration of the fade animation. [...]
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
interactive bool?
Whether the Scrollbar should be interactive and respond to dragging on the thumb, or tapping in the track area. [...]
isAlwaysShown bool?
Indicates that the scrollbar should be visible, even when a scroll is not underway. [...]
key Key?
Controls how one widget replaces another widget in the tree. [...]
final, inherited
notificationPredicate ScrollNotificationPredicate
A check that specifies whether a ScrollNotification should be handled by this widget. [...]
pressDuration Duration
The Duration of time that a LongPress will trigger the drag gesture of the scrollbar thumb. [...]
radius Radius?
The Radius of the scrollbar thumb's rounded rectangle corners. [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
thickness double?
The thickness of the scrollbar in the cross axis of the scrollable. [...]
thumbColor Color?
The color of the scrollbar thumb. [...]
timeToFade Duration
The Duration of time until the fade animation begins. [...]


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() RawScrollbarState<RawScrollbar>
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited