of static method

SfThemeData of(
  1. BuildContext context
)

The data from the closest SfTheme instance that encloses the given context.

Defaults to SfThemeData.fallback if there is no SfTheme in the given build context.

Implementation

static SfThemeData of(BuildContext context) {
  final _SfInheritedTheme? inheritedTheme =
      context.dependOnInheritedWidgetOfExactType<_SfInheritedTheme>();
  return inheritedTheme?.data ??
      (Theme.of(context).colorScheme.brightness == Brightness.light
          ? SfThemeData.light()
          : SfThemeData.dark());
}