of static method
Returns the nearest TreeTheme.
Implementation
static TreeThemeData of(BuildContext context) {
final TreeTheme? treeTheme =
context.dependOnInheritedWidgetOfExactType<TreeTheme>();
TreeThemeData? treeThemeData = treeTheme?.data;
if (treeThemeData == null || !treeThemeData._isConcrete) {
final ThemeData themeData = Theme.of(context);
final TextTheme textTheme = themeData.textTheme;
final ColorScheme colorScheme = themeData.colorScheme;
treeThemeData ??= themeData.treeTheme;
final treeValue =
_TreeThemeData(textTheme: textTheme, colorScheme: colorScheme);
final TextStyle textStyle =
treeThemeData.textStyle ?? treeValue.textStyle;
final Color color = treeThemeData.color ?? treeValue.color;
final Color hoverColor = treeThemeData.hoverColor ?? treeValue.hoverColor;
final Color highlightColor =
treeThemeData.highlightColor ?? treeValue.highlightColor;
return treeThemeData.copyWith(
textStyle: textStyle,
color: color,
hoverColor: hoverColor,
highlightColor: highlightColor,
);
}
assert(treeThemeData._isConcrete);
return treeThemeData;
}