e Res
e Res

Reputation: 155

change color of scroll bar indicator in SingleChildScrollView

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

Upvotes: 3

Views: 4465

Answers (2)

eamirho3ein
eamirho3ein

Reputation: 17880

Try this:

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

Upvotes: 6

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63559

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

Upvotes: 5

Related Questions