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:
Padding, a widget that acceptsEdgeInsetsto describe its margins.EdgeInsetsDirectional, which (for properties and arguments that accept the typeEdgeInsetsGeometry) allows the horizontal insets to be specified in aTextDirection-aware manner.
Fields§
§left: f64The offset from the left.
top: f64The offset from the top.
right: f64The offset from the right.
bottom: f64The offset from the bottom.
Implementations§
Source§impl EdgeInsets
impl EdgeInsets
Sourcepub const ZERO: EdgeInsets
pub const ZERO: EdgeInsets
An EdgeInsets with zero offsets in each direction.
Sourcepub const fn from_ltrb(
left: f64,
top: f64,
right: f64,
bottom: f64,
) -> EdgeInsets
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.
Sourcepub const fn all(value: f64) -> EdgeInsets
pub const fn all(value: f64) -> EdgeInsets
Creates insets where all the offsets are value.
Sourcepub const fn only(left: f64, top: f64, right: f64, bottom: f64) -> EdgeInsets
pub const fn only(left: f64, top: f64, right: f64, bottom: f64) -> EdgeInsets
Creates insets with only the given values non-zero.
Sourcepub const fn symmetric(vertical: f64, horizontal: f64) -> EdgeInsets
pub const fn symmetric(vertical: f64, horizontal: f64) -> EdgeInsets
Creates insets with symmetrical vertical and horizontal offsets.
Sourcepub const fn with_left(self, left: f64) -> EdgeInsets
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.
Sourcepub const fn with_top(self, top: f64) -> EdgeInsets
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.
Sourcepub const fn with_right(self, right: f64) -> EdgeInsets
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.
Sourcepub const fn with_bottom(self, bottom: f64) -> EdgeInsets
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.
Sourcepub const fn with_horizontal(self, horizontal: f64) -> EdgeInsets
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.
Sourcepub const fn with_vertical(self, vertical: f64) -> EdgeInsets
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.
Sourcepub fn horizontal(&self) -> f64
pub fn horizontal(&self) -> f64
The total offset in the horizontal direction.
Sourcepub fn is_non_negative(&self) -> bool
pub fn is_non_negative(&self) -> bool
Whether every dimension is non-negative.
Sourcepub fn top_left(&self) -> Offset
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.
Sourcepub fn top_right(&self) -> Offset
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.
Sourcepub fn bottom_left(&self) -> Offset
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.
Sourcepub fn bottom_right(&self) -> Offset
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.
Sourcepub fn flipped(&self) -> EdgeInsets
pub fn flipped(&self) -> EdgeInsets
An EdgeInsets with top and bottom as well as left and right flipped.
Sourcepub fn inflate_rect(&self, rect: Rect) -> Rect
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:
EdgeInsetsGeometry::inflate_size, to inflate aSizerather than aRect.deflate_rect, to deflate aRectrather than inflating it.
Sourcepub fn inflate_rrect(&self, rect: RRect) -> RRect
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).
Sourcepub fn deflate_rrect(&self, rect: RRect) -> RRect
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).
Sourcepub fn deflate_rect(&self, rect: Rect) -> Rect
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:
EdgeInsetsGeometry::deflate_size, to deflate aSizerather than aRect.inflate_rect, to inflate aRectrather than deflating it.
Sourcepub fn clamp(
&self,
min: &EdgeInsetsGeometry,
max: &EdgeInsetsGeometry,
) -> EdgeInsets
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.
Sourcepub fn truncating_div(&self, other: f64) -> EdgeInsets
pub fn truncating_div(&self, other: f64) -> EdgeInsets
Integer divides the EdgeInsets in each dimension by the given
factor.
Sourcepub fn lerp(
a: Option<EdgeInsets>,
b: Option<EdgeInsets>,
t: f64,
) -> Option<EdgeInsets>
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.
Sourcepub fn resolve(&self, _direction: Option<TextDirection>) -> EdgeInsets
pub fn resolve(&self, _direction: Option<TextDirection>) -> EdgeInsets
Convert this instance into an EdgeInsets, which uses literal
coordinates.
Trait Implementations§
Source§impl Add for EdgeInsets
Returns the sum of two EdgeInsets.
impl Add for EdgeInsets
Returns the sum of two EdgeInsets.
Source§type Output = EdgeInsets
type Output = EdgeInsets
+ operator.Source§fn add(self, other: EdgeInsets) -> EdgeInsets
fn add(self, other: EdgeInsets) -> EdgeInsets
+ operation. Read moreSource§impl Animatable<EdgeInsets> for EdgeInsetsTween
impl Animatable<EdgeInsets> for EdgeInsetsTween
Source§fn transform(&self, _app: &App, t: f64) -> EdgeInsets
fn transform(&self, _app: &App, t: f64) -> EdgeInsets
t. Read moreSource§fn evaluate(&self, app: &App, animation: AnyAnimation<f64>) -> Twhere
Self: Sized,
fn evaluate(&self, app: &App, animation: AnyAnimation<f64>) -> Twhere
Self: Sized,
Source§fn animate(
self,
app: &mut App,
parent: Retained<AnyAnimation<f64>>,
) -> Retained<AnyAnimation<T>>
fn animate( self, app: &mut App, parent: Retained<AnyAnimation<f64>>, ) -> Retained<AnyAnimation<T>>
parent; whoever keeps the result keeps both.Source§fn chain<P>(self, parent: P) -> ChainedEvaluation<P, Self>
fn chain<P>(self, parent: P) -> ChainedEvaluation<P, Self>
Animatable whose value is determined by first
evaluating the given parent and then evaluating this object at the
result.Source§impl Clone for EdgeInsets
impl Clone for EdgeInsets
Source§fn clone(&self) -> EdgeInsets
fn clone(&self) -> EdgeInsets
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EdgeInsets
Source§impl Debug for EdgeInsets
impl Debug for EdgeInsets
Source§impl Default for EdgeInsets
impl Default for EdgeInsets
Source§fn default() -> EdgeInsets
fn default() -> EdgeInsets
Source§impl Display for EdgeInsets
Dart’s EdgeInsets.toString, which a dump prints.
impl Display for EdgeInsets
Dart’s EdgeInsets.toString, which a dump prints.
Source§impl Div<f64> for EdgeInsets
Divides the EdgeInsets in each dimension by the given factor.
impl Div<f64> for EdgeInsets
Divides the EdgeInsets in each dimension by the given factor.
Source§type Output = EdgeInsets
type Output = EdgeInsets
/ operator.Source§impl From<EdgeInsets> for EdgeInsetsGeometry
impl From<EdgeInsets> for EdgeInsetsGeometry
Source§fn from(insets: EdgeInsets) -> EdgeInsetsGeometry
fn from(insets: EdgeInsets) -> EdgeInsetsGeometry
Source§impl Mul<f64> for EdgeInsets
Scales the EdgeInsets in each dimension by the given factor.
impl Mul<f64> for EdgeInsets
Scales the EdgeInsets in each dimension by the given factor.
Source§type Output = EdgeInsets
type Output = EdgeInsets
* operator.Source§impl Neg for EdgeInsets
Returns the EdgeInsets object with each dimension negated.
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
type Output = EdgeInsets
- operator.Source§fn neg(self) -> EdgeInsets
fn neg(self) -> EdgeInsets
- operation. Read moreSource§impl PartialEq for EdgeInsets
impl PartialEq for EdgeInsets
Source§impl Rem<f64> for EdgeInsets
Computes the remainder in each dimension by the given factor.
impl Rem<f64> for EdgeInsets
Computes the remainder in each dimension by the given factor.
Source§type Output = EdgeInsets
type Output = EdgeInsets
% operator.impl StructuralPartialEq for EdgeInsets
Source§impl Sub for EdgeInsets
Returns the difference between two EdgeInsets.
impl Sub for EdgeInsets
Returns the difference between two EdgeInsets.
Source§type Output = EdgeInsets
type Output = EdgeInsets
- operator.Source§fn sub(self, other: EdgeInsets) -> EdgeInsets
fn sub(self, other: EdgeInsets) -> EdgeInsets
- operation. Read moreSource§impl TweenValue for EdgeInsets
impl TweenValue for EdgeInsets
Source§fn same(&self, other: &EdgeInsets) -> bool
fn same(&self, other: &EdgeInsets) -> bool
== between a widget’s target value and a tween endpoint.