pub struct ShowSearch { /* private fields */ }Expand description
Shows a full screen search page and returns the search result selected by the user when the page is closed.
The search page consists of an app bar with a search field and a body which can either show suggested search queries or the search results.
The appearance of the search page is determined by the provided delegate. The initial query
string is given by query; Dart’s default is the empty string, Some(""). When query is
None, delegate.query will be used as the initial query.
The use_root_navigator argument is used to determine whether to push the search page to the
Navigator furthest from or nearest to the given context. By default, use_root_navigator
is false and the search page route created by this method is pushed to the nearest
navigator to the given context. It can not be None.
The maintain_state argument is used to determine whether the route should remain in memory
when it is inactive. By default, maintain_state is false.
The delegate’s SearchDelegate::build_results method result is given back to the caller
through the future this function returns, when the page is closed with
SearchDelegate::close.
Implementations§
Source§impl ShowSearch
impl ShowSearch
Sourcepub fn new(delegate: Rc<dyn SearchDelegate>) -> ShowSearch
pub fn new(delegate: Rc<dyn SearchDelegate>) -> ShowSearch
Creates a builder for a full screen search page; Dart’s showSearch required argument is
the delegate, and every other argument is a setter.
Sourcepub fn query(self, query: Option<String>) -> ShowSearch
pub fn query(self, query: Option<String>) -> ShowSearch
The initial query; Dart’s Some(String::new()) by default, and None keeps the
delegate’s current query.
Whether to push the search page to the root navigator. Defaults to false.
Sourcepub fn maintain_state(self, maintain_state: bool) -> ShowSearch
pub fn maintain_state(self, maintain_state: bool) -> ShowSearch
Whether the route should remain in memory when it is inactive. Defaults to false.
Sourcepub fn show(
self,
app: &mut App,
context: BuildContext,
) -> CompleterFuture<RouteResult> ⓘ
pub fn show( self, app: &mut App, context: BuildContext, ) -> CompleterFuture<RouteResult> ⓘ
Shows the search page and returns the result selected by the user.