pub struct EdgeInsets {
pub left: f64,
pub top: f64,
pub right: f64,
pub bottom: f64,
}Expand description
Per-edge inset amounts, in logical pixels.
The framework-core counterpart of frust-widgets’ layout EdgeInsets
(that one is a Padding container’s spacing; this one is the platform
occlusion model — a different layer, so it is not reused). Every value is a
non-negative logical-px distance from the corresponding window edge.
Fields§
§left: f64Inset from the left edge.
top: f64Inset from the top edge.
right: f64Inset from the right edge.
bottom: f64Inset from the bottom edge.
Implementations§
Source§impl EdgeInsets
impl EdgeInsets
Sourcepub const ZERO: EdgeInsets
pub const ZERO: EdgeInsets
The zero inset — no occlusion on any edge (the default, and the value a
WindowInsets carries until a shell pushes a real one).
Sourcepub fn new(left: f64, top: f64, right: f64, bottom: f64) -> Self
pub fn new(left: f64, top: f64, right: f64, bottom: f64) -> Self
Construct per-edge insets directly.
Sourcepub fn max(self, other: EdgeInsets) -> EdgeInsets
pub fn max(self, other: EdgeInsets) -> EdgeInsets
Per-edge maximum of self and other.
Mirrors Flutter’s engine-side merge of Type.systemBars() with the
display cutout (FlutterView.java:751-793): a shell that assembles its
view_padding from several platform inset sources combines them per edge
with this rather than summing.
Sourcepub fn saturating_sub(self, other: EdgeInsets) -> EdgeInsets
pub fn saturating_sub(self, other: EdgeInsets) -> EdgeInsets
Per-edge saturating subtraction: max(0.0, self.edge - other.edge) for
each edge, clamping a would-be-negative result to zero.
This is the building block of WindowInsets::padding (Flutter’s
padding = max(0.0, viewPadding - viewInsets),
media_query.dart:152-170): where the IME (view_insets) fully covers a
system-bar edge (view_padding), the derived safe-area padding for that
edge collapses to zero rather than going negative.