For a Text like:
Text(
'Hello World',
style: Theme.of(context).textTheme.display1,
)
Is there a way to merge textTheme with a TextStyle? Like say, to modify the color of the text..
We do something like
Theme.of(context)
.textTheme.display1
.merge(TextStyle(color: Colors.red)
and apply it to the style
Merge method causes error in Flutter 2.2 because of the null safety feature. Don't forget to add "?" after the variable.
Theme.of(context).textTheme.display1?.merge(TextStyle(color: Colors.red)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.