appBarTheme method Null safety

ThemeData appBarTheme(
  1. BuildContext context
)

The theme used to configure the search page.

The returned ThemeData will be used to wrap the entire search page, so it can be used to configure any of its components with the appropriate theme properties.

Unless overridden, the default theme will configure the AppBar containing the search input text field with a white background and black text on light themes. For dark themes the default is a dark grey background with light color text.

See also:

Implementation

ThemeData appBarTheme(BuildContext context) {
  assert(context != null);
  final ThemeData theme = Theme.of(context);
  final ColorScheme colorScheme = theme.colorScheme;
  assert(theme != null);
  return theme.copyWith(
    appBarTheme: AppBarTheme(
      brightness: colorScheme.brightness,
      backgroundColor: colorScheme.brightness == Brightness.dark ? Colors.grey[900] : Colors.white,
      iconTheme: theme.primaryIconTheme.copyWith(color: Colors.grey),
      textTheme: theme.textTheme,
    ),
    inputDecorationTheme: searchFieldDecorationTheme ??
        InputDecorationTheme(
          hintStyle: searchFieldStyle ?? theme.inputDecorationTheme.hintStyle,
          border: InputBorder.none,
        ),
  );
}