Skip to main content

SearchController

Struct SearchController 

Source
pub struct SearchController { /* private fields */ }
Expand description

A controller to manage a search view created by SearchAnchor.

A SearchController is used to control a menu after it has been created, with methods such as open_view and close_view. It can also be used to read the text the user has typed, and to set that text, as any other TextEditingControllerLeaf.

Implementations§

Source§

impl SearchController

Source

pub fn new(app: &mut App) -> Ref<SearchController>

Creates a controller for a SearchAnchor.

Source

pub fn is_attached(self: Handle<Self>, app: &App) -> bool

Whether this controller has been attached to a SearchAnchor.

Source

pub fn is_open(self: Handle<Self>, app: &App) -> bool

Whether this controller’s search view is open.

The controller must be attached to a SearchAnchor.

Source

pub fn open_view(self: Handle<Self>, app: &mut App)

Opens the search view.

The controller must be attached to a SearchAnchor.

Source

pub fn close_view( self: Handle<Self>, app: &mut App, selected_text: Option<String>, )

Close the search view that was opened by this controller.

If selected_text is given, it is the new text of the search controller, which a search view writes when the user selects a suggestion.

Trait Implementations§

Source§

impl ChangeNotifier for SearchController

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl Debug for SearchController

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl TextEditingControllerLeaf for SearchController

Source§

fn text_editing_controller_data( self: Handle<Self>, app: &App, ) -> &TextEditingControllerData

Dart’s TextEditingController fields, held under the field text_editing_controller (text_editing_controller_accessors!).
Source§

fn text_editing_controller_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut TextEditingControllerData

Source§

fn build_text_span( self: Handle<Self>, app: &App, context: AnyElement, style: Option<TextStyle>, with_composing: bool, ) -> TextSpan

Builds TextSpan from current editing value. Read more
Source§

fn text_value(self: Handle<Self>, app: &App) -> &str

Source§

fn set_text(self: Handle<Self>, app: &mut App, new_text: impl Into<String>)

Source§

fn value(self: Handle<Self>, app: &App) -> &TextEditingValue

Source§

fn set_value(self: Handle<Self>, app: &mut App, new_value: TextEditingValue)

Source§

fn selection(self: Handle<Self>, app: &App) -> TextSelection

Source§

fn set_selection( self: Handle<Self>, app: &mut App, new_selection: TextSelection, )

Source§

fn clear(self: Handle<Self>, app: &mut App)

Source§

fn clear_composing(self: Handle<Self>, app: &mut App)

Source§

fn as_controller(self: Handle<Self>) -> AnyTextEditingController

This controller as the erased AnyTextEditingController: what to pass where a Dart API takes a TextEditingController.

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> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
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>