How to set Scrollbar colour in flutter? How to set Scrollbar colour in flutter? android android

How to set Scrollbar colour in flutter?


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                   )


Scroll bar uses the highlight color.. so just add ur desired scrollbar color in the highlightColor inside Theme in MaterialApp and you are done.

MaterialApp(      debugShowCheckedModeBanner: false,      theme: ThemeData(        //main color        primaryColor: const Color(0xffFFC600),        //main font        fontFamily: 'Roboto-Medium',        //swatch stretching        primarySwatch: goldenThemeColor,        visualDensity: VisualDensity.adaptivePlatformDensity,        splashColor:  const Color(0xffFFC600),        //color for scrollbar        highlightColor: Color(0xffffc600)      ),      routes: {        '/' : (context) => SplashScreen(),        ...      }      initialRoute: '/',    )


I changed it like this.

class MyApp extends StatelessWidget {  @override  Widget build(BuildContext context) {    return MaterialApp(      debugShowCheckedModeBanner: false,      theme: ThemeData.light().copyWith(        scrollbarTheme: ScrollbarThemeData().copyWith(          thumbColor: MaterialStateProperty.all(Colors.grey[500]),        )      ),    );  }}