Color Arg

The color arg renders a combination of a color preview and input fields in the Widgetbook UI where you can dynamically pick a Color value for a widget property.

Variants

The color arg has two variants:

  • ColorArg: Allows you to pick a Color value. Does not accept null values.
  • NullableColorArg: Allows you to pick a Color value or set it to null. Useful when the property is optional.

ColorArg

Example

Usage

my_widget.stories.dart
final $Default = _Story(
  args: _Args(
    color: ColorArg(Colors.blue), 
  ),
);

NullableColorArg

Example

Usage

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