Double Arg

The double arg renders a text field or slider in the Widgetbook UI where you can dynamically enter a double value for a widget property.

Variants

The double arg has two style variants, each with a regular and nullable type:

  • Input: A text field for entering double values.
  • Slider: A slider for selecting double values within a range.

DoubleArg (Input)

By default, DoubleArg uses the input style.

Example

Usage

my_widget.stories.dart
final $Default = _Story(
  args: _Args(
    progress: DoubleArg(0.5), 
  ),
);

NullableDoubleArg (Input)

Example

Usage

my_widget.stories.dart
final $Default = _Story(
  args: _Args(
    progress: NullableDoubleArg(null), 
  ),
);

DoubleArg (Slider)

To use the slider style, pass a SliderDoubleArgStyle to the style parameter.

Example

Usage

my_widget.stories.dart
final $Default = _Story(
  args: _Args(
    progress: DoubleArg( 
      0.5, 
      style: const SliderDoubleArgStyle(min: 0.0, max: 1.0, divisions: 10), 
    ), 
  ),
);

Properties

mindoublerequired

The minimum value of the slider.

maxdoublerequired

The maximum value of the slider.

divisionsintrequired

The number of discrete divisions on the slider.

NullableDoubleArg (Slider)

Example

Usage

my_widget.stories.dart
final $Default = _Story(
  args: _Args(
    progress: NullableDoubleArg( 
      null, 
      style: const SliderDoubleArgStyle(min: 0.0, max: 1.0, divisions: 10), 
    ), 
  ),
);