pub struct AnyRenderBox { /* private fields */ }Expand description
Erased RenderBox.
Implementations§
Source§impl AnyRenderBox
impl AnyRenderBox
Sourcepub fn has_size(self, app: &App) -> bool
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.
pub fn as_object(self) -> AnyRenderObject
Sourcepub fn hit_test(
self,
app: &mut App,
result: &mut BoxHitTestResult<'_>,
position: Offset,
) -> bool
pub fn hit_test( self, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool
See RenderBox::hit_test.
Sourcepub fn handle_event(
self,
app: &mut App,
event: &PointerEvent,
entry: &BoxHitTestEntry,
)
pub fn handle_event( self, app: &mut App, event: &PointerEvent, entry: &BoxHitTestEntry, )
Sourcepub fn layout(
self,
app: &mut App,
constraints: BoxConstraints,
parent_uses_size: bool,
)
pub fn layout( self, app: &mut App, constraints: BoxConstraints, parent_uses_size: bool, )
Compute the layout for this box.
Sourcepub fn constraints(self, app: &App) -> BoxConstraints
pub fn constraints(self, app: &App) -> BoxConstraints
Sourcepub fn get_min_intrinsic_width(self, app: &mut App, height: f64) -> f64
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.
Sourcepub fn get_max_intrinsic_width(self, app: &mut App, height: f64) -> f64
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.
Sourcepub fn get_min_intrinsic_height(self, app: &mut App, width: f64) -> f64
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.
Sourcepub fn get_max_intrinsic_height(self, app: &mut App, width: f64) -> f64
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.
Sourcepub fn get_dry_layout(self, app: &mut App, constraints: BoxConstraints) -> Size
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.
Sourcepub fn get_dry_baseline(
self,
app: &mut App,
constraints: BoxConstraints,
baseline: TextBaseline,
) -> Option<f64>
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.
Sourcepub fn get_distance_to_baseline(
self,
app: &mut App,
baseline: TextBaseline,
only_real: bool,
) -> Option<f64>
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.
Sourcepub fn get_distance_to_actual_baseline(
self,
app: &mut App,
baseline: TextBaseline,
) -> Option<f64>
pub fn get_distance_to_actual_baseline( self, app: &mut App, baseline: TextBaseline, ) -> Option<f64>
Calls RenderBox::compute_distance_to_actual_baseline and caches the result.
This function must only be called from
get_distance_to_baseline and
RenderBox::compute_distance_to_actual_baseline.
Sourcepub fn box_parent_data(self, app: &App) -> &BoxParentData
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.
Sourcepub fn global_to_local(
self,
app: &App,
point: Offset,
ancestor: Option<AnyRenderObject>,
) -> Offset
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.
Sourcepub fn local_to_global(
self,
app: &App,
point: Offset,
ancestor: Option<AnyRenderObject>,
) -> Offset
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).
Sourcepub fn parent_data_of_mut<P: ParentData + 'static>(
self,
app: &mut App,
) -> &mut P
pub fn parent_data_of_mut<P: ParentData + 'static>( self, app: &mut App, ) -> &mut P
Sourcepub fn parent_data_is<P: ParentData + 'static>(self, app: &App) -> bool
pub fn parent_data_is<P: ParentData + 'static>(self, app: &App) -> bool
Trait Implementations§
Source§impl Clone for AnyRenderBox
impl Clone for AnyRenderBox
impl Copy for AnyRenderBox
Source§impl Debug for AnyRenderBox
impl Debug for AnyRenderBox
impl Eq for AnyRenderBox
Source§impl ErasedRenderObject for AnyRenderBox
impl ErasedRenderObject for AnyRenderBox
Source§fn as_object(self) -> AnyRenderObject
fn as_object(self) -> AnyRenderObject
RenderObject view of this handle.Source§fn from_object(object: AnyRenderObject) -> AnyRenderBox
fn from_object(object: AnyRenderObject) -> AnyRenderBox
Source§impl From<AnyRenderBox> for AnyRenderObject
impl From<AnyRenderBox> for AnyRenderObject
Source§fn from(box_: AnyRenderBox) -> AnyRenderObject
fn from(box_: AnyRenderBox) -> AnyRenderObject
Source§impl Hash for AnyRenderBox
impl Hash for AnyRenderBox
Auto Trait Implementations§
impl Freeze for AnyRenderBox
impl RefUnwindSafe for AnyRenderBox
impl Send for AnyRenderBox
impl Sync for AnyRenderBox
impl Unpin for AnyRenderBox
impl UnsafeUnpin for AnyRenderBox
impl UnwindSafe for AnyRenderBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.