Reputation: 223
In my App, I am using ThemeData for text styling. Now I have the problem that I want some text elements to use special attributes than what is given trough the ThemeData. In my example I want a text element to have a different font size than the regular text element. What I currently have is following:
Text(
localText,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText2,
),
but instead of the regular font size given for this style, it should use:
fontSize: ResponsiveFlutter.of(context).fontSize(3)
How do I "combine" these two?
Upvotes: 0
Views: 76
Reputation: 2862
You can use .copyWith()
, example:
Text(
localText,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: ResponsiveFlutter.of(context).fontSize(3)
),
),
Upvotes: 2