pub struct ScrollAxisRange {
pub value: f32,
pub max_value: f32,
pub reverse: bool,
pub content_padding_start: f32,
pub content_padding_end: f32,
pub bring_into_view_spec: BringIntoViewSpec,
}Expand description
How far a container has scrolled along one axis and how far it can go.
This is Compose’s ScrollAxisRange (verticalScrollAxisRange,
horizontalScrollAxisRange). A lazy list has no whole extent to give, so
it reports the first visible item as the value and one more than that as
the end while it can still scroll; a reader only needs to know whether it
can page on.
content_padding_start and content_padding_end are the container’s
content padding at its top and bottom (or left and right) edges, in layout
pixels. Content scrolls under that padding, where a bar may cover it, so a
control a reader or the keyboard moves to is brought in past it.
bring_into_view_spec says where in the space between the paddings that
control comes to rest.
Fields§
§value: f32The current scroll position, in layout pixels. A lazy list reports the index of its first visible item.
max_value: f32The largest value that value reaches, in the same unit.
reverse: boolWhether the container scrolls in reverse, so content starts at the far end. Compose’s
reverseScrolling.
content_padding_start: f32The content padding at the start edge of the container, in layout pixels.
content_padding_end: f32The content padding at the end edge of the container, in layout pixels.
bring_into_view_spec: BringIntoViewSpecWhere the container puts a child that takes focus or that a reader moves to.
Implementations§
Source§impl ScrollAxisRange
impl ScrollAxisRange
Sourcepub fn new(value: f32, max_value: f32, reverse: bool) -> Self
pub fn new(value: f32, max_value: f32, reverse: bool) -> Self
Creates a range for a container at scroll offset value that reaches at most max_value,
with no content padding and the default BringIntoViewSpec.
Sourcepub fn with_content_padding(self, start: f32, end: f32) -> Self
pub fn with_content_padding(self, start: f32, end: f32) -> Self
The same range with the container’s content padding at its start and end edges, in layout pixels.
Sourcepub fn with_bring_into_view_spec(
self,
bring_into_view_spec: BringIntoViewSpec,
) -> Self
pub fn with_bring_into_view_spec( self, bring_into_view_spec: BringIntoViewSpec, ) -> Self
The same range with the container’s BringIntoViewSpec.
Sourcepub fn can_scroll_forward(&self) -> bool
pub fn can_scroll_forward(&self) -> bool
Whether the container can scroll further in the forward direction.
Sourcepub fn can_scroll_backward(&self) -> bool
pub fn can_scroll_backward(&self) -> bool
Whether the container can scroll further in the backward direction.