pub struct AnyBoxConstraints { /* private fields */ }Expand description
A BoxConstraints that may be an instance of a BoxConstraints subclass.
Rendering stores this where Flutter stores constraints that a later reader type-checks: a
box’s constraints from its last AnyRenderBox::layout, read back with
any_constraints, and what a LayoutBuilder hands its
builder. The plain value is the one the subclass passed to super, reached by
constraints or by deref, so every BoxConstraints method is
available and returns a plain BoxConstraints, as an inherited method does in Dart. The
subclass is recovered with extension, Dart’s is check.
Equality follows Dart’s: two plain constraints compare by value, two extended ones by value
and by the subclass’s ==, and a plain value never equals an extended one. So
AnyRenderBox::layout’s early return lays out again when only the extension changed.
A box’s constraints is the plain value: a render object that
hands its own constraints on to its child passes the value without the extension.
Implementations§
Source§impl AnyBoxConstraints
impl AnyBoxConstraints
Sourcepub const fn new(constraints: BoxConstraints) -> AnyBoxConstraints
pub const fn new(constraints: BoxConstraints) -> AnyBoxConstraints
Plain constraints.
A subclass instance: constraints is what it passed to super.
Sourcepub fn constraints(&self) -> BoxConstraints
pub fn constraints(&self) -> BoxConstraints
The constraints as a layout reads them: the subclass’s super value.
Sourcepub fn extension<T>(&self) -> Option<&T>where
T: BoxConstraintsExtension,
pub fn extension<T>(&self) -> Option<&T>where
T: BoxConstraintsExtension,
Dart’s constraints is T: the subclass instance, if these constraints are one.
Sourcepub fn has_extension(&self) -> bool
pub fn has_extension(&self) -> bool
Whether these constraints are a subclass instance.
Trait Implementations§
Source§impl Clone for AnyBoxConstraints
impl Clone for AnyBoxConstraints
Source§fn clone(&self) -> AnyBoxConstraints
fn clone(&self) -> AnyBoxConstraints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnyBoxConstraints
A subclass prints as its BoxConstraints: neither scaffold subclass overrides toString.
impl Debug for AnyBoxConstraints
A subclass prints as its BoxConstraints: neither scaffold subclass overrides toString.