主题
OnScrollEvent 继承自: Event['ScrollableControl']
Payload for on_scroll handlers.
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
event_type | ScrollType | required | Logical type of the scroll notification. Determines which optional fields are populated: - UPDATE: scroll_delta - USER: direction - OVERSCROLL: overscroll and velocity |
pixels | float | required | Current scroll offset in logical pixels. |
min_scroll_extent | float | required | Minimum 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_extent | float | required | Maximum in-range value for pixels. pixels may still be out_of_range during overscroll. For unbounded scrollables this value can be positive infinity. |
viewport_dimension | float | required | Visible viewport extent along the scroll axis, in logical pixels. |
scroll_delta | Optional[float] | None | Delta in logical pixels since the previous update. Populated for UPDATE notifications. |
direction | Optional[ScrollDirection] | None | User scroll direction reported by Flutter. Populated for USER notifications. |
overscroll | Optional[float] | None | Logical 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. |
velocity | Optional[float] | None | Scroll velocity when overscroll occurred, in logical pixels per second. Populated for OVERSCROLL. |
只读属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
out_of_range | bool | — | Whether pixels is outside scroll extents. Returns: True if pixels < min_scroll_extent or pixels > max_scroll_extent; otherwise False. |
at_edge | bool | — | Whether pixels is exactly at either scroll edge. Returns: True when pixels equals min_scroll_extent or max_scroll_extent; otherwise False. |
extent_before | float | — | Quantity of content conceptually "before" the viewport. This corresponds to the content preceding the visible region in the current scroll direction. |
extent_after | float | — | Quantity of content conceptually "after" the viewport. This corresponds to the content following the visible region in the current scroll direction. |
extent_total | float | — | Total conceptual content extent available to the scrollable. Equivalent to: max_scroll_extent - min_scroll_extent + viewport_dimension. |