-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbottom_sheet_widgetbook.dart
63 lines (60 loc) · 1.97 KB
/
bottom_sheet_widgetbook.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';
import '../test/test_components.dart';
WidgetbookComponent bottomSheetWidgetBook() {
return WidgetbookComponent(
isInitiallyExpanded: false,
name: 'Bottom Sheet',
useCases: [
WidgetbookUseCase(
name: 'Content',
builder: (context) => WidgetbookTestWidget(
themeMode: ThemeMode.dark,
widget: Padding(
padding: const EdgeInsets.all(20),
child: _bottomSheet(context),
),
),
),
WidgetbookUseCase(
name: 'Live',
builder: (context) {
final sheet = _bottomSheet(context);
return WidgetbookTestWidget(
themeMode: ThemeMode.dark,
widget: Padding(
padding: const EdgeInsets.all(20),
child: ElevatedButton(
child: Text('Open'),
onPressed: () {
showModalBottomSheet(context: context, builder: (_) => sheet);
},
),
),
);
},
),
],
);
}
ZetaBottomSheet _bottomSheet(BuildContext context) {
return ZetaBottomSheet(
centerTitle: context.knobs.boolean(label: 'Center title', initialValue: true),
title: context.knobs.string(label: 'Title', initialValue: 'Title'),
body: Wrap(
spacing: 12,
runSpacing: 12,
children: List.generate(
6,
(index) => ZetaMenuItem(
type: context.knobs.boolean(label: 'Grid') ? ZetaMenuItemType.vertical : ZetaMenuItemType.horizontal,
leading: context.knobs.boolean(label: 'Leading Icon') ? Icon(ZetaIcons.star_round) : null,
trailing: context.knobs.boolean(label: 'Trailing Icon') ? Icon(ZetaIcons.chevron_right_round) : null,
label: Text('Menu Item'),
onTap: context.knobs.boolean(label: 'Disabled') ? null : () {},
),
),
),
);
}