Skip to main content

RenderBoxContainerDefaultsMixin

Trait RenderBoxContainerDefaultsMixin 

Source
pub trait RenderBoxContainerDefaultsMixin: ContainerRenderObjectMixin<ChildType = AnyRenderBox, ParentDataType: ContainerBoxParentData> + RenderBox {
    // Provided methods
    fn default_compute_distance_to_first_actual_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        baseline: TextBaseline,
    ) -> Option<f64> { ... }
    fn default_compute_distance_to_highest_actual_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        baseline: TextBaseline,
    ) -> Option<f64> { ... }
    fn default_hit_test_children(
        self: RenderHandle<Self>,
        app: &mut App,
        result: &mut BoxHitTestResult<'_>,
        position: Offset,
    ) -> bool { ... }
    fn default_paint(
        self: RenderHandle<Self>,
        app: &mut App,
        context: &mut PaintingContext,
        offset: Offset,
    ) { ... }
}
Expand description

A mixin that provides useful default behaviors for boxes with children managed by the ContainerRenderObjectMixin mixin.

By convention, this trait doesn’t override any members of the supertrait. Instead, it provides helpful functions that render objects can call as appropriate.

Flutter’s RenderBoxContainerDefaultsMixin.

Provided Methods§

Source

fn default_compute_distance_to_first_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

Returns the baseline of the first child with a baseline.

Useful when the children are displayed vertically in the same order they appear in the child list.

Source

fn default_compute_distance_to_highest_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64>

Returns the minimum baseline value among every child.

Useful when the vertical position of the children isn’t determined by the order in the child list.

Source

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

Performs a hit test on each child by walking the child list backwards.

Stops walking once after the first child reports that it contains the given point. Returns whether any children contain the given point.

See also:

  • default_paint, which paints the children appropriate for this hit-testing strategy.
Source

fn default_paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )

Paints each child by walking the child list forwards.

See also:

  • default_hit_test_children, which implements hit-testing of the children in a manner appropriate for this painting strategy.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§