From 5f0c6e51455916eb41a2eaca8af0efab9c46f091 Mon Sep 17 00:00:00 2001 From: Daniel Eshkeri Date: Tue, 5 Nov 2024 17:20:41 +0000 Subject: [PATCH] feat: implemented status chip widgetbook use case fix: set rounded to default to true --- example/widgetbook/main.dart | 1 + .../pages/components/chip_widgetbook.dart | 11 +++++++++++ lib/src/components/chips/status_chip.dart | 14 ++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/example/widgetbook/main.dart b/example/widgetbook/main.dart index 6a5202c6..7eeba843 100644 --- a/example/widgetbook/main.dart +++ b/example/widgetbook/main.dart @@ -163,6 +163,7 @@ class _HotReloadState extends State { 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( diff --git a/example/widgetbook/pages/components/chip_widgetbook.dart b/example/widgetbook/pages/components/chip_widgetbook.dart index d8e7848a..057d6d6c 100644 --- a/example/widgetbook/pages/components/chip_widgetbook.dart +++ b/example/widgetbook/pages/components/chip_widgetbook.dart @@ -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'), + ), + ); +} diff --git a/lib/src/components/chips/status_chip.dart b/lib/src/components/chips/status_chip.dart index 7cad4fa1..079fd2e7 100644 --- a/lib/src/components/chips/status_chip.dart +++ b/lib/src/components/chips/status_chip.dart @@ -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, @@ -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,