of static method
Returns the nearest HyperlinkTheme.
Implementation
static HyperlinkThemeData of(BuildContext context) {
final HyperlinkTheme? hyperlinkTheme =
context.dependOnInheritedWidgetOfExactType<HyperlinkTheme>();
HyperlinkThemeData? hyperlinkThemeData = hyperlinkTheme?.data;
if (hyperlinkThemeData == null || !hyperlinkThemeData._isConcrete) {
final ThemeData themeData = Theme.of(context);
final TextTheme textTheme = themeData.textTheme;
final ColorScheme colorScheme = themeData.colorScheme;
hyperlinkThemeData ??= themeData.hyperlinkTheme;
final hyperlinkValue =
_HyperlinkThemeData(textTheme: textTheme, colorScheme: colorScheme);
final Color color = hyperlinkThemeData.color ?? hyperlinkValue.color;
final Color hoverColor =
hyperlinkThemeData.hoverColor ?? hyperlinkValue.hoverColor;
final TextStyle textStyle =
hyperlinkThemeData.textStyle ?? hyperlinkValue.textStyle;
final Color highlightColor =
hyperlinkThemeData.highlightColor ?? hyperlinkValue.highlightColor;
return hyperlinkThemeData.copyWith(
color: color,
hoverColor: hoverColor,
textStyle: textStyle,
highlightColor: highlightColor,
);
}
assert(hyperlinkThemeData._isConcrete);
return hyperlinkThemeData;
}