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')),
   ),
 )
Implementers

Constructors

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

Properties

hashCode int
The hash code for this object.
no setterinherited
nullable NullableKnobsBuilder
Create knobs with nullable values
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Operators

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