I am using Flutter + Dart to make a mobile app. I have defined a CustomTheme class which looks like the following
class CustomTheme {
static ThemeData lightTheme = ThemeData(
primaryColor: Colors.red,
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: Colors.red,
secondary: Colors.green),
textTheme: lightTheme.textTheme.copyWith(
displayMedium:
lightTheme.textTheme.displayMedium!.copyWith(color: Colors.blue)),
useMaterial3: true,
fontFamily: GoogleFonts.merriweather().fontFamily);
}
I am trying to change the color of my displayMedium
but the color is not being applied. I am using it as follows:
Text("Hello", style: Theme.of(context).textTheme.displayMedium)
How can I get the color to apply?