ValuePrompt class

ValuePrompt – composable system for continuous value selection.

Handles patterns for numeric/continuous value input:

  • Sliders (single value)
  • Ratings (discrete stars)
  • Ranges (two values with handles)

Usage:

final prompt = ValuePrompt(
  title: 'Volume',
  min: 0,
  max: 100,
  initial: 50,
);

final value = prompt.run(
  render: (ctx, value, ratio) {
    ctx.sliderBar(ratio);
    ctx.labeledAccent('Value', '$value%');
  },
);

Constructors

ValuePrompt({required String title, num min = 0, num max = 100, num initial = 50, num step = 1, PromptTheme theme = PromptTheme.dark})

Properties

bindings → KeyBindings
Current key bindings.
no setter
hashCode → int
The hash code for this object.
no setterinherited
initial → num
Initial value.
final
max → num
Maximum value.
final
min → num
Minimum value.
final
ratio → double
Current value as ratio (0.0 to 1.0).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
step → num
Step size for adjustments.
final
theme → PromptTheme
Theme for styling.
final
title → String
Title for the frame header.
final
value → num
Current value.
no setter
wasCancelled → bool
Whether the prompt was cancelled.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run({required void render(FrameContext ctx, num value, double ratio), KeyBindings? extraBindings, bool useNumberKeys = false, int numberKeyMax = 9}) → num
Runs the value prompt with custom rendering.
toString() → String
A string representation of this object.
inherited

Operators

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