of static method
- BuildContext context
Returns the closest instance of this class's data value that encloses the given context. If there is no ancestor, it returns ThemeData.menuBarTheme.
Typical usage is as follows:
MenuBarThemeData theme = MenuBarTheme.of(context);
Implementation
static MenuBarThemeData of(BuildContext context) {
final MenuBarTheme? menuBarTheme = context.dependOnInheritedWidgetOfExactType<MenuBarTheme>();
return menuBarTheme?.data ?? Theme.of(context).menuBarTheme;
}