Skip to main content

EdgeInsets

Struct EdgeInsets 

Source
pub struct EdgeInsets {
    pub left: f64,
    pub top: f64,
    pub right: f64,
    pub bottom: f64,
}
Expand description

An immutable set of offsets in each of the four cardinal directions.

Typically used for an offset from each of the four sides of a box. For example, the padding inside a box can be represented using this class.

The EdgeInsets class specifies offsets in terms of visual edges, left, top, right, and bottom. These values are not affected by the TextDirection. To support both left-to-right and right-to-left layouts, consider using EdgeInsetsDirectional, which is expressed in terms of start, top, end, and bottom, where start and end are resolved in terms of a TextDirection (typically obtained from the ambient Directionality).

See also:

Fields§

§left: f64

The offset from the left.

§top: f64

The offset from the top.

§right: f64

The offset from the right.

§bottom: f64

The offset from the bottom.

Implementations§

Source§

impl EdgeInsets

Source

pub const ZERO: EdgeInsets

An EdgeInsets with zero offsets in each direction.

Source

pub const fn from_ltrb( left: f64, top: f64, right: f64, bottom: f64, ) -> EdgeInsets

Creates insets from offsets from the left, top, right, and bottom.

Source

pub const fn all(value: f64) -> EdgeInsets

Creates insets where all the offsets are value.

Source

pub const fn only(left: f64, top: f64, right: f64, bottom: f64) -> EdgeInsets

Creates insets with only the given values non-zero.

Source

pub const fn symmetric(vertical: f64, horizontal: f64) -> EdgeInsets

Creates insets with symmetrical vertical and horizontal offsets.

Source

pub const fn with_left(self, left: f64) -> EdgeInsets

The same insets with the left side left: one of Dart’s copyWith arguments, named, so a chain of them reads as Dart’s named arguments do.

Source

pub const fn with_top(self, top: f64) -> EdgeInsets

The same insets with the top side top: one of Dart’s copyWith arguments, named, so a chain of them reads as Dart’s named arguments do.

Source

pub const fn with_right(self, right: f64) -> EdgeInsets

The same insets with the right side right: one of Dart’s copyWith arguments, named, so a chain of them reads as Dart’s named arguments do.

Source

pub const fn with_bottom(self, bottom: f64) -> EdgeInsets

The same insets with the bottom side bottom: one of Dart’s copyWith arguments, named, so a chain of them reads as Dart’s named arguments do.

Source

pub const fn with_horizontal(self, horizontal: f64) -> EdgeInsets

The same insets with the left and right sides each horizontal, as Dart’s EdgeInsets.symmetric(horizontal:) sets them.

Source

pub const fn with_vertical(self, vertical: f64) -> EdgeInsets

The same insets with the top and bottom sides each vertical, as Dart’s EdgeInsets.symmetric(vertical:) sets them.

Source

pub fn horizontal(&self) -> f64

The total offset in the horizontal direction.

Source

pub fn vertical(&self) -> f64

The total offset in the vertical direction.

Source

pub fn is_non_negative(&self) -> bool

Whether every dimension is non-negative.

Source

pub fn top_left(&self) -> Offset

An Offset describing the vector from the top left of a rectangle to the top left of that rectangle inset by this object.

Source

pub fn top_right(&self) -> Offset

An Offset describing the vector from the top right of a rectangle to the top right of that rectangle inset by this object.

Source

pub fn bottom_left(&self) -> Offset

An Offset describing the vector from the bottom left of a rectangle to the bottom left of that rectangle inset by this object.

Source

pub fn bottom_right(&self) -> Offset

An Offset describing the vector from the bottom right of a rectangle to the bottom right of that rectangle inset by this object.

Source

pub fn flipped(&self) -> EdgeInsets

An EdgeInsets with top and bottom as well as left and right flipped.

Source

pub fn inflate_rect(&self, rect: Rect) -> Rect

Returns a new rect that is bigger than the given rect in each direction by the amount of inset in each direction. Specifically, the left edge of the rect is moved left by left, the top edge of the rect is moved up by top, the right edge of the rect is moved right by right, and the bottom edge of the rect is moved down by bottom.

See also:

Source

pub fn inflate_rrect(&self, rect: RRect) -> RRect

Returns a new RRect expanded by this EdgeInsets, increasing each corner’s radius by the corresponding per-axis inset amounts (clamped at zero).

Source

pub fn deflate_rrect(&self, rect: RRect) -> RRect

Returns a new RRect shrunk by this EdgeInsets, decreasing each corner’s radius by the corresponding per-axis inset amounts (clamped at zero).

Source

pub fn deflate_rect(&self, rect: Rect) -> Rect

Returns a new rect that is smaller than the given rect in each direction by the amount of inset in each direction. Specifically, the left edge of the rect is moved right by left, the top edge of the rect is moved down by top, the right edge of the rect is moved left by right, and the bottom edge of the rect is moved up by bottom.

If the argument’s Rect size is smaller than EdgeInsetsGeometry::collapsed_size, then the resulting rectangle will have negative dimensions.

See also:

Source

pub fn clamp( &self, min: &EdgeInsetsGeometry, max: &EdgeInsetsGeometry, ) -> EdgeInsets

Returns a new EdgeInsets object with all values greater than or equal to min, and less than or equal to max.

Source

pub fn truncating_div(&self, other: f64) -> EdgeInsets

Integer divides the EdgeInsets in each dimension by the given factor.

Source

pub fn lerp( a: Option<EdgeInsets>, b: Option<EdgeInsets>, t: f64, ) -> Option<EdgeInsets>

Linearly interpolate between two EdgeInsets.

If either is null, this function interpolates from EdgeInsets::ZERO.

Source

pub fn resolve(&self, _direction: Option<TextDirection>) -> EdgeInsets

Convert this instance into an EdgeInsets, which uses literal coordinates.

Source

pub fn copy_with( &self, left: Option<f64>, top: Option<f64>, right: Option<f64>, bottom: Option<f64>, ) -> EdgeInsets

Creates a copy of this EdgeInsets but with the given fields replaced with the new values.

Trait Implementations§

Source§

impl Add for EdgeInsets

Returns the sum of two EdgeInsets.

Source§

type Output = EdgeInsets

The resulting type after applying the + operator.
Source§

fn add(self, other: EdgeInsets) -> EdgeInsets

Performs the + operation. Read more
Source§

impl Animatable<EdgeInsets> for EdgeInsetsTween

Source§

fn transform(&self, _app: &App, t: f64) -> EdgeInsets

Returns the value of the object at point t. Read more
Source§

fn evaluate(&self, app: &App, animation: AnyAnimation<f64>) -> T
where Self: Sized,

The current value of this object for the given animation. Read more
Source§

fn animate( self, app: &mut App, parent: Retained<AnyAnimation<f64>>, ) -> Retained<AnyAnimation<T>>
where Self: Sized + Clone + 'static, T: 'static,

Returns a new animation that is driven by the given animation but that takes on values determined by this object. The new animation keeps parent; whoever keeps the result keeps both.
Source§

fn chain<P>(self, parent: P) -> ChainedEvaluation<P, Self>
where Self: Sized + Clone, P: Animatable<f64> + Clone,

Returns a new Animatable whose value is determined by first evaluating the given parent and then evaluating this object at the result.
Source§

impl Clone for EdgeInsets

Source§

fn clone(&self) -> EdgeInsets

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 EdgeInsets

Source§

impl Debug for EdgeInsets

Source§

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

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

impl Default for EdgeInsets

Source§

fn default() -> EdgeInsets

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

impl Display for EdgeInsets

Dart’s EdgeInsets.toString, which a dump prints.

Source§

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

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

impl Div<f64> for EdgeInsets

Divides the EdgeInsets in each dimension by the given factor.

Source§

type Output = EdgeInsets

The resulting type after applying the / operator.
Source§

fn div(self, other: f64) -> EdgeInsets

Performs the / operation. Read more
Source§

impl From<EdgeInsets> for EdgeInsetsGeometry

Source§

fn from(insets: EdgeInsets) -> EdgeInsetsGeometry

Converts to this type from the input type.
Source§

impl Mul<f64> for EdgeInsets

Scales the EdgeInsets in each dimension by the given factor.

Source§

type Output = EdgeInsets

The resulting type after applying the * operator.
Source§

fn mul(self, other: f64) -> EdgeInsets

Performs the * operation. Read more
Source§

impl Neg for EdgeInsets

Returns the EdgeInsets object with each dimension negated.

This is the same as multiplying the object by -1.0.

Source§

type Output = EdgeInsets

The resulting type after applying the - operator.
Source§

fn neg(self) -> EdgeInsets

Performs the unary - operation. Read more
Source§

impl PartialEq for EdgeInsets

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Rem<f64> for EdgeInsets

Computes the remainder in each dimension by the given factor.

Source§

type Output = EdgeInsets

The resulting type after applying the % operator.
Source§

fn rem(self, other: f64) -> EdgeInsets

Performs the % operation. Read more
Source§

impl StructuralPartialEq for EdgeInsets

Source§

impl Sub for EdgeInsets

Returns the difference between two EdgeInsets.

Source§

type Output = EdgeInsets

The resulting type after applying the - operator.
Source§

fn sub(self, other: EdgeInsets) -> EdgeInsets

Performs the - operation. Read more
Source§

impl TweenValue for EdgeInsets

Source§

fn same(&self, other: &EdgeInsets) -> bool

Dart’s == between a widget’s target value and a tween endpoint.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,