isAlwaysShown property Null safety

bool? isAlwaysShown
final

Indicates that the scrollbar should be visible, even when a scroll is not underway.

When false, the scrollbar will be shown during scrolling and will fade out otherwise.

When true, the scrollbar will always be visible and never fade out. If the controller property has not been set, the PrimaryScrollController will be used.

Defaults to false when null.

final ScrollController _controllerOne = ScrollController();
final ScrollController _controllerTwo = ScrollController();

build(BuildContext context) {
return Column(
  children: <Widget>[
    SizedBox(
       height: 200,
       child: Scrollbar(
         isAlwaysShown: true,
         controller: _controllerOne,
         child: ListView.builder(
           controller: _controllerOne,
           itemCount: 120,
           itemBuilder: (BuildContext context, int index) {
             return  Text('item $index');
           },
         ),
       ),
     ),
     SizedBox(
       height: 200,
       child: CupertinoScrollbar(
         isAlwaysShown: true,
         controller: _controllerTwo,
         child: SingleChildScrollView(
           controller: _controllerTwo,
           child: SizedBox(
             height: 2000,
             width: 500,
             child: Placeholder(),
           ),
         ),
       ),
     ),
   ],
  );
}

Implementation

final bool? isAlwaysShown;