use fission::prelude::*;
fission_component! {
pub RefreshableCatalog<()> {
props {
products: Widget,
status: RefreshIndicatorStatus,
pulled_extent: f32,
start_pull: ActionEnvelope,
update_pull: ActionEnvelope,
cancel_pull: ActionEnvelope,
refresh: ActionEnvelope,
}
}
view(catalog, _state, _cx) =>
RefreshIndicator(
catalog.products.clone(),
id: WidgetId::explicit("catalog.refresh"),
status: catalog.status,
pulled_extent: catalog.pulled_extent,
on_pull_start: catalog.start_pull.clone(),
on_pull_update: catalog.update_pull.clone(),
on_pull_cancel: catalog.cancel_pull.clone(),
on_refresh: catalog.refresh.clone(),
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | WidgetId | Stable identity for the refresh indicator and its progress animation. | Set this explicitly when a screen has more than one refresh region. |
child | Widget | Content being refreshed. | Usually a scrollable list or grid. |
status | RefreshIndicatorStatus | Current visual and interaction state. | Defaults to Inactive. |
pulled_extent | f32 | Current pull distance in logical points. | Stored in app state. |
trigger_distance | f32 | Pull distance needed to trigger refresh. | Defaults to 80.0. |
displacement | f32 | How far the child content is visually displaced. | Defaults to 40.0. |
edge_offset | f32 | Extra top offset before the indicator appears. | Defaults to 0.0. |
color | Option<Color> | Progress arc color override. | Defaults to theme primary. |
background_color | Option<Color> | Indicator container background override. | Defaults to theme surface. |
track_color | Option<Color> | Progress track color override. | Defaults to theme border. |
stroke_width | Option<f32> | Progress stroke width. | None uses twice the theme's thick border width. |
indicator_size | Option<f32> | Inner progress indicator size. | None uses the refresh-indicator recipe. |
on_pull_start | Option<ActionEnvelope> | Action dispatched when dragging starts. | Usually sets status to Drag. |
on_pull_update | Option<ActionEnvelope> | Action dispatched for drag movement. | Usually updates pulled_extent and arms the refresh. |
on_pull_cancel | Option<ActionEnvelope> | Action dispatched when release does not refresh. | Usually resets status and pull distance. |
on_refresh | Option<ActionEnvelope> | Action dispatched when the pull is released while armed. | Usually starts a job/resource refresh. |
Status | Meaning |
|---|---|
Inactive | No pull is active and the indicator is hidden. |
Drag | The user is pulling but has not crossed the trigger distance. |
Armed | The pull distance is enough to refresh if released. |
Refreshing | Refresh work is running. The indicator uses indeterminate progress. |
Done | Refresh has completed and the indicator can settle. |