pub struct RenderIntrinsicWidth { /* private fields */ }Expand description
Sizes its child to the child’s maximum intrinsic width.
This class is useful, for example, when unlimited width is available and you would like a child that would otherwise attempt to expand infinitely to instead size itself to a more reasonable width.
The constraints that this object passes to its child will adhere to the parent’s constraints, so if the constraints are not large enough to satisfy the child’s maximum intrinsic width, then the child will get less width than it otherwise would. Likewise, if the minimum width constraint is larger than the child’s maximum intrinsic width, the child will be given more width than it otherwise would.
If step_width is non-null, the child’s width will be snapped to a
multiple of it. Similarly, if step_height is non-null, the child’s
height will be snapped to a multiple of it.
This class is relatively expensive, because it adds a speculative layout pass before the final layout phase. Avoid using it where possible. In the worst case, this render object can result in a layout that is O(N²) in the depth of the tree.
Implementations§
Source§impl RenderIntrinsicWidth
impl RenderIntrinsicWidth
Sourcepub fn new(
app: &mut App,
step_width: Option<f64>,
step_height: Option<f64>,
child: Option<AnyRenderBox>,
) -> RenderHandle<RenderIntrinsicWidth>
pub fn new( app: &mut App, step_width: Option<f64>, step_height: Option<f64>, child: Option<AnyRenderBox>, ) -> RenderHandle<RenderIntrinsicWidth>
Creates a render object that sizes itself to its child’s intrinsic width.
If step_width is given it must be > 0.0. Similarly if step_height is given it must be
0.0.
Sourcepub fn step_width(self: RenderHandle<Self>, app: &App) -> Option<f64>
pub fn step_width(self: RenderHandle<Self>, app: &App) -> Option<f64>
If non-null, force the child’s width to be a multiple of this value.
Sourcepub fn set_step_width(
self: RenderHandle<Self>,
app: &mut App,
value: Option<f64>,
)
pub fn set_step_width( self: RenderHandle<Self>, app: &mut App, value: Option<f64>, )
Sets step_width.
Sourcepub fn step_height(self: RenderHandle<Self>, app: &App) -> Option<f64>
pub fn step_height(self: RenderHandle<Self>, app: &App) -> Option<f64>
If non-null, force the child’s height to be a multiple of this value.
Sourcepub fn set_step_height(
self: RenderHandle<Self>,
app: &mut App,
value: Option<f64>,
)
pub fn set_step_height( self: RenderHandle<Self>, app: &mut App, value: Option<f64>, )
Sets step_height.
Trait Implementations§
Source§impl RenderBox for RenderIntrinsicWidth
impl RenderBox for RenderIntrinsicWidth
Source§fn render_box_data(self: RenderHandle<Self>, app: &App) -> &RenderBoxData
fn render_box_data(self: RenderHandle<Self>, app: &App) -> &RenderBoxData
Source§fn render_box_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderBoxData
fn render_box_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderBoxData
render_box_data.Source§fn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
)
fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )
BoxParentData unless the child already has it. Read moreSource§fn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
)
fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )
Source§fn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut BoxHitTestResult<'_>,
position: Offset,
) -> bool
fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool
Source§fn compute_min_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn compute_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
get_min_intrinsic_width.
Do not call this function directly, instead, call
get_min_intrinsic_width. Read moreSource§fn compute_max_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn compute_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
get_max_intrinsic_width.
Do not call this function directly, instead, call
get_max_intrinsic_width. Read moreSource§fn compute_min_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn compute_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
get_min_intrinsic_height. Do not call this function
directly, instead, call get_min_intrinsic_height. Read moreSource§fn compute_max_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn compute_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
get_max_intrinsic_height. Do not call this function
directly, instead, call get_max_intrinsic_height. Read moreSource§fn compute_distance_to_actual_baseline(
self: RenderHandle<Self>,
app: &mut App,
baseline: TextBaseline,
) -> Option<f64>
fn compute_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>
None otherwise. Read moreSource§fn compute_dry_layout(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
) -> Size
fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size
get_dry_layout. Do not call this
function directly, instead, call get_dry_layout. Read moreSource§fn compute_dry_baseline(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
baseline: TextBaseline,
) -> Option<f64>
fn compute_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>
get_dry_baseline. Read moreSource§fn constraints(self: RenderHandle<Self>, app: &App) -> BoxConstraints
fn constraints(self: RenderHandle<Self>, app: &App) -> BoxConstraints
Source§fn get_min_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn get_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
Source§fn get_max_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn get_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
Source§fn get_min_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn get_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
Source§fn get_max_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn get_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
Source§fn get_dry_layout(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
) -> Size
fn get_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size
Source§fn get_dry_baseline(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
baseline: TextBaseline,
) -> Option<f64>
fn get_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>
Source§fn debug_cannot_compute_dry_layout(
self: RenderHandle<Self>,
failure: DryLayoutFailure<'_>,
)
fn debug_cannot_compute_dry_layout( self: RenderHandle<Self>, failure: DryLayoutFailure<'_>, )
compute_dry_layout or
compute_dry_baseline if this box does not support
calculating a dry layout. Read moreSource§fn get_distance_to_baseline(
self: RenderHandle<Self>,
app: &mut App,
baseline: TextBaseline,
only_real: bool,
) -> Option<f64>
fn get_distance_to_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, only_real: bool, ) -> Option<f64>
Source§fn get_distance_to_actual_baseline(
self: RenderHandle<Self>,
app: &mut App,
baseline: TextBaseline,
) -> Option<f64>
fn get_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>
Source§fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
Source§fn perform_resize(self: RenderHandle<Self>, app: &mut App)
fn perform_resize(self: RenderHandle<Self>, app: &mut App)
Source§fn paint_bounds(self: RenderHandle<Self>, app: &App) -> Rect
fn paint_bounds(self: RenderHandle<Self>, app: &App) -> Rect
Source§fn has_size(self: RenderHandle<Self>, app: &App) -> bool
fn has_size(self: RenderHandle<Self>, app: &App) -> bool
size.Source§fn handle_event(
self: RenderHandle<Self>,
app: &mut App,
event: &PointerEvent,
entry: &BoxHitTestEntry,
)
fn handle_event( self: RenderHandle<Self>, app: &mut App, event: &PointerEvent, entry: &BoxHitTestEntry, )
Source§fn hit_test(
self: RenderHandle<Self>,
app: &mut App,
result: &mut BoxHitTestResult<'_>,
position: Offset,
) -> bool
fn hit_test( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool
Source§fn hit_test_self(
self: RenderHandle<Self>,
_app: &App,
_position: Offset,
) -> bool
fn hit_test_self( self: RenderHandle<Self>, _app: &App, _position: Offset, ) -> bool
Source§fn set_size(self: RenderHandle<Self>, app: &mut App, size: Size)
fn set_size(self: RenderHandle<Self>, app: &mut App, size: Size)
RenderObject::perform_layout or
RenderObject::perform_resize.Source§fn layout(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
parent_uses_size: bool,
)
fn layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, parent_uses_size: bool, )
AnyRenderBox::layout.Source§fn as_box(self: RenderHandle<Self>) -> AnyRenderBox
fn as_box(self: RenderHandle<Self>) -> AnyRenderBox
RenderBox handle. Free: the vtable is a const, and the id is copied.Source§fn as_object(self: RenderHandle<Self>) -> AnyRenderObject
fn as_object(self: RenderHandle<Self>) -> AnyRenderObject
RenderObject handle, through as_box.Source§fn adopt_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)
fn adopt_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)
Source§fn drop_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)
fn drop_child(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject)
Source§fn mark_needs_paint(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_paint(self: RenderHandle<Self>, app: &mut App)
Source§fn mark_needs_composited_layer_update(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_composited_layer_update(self: RenderHandle<Self>, app: &mut App)
Source§fn mark_needs_compositing_bits_update(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_compositing_bits_update(self: RenderHandle<Self>, app: &mut App)
Source§fn schedule_initial_layout(self: RenderHandle<Self>, app: &mut App)
fn schedule_initial_layout(self: RenderHandle<Self>, app: &mut App)
Source§fn parent(self: RenderHandle<Self>, app: &App) -> Option<AnyRenderObject>
fn parent(self: RenderHandle<Self>, app: &App) -> Option<AnyRenderObject>
Source§fn owner(self: RenderHandle<Self>, app: &App) -> Option<Handle<PipelineOwner>>
fn owner(self: RenderHandle<Self>, app: &App) -> Option<Handle<PipelineOwner>>
Source§fn debug_needs_layout(self: RenderHandle<Self>, app: &App) -> bool
fn debug_needs_layout(self: RenderHandle<Self>, app: &App) -> bool
Source§impl RenderObject for RenderIntrinsicWidth
impl RenderObject for RenderIntrinsicWidth
Source§fn render_object_data(self: RenderHandle<Self>, app: &App) -> &RenderObjectData
fn render_object_data(self: RenderHandle<Self>, app: &App) -> &RenderObjectData
Source§fn render_object_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderObjectData
fn render_object_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderObjectData
render_object_data.Source§fn perform_layout(self: RenderHandle<Self>, app: &mut App)
fn perform_layout(self: RenderHandle<Self>, app: &mut App)
Source§fn paint(
self: RenderHandle<Self>,
app: &mut App,
context: &mut PaintingContext,
offset: Offset,
)
fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )
Source§fn visit_children(
self: RenderHandle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyRenderObject),
)
fn visit_children( self: RenderHandle<Self>, app: &App, visitor: &mut dyn FnMut(AnyRenderObject), )
visitor for each immediate child.Source§fn as_render_object(self: RenderHandle<Self>, app: &App) -> AnyRenderObject
fn as_render_object(self: RenderHandle<Self>, app: &App) -> AnyRenderObject
RenderObject: this object’s
type-erased handle, through the vtable the protocol recorded when it created it.Source§fn perform_resize(self: RenderHandle<Self>, _app: &mut App)
fn perform_resize(self: RenderHandle<Self>, _app: &mut App)
Source§fn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
)
fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )
child if it has none. Read moreSource§fn did_attach(
self: RenderHandle<Self>,
app: &mut App,
owner: Handle<PipelineOwner>,
)
fn did_attach( self: RenderHandle<Self>, app: &mut App, owner: Handle<PipelineOwner>, )
attach override after super.attach(owner); the base body has
already run. The default attaches the children reported by
visit_children.Source§fn did_detach(self: RenderHandle<Self>, app: &mut App)
fn did_detach(self: RenderHandle<Self>, app: &mut App)
detach override after super.detach(). The default detaches
the children reported by visit_children.Source§fn redepth_children(self: RenderHandle<Self>, app: &mut App)
fn redepth_children(self: RenderHandle<Self>, app: &mut App)
visit_children.Source§fn sized_by_parent(self: RenderHandle<Self>, _app: &App) -> bool
fn sized_by_parent(self: RenderHandle<Self>, _app: &App) -> bool
Source§fn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
)
fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )
Source§fn is_repaint_boundary(self: RenderHandle<Self>, _app: &App) -> bool
fn is_repaint_boundary(self: RenderHandle<Self>, _app: &App) -> bool
Source§fn always_needs_compositing(self: RenderHandle<Self>, _app: &App) -> bool
fn always_needs_compositing(self: RenderHandle<Self>, _app: &App) -> bool
Source§fn mouse_tracker_annotation(
self: RenderHandle<Self>,
_app: &App,
) -> Option<MouseTrackerAnnotation>
fn mouse_tracker_annotation( self: RenderHandle<Self>, _app: &App, ) -> Option<MouseTrackerAnnotation>
this is MouseTrackerAnnotation: the annotation this render object implements,
read live each time the mouse tracker consults it. None for a render object that is
not an annotation, which is the default.Source§fn update_composited_layer(
self: RenderHandle<Self>,
app: &mut App,
old_layer: Option<AnyOffsetLayer>,
) -> AnyOffsetLayer
fn update_composited_layer( self: RenderHandle<Self>, app: &mut App, old_layer: Option<AnyOffsetLayer>, ) -> AnyOffsetLayer
Source§fn show_on_screen(
self: RenderHandle<Self>,
app: &mut App,
descendant: Option<AnyRenderObject>,
rect: Option<Rect>,
duration: Duration,
curve: Rc<dyn Curve>,
)
fn show_on_screen( self: RenderHandle<Self>, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )
RenderObject visible on screen. Read moreSource§impl RenderObjectWithChildMixin for RenderIntrinsicWidth
impl RenderObjectWithChildMixin for RenderIntrinsicWidth
Source§type ChildType = AnyRenderBox
type ChildType = AnyRenderBox
ChildType: the protocol of this render object’s child.Source§fn child_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderObjectWithChildData<AnyRenderBox>
fn child_data( self: RenderHandle<Self>, app: &App, ) -> &RenderObjectWithChildData<AnyRenderBox>
Source§fn child_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderObjectWithChildData<AnyRenderBox>
fn child_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderObjectWithChildData<AnyRenderBox>
child_data.Source§impl RenderProxyBoxMixin for RenderIntrinsicWidth
impl RenderProxyBoxMixin for RenderIntrinsicWidth
Source§fn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
)
fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )
crate::BoxParentData.Source§fn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
)
fn apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )
Source§fn compute_min_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn compute_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
Source§fn compute_max_intrinsic_width(
self: RenderHandle<Self>,
app: &mut App,
height: f64,
) -> f64
fn compute_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64
Source§fn compute_min_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn compute_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
Source§fn compute_max_intrinsic_height(
self: RenderHandle<Self>,
app: &mut App,
width: f64,
) -> f64
fn compute_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64
Source§fn compute_distance_to_actual_baseline(
self: RenderHandle<Self>,
app: &mut App,
baseline: TextBaseline,
) -> Option<f64>
fn compute_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>
Source§fn compute_dry_baseline(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
baseline: TextBaseline,
) -> Option<f64>
fn compute_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64>
Source§fn compute_dry_layout(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
) -> Size
fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size
compute_size_for_no_child.Source§fn perform_layout(self: RenderHandle<Self>, app: &mut App)
fn perform_layout(self: RenderHandle<Self>, app: &mut App)
Source§fn compute_size_for_no_child(
self: RenderHandle<Self>,
_app: &App,
constraints: BoxConstraints,
) -> Size
fn compute_size_for_no_child( self: RenderHandle<Self>, _app: &App, constraints: BoxConstraints, ) -> Size
Source§fn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut BoxHitTestResult<'_>,
position: Offset,
) -> bool
fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool
Source§fn paint(
self: RenderHandle<Self>,
app: &mut App,
context: &mut PaintingContext,
offset: Offset,
)
fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )
Auto Trait Implementations§
impl !RefUnwindSafe for RenderIntrinsicWidth
impl !Send for RenderIntrinsicWidth
impl !Sync for RenderIntrinsicWidth
impl !UnwindSafe for RenderIntrinsicWidth
impl Freeze for RenderIntrinsicWidth
impl Unpin for RenderIntrinsicWidth
impl UnsafeUnpin for RenderIntrinsicWidth
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> RenderObjectBase for Twhere
T: RenderObject,
impl<T> RenderObjectBase for Twhere
T: RenderObject,
Source§fn dispose(self: RenderHandle<Self>, app: &mut App)
fn dispose(self: RenderHandle<Self>, app: &mut App)
RenderObject.dispose body: releases the layer handle. An override calls it
last, where Dart writes super.dispose().Source§fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
RenderObject.markNeedsLayout body; an override calls it where Dart writes
super.markNeedsLayout().Source§fn show_on_screen(
self: RenderHandle<Self>,
app: &mut App,
descendant: Option<AnyRenderObject>,
rect: Option<Rect>,
duration: Duration,
curve: Rc<dyn Curve>,
)
fn show_on_screen( self: RenderHandle<Self>, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )
RenderObject.showOnScreen.