nestedCheckboxStory top-level property
Story
nestedCheckboxStory
getter/setter pair
Implementation
Story nestedCheckboxStory = Story(
name: 'Nested Checkbox',
builder: (context) {
final rootItem = CheckboxItem(
text: 'Root',
children: [
CheckboxItem(
text: 'Parent 1',
disabled: true,
children: [
CheckboxItem(text: 'Child 1.1', value: true),
CheckboxItem(
text: 'Child 1.2',
children: [
CheckboxItem(text: 'Grandchild 1.2.1', disabled: true),
CheckboxItem(text: 'Grandchild 1.2.2'),
],
),
],
),
CheckboxItem(
text: 'Parent 2',
children: [
CheckboxItem(text: 'Child 2.1'),
CheckboxItem(text: 'Child 2.2'),
],
),
],
);
final shape = context.knobs.options(
options: [
Option(
label: 'Rounded Rectangle',
value: CheckboxShape.roundedRectangle),
Option(label: 'Rectangle', value: CheckboxShape.rectangle),
Option(label: 'Rounded', value: CheckboxShape.rounded),
],
initial: CheckboxShape.roundedRectangle,
label: 'Shape',
);
final checkedColor = context.knobs.options(
label: 'Checked Color',
options: [
Option(label: 'Primary', value: ThemeColors.primary),
Option(label: 'Secondary', value: Colors.blue),
Option(label: 'Accent', value: Colors.green),
],
initial: ThemeColors.primary,
);
return ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: 600,
minWidth: 200,
),
child: DDSNestedCheckbox(
item: rootItem,
shape: shape,
checkboxColor: checkedColor,
),
);
});