Skip to main content

BorderRadiusDirectional

Struct BorderRadiusDirectional 

Source
pub struct BorderRadiusDirectional {
    pub top_start: f32,
    pub top_end: f32,
    pub bottom_end: f32,
    pub bottom_start: f32,
}
Expand description

What a decoration is made of — its shape, its sides, its border’s two forms, its shadows’ blur — and the shapes a border can take. A corner radius named by the reading direction rather than by the wall (border_radius.dart:621).

A BorderRadius says top left. This says top start — the corner where the text begins, which is the left one in English and the right one in Arabic. resolve turns one into the other once the direction is known.

The distinction is not decorative. A drawer rounds its inner edge, the one facing the page: for a leading drawer that is the end side in either direction, and a radius written as right is correct in English and wrong in Arabic. Every asymmetric radius in an interface that mirrors has this question, and answering it by hand at each site is how one of them ends up answered differently.

The reference has one type hierarchy for this (BorderRadiusGeometry, with a resolved and an unresolved subclass); this is two plain types and a resolve, because a widget here is handed a &Theme and so always has a direction available when it needs one.

Fields§

§top_start: f32

The corner at the top of the line’s beginning.

§top_end: f32

The corner at the top of the line’s end.

§bottom_end: f32

The corner at the bottom of the line’s end.

§bottom_start: f32

The corner at the bottom of the line’s beginning.

Implementations§

Source§

impl BorderRadiusDirectional

Source

pub const ZERO: BorderRadiusDirectional

No rounding at all.

Source

pub const fn uniform(radius: f32) -> BorderRadiusDirectional

The same radius on all four corners — which needs no direction, and is here so a caller can write one without changing type halfway through an expression.

Source

pub const fn start(radius: f32) -> BorderRadiusDirectional

The two corners at the line’s beginning — the left pair in English, the right pair in Arabic.

Source

pub const fn end(radius: f32) -> BorderRadiusDirectional

The two corners at the line’s end.

Source

pub const fn horizontal(start: f32, end: f32) -> BorderRadiusDirectional

Both sides at once, each with its own radius — the reference’s BorderRadiusDirectional.horizontal.

Source

pub const fn vertical(top: f32, bottom: f32) -> BorderRadiusDirectional

The top pair and the bottom pair. Neither depends on the direction, so this is the same as BorderRadius’s — and is here for the same reason as uniform.

Source

pub const fn resolve(self, direction: TextDirection) -> BorderRadius

The concrete radius, once the direction is known: start becomes left where the text runs left to right, and right where it does not.

Trait Implementations§

Source§

impl Clone for BorderRadiusDirectional

Source§

fn clone(&self) -> BorderRadiusDirectional

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 Copy for BorderRadiusDirectional

Source§

impl Debug for BorderRadiusDirectional

Source§

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

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

impl Default for BorderRadiusDirectional

Source§

fn default() -> BorderRadiusDirectional

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

impl From<f32> for BorderRadiusDirectional

Source§

fn from(radius: f32) -> BorderRadiusDirectional

Converts to this type from the input type.
Source§

impl PartialEq for BorderRadiusDirectional

Source§

fn eq(&self, other: &BorderRadiusDirectional) -> 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 BorderRadiusDirectional

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> 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<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

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.