SearchPage<T> class

This class helps to implement a search view, using SearchDelegate. It can show suggestion & unsuccessful-search widgets.

Inheritance

Constructors

SearchPage({Widget suggestion = const SizedBox(), Widget failure = const SizedBox(), required ResultBuilder<T> builder, required SearchFilter<T> filter, required List<T> items, bool showItemsOnEmpty = false, String? searchLabel, ThemeData? barTheme, bool itemStartsWith = false, bool itemEndsWith = false, ValueChanged<String>? onQueryUpdate, TextStyle? searchStyle, SortCallback<T>? sort})

Properties

automaticallyImplyLeading bool?
Controls whether we should try to imply the leading widget if null.
getter/setter pairinherited
barTheme ThemeData?
Theme that would be used in the AppBar widget, inside the search view.
final
builder ResultBuilder<T>
Method that builds a widget for each item that matches the current query parameter entered by the user.
final
failure Widget
Widget built when there's no item in items that matches current query.
final
filter SearchFilter<T>
Method that returns the specific parameters intrinsic to a T instance.
final
hashCode int
The hash code for this object.
no setterinherited
itemEndsWith bool
Provided queries only matches with the end of each string item's representation.
final
items List<T>
List of items where the search is going to take place on. They have T on run time.
final
itemStartsWith bool
Provided queries only matches with the begining of each string item's representation.
final
keyboardType TextInputType?
The type of action button to use for the keyboard.
finalinherited
leadingWidth double?
Defines the width of AppBar.leading widget.
getter/setter pairinherited
onQueryUpdate ValueChanged<String>?
Functions that gets called when the screen performs a search operation.
final
query String
The current query string shown in the AppBar.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchFieldDecorationTheme InputDecorationTheme?
The InputDecorationTheme used to configure the search field's visuals.
finalinherited
searchFieldLabel String?
The hint text that is shown in the search field when it is empty.
finalinherited
searchFieldStyle TextStyle?
The style of the searchFieldLabel.
finalinherited
searchLabel String?
This text will be shown in the AppBar when current query is empty.
final
searchStyle TextStyle?
The style of the searchFieldLabel text widget.
final
showItemsOnEmpty bool
Set this to true to display the complete list instead of the suggestion. This is useful to give your users the chance to explore all the items in the list without knowing what so search for.
final
sort SortCallback<T>?
final
suggestion Widget
Widget that is built when current query is empty. Suggests the user what's possible to do.
final
textInputAction TextInputAction
The text input action configuring the soft keyboard to a particular action button.
finalinherited
transitionAnimation Animation<double>
Animation triggered when the search pages fades in or out.
no setterinherited

Methods

appBarTheme(BuildContext context) ThemeData
The theme used to configure the search page.
override
buildActions(BuildContext context) List<Widget>
Widgets to display after the search query in the AppBar.
override
buildBottom(BuildContext context) PreferredSizeWidget?
Widget to display across the bottom of the AppBar.
inherited
buildFlexibleSpace(BuildContext context) Widget?
Widget to display a flexible space in the AppBar.
inherited
buildLeading(BuildContext context) Widget
A widget to display before the current query in the AppBar.
override
buildResults(BuildContext context) Widget
The results shown after the user submits a search from the search page.
override
buildSuggestions(BuildContext context) Widget
Suggestions shown in the body of the search page while the user types a query into the search field.
override
close(BuildContext context, T? result) → void
Closes the search page and returns to the underlying route.
inherited
dispose() → void
Releases the resources.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showResults(BuildContext context) → void
Transition from the suggestions returned by buildSuggestions to the query results returned by buildResults.
inherited
showSuggestions(BuildContext context) → void
Transition from showing the results returned by buildResults to showing the suggestions returned by buildSuggestions.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited