pub struct Avatar { /* private fields */ }Expand description
A circular or rounded Material avatar displaying initials, an icon, an image, or custom content.
Implementations§
Source§impl Avatar
impl Avatar
Sourcepub fn initials(text: impl Into<SharedString>) -> Avatar
pub fn initials(text: impl Into<SharedString>) -> Avatar
Displays trimmed, uppercased 1–2 character initials with typography scaled to the avatar size.
Sourcepub fn icon(icon: impl IntoElement) -> Avatar
pub fn icon(icon: impl IntoElement) -> Avatar
Displays a decorative icon sized proportionally to the avatar.
Sourcepub fn image(source: impl Into<ImageSource>) -> Avatar
pub fn image(source: impl Into<ImageSource>) -> Avatar
Displays an image cropped with ObjectFit::Cover and clipped to the avatar shape.
Sourcepub fn custom(content: impl IntoElement) -> Avatar
pub fn custom(content: impl IntoElement) -> Avatar
Displays arbitrary caller-supplied visual content clipped to the avatar shape.
Sourcepub fn fallback(self, fallback: impl IntoElement) -> Avatar
pub fn fallback(self, fallback: impl IntoElement) -> Avatar
Supplies fallback visual content for Avatar::image while loading or if loading fails.
Sourcepub fn size(self, size: AvatarSize) -> Avatar
pub fn size(self, size: AvatarSize) -> Avatar
Sets the avatar diameter preset or custom pixel size. Defaults to AvatarSize::Medium (40 px).
Sourcepub fn shape(self, shape: AvatarShape) -> Avatar
pub fn shape(self, shape: AvatarShape) -> Avatar
Sets the avatar shape. Defaults to AvatarShape::Circle.
Sourcepub fn color_role(self, container: ColorRole, content: ColorRole) -> Avatar
pub fn color_role(self, container: ColorRole, content: ColorRole) -> Avatar
Resolves container and content pigments from the window theme’s semantic color roles.
Sourcepub fn colors(self, colors: AvatarColors) -> Avatar
pub fn colors(self, colors: AvatarColors) -> Avatar
Overrides container, content, and border pigments directly.
Sourcepub fn border(self, width: Pixels) -> Avatar
pub fn border(self, width: Pixels) -> Avatar
Draws an inner border stroke around the avatar perimeter in logical pixels.
Sourcepub fn accessible_label(
self,
id: impl Into<ElementId>,
label: impl Into<SharedString>,
) -> Avatar
pub fn accessible_label( self, id: impl Into<ElementId>, label: impl Into<SharedString>, ) -> Avatar
Exposes the avatar as a named Role::Image for assistive technology without adding a focus stop.
Trait Implementations§
Source§impl IntoElement for Avatar
impl IntoElement for Avatar
Source§type Element = ViewElement<Avatar>
type Element = ViewElement<Avatar>
Source§fn into_element(self) -> <Avatar as IntoElement>::Element
fn into_element(self) -> <Avatar as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for Avatar
impl RenderOnce for Avatar
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for Avatar
impl !Send for Avatar
impl !Sync for Avatar
impl !UnwindSafe for Avatar
impl Forget for Avatar
impl Freeze for Avatar
impl Move for Avatar
impl Unpin for Avatar
impl UnsafeUnpin for Avatar
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§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,
Source§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,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§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,
Source§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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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> ⓘ
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> ⓘ
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.