of static method

MenuButtonThemeData of(
  1. BuildContext context
)

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

If there is no enclosing MenuButtonTheme widget, then ThemeData.menuButtonTheme is used.

Typical usage is as follows:

MenuButtonThemeData theme = MenuButtonTheme.of(context);

Implementation

static MenuButtonThemeData of(BuildContext context) {
  final MenuButtonTheme? buttonTheme = context.dependOnInheritedWidgetOfExactType<MenuButtonTheme>();
  return buttonTheme?.data ?? Theme.of(context).menuButtonTheme;
}