Skip to main content

RenderFlexMixin

Trait RenderFlexMixin 

Source
pub trait RenderFlexMixin:
    RenderBox
    + ContainerRenderObjectMixin<ChildType = AnyRenderBox, ParentDataType = FlexParentData>
    + RenderBoxContainerDefaultsMixin {
Show 46 methods // Required methods fn flex_data(self: RenderHandle<Self>, app: &App) -> &RenderFlexData; fn flex_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderFlexData; // Provided methods fn direction(self: RenderHandle<Self>, app: &App) -> Axis { ... } fn set_direction(self: RenderHandle<Self>, app: &mut App, value: Axis) { ... } fn main_axis_alignment( self: RenderHandle<Self>, app: &App, ) -> MainAxisAlignment { ... } fn set_main_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: MainAxisAlignment, ) { ... } fn main_axis_size(self: RenderHandle<Self>, app: &App) -> MainAxisSize { ... } fn set_main_axis_size( self: RenderHandle<Self>, app: &mut App, value: MainAxisSize, ) { ... } fn cross_axis_alignment( self: RenderHandle<Self>, app: &App, ) -> CrossAxisAlignment { ... } fn set_cross_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: CrossAxisAlignment, ) { ... } fn text_direction( self: RenderHandle<Self>, app: &App, ) -> Option<TextDirection> { ... } fn set_text_direction( self: RenderHandle<Self>, app: &mut App, value: Option<TextDirection>, ) { ... } fn vertical_direction( self: RenderHandle<Self>, app: &App, ) -> VerticalDirection { ... } fn set_vertical_direction( self: RenderHandle<Self>, app: &mut App, value: VerticalDirection, ) { ... } fn text_baseline( self: RenderHandle<Self>, app: &App, ) -> Option<TextBaseline> { ... } fn set_text_baseline( self: RenderHandle<Self>, app: &mut App, value: Option<TextBaseline>, ) { ... } fn has_overflow(self: RenderHandle<Self>, app: &App) -> bool { ... } fn clip_behavior(self: RenderHandle<Self>, app: &App) -> Clip { ... } fn set_clip_behavior(self: RenderHandle<Self>, app: &mut App, value: Clip) { ... } fn spacing(self: RenderHandle<Self>, app: &App) -> f64 { ... } fn set_spacing(self: RenderHandle<Self>, app: &mut App, value: f64) { ... } fn debug_has_necessary_directions( self: RenderHandle<Self>, app: &App, ) -> bool { ... } fn is_baseline_aligned(self: RenderHandle<Self>, app: &App) -> bool { ... } fn get_cross_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64 { ... } fn get_main_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64 { ... } fn flip_main_axis(self: RenderHandle<Self>, app: &App) -> bool { ... } fn flip_cross_axis(self: RenderHandle<Self>, app: &App) -> bool { ... } fn constraints_for_non_flex_child( self: RenderHandle<Self>, app: &App, constraints: BoxConstraints, ) -> BoxConstraints { ... } fn constraints_for_flex_child( self: RenderHandle<Self>, app: &App, child: AnyRenderBox, constraints: BoxConstraints, max_child_extent: f64, ) -> BoxConstraints { ... } fn get_intrinsic_size( self: RenderHandle<Self>, app: &mut App, sizing_direction: Axis, extent: f64, child_size: fn(AnyRenderBox, &mut App, f64) -> f64, ) -> f64 { ... } fn debug_check_constraints( self: RenderHandle<Self>, app: &App, constraints: BoxConstraints, ) -> Option<String> { ... } fn compute_sizes( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, layout_child: impl FnMut(&mut App, AnyRenderBox, BoxConstraints) -> Size, get_baseline: ChildBaselineGetter, ) -> LayoutSizes { ... } fn perform_layout(self: RenderHandle<Self>, app: &mut App) { ... } fn paint( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, ) { ... } fn dispose(self: RenderHandle<Self>, app: &mut App) { ... } fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, ) { ... } fn compute_min_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 { ... } fn compute_min_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 { ... } fn compute_distance_to_actual_baseline( self: RenderHandle<Self>, app: &mut App, baseline: TextBaseline, ) -> Option<f64> { ... } fn compute_dry_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, ) -> Option<f64> { ... } fn compute_dry_distance_to_highest_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, sizes: &LayoutSizes, ) -> Option<f64> { ... } fn compute_dry_distance_to_first_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, sizes: &LayoutSizes, ) -> Option<f64> { ... } fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size { ... } fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool { ... }
}
Expand description

Displays its children in a one-dimensional array.

Flutter’s RenderFlex: the shared bodies of the flex layout. A leaf holds a RenderFlexData, implements this trait, and calls these where Dart would run the inherited method: RenderFlexMixin::perform_layout(self, app).

See RenderFlex for the layout algorithm.

Required Methods§

Source

fn flex_data(self: RenderHandle<Self>, app: &App) -> &RenderFlexData

Mixin field access.

Source

fn flex_data_mut(self: RenderHandle<Self>, app: &mut App) -> &mut RenderFlexData

See flex_data.

Provided Methods§

Source

fn direction(self: RenderHandle<Self>, app: &App) -> Axis

The direction to use as the main axis.

Source

fn set_direction(self: RenderHandle<Self>, app: &mut App, value: Axis)

Sets direction.

Source

fn main_axis_alignment(self: RenderHandle<Self>, app: &App) -> MainAxisAlignment

How the children should be placed along the main axis.

If the direction is Axis::Horizontal, and the alignment is either MainAxisAlignment::Start or MainAxisAlignment::End, then the text_direction must not be None.

Source

fn set_main_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: MainAxisAlignment, )

Source

fn main_axis_size(self: RenderHandle<Self>, app: &App) -> MainAxisSize

How much space should be occupied in the main axis.

After allocating space to children, there might be some remaining free space. This value controls whether to maximize or minimize the amount of free space, subject to the incoming layout constraints.

Source

fn set_main_axis_size( self: RenderHandle<Self>, app: &mut App, value: MainAxisSize, )

Source

fn cross_axis_alignment( self: RenderHandle<Self>, app: &App, ) -> CrossAxisAlignment

How the children should be placed along the cross axis.

If the direction is Axis::Vertical, and the alignment is either CrossAxisAlignment::Start or CrossAxisAlignment::End, then the text_direction must not be None.

Source

fn set_cross_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: CrossAxisAlignment, )

Source

fn text_direction(self: RenderHandle<Self>, app: &App) -> Option<TextDirection>

Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.

If the direction is Axis::Horizontal, this controls the order in which children are positioned (left-to-right or right-to-left), and the meaning of the main_axis_alignment property’s MainAxisAlignment::Start and MainAxisAlignment::End values.

If the direction is Axis::Vertical, this controls the meaning of the cross_axis_alignment property’s CrossAxisAlignment::Start and CrossAxisAlignment::End values.

Source

fn set_text_direction( self: RenderHandle<Self>, app: &mut App, value: Option<TextDirection>, )

Source

fn vertical_direction(self: RenderHandle<Self>, app: &App) -> VerticalDirection

Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.

If the direction is Axis::Vertical, this controls which order children are painted in (down or up), and the meaning of the main_axis_alignment property’s MainAxisAlignment::Start and MainAxisAlignment::End values.

If the direction is Axis::Horizontal, this controls the meaning of the cross_axis_alignment property’s CrossAxisAlignment::Start and CrossAxisAlignment::End values.

Source

fn set_vertical_direction( self: RenderHandle<Self>, app: &mut App, value: VerticalDirection, )

Source

fn text_baseline(self: RenderHandle<Self>, app: &App) -> Option<TextBaseline>

If aligning items according to their baseline, which baseline to use.

Must not be None if cross_axis_alignment is CrossAxisAlignment::Baseline.

Source

fn set_text_baseline( self: RenderHandle<Self>, app: &mut App, value: Option<TextBaseline>, )

Source

fn has_overflow(self: RenderHandle<Self>, app: &App) -> bool

Whether the flex overflowed along the main axis.

Values below an epsilon are treated as not overflowing. Internal to the flex layout; a leaf does not republish it.

Source

fn clip_behavior(self: RenderHandle<Self>, app: &App) -> Clip

How to clip the children that overflow along the main axis.

Defaults to Clip::None.

Source

fn set_clip_behavior(self: RenderHandle<Self>, app: &mut App, value: Clip)

Source

fn spacing(self: RenderHandle<Self>, app: &App) -> f64

How much space to place between children in the main axis.

The spacing is only applied between children in the main axis: not before the first child or after the last one. When it is non-zero, the layout size will be larger than the sum of the children’s layout sizes in the main axis, and the children overflow when their sizes plus the total spacing exceed the maximum main axis constraint.

Defaults to 0.0.

Source

fn set_spacing(self: RenderHandle<Self>, app: &mut App, value: f64)

Sets spacing.

Source

fn debug_has_necessary_directions(self: RenderHandle<Self>, app: &App) -> bool

Flutter’s _debugHasNecessaryDirections: asserts the directions the current alignment needs are available. Always returns true. Internal to the flex layout.

Source

fn is_baseline_aligned(self: RenderHandle<Self>, app: &App) -> bool

Whether the children are placed on a shared baseline: a CrossAxisAlignment::Baseline along a horizontal main axis. Internal to the flex layout.

Source

fn get_cross_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64

The extent of size along the cross axis. Internal to the flex layout.

Source

fn get_main_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64

The extent of size along the main axis. Internal to the flex layout.

Source

fn flip_main_axis(self: RenderHandle<Self>, app: &App) -> bool

Whether to lay out left-to-right / top-to-bottom (false), or right-to-left / bottom-to-top (true). false when the layout direction does not matter (for instance, there is no child). Internal to the flex layout.

Source

fn flip_cross_axis(self: RenderHandle<Self>, app: &App) -> bool

The cross axis counterpart of flip_main_axis. Internal to the flex layout.

Source

fn constraints_for_non_flex_child( self: RenderHandle<Self>, app: &App, constraints: BoxConstraints, ) -> BoxConstraints

The constraints an inflexible child is laid out with. Internal to the flex layout.

Source

fn constraints_for_flex_child( self: RenderHandle<Self>, app: &App, child: AnyRenderBox, constraints: BoxConstraints, max_child_extent: f64, ) -> BoxConstraints

The constraints a flexible child is laid out with, given the main axis extent it was allocated. Internal to the flex layout.

Source

fn get_intrinsic_size( self: RenderHandle<Self>, app: &mut App, sizing_direction: Axis, extent: f64, child_size: fn(AnyRenderBox, &mut App, f64) -> f64, ) -> f64

Flutter’s _getIntrinsicSize: the intrinsic extent along sizing_direction, given the extent in the other direction and a child_size that measures one child. Internal to the flex layout.

Source

fn debug_check_constraints( self: RenderHandle<Self>, app: &App, constraints: BoxConstraints, ) -> Option<String>

Flutter’s _debugCheckConstraints: the error to report when a child has a non-zero flex factor while the incoming main axis constraint is unbounded and that child would have to fill it, or None when the constraints are usable. Internal to the flex layout.

Source

fn compute_sizes( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, layout_child: impl FnMut(&mut App, AnyRenderBox, BoxConstraints) -> Size, get_baseline: ChildBaselineGetter, ) -> LayoutSizes

Flutter’s _computeSizes: measures the children with layout_child, reads their baselines with get_baseline when they are baseline aligned, and works out this flex’s own size. Internal to the flex layout.

§Panics

If the children are baseline aligned and text_baseline is None.

Source

fn perform_layout(self: RenderHandle<Self>, app: &mut App)

Sizes this flex and positions its children; see RenderFlex for the algorithm.

Source

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

Paints the children, clipping them to this flex when they overflow the main axis.

Source

fn dispose(self: RenderHandle<Self>, app: &mut App)

Flutter’s dispose: drop the clip layer handle, then super.dispose().

Source

fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )

A flex child gets a FlexParentData.

Source

fn compute_min_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

The minimum intrinsic width of the children laid out in a flex.

Source

fn compute_max_intrinsic_width( self: RenderHandle<Self>, app: &mut App, height: f64, ) -> f64

The maximum intrinsic width of the children laid out in a flex.

Source

fn compute_min_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

The minimum intrinsic height of the children laid out in a flex.

Source

fn compute_max_intrinsic_height( self: RenderHandle<Self>, app: &mut App, width: f64, ) -> f64

The maximum intrinsic height of the children laid out in a flex.

Source

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

A row’s highest child baseline, or a column’s first child baseline.

Source

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

The baseline compute_distance_to_actual_baseline would answer, measuring the children dry; a baseline-aligned flex answers its shared baseline.

Source

fn compute_dry_distance_to_highest_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, sizes: &LayoutSizes, ) -> Option<f64>

Dry layout equivalent of default_compute_distance_to_highest_actual_baseline. Internal to the flex layout.

Source

fn compute_dry_distance_to_first_baseline( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, baseline: TextBaseline, sizes: &LayoutSizes, ) -> Option<f64>

Dry layout equivalent of default_compute_distance_to_first_actual_baseline. Internal to the flex layout.

Source

fn compute_dry_layout( self: RenderHandle<Self>, app: &mut App, constraints: BoxConstraints, ) -> Size

The size this flex would take, measuring the children dry.

Source

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

Hit tests the children in paint order.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§