of static method
The closest instance of this class that encloses the given context.
If there is no enclosing SimpleShimmerTheme widget, then a default ShimmerThemeData based on Brightness is used.
A Brightness for the theme is inherited with Theme.of's ThemeData.brightness. The
property brightness
can be used to override the default theme returned by
of.
Typical usage is as follows:
ShimmerThemeData? theme = SimpleShimmerTheme.of(context);
Implementation
static ShimmerThemeData of(
BuildContext context, {
Brightness? brightness,
}) {
final widget =
context.dependOnInheritedWidgetOfExactType<SimpleShimmerTheme>();
if (widget != null) {
return widget.data;
}
final effectiveBrightness = brightness ?? Theme.of(context).brightness;
return effectiveBrightness == Brightness.light
? ShimmerThemeData.lightAlternate
: ShimmerThemeData.dark;
}