Skip to main content

SearchBarState

Struct SearchBarState 

Source
pub struct SearchBarState {
    pub query: Signal<String>,
    pub expanded: Signal<bool>,
    pub active: Signal<bool>,
    pub expands_to_full_screen: Signal<bool>,
    pub collapsed_layout_rect: Signal<(f32, f32, f32, f32)>,
    /* private fields */
}
Expand description

State for SearchBar -> manages expanded/collapsed progress, query text, active state, and collapsed layout coordinates for popup anchoring.

Fields§

§query: Signal<String>§expanded: Signal<bool>§active: Signal<bool>§expands_to_full_screen: Signal<bool>

Whether this search bar expands to full-screen (vs docked). Used by AppBarWithSearch to hide the collapsed bar when expanded.

§collapsed_layout_rect: Signal<(f32, f32, f32, f32)>

Tracked via on_globally_positioned on the collapsed bar. Used by expanded docked variants for popup placement.

Implementations§

Source§

impl SearchBarState

Source

pub fn new() -> Self

Source

pub fn query(&self) -> String

Source

pub fn set_query(&self, q: impl Into<String>)

Source

pub fn is_expanded(&self) -> bool

Source

pub fn expand(&self)

Source

pub fn collapse(&self)

Source

pub fn is_active(&self) -> bool

Source

pub fn activate(&self)

Source

pub fn deactivate(&self)

Source

pub fn progress(&self) -> f32

Container animation progress: 0.0 = collapsed, 1.0 = expanded. Ticks the underlying AnimatedValue and requests frames while animating.

Source

pub fn content_progress(&self) -> f32

Content fade progress -> fades ahead of container on collapse.

Source

pub fn is_animating(&self) -> bool

Whether the animation is currently running.

Source

pub fn current_value(&self) -> SearchBarValue

Whether the search bar is currently expanded (with tolerance for spring overshoot).

Source

pub fn snap_to(&self, fraction: f32)

Snap the container progress to a specific fraction (0.0 = collapsed, 1.0 = expanded).

Trait Implementations§

Source§

impl Default for SearchBarState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.