of static method

TextButtonThemeData of(
  1. BuildContext context
)

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

If there is no enclosing TextButtonTheme widget, then ThemeData.textButtonTheme is used.

Typical usage is as follows:

TextButtonThemeData theme = TextButtonTheme.of(context);

Implementation

static TextButtonThemeData of(BuildContext context) {
  final TextButtonTheme? buttonTheme = context.dependOnInheritedWidgetOfExactType<TextButtonTheme>();
  return buttonTheme?.data ?? Theme.of(context).textButtonTheme;
}