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§
Sourcefn flex_data(self: RenderHandle<Self>, app: &App) -> &RenderFlexData
fn flex_data(self: RenderHandle<Self>, app: &App) -> &RenderFlexData
Mixin field access.
Sourcefn flex_data_mut(self: RenderHandle<Self>, app: &mut App) -> &mut RenderFlexData
fn flex_data_mut(self: RenderHandle<Self>, app: &mut App) -> &mut RenderFlexData
See flex_data.
Provided Methods§
Sourcefn direction(self: RenderHandle<Self>, app: &App) -> Axis
fn direction(self: RenderHandle<Self>, app: &App) -> Axis
The direction to use as the main axis.
Sourcefn set_direction(self: RenderHandle<Self>, app: &mut App, value: Axis)
fn set_direction(self: RenderHandle<Self>, app: &mut App, value: Axis)
Sets direction.
Sourcefn main_axis_alignment(self: RenderHandle<Self>, app: &App) -> MainAxisAlignment
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.
Sourcefn set_main_axis_alignment(
self: RenderHandle<Self>,
app: &mut App,
value: MainAxisAlignment,
)
fn set_main_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: MainAxisAlignment, )
Sets main_axis_alignment.
Sourcefn main_axis_size(self: RenderHandle<Self>, app: &App) -> MainAxisSize
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.
Sourcefn set_main_axis_size(
self: RenderHandle<Self>,
app: &mut App,
value: MainAxisSize,
)
fn set_main_axis_size( self: RenderHandle<Self>, app: &mut App, value: MainAxisSize, )
Sets main_axis_size.
Sourcefn cross_axis_alignment(
self: RenderHandle<Self>,
app: &App,
) -> CrossAxisAlignment
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.
Sourcefn set_cross_axis_alignment(
self: RenderHandle<Self>,
app: &mut App,
value: CrossAxisAlignment,
)
fn set_cross_axis_alignment( self: RenderHandle<Self>, app: &mut App, value: CrossAxisAlignment, )
Sets cross_axis_alignment.
Sourcefn text_direction(self: RenderHandle<Self>, app: &App) -> Option<TextDirection>
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.
Sourcefn set_text_direction(
self: RenderHandle<Self>,
app: &mut App,
value: Option<TextDirection>,
)
fn set_text_direction( self: RenderHandle<Self>, app: &mut App, value: Option<TextDirection>, )
Sets text_direction.
Sourcefn vertical_direction(self: RenderHandle<Self>, app: &App) -> VerticalDirection
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.
Sourcefn set_vertical_direction(
self: RenderHandle<Self>,
app: &mut App,
value: VerticalDirection,
)
fn set_vertical_direction( self: RenderHandle<Self>, app: &mut App, value: VerticalDirection, )
Sets vertical_direction.
Sourcefn text_baseline(self: RenderHandle<Self>, app: &App) -> Option<TextBaseline>
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.
Sourcefn set_text_baseline(
self: RenderHandle<Self>,
app: &mut App,
value: Option<TextBaseline>,
)
fn set_text_baseline( self: RenderHandle<Self>, app: &mut App, value: Option<TextBaseline>, )
Sets text_baseline.
Sourcefn has_overflow(self: RenderHandle<Self>, app: &App) -> bool
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.
Sourcefn clip_behavior(self: RenderHandle<Self>, app: &App) -> Clip
fn clip_behavior(self: RenderHandle<Self>, app: &App) -> Clip
How to clip the children that overflow along the main axis.
Defaults to Clip::None.
Sourcefn set_clip_behavior(self: RenderHandle<Self>, app: &mut App, value: Clip)
fn set_clip_behavior(self: RenderHandle<Self>, app: &mut App, value: Clip)
Sets clip_behavior.
Sourcefn spacing(self: RenderHandle<Self>, app: &App) -> f64
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.
Sourcefn set_spacing(self: RenderHandle<Self>, app: &mut App, value: f64)
fn set_spacing(self: RenderHandle<Self>, app: &mut App, value: f64)
Sets spacing.
Sourcefn debug_has_necessary_directions(self: RenderHandle<Self>, app: &App) -> bool
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.
Sourcefn is_baseline_aligned(self: RenderHandle<Self>, app: &App) -> bool
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.
Sourcefn get_cross_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64
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.
Sourcefn get_main_size(self: RenderHandle<Self>, app: &App, size: Size) -> f64
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.
Sourcefn flip_main_axis(self: RenderHandle<Self>, app: &App) -> bool
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.
Sourcefn flip_cross_axis(self: RenderHandle<Self>, app: &App) -> bool
fn flip_cross_axis(self: RenderHandle<Self>, app: &App) -> bool
The cross axis counterpart of flip_main_axis. Internal to the
flex layout.
Sourcefn constraints_for_non_flex_child(
self: RenderHandle<Self>,
app: &App,
constraints: BoxConstraints,
) -> BoxConstraints
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.
Sourcefn constraints_for_flex_child(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderBox,
constraints: BoxConstraints,
max_child_extent: f64,
) -> BoxConstraints
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.
Sourcefn get_intrinsic_size(
self: RenderHandle<Self>,
app: &mut App,
sizing_direction: Axis,
extent: f64,
child_size: fn(AnyRenderBox, &mut App, f64) -> f64,
) -> f64
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.
Sourcefn debug_check_constraints(
self: RenderHandle<Self>,
app: &App,
constraints: BoxConstraints,
) -> Option<String>
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.
Sourcefn compute_sizes(
self: RenderHandle<Self>,
app: &mut App,
constraints: BoxConstraints,
layout_child: impl FnMut(&mut App, AnyRenderBox, BoxConstraints) -> Size,
get_baseline: ChildBaselineGetter,
) -> LayoutSizes
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.
Sourcefn perform_layout(self: RenderHandle<Self>, app: &mut App)
fn perform_layout(self: RenderHandle<Self>, app: &mut App)
Sizes this flex and positions its children; see RenderFlex for the algorithm.
Sourcefn 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, )
Paints the children, clipping them to this flex when they overflow the main axis.
Sourcefn dispose(self: RenderHandle<Self>, app: &mut App)
fn dispose(self: RenderHandle<Self>, app: &mut App)
Flutter’s dispose: drop the clip layer handle, then super.dispose().
Sourcefn setup_parent_data(
self: RenderHandle<Self>,
app: &mut App,
child: AnyRenderObject,
)
fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )
A flex child gets a FlexParentData.
Sourcefn 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
The minimum intrinsic width of the children laid out in a flex.
Sourcefn 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
The maximum intrinsic width of the children laid out in a flex.
Sourcefn 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
The minimum intrinsic height of the children laid out in a flex.
Sourcefn 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
The maximum intrinsic height of the children laid out in a flex.
Sourcefn 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>
A row’s highest child baseline, or a column’s first child baseline.
Sourcefn 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>
The baseline compute_distance_to_actual_baseline
would answer, measuring the children dry; a baseline-aligned flex answers its shared
baseline.
Sourcefn 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_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.
Sourcefn compute_dry_distance_to_first_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>
Dry layout equivalent of
default_compute_distance_to_first_actual_baseline.
Internal to the flex layout.
Sourcefn 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
The size this flex would take, measuring the children dry.
Sourcefn 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
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".