I have a normal ListView which is wrapped by the Scrollbar class to produce a scrollbar when scrolling down. But I want to change the Scrollbar color to white since I have a dark background.
After exploring the Scrollbar class I can see that it uses the theme highlightColor as shown inside scrollbar.dart.
_themeColor = theme.highlightColor.withOpacity(1.0);
Tried wrapping the Scrollbar in a Theme but still no luck.
Below is my code -
Theme(
data: ThemeData(
highlightColor: Colors.white, //Does not work
),
child: Scrollbar(
child: ListView(
//Normal ListView code
),
),
)
Any help is appreciated. Thanks in advance.
However, it is still possible to adjust the scrollbar colour in Windows 10, but you have to do the change via Registry: Open the Registry Editor. There you have to change the Scrollbar value to any colour you like. The defaults are: "200 200 200" and "212 208 200", respectively.
What you'll have to do is nest the vertical and horizontal SingleChildScrollView and wrap it with two ScrollBar then attach a ScrollController respectively and use the notificationPredicate property on the inner ScrollBar.
You can use RawScrollbar instead and set the thumbColor to whatever color u like.
child: RawScrollbar(
thumbColor: Colors.redAccent,
radius: Radius.circular(20),
thickness: 5,
child: //scrollable widget
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With