Skip to content

Commit

Permalink
feat: implemented status chip widgetbook use case
Browse files Browse the repository at this point in the history
fix: set rounded to default to true
  • Loading branch information
DE7924 committed Nov 5, 2024
1 parent 5505885 commit 5f0c6e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions example/widgetbook/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class _HotReloadState extends State<HotReload> {
WidgetbookUseCase(name: 'Filter Chip', builder: (context) => filterChipUseCase(context)),
WidgetbookUseCase(name: 'Input Chip', builder: (context) => inputChipUseCase(context)),
WidgetbookUseCase(name: 'Assist Chip', builder: (context) => assistChipUseCase(context)),
WidgetbookUseCase(name: 'Status Chip', builder: (context) => statusChipUseCase(context)),
],
),
WidgetbookComponent(
Expand Down
11 changes: 11 additions & 0 deletions example/widgetbook/pages/components/chip_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ Widget assistChipUseCase(BuildContext context) {
),
);
}

Widget statusChipUseCase(BuildContext context) {
return WidgetbookScaffold(
builder: (context, _) => ZetaStatusChip(
label: context.knobs.string(label: 'Label', initialValue: 'Label'),
draggable: context.knobs.boolean(label: 'Draggable', initialValue: false),
rounded: context.knobs.boolean(label: 'Rounded', initialValue: true),
onDragCompleted: () => print('Drag completed'),
),
);
}
14 changes: 8 additions & 6 deletions lib/src/components/chips/status_chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ZetaStatusChip extends ZetaStatelessWidget {
const ZetaStatusChip({
super.key,
required this.label,
super.rounded,
super.rounded = true,
this.draggable = false,
this.data,
this.onDragCompleted,
Expand Down Expand Up @@ -94,11 +94,13 @@ class _Child extends StatelessWidget {
return Container(
decoration: BoxDecoration(
color: Zeta.of(context).colors.surfaceWarm,
borderRadius: BorderRadius.all(
Radius.circular(
Zeta.of(context).spacing.small,
),
),
borderRadius: context.rounded
? BorderRadius.all(
Radius.circular(
Zeta.of(context).spacing.small,
),
)
: null,
),
padding: EdgeInsets.symmetric(
horizontal: Zeta.of(context).spacing.small,
Expand Down

0 comments on commit 5f0c6e5

Please sign in to comment.