appBarTheme method
- 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:
- AppBarTheme, which configures the AppBar's appearance.
- InputDecorationTheme, which configures the appearance of the search text field.
Implementation
ThemeData appBarTheme(BuildContext context) {
final ThemeData theme = Theme.of(context);
final ColorScheme colorScheme = theme.colorScheme;
return theme.copyWith(
appBarTheme: AppBarTheme(
systemOverlayStyle: colorScheme.brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
backgroundColor: colorScheme.brightness == Brightness.dark ? Colors.grey[900] : Colors.white,
iconTheme: theme.primaryIconTheme.copyWith(color: Colors.grey),
titleTextStyle: theme.textTheme.titleLarge,
toolbarTextStyle: theme.textTheme.bodyMedium,
),
inputDecorationTheme: searchFieldDecorationTheme ??
InputDecorationTheme(
hintStyle: searchFieldStyle ?? theme.inputDecorationTheme.hintStyle,
border: InputBorder.none,
),
);
}