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, call finish with a success flag. Body retention comes from
successRetention / failureRetention, or from finish's
overrideRetention when one is passed.
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 or failedMessage 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, RetainSection? successRetention, RetainSection? failureRetention, 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
headingwhen finish is called withsuccess: false. Ignored when null.final - failureRetention → RetainSection
-
What happens to the body when finish is called with
success: false.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isFinished → bool
-
Whether the section has been finished with finish.
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
headingwhen finish is called withsuccess: true. Ignored when null.final - successRetention → RetainSection
-
What happens to the body when finish is called with
success: true.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. -
finish(
{required bool success, RetainSection? overrideRetention}) → void - Finishes the section.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateHeading(
String newHeading) → void - Updates the heading text and re-renders.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
runSpinner<
T> (InlineTerminal terminal, {required String heading, required Stream< T> stream, String toMessage(T)?, bool isSuccess(T)?, String? successMessage, String? failedMessage, Duration spinnerInterval = _defaultSpinnerInterval, Duration? elapsed()?, SpinnerScheduler? scheduleTicker}) → Future<T> -
Runs a heading-only spinner (no scrolling output lines) while consuming
stream.