Flutter. Using Theme, how to change scroll offset color?
812
You need to use accentColor property
of ThemeData class
The foreground color for widgets (knobs, text, overscroll edge effect, etc).
SAMPLE CODE
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MyApp',
theme: ThemeData(
brightness: Brightness.light,
//Change your color here
accentColor: Colors.blue,
accentColorBrightness: Brightness.light,
),
home: MyHomePage(),
);
}
}
Author by
Jakub Padło
Updated on December 16, 2022Comments
-
Jakub Padło over 1 year
For beginning I am very sorry for my English. I am not a native speaker and additionally this is my first post in this language. I will be grateful for your understanding. Here is what I mean:
How to set scroll color other than this green in dark theme? I can't do this.
Below is my code:
theme: ThemeData( brightness: Brightness.dark, primaryColor: Colors.pink, backgroundColor: Colors.grey[900], textSelectionColor: Colors.pink, textSelectionHandleColor: Colors.pink[700], textTheme: TextTheme( body1: TextStyle(color: Colors.white), ), ),
Thank you in advance for your help :)