KnobsBuilder class abstract

Provides helper methods for creating knobs: control elements that can be used in stories to dynamically update its properties.

It's injected into a story builder, so you can use it there:

 Story(
   name: 'Flat button',
   builder: (_, k) => MaterialButton(
     onPressed: k.boolean('Enabled', initial: true) ? () {} : null,
     child: Text(k.text('Text', initial: 'Flat button')),
   ),
 )

Constructors

KnobsBuilder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

boolean({required String label, bool initial = false}) bool
Creates checkbox with label and initial value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
options<T>({required String label, required T initial, List<Option<T>> options = const []}) → T
Creates select field with label, initial value and list of options.
slider({required String label, double initial = 0, double max = 1, double min = 0}) double
Creates slider knob with double value.
sliderInt({required String label, int initial = 0, int max = 100, int min = 0, int divisions = 100}) int
Creates slider knob with int value.
text({required String label, String initial = ''}) String
Creates text input field with label and initial value.
toString() String
A string representation of this object.
inherited

Operators

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