I want to extract the TextTheme customization in it's own class so I have a single point where I configure the text.
In this class I have tried the following with the same result:
var lightTextTheme =Typography().black.copyWith();
var darkTextTheme = Typography().white.copyWith();
OR
var lightTextTheme = TextTheme().copyWith();
var darkTextTheme = TextTheme().copyWith();
My ThemeData is configured as follows:
ThemeData lightMaterial3 = ThemeData(
brightness: Brightness.light,
useMaterial3: true,
inputDecorationTheme: inputDecorationTheme,
primaryTextTheme: lightTextTheme,
textTheme: lightTextTheme,
);
ThemeData darkMaterial3 = ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
inputDecorationTheme: inputDecorationTheme,
primaryTextTheme: darkTextTheme,
textTheme: darkTextTheme,
);
And I use the TextStyles as follows:
TextStyle labelSmall = Theme.of(Get.context!).textTheme.labelSmall!;
TextStyle labelMedium = Theme.of(Get.context!).textTheme.labelMedium!;
TextStyle labelLarge = Theme.of(Get.context!).textTheme.labelLarge!;
When changing the Theme, the TextTheme doesn't get updated, therefore, when I switch from dar to light, the text remains white.