Home > Enterprise >  change color of scroll bar indicator in SingleChildScrollView
change color of scroll bar indicator in SingleChildScrollView

Time:08-28

How can I change color of scroll bar indicator in SingleChildScrollView, the SingleChildScrollView doesn't have option color or something for style, if we can't change color of SingleChildScrollView do we have any alternative for that

CodePudding user response:

try this:

RawScrollbar(
    thumbColor: Colors.red,
    radius: Radius.circular(16),
    thickness: 7,
    child: SingleChildScrollView()
)

CodePudding user response:

You can provide ScrollbarThemeData:thumbColor by wrapping the SingleChildScrollView

 Theme(
  data: Theme.of(context).copyWith(
      scrollbarTheme: ScrollbarThemeData(
    thumbColor: MaterialStateProperty.all(Colors.red),
  )),
  child: SingleChildScrollView(

enter image description here

CodePudding user response:

You can use RawScrollbar instead and set the thumbColor to whatever color you like.

child: RawScrollbar(
                    thumbColor: Colors.redAccent,
                    radius: Radius.circular(20),
                    thickness: 5,
                    child: //scrollable widget
                   )
  • Related