Skip to content

OnScrollEvent 继承自: Event['ScrollableControl']

Payload for on_scroll handlers.

属性 ​

名称类型默认值说明
event_typeScrollTyperequiredLogical type of the scroll notification. Determines which optional fields are populated: - UPDATE: scroll_delta - USER: direction - OVERSCROLL: overscroll and velocity
pixelsfloatrequiredCurrent scroll offset in logical pixels.
min_scroll_extentfloatrequiredMinimum in-range value for pixels. pixels may still be out_of_range during overscroll. For unbounded scrollables this value can be negative infinity.
max_scroll_extentfloatrequiredMaximum in-range value for pixels. pixels may still be out_of_range during overscroll. For unbounded scrollables this value can be positive infinity.
viewport_dimensionfloatrequiredVisible viewport extent along the scroll axis, in logical pixels.
scroll_deltaOptional[float]NoneDelta in logical pixels since the previous update. Populated for UPDATE notifications.
directionOptional[ScrollDirection]NoneUser scroll direction reported by Flutter. Populated for USER notifications.
overscrollOptional[float]NoneLogical pixels that were prevented from being applied to pixels. Negative values indicate overscroll on the start side; positive values indicate overscroll on the end side. Populated for OVERSCROLL.
velocityOptional[float]NoneScroll velocity when overscroll occurred, in logical pixels per second. Populated for OVERSCROLL.

只读属性 ​

名称类型默认值说明
out_of_rangebool—Whether pixels is outside scroll extents. Returns: True if pixels < min_scroll_extent or pixels > max_scroll_extent; otherwise False.
at_edgebool—Whether pixels is exactly at either scroll edge. Returns: True when pixels equals min_scroll_extent or max_scroll_extent; otherwise False.
extent_beforefloat—Quantity of content conceptually "before" the viewport. This corresponds to the content preceding the visible region in the current scroll direction.
extent_afterfloat—Quantity of content conceptually "after" the viewport. This corresponds to the content following the visible region in the current scroll direction.
extent_totalfloat—Total conceptual content extent available to the scrollable. Equivalent to: max_scroll_extent - min_scroll_extent + viewport_dimension.

关注我,学习大模型、大数据、Python等热门技术。