getThemeAwareTextStyle method
Returns a TextStyle based on provided context
, if providedStyle
provided we try to merge it.
Implementation
TextStyle getThemeAwareTextStyle(
BuildContext context,
TextStyle? providedStyle,
) {
final defaultTextStyle = DefaultTextStyle.of(context);
var effectiveTextStyle = providedStyle;
if (providedStyle == null || providedStyle.inherit) {
effectiveTextStyle = defaultTextStyle.style.merge(providedStyle);
}
if (MediaQuery.boldTextOf(context)) {
effectiveTextStyle = effectiveTextStyle!
.merge(const TextStyle(fontWeight: FontWeight.bold));
}
return effectiveTextStyle!;
}