Cleanly overriding parts of a theme locally in Flutter. Data are immutable in Flutter. You cannot mutate them, you are forced to clone them with different properties.
1 2 3 4 5 6 7 8 | final ThemeData theme = Theme.of(context); theme.copyWith( textTheme: theme.textTheme.copyWith( subhead: theme.textTheme.subhead.copyWith( fontSize: 30.0, ), ), ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.