WidgetScrollController class

A simple ScrollController for use with SingleChildScrollView, ScrollView, and ListView.

Tracks viewport dimension, content extent, and scroll offset. The viewport render object calls updateMetrics after layout; the widget state calls scrollBy / jumpTo in response to user input.

Implemented types

Constructors

WidgetScrollController()

Properties

contentExtent int
Total content extent in rows.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasSelection bool
Whether a selection is currently active (start and end are set).
no setter
maxOffset int
Maximum scroll offset.
no setteroverride
offset int
Current scroll offset in rows.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollPercent double
Scroll percentage in the range 0, 1.
no setteroverride
selecting bool
Whether a drag-selection is in progress.
no setter
selectionEnd → ({int x, int y})?
The selection end point, or null.
no setter
selectionStart → ({int x, int y})?
The selection start point, or null.
no setter
thumbDragActive bool
Whether an attached scrollbar thumb drag is currently active.
no setter
viewportExtent int
Visible viewport extent in rows.
no setteroverride

Methods

addListener(void listener()) → void
Adds a listener that fires when the scroll offset changes.
override
clearSelection() → void
Clears the current selection and notifies listeners.
getSelectedText(List<String> lines) String
Extracts the selected text from rendered content lines.
jumpTo(int offset) bool
Jumps to an absolute offset. Returns true if the offset changed.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(void listener()) → void
Removes a previously added listener.
override
scrollBy(int delta) bool
Scrolls by a delta. Returns true if the offset changed.
override
setSelection({required ({int x, int y}) start, required ({int x, int y}) end}) → void
Sets the selection start and end, and notifies listeners.
setThumbDragActive(bool active) → void
Marks whether an attached scrollbar thumb drag is active.
toString() String
A string representation of this object.
inherited
updateMetrics({required int viewportExtent, required int contentExtent}) bool
Updates metrics after layout. Returns true if offset was clamped.

Operators

operator ==(Object other) bool
The equality operator.
inherited