pub trait RenderSliverPersistentHeader:
RenderSliver
+ RenderObjectWithChildMixin<ChildType = AnyRenderBox>
+ RenderSliverHelpers {
Show 15 methods
// Required methods
fn header_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderSliverPersistentHeaderData;
fn header_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderSliverPersistentHeaderData;
fn max_extent(self: RenderHandle<Self>, app: &App) -> f64;
fn min_extent(self: RenderHandle<Self>, app: &App) -> f64;
// Provided methods
fn child_extent(self: RenderHandle<Self>, app: &App) -> f64 { ... }
fn last_shrink_offset(self: RenderHandle<Self>, app: &App) -> f64 { ... }
fn last_overlaps_content(self: RenderHandle<Self>, app: &App) -> bool { ... }
fn stretch_configuration(
self: RenderHandle<Self>,
app: &App,
) -> Option<OverScrollHeaderStretchConfiguration> { ... }
fn set_stretch_configuration(
self: RenderHandle<Self>,
app: &mut App,
value: Option<OverScrollHeaderStretchConfiguration>,
) { ... }
fn update_child(
self: RenderHandle<Self>,
app: &mut App,
shrink_offset: f64,
overlaps_content: bool,
) { ... }
fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App) { ... }
fn layout_child(
self: RenderHandle<Self>,
app: &mut App,
scroll_offset: f64,
max_extent: f64,
overlaps_content: bool,
) { ... }
fn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut SliverHitTestResult<'_>,
main_axis_position: f64,
cross_axis_position: f64,
) -> bool { ... }
fn apply_paint_transform(
self: RenderHandle<Self>,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
) { ... }
fn paint(
self: RenderHandle<Self>,
app: &mut App,
context: &mut PaintingContext,
offset: Offset,
) { ... }
}Expand description
A sliver that has a box child which scrolls normally, except that when it hits the leading
edge (typically the top) of the viewport, it shrinks to a minimum size
(min_extent).
This trait primarily provides helpers for managing the child, in particular:
layout_child, which applies min and max extents and a scroll offset to lay out the child. This is normally called fromperform_layout.child_extent, to convert the child’s box layout dimensions to the sliver geometry model.- hit testing, painting, and other details of the sliver protocol.
Implementors must implement perform_layout, min_extent and
max_extent, and typically also will implement
update_child.
Required Methods§
Sourcefn header_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderSliverPersistentHeaderData
fn header_data( self: RenderHandle<Self>, app: &App, ) -> &RenderSliverPersistentHeaderData
Mixin field access.
Sourcefn header_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderSliverPersistentHeaderData
fn header_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderSliverPersistentHeaderData
See header_data.
Sourcefn max_extent(self: RenderHandle<Self>, app: &App) -> f64
fn max_extent(self: RenderHandle<Self>, app: &App) -> f64
The biggest that this render object can become, in the main axis direction.
This value should not be based on the child. If it changes, call mark_needs_layout.
Sourcefn min_extent(self: RenderHandle<Self>, app: &App) -> f64
fn min_extent(self: RenderHandle<Self>, app: &App) -> f64
The smallest that this render object can become, in the main axis direction.
If this is based on the intrinsic dimensions of the child, the child should be measured
during update_child and the value cached and returned here.
Provided Methods§
Sourcefn child_extent(self: RenderHandle<Self>, app: &App) -> f64
fn child_extent(self: RenderHandle<Self>, app: &App) -> f64
The dimension of the child in the main axis.
Sourcefn last_shrink_offset(self: RenderHandle<Self>, app: &App) -> f64
fn last_shrink_offset(self: RenderHandle<Self>, app: &App) -> f64
The most recent shrink_offset passed to update_child.
Sourcefn last_overlaps_content(self: RenderHandle<Self>, app: &App) -> bool
fn last_overlaps_content(self: RenderHandle<Self>, app: &App) -> bool
The most recent overlaps_content passed to update_child.
Sourcefn stretch_configuration(
self: RenderHandle<Self>,
app: &App,
) -> Option<OverScrollHeaderStretchConfiguration>
fn stretch_configuration( self: RenderHandle<Self>, app: &App, ) -> Option<OverScrollHeaderStretchConfiguration>
Defines the parameters used to execute a callback when a stretching header over-scrolls.
Sourcefn set_stretch_configuration(
self: RenderHandle<Self>,
app: &mut App,
value: Option<OverScrollHeaderStretchConfiguration>,
)
fn set_stretch_configuration( self: RenderHandle<Self>, app: &mut App, value: Option<OverScrollHeaderStretchConfiguration>, )
Sets stretch_configuration.
Sourcefn update_child(
self: RenderHandle<Self>,
app: &mut App,
shrink_offset: f64,
overlaps_content: bool,
)
fn update_child( self: RenderHandle<Self>, app: &mut App, shrink_offset: f64, overlaps_content: bool, )
Update the child render object if necessary.
Called before the first layout, any time mark_needs_layout is called, and any time the
scroll offset changes. The shrink_offset is the difference between the
max_extent and the current size. Zero means the header is fully
expanded, any greater number up to max_extent means that the header has been scrolled by
that much. The overlaps_content argument is true if the sliver’s leading edge is beyond
its normal place in the viewport contents.
When this method is called by layout_child, the child can be set,
mutated, or replaced. Any time this method would mutate the child, call mark_needs_layout.
Sourcefn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
fn mark_needs_layout(self: RenderHandle<Self>, app: &mut App)
The body of Flutter’s markNeedsLayout override, run before the inherited body.
This is automatically called whenever the child’s intrinsic dimensions change, at which point we should remeasure them during the next layout.
Sourcefn layout_child(
self: RenderHandle<Self>,
app: &mut App,
scroll_offset: f64,
max_extent: f64,
overlaps_content: bool,
)
fn layout_child( self: RenderHandle<Self>, app: &mut App, scroll_offset: f64, max_extent: f64, overlaps_content: bool, )
Lays out the child.
This is called by perform_layout. It applies the given scroll_offset (which need not
match the offset given by the constraints) and the max_extent (which need not match the
value returned by max_extent).
The overlaps_content argument is passed to update_child.
Sourcefn hit_test_children(
self: RenderHandle<Self>,
app: &mut App,
result: &mut SliverHitTestResult<'_>,
main_axis_position: f64,
cross_axis_position: f64,
) -> bool
fn hit_test_children( self: RenderHandle<Self>, app: &mut App, result: &mut SliverHitTestResult<'_>, main_axis_position: f64, cross_axis_position: f64, ) -> bool
The body of Flutter’s hitTestChildren override.
Sourcefn 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, )
The body of Flutter’s applyPaintTransform override.
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, )
The body of Flutter’s paint override.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".