Skip to main content

RenderSliverPersistentHeader

Trait RenderSliverPersistentHeader 

Source
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 from perform_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§

Source

fn header_data( self: RenderHandle<Self>, app: &App, ) -> &RenderSliverPersistentHeaderData

Mixin field access.

Source

fn header_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderSliverPersistentHeaderData

Source

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.

Source

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§

Source

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

The dimension of the child in the main axis.

Source

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

The most recent shrink_offset passed to update_child.

Source

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

The most recent overlaps_content passed to update_child.

Source

fn stretch_configuration( self: RenderHandle<Self>, app: &App, ) -> Option<OverScrollHeaderStretchConfiguration>

Defines the parameters used to execute a callback when a stretching header over-scrolls.

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

The body of Flutter’s applyPaintTransform override.

Source

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".

Implementors§