Skip to main content

ViewStyle

Struct ViewStyle 

Source
pub struct ViewStyle {
Show 28 fields pub background_color: Color, pub border_radius: Points, pub corner_radius: Corners<Option<Points>>, pub continuous_corners: bool, pub borders: Borders, pub opacity: f32, pub overflow_hidden: bool, pub transform: Transform, pub tint_color: Option<Color>, pub accent_color: Option<Color>, pub elevation: Points, pub transform_origin: TransformOrigin, pub object_position: ObjectPosition, pub backface_hidden: bool, pub effects: Option<Arc<Effects>>, pub blend_mode: BlendMode, pub backdrop_material: BackdropMaterial, pub glass_effect: GlassEffect, pub glass_tint_color: Option<Color>, pub macos_backdrop: Option<MacOsBackdrop>, pub windows_backdrop: Option<WindowsBackdrop>, pub outline: Outline, pub hidden: bool, pub cursor: Cursor, pub transition: Option<Transition>, pub animation: Option<KeyframeAnimation>, pub shows_label: bool, pub label_arrow_only: bool,
}
Expand description

Visual (non-layout) properties of a native view.

Fields§

§background_color: Color

Background fill.

§border_radius: Points

borderRadius: the radius of corners without their own.

§corner_radius: Corners<Option<Points>>

borderTopLeftRadius etc.; they override border_radius.

§continuous_corners: bool

borderCurve: "continuous".

§borders: Borders

Borders (their widths also affect layout).

§opacity: f32

Opacity in 0.0..=1.0.

§overflow_hidden: bool

Clip children to the (rounded) bounds.

§transform: Transform

Static transform, around the view’s center.

§tint_color: Option<Color>

tintColor: recolors an image’s opaque pixels.

§accent_color: Option<Color>

accentColor: the color a system control shows its state in, which a native component gets as its accentColor prop (a system switch’s track when on, for example); the control’s own when None.

§elevation: Points

Android’s material shadow: the node’s android={{ elevation }} prop, not a style.

§transform_origin: TransformOrigin

transformOrigin: the point transforms act around.

§object_position: ObjectPosition

objectPosition: where an image sits in its box (image views; the platforms take it from crate::mount::ImageOptions::position).

§backface_hidden: bool

backfaceVisibility: "hidden": invisible when turned away.

§effects: Option<Arc<Effects>>

Layered / inset shadows, gradients and filters.

§blend_mode: BlendMode

mixBlendMode.

§backdrop_material: BackdropMaterial

The iOS material from ios={{ backdropMaterial }}, projected at mount time.

§glass_effect: GlassEffect

glassEffect.

§glass_tint_color: Option<Color>

glassTintColor: the tint of glassEffect’s native material.

§macos_backdrop: Option<MacOsBackdrop>

The macOS backdrop from macos={{ backdrop }}, projected at mount time.

§windows_backdrop: Option<WindowsBackdrop>

The Windows backdrop from windows={{ backdrop }}, projected at mount time.

§outline: Outline

outline*.

§hidden: bool

visibility: "hidden": not drawn and not touchable, still laid out.

§cursor: Cursor

cursor.

§transition: Option<Transition>

transition*: style changes animate.

§animation: Option<KeyframeAnimation>

animation*: a keyframe animation runs.

§shows_label: bool

In a terminal, the layout gave the view one row of its accessibility label in place of its content (an icon button whose icon a terminal leaves out): the platform draws the label there, and on no other view. Not a style: the core sets it at mount time, always false off a terminal.

§label_arrow_only: bool

In a terminal, the label the layout gave the view (Self::shows_label) is a popup trigger’s arrow alone (▾): the words it is flush against (a split button’s main action) say what it opens. Another popup trigger’s label is its name and the arrow. Not a style: the core sets it at mount time, always false off a terminal.

Implementations§

Source§

impl ViewStyle

Source

pub fn clip_path(&self) -> Option<&ClipInset>

clipPath: the shape everything the view draws is clipped to.

Source

pub fn radii(&self) -> CornerRadii

The radius of each corner (before fitting them to a size with CornerRadii::fit).

Trait Implementations§

Source§

impl Clone for ViewStyle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewStyle

Source§

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

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

impl Default for ViewStyle

Source§

fn default() -> Self

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

impl PartialEq for ViewStyle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ViewStyle

Auto Trait Implementations§

§

impl Forget for ViewStyle

§

impl Freeze for ViewStyle
where *const ArcInner<Effects> is !null: Freeze, PhantomData<ArcInner<Effects>>: Freeze,

§

impl Move for ViewStyle

§

impl RefUnwindSafe for ViewStyle

§

impl Send for ViewStyle
where Arc<Effects>: Send,

§

impl Sync for ViewStyle
where Arc<Effects>: Sync,

§

impl Unpin for ViewStyle
where Arc<Effects>: Unpin,

§

impl UnsafeUnpin for ViewStyle
where *const ArcInner<Effects> is !null: UnsafeUnpin, PhantomData<ArcInner<Effects>>: UnsafeUnpin,

§

impl UnwindSafe for ViewStyle

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.