pub struct ExtendedFab { /* private fields */ }Expand description
An extended FAB: icon and visible label. expanded(false) collapses it
to a FAB of the same height, the label clipping away while the padding
and icon-label gap close on the default spatial spring (reduced motion
jumps). A label-only FAB (ExtendedFab::label_only) has nothing to
collapse to and stays extended.
Implementations§
Source§impl ExtendedFab
impl ExtendedFab
pub fn new( id: impl Into<ElementId>, icon: impl Into<Icon>, label: impl Into<SharedString>, ) -> Self
Sourcepub fn label_only(
id: impl Into<ElementId>,
label: impl Into<SharedString>,
) -> Self
pub fn label_only( id: impl Into<ElementId>, label: impl Into<SharedString>, ) -> Self
An extended FAB showing only its label.
pub fn expanded(self, expanded: bool) -> Self
Sourcepub fn icon_position(self, position: ButtonIconPosition) -> Self
pub fn icon_position(self, position: ButtonIconPosition) -> Self
The icon before (default) or after the label.
Sourcepub fn fluid(self, fluid: bool) -> Self
pub fn fluid(self, fluid: bool) -> Self
Fill the parent’s width (content centered) instead of fitting the content.
pub fn size(self, size: FabSize) -> Self
pub fn color(self, color: FabColor) -> Self
Sourcepub fn lowered(self, lowered: bool) -> Self
pub fn lowered(self, lowered: bool) -> Self
The lowered FAB: elevation level 1 (2 on hover) instead of 3 (4), for surfaces where the FAB should not float as high.
Sourcepub fn disabled(self, disabled: bool) -> Self
pub fn disabled(self, disabled: bool) -> Self
Disabled: on-surface at 10% container and 38% content, no elevation, no activation.
Sourcepub fn preview_state(self, state: InteractionPreview) -> Self
pub fn preview_state(self, state: InteractionPreview) -> Self
Render as a static specimen in one interaction state.
pub fn track_focus(self, focus: &FocusHandle) -> Self
pub fn on_click( self, callback: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self
Trait Implementations§
Source§impl IntoElement for ExtendedFab
impl IntoElement for ExtendedFab
Source§type Element = ViewElement<ExtendedFab>
type Element = ViewElement<ExtendedFab>
The specific type of element into which the implementing type is converted.
Useful for converting other types into elements automatically, like Strings
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Convert self into a type that implements [
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
Convert self into a dynamically-typed [
AnyElement].Auto Trait Implementations§
impl !RefUnwindSafe for ExtendedFab
impl !Send for ExtendedFab
impl !Sync for ExtendedFab
impl !UnwindSafe for ExtendedFab
impl Freeze for ExtendedFab
impl Unpin for ExtendedFab
impl UnsafeUnpin for ExtendedFab
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with an animation
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with a chain of animations
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
Renders this component or element at the value produced by a spring. Read more
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
With
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Like [
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.