CupertinoSliverNavigationBar.search constructor
- Key? key,
- required Widget searchField,
- Widget? largeTitle,
- Widget? leading,
- bool automaticallyImplyLeading = true,
- bool automaticallyImplyTitle = true,
- bool alwaysShowMiddle = true,
- String? previousPageTitle,
- Widget? middle,
- Widget? trailing,
- Border? border = _kDefaultNavBarBorder,
- Color? backgroundColor,
- bool automaticBackgroundVisibility = true,
- bool enableBackgroundFilterBlur = true,
- Brightness? brightness,
- EdgeInsetsDirectional? padding,
- bool transitionBetweenRoutes = true,
- Object heroTag = _defaultHeroTag,
- bool stretch = false,
- NavigationBarBottomMode? bottomMode = NavigationBarBottomMode.automatic,
- ValueChanged<
bool> ? onSearchableBottomTap,
A navigation bar for scrolling lists that integrates a provided search field directly into the navigation bar.
This search-enabled navigation bar is functionally equivalent to
the standard CupertinoSliverNavigationBar constructor, but with the
addition of searchField, which sits at the bottom of the navigation bar.
When the search field is tapped, leading, trailing, middle, and
largeTitle all collapse, causing the search field to animate to the
'top' of the navigation bar. A 'Cancel' button is presented next to the
active searchField, which when tapped, closes the search view, bringing
the navigation bar back to its initial state.
If automaticallyImplyTitle is false, then the largeTitle argument is
required.
To create a local project with this code sample, run:
flutter create --sample=cupertino.CupertinoSliverNavigationBar.CupertinoSliverNavigationBar.search.1 mysample
Implementation
const CupertinoSliverNavigationBar.search({
super.key,
required Widget this.searchField,
this.largeTitle,
this.leading,
this.automaticallyImplyLeading = true,
this.automaticallyImplyTitle = true,
this.alwaysShowMiddle = true,
this.previousPageTitle,
this.middle,
this.trailing,
this.border = _kDefaultNavBarBorder,
this.backgroundColor,
this.automaticBackgroundVisibility = true,
this.enableBackgroundFilterBlur = true,
this.brightness,
this.padding,
this.transitionBetweenRoutes = true,
this.heroTag = _defaultHeroTag,
this.stretch = false,
this.bottomMode = NavigationBarBottomMode.automatic,
this.onSearchableBottomTap,
}) : assert(
automaticallyImplyTitle || largeTitle != null,
'No largeTitle has been provided but automaticallyImplyTitle is also '
'false. Either provide a largeTitle or set automaticallyImplyTitle to '
'true.',
),
bottom = null,
_searchable = true;