ScrollView Widget
This content is for v1.1.2. Switch to the latest version for up-to-date documentation.
ScrollView allows content that exceeds the screen dimensions to be scrolled smoothly using native Android touch physics and scroll velocity.
Code Example
Section titled “Code Example”from zkite import ScrollView, Column, Text
def TermsOfService(paragraphs: list[str]): return ScrollView( "flex-1 w-full p-4 bg-slate-900 rounded-xl", Column( "gap-4", Text("text-xl font-bold text-white", "Terms & Conditions"), *[ Text("text-sm text-slate-300 leading-relaxed", p, key=f"p-{i}") for i, p in enumerate(paragraphs) ] ), horizontal=False, )Constructor & Properties
Section titled “Constructor & Properties”ScrollView(classes: str, *children, horizontal: bool = False, key: str | None = None)| Parameter | Type | Default | Description |
|---|---|---|---|
classes |
str |
None | Utility classes defining the bounded viewport dimensions (e.g. flex-1, h-64). |
*children |
Widget |
None | Content placed within the scrollable view. |
horizontal |
bool |
False |
When True, scrolling occurs along the X-axis rather than the default vertical axis. |
key |
str |
None |
Stable widget key. |
Smooth Momentum Scrolling (New in 1.1.2)
Section titled “Smooth Momentum Scrolling (New in 1.1.2)”In ZKite 1.1.2, scroll momentum uses an adaptive, velocity- and density-aware spline curve sampled by elapsed time:
- Velocity Tracking: Natural deceleration curves calibrated to Android physical display densities.
- Held-Finger Gesture Cancellation: Holding a finger still before lifting cancels stale movement vectors, preventing unexpected inertia fling launches.
- Fast Rendering Integrity: Momentum calculation is frame-paced; keep view rendering and event handlers nonblocking (using
Taskfor I/O) to sustain smooth 60/120 FPS scrolling.
