of static method

The data from the closest instance of this class that encloses the given context.

Typical usage is as follows:

SheetThemeData theme = SheetTheme.of(context);

Implementation

static SheetThemeData of(BuildContext context) {
  final parentTheme =
      context.dependOnInheritedWidgetOfExactType<SheetTheme>();
  if (parentTheme != null) return parentTheme.data;

  final globalTheme = Theme.of(context).extension<SheetThemeData>();
  final defaultTheme = SheetThemeData.defaults(context);
  return defaultTheme.merge(globalTheme);
}