ScrollableControl
Inherits: Control
Properties
-
auto_scroll(bool) –Whether the scrollbar should automatically move its position to the end when
-
scroll(ScrollMode | None) –Enables a vertical scrolling for the Column to prevent its content overflow.
-
scroll_interval(Number) –Throttling in milliseconds for
on_scrollevent.
Events
-
on_scroll(EventHandler[OnScrollEvent] | None) –Called when scroll position is changed by a user.
Methods
-
scroll_to–Moves the scroll position.
Properties#
auto_scroll
class-attribute
instance-attribute
#
auto_scroll: bool = False
Whether the scrollbar should automatically move its position to the end when children updated.
Note
Must be False for scroll_to() method to work.
scroll
class-attribute
instance-attribute
#
scroll: ScrollMode | None = None
Enables a vertical scrolling for the Column to prevent its content overflow.
scroll_interval
class-attribute
instance-attribute
#
scroll_interval: Number = 10
Throttling in milliseconds for on_scroll event.
Events#
on_scroll
class-attribute
instance-attribute
#
on_scroll: EventHandler[OnScrollEvent] | None = None
Called when scroll position is changed by a user.
Methods#
scroll_to
async
#
scroll_to(
offset: float | None = None,
delta: float | None = None,
scroll_key: str
| int
| float
| bool
| ScrollKey
| None = None,
duration: DurationValue = 0,
curve: AnimationCurve = EASE,
)
Moves the scroll position.
Parameters:
-
offset(float | None, default:None) –Absolute scroll target in pixels. A negative value is interpreted relative to the end (e.g.
-1to jump to the very end). -
delta(float | None, default:None) –Relative scroll change in pixels. Positive values scroll forward, negative values scroll backward.
-
scroll_key(str | int | float | bool | ScrollKey | None, default:None) –Key of the target control to scroll to.
-
duration(DurationValue, default:0) –The scroll animation duration.
-
curve(AnimationCurve, default:EASE) –The scroll animation curve.
Notes
- Exactly one of
offset,deltaorscroll_keyshould be provided. auto_scrollmust beFalse.- This method is ineffective for controls (e.g.
[
ListView][flet.controls.scrollable_control.ScrollableControl.ListView], [GridView][flet.controls.scrollable_control.ScrollableControl.GridView]) that build items dynamically.
Examples: