Skip to main content

AnyRenderBox

Struct AnyRenderBox 

Source
pub struct AnyRenderBox { /* private fields */ }
Expand description

Erased RenderBox.

Implementations§

Source§

impl AnyRenderBox

Source

pub fn has_size(self, app: &App) -> bool

The RenderObject view of this box. Free: points into the nested table. Whether this render object has undergone layout and has a size.

Source

pub fn as_object(self) -> AnyRenderObject

Source

pub fn hit_test( self, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Source

pub fn handle_event( self, app: &mut App, event: &PointerEvent, entry: &BoxHitTestEntry, )

Source

pub fn layout( self, app: &mut App, constraints: BoxConstraints, parent_uses_size: bool, )

Compute the layout for this box.

Source

pub fn size(self, app: &App) -> Size

The size of this box.

§Panics

If this box has not been laid out.

Source

pub fn set_size(self, app: &mut App, size: Size)

Sets the size of this box.

Source

pub fn constraints(self, app: &App) -> BoxConstraints

The box constraints most recently supplied by the parent.

§Panics

If layout has not yet happened.

Source

pub fn get_min_intrinsic_width(self, app: &mut App, height: f64) -> f64

Returns the minimum width that this box could be without failing to correctly paint its contents within itself, without clipping.

The height argument may give a specific height to assume. The given height can be infinite, meaning that the intrinsic width in an unconstrained environment is being requested. The given height should never be negative.

This function should only be called on one’s children. Calling this function couples the child with the parent so that when the child’s layout changes, the parent is notified (via RenderBox::mark_needs_layout).

Calling this function is expensive as it can result in O(N^2) behavior.

Do not override this method. Instead, implement RenderBox::compute_min_intrinsic_width.

Source

pub fn get_max_intrinsic_width(self, app: &mut App, height: f64) -> f64

Returns the smallest width beyond which increasing the width never decreases the preferred height. The preferred height is the value that would be returned by get_min_intrinsic_height for that width.

Do not override this method. Instead, implement RenderBox::compute_max_intrinsic_width.

Source

pub fn get_min_intrinsic_height(self, app: &mut App, width: f64) -> f64

Returns the minimum height that this box could be without failing to correctly paint its contents within itself, without clipping.

Do not override this method. Instead, implement RenderBox::compute_min_intrinsic_height.

Source

pub fn get_max_intrinsic_height(self, app: &mut App, width: f64) -> f64

Returns the smallest height beyond which increasing the height never decreases the preferred width. The preferred width is the value that would be returned by get_min_intrinsic_width for that height.

Do not override this method. Instead, implement RenderBox::compute_max_intrinsic_height.

Source

pub fn get_dry_layout(self, app: &mut App, constraints: BoxConstraints) -> Size

Returns the Size that this box would like to be given the provided BoxConstraints.

The size returned by this method is guaranteed to be the same size that this box computes for itself during layout given the same constraints.

This function should only be called on one’s children. Calling this function couples the child with the parent so that when the child’s layout changes, the parent is notified (via RenderBox::mark_needs_layout).

This layout is called “dry” layout as opposed to the regular “wet” layout run performed by RenderObject::perform_layout because it computes the desired size for the given constraints without changing any internal state.

Calling this function is expensive as it can result in O(N^2) behavior.

Do not override this method. Instead, implement RenderBox::compute_dry_layout.

Source

pub fn get_dry_baseline( self, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>

Returns the distance from the top of the box to the first baseline of the box’s contents for the given constraints, or None if this box does not have any baselines.

This method calls RenderBox::compute_dry_baseline under the hood and caches the result. Boxes typically don’t override get_dry_baseline. Instead, consider overriding RenderBox::compute_dry_baseline such that it returns a baseline location that is consistent with get_distance_to_actual_baseline.

This method is usually called by the RenderBox::compute_dry_baseline or the RenderBox::compute_dry_layout implementation of a parent box to get the baseline location of a box child. Unlike get_distance_to_baseline, this method takes a BoxConstraints as an argument and computes the baseline location as if the box was laid out by the parent using that BoxConstraints.

Source

pub fn get_distance_to_baseline( self, app: &mut App, baseline: TextBaseline, only_real: bool, ) -> Option<f64>

Returns the distance from the y-coordinate of the position of the box to the y-coordinate of the first given baseline in the box’s contents.

Used by certain layout models to align adjacent boxes on a common baseline, regardless of padding, font size differences, etc. If there is no baseline, this function returns the distance from the y-coordinate of the position of the box to the y-coordinate of the bottom of the box (i.e., the height of the box) unless the caller passes true for only_real, in which case the function returns None.

Only call this function after calling layout on this box. You are only allowed to call this from the parent of this box during that parent’s RenderObject::perform_layout or RenderObject::paint functions.

To override the baseline computation, override RenderBox::compute_distance_to_actual_baseline.

Source

pub fn get_distance_to_actual_baseline( self, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

Source

pub fn box_parent_data(self, app: &App) -> &BoxParentData

BoxParentData stored on this child by its box parent.

Dart’s child.parentData! as BoxParentData: a subclass answers with its own BoxParentData half through ParentData::provide.

Source

pub fn global_to_local( self, app: &App, point: Offset, ancestor: Option<AnyRenderObject>, ) -> Offset

Convert the given point from the global coordinate system in logical pixels to the local coordinate system for this box.

This method will un-project the point from the screen onto the widget, which makes it different from MatrixUtils.transformPoint.

If the transform from global coordinates to local coordinates is degenerate, this function returns Offset::ZERO.

If ancestor is non-null, this function converts the given point from the coordinate system of ancestor (which must be an ancestor of this render object) instead of from the global coordinate system.

This method is implemented in terms of AnyRenderObject::get_transform_to.

Source

pub fn local_to_global( self, app: &App, point: Offset, ancestor: Option<AnyRenderObject>, ) -> Offset

Convert the given point from the local coordinate system for this box to the global coordinate system in logical pixels.

If ancestor is non-null, this function converts the given point to the coordinate system of ancestor (which must be an ancestor of this render object) instead of to the global coordinate system.

This method is implemented in terms of AnyRenderObject::get_transform_to. If the transform matrix puts the given point on the line at infinity (for instance, when the transform matrix is the zero matrix), this method returns (NaN, NaN).

Source

pub fn parent_data_of_mut<P: ParentData + 'static>( self, app: &mut App, ) -> &mut P

Source

pub fn parent_data_is<P: ParentData + 'static>(self, app: &App) -> bool

Trait Implementations§

Source§

impl Clone for AnyRenderBox

Source§

fn clone(&self) -> Self

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 AnyRenderBox

Source§

impl Debug for AnyRenderBox

Source§

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

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

impl Eq for AnyRenderBox

Source§

impl ErasedRenderObject for AnyRenderBox

Source§

fn as_object(self) -> AnyRenderObject

The RenderObject view of this handle.
Source§

fn from_object(object: AnyRenderObject) -> AnyRenderBox

Dart’s implicit downcast of a RenderObject to ChildType. Read more
Source§

impl From<AnyRenderBox> for AnyRenderObject

Source§

fn from(box_: AnyRenderBox) -> AnyRenderObject

Converts to this type from the input type.
Source§

impl Hash for AnyRenderBox

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AnyRenderBox

Source§

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

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

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

Inequality operator !=. Read more

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, 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,