ScrollingSection class
A fixed-height scrolling output region anchored at the bottom of the terminal.
Lines appended with appendLine scroll within at most rows visual rows: only the most recent rows lines are shown, older lines scroll out of view. The region renders in place and leaves any output above it untouched, so it is well suited for tailing the output of a long-running subprocess.
When done, choose one of:
- keep to leave the last visible lines in place (or, with
full: trueand captureOutput enabled, the complete output), or - clear to remove the section so the area can be overwritten.
An optional heading is rendered immediately above the scrolling lines,
prefixed with an animated braille spinner and suffixed with an elapsed-time
counter (e.g. ⠹ Building (1.2s)). When the section is finished, the spinner
is replaced with a success (✓) or failure (✗) icon and the heading is
replaced with successMessage (on clear) or failedMessage (on keep)
when the relevant message is non-null; otherwise the heading is left in
place. The final elapsed time is kept either way.
Constructors
- ScrollingSection({required InlineTerminal terminal, int rows = 5, bool dim = true, String? heading, String? successMessage, String? failedMessage, bool captureOutput = false, Duration spinnerInterval = _defaultSpinnerInterval, Duration elapsed()?, SpinnerScheduler? scheduleTicker})
-
Creates a scrolling section rendered to
terminal.
Properties
-
capturedOutput
→ List<
String> -
All lines appended to the section, oldest first.
no setter
- captureOutput → bool
-
Whether every appended line is retained (in addition to the rows visible
ones) so the complete output can be re-displayed, e.g. on failure.
final
- dim → bool
-
Whether to render the scrolled lines dimmed (only when the terminal
supports color).
final
- failedMessage → String?
-
The message that replaces the heading when the section is finished with
keep (i.e. on failure). Ignored when null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heading → String?
-
An optional heading rendered undimmed immediately above the scrolling
lines.
final
- isFinished → bool
-
Whether the section has been finished with keep or clear.
no setter
- rows → int
-
The maximum number of visual rows the section occupies.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- successMessage → String?
-
The message that replaces the heading when the section is finished with
clear (i.e. on success). Ignored when null.
final
-
visibleLines
→ List<
String> -
The lines currently visible in the section, oldest first.
no setter
Methods
-
appendLine(
String line) → void -
Appends
lineto the section and re-renders. -
clear(
) → void - Finishes the section by clearing the scrolling lines so the area can be overwritten.
-
keep(
{bool full = false}) → void - Finishes the section, leaving the currently visible lines in place and moving the cursor below them.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited