storybook_flutter
storybook_flutter copied to clipboard
Global knob to have values shared between all stories
Need to have a Knob that keep its value when changing between stories.
For example, a Font Size options knob that is present on all stories:
context.knobs.options(
label: 'Font Size',
initial: '12',
options: [
const Option<String>(
label: '10',
value: '10',
),
const Option<String>(
label: '11',
value: '11',
),
const Option<String>(
label: '12',
value: '12',
),
const Option<String>(
label: '13',
value: '13',
),
const Option<String>(
label: '14',
value: '14',
)
],
);

The "issue" is when I select a different value, let's say 11, and navigates to a different story, the "Font Size" knob value gets reset to its initial
value. So there is a need to select the knob again.
Is there a way I could declare a global knob of "settings" or have its initial value to be kept between all stories??