Skip to main content

ShowSearch

Struct ShowSearch 

Source
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

Source

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.

Source

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.

Source

pub fn use_root_navigator(self, use_root_navigator: bool) -> ShowSearch

Whether to push the search page to the root navigator. Defaults to false.

Source

pub fn maintain_state(self, maintain_state: bool) -> ShowSearch

Whether the route should remain in memory when it is inactive. Defaults to false.

Source

pub fn show( self, app: &mut App, context: BuildContext, ) -> CompleterFuture<RouteResult> ⓘ

Shows the search page and returns the result selected by the user.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>