From 462ec14fe057241d3521f77de17153a31825f294 Mon Sep 17 00:00:00 2001 From: yejin <7602yejin@gmail.com> Date: Mon, 5 Jan 2026 16:28:02 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20option=20>=20varaint.normal=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/lib/src/option/wds_option.dart | 53 ++++++++++++++++++- .../lib/src/component/option_use_case.dart | 38 ++++++++++--- 2 files changed, 84 insertions(+), 7 deletions(-) diff --git a/packages/components/lib/src/option/wds_option.dart b/packages/components/lib/src/option/wds_option.dart index 1da436b..e20f01e 100644 --- a/packages/components/lib/src/option/wds_option.dart +++ b/packages/components/lib/src/option/wds_option.dart @@ -1,6 +1,12 @@ part of '../../wds_components.dart'; enum WdsOptionVariant { + normal( + maxHeight: 521, + scrollThreshold: 6, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4), + itemHeight: 44, + ), power( maxHeight: 289, scrollThreshold: 6, @@ -38,6 +44,11 @@ enum WdsOptionVariant { /// 이 때, Option은 left, right, 그리고 bottom에 `WdsColors.primary`로 칠해진 stroke를 가지며, /// 배경 색상은 `WdsColors.backgroundNormal`을 가집니다. class WdsOption extends StatelessWidget { + const WdsOption.normal({ + required this.items, + super.key, + }) : variant = WdsOptionVariant.normal; + const WdsOption.power({ required this.items, super.key, @@ -48,7 +59,7 @@ class WdsOption extends StatelessWidget { super.key, }) : variant = WdsOptionVariant.product; - /// Option의 variant (power 또는 product) + /// Option의 variant final WdsOptionVariant variant; /// OptionItem들의 리스트 @@ -199,6 +210,46 @@ abstract class WdsOptionItem { Widget build(BuildContext context, WdsOptionVariant variant); } +/// Normal variant용 OptionItem +class WdsNormalOptionItem extends WdsOptionItem { + const WdsNormalOptionItem({ + required this.label, + this.onTap, + }); + + /// 필수 라벨 + final String label; + + /// 탭 콜백 + final VoidCallback? onTap; + + static const TextStyle _labelStyle = WdsTypography.body14NormalRegular; + + @override + Widget build(BuildContext context, WdsOptionVariant variant) { + assert( + variant == WdsOptionVariant.normal, + 'NormalOptionItem은 normal variant에서만 사용 가능합니다', + ); + + return GestureDetector( + onTap: onTap, + child: Row( + children: [ + Expanded( + child: Text( + label, + style: _labelStyle.copyWith( + color: WdsColors.textNormal, + ), + ), + ), + ], + ), + ); + } +} + /// Power variant용 OptionItem class WdsPowerOptionItem extends WdsOptionItem { const WdsPowerOptionItem({ diff --git a/packages/widgetbook/lib/src/component/option_use_case.dart b/packages/widgetbook/lib/src/component/option_use_case.dart index 6f2780a..cfdec53 100644 --- a/packages/widgetbook/lib/src/component/option_use_case.dart +++ b/packages/widgetbook/lib/src/component/option_use_case.dart @@ -24,7 +24,7 @@ Widget _buildPlaygroundSection(BuildContext context) { final variant = context.knobs.object.dropdown( label: 'variant', options: WdsOptionVariant.values, - initialOption: WdsOptionVariant.power, + initialOption: WdsOptionVariant.normal, labelBuilder: (v) => v.name, ); @@ -47,9 +47,11 @@ Widget _buildPlaygroundSection(BuildContext context) { 'Scroll Threshold: ${variant.scrollThreshold}', 'Item Height: ${variant.itemHeight}px', ], - child: variant == WdsOptionVariant.power - ? WdsOption.power(items: items) - : WdsOption.product(items: items), + child: switch (variant) { + WdsOptionVariant.normal => WdsOption.normal(items: items), + WdsOptionVariant.power => WdsOption.power(items: items), + WdsOptionVariant.product => WdsOption.product(items: items), + }, ); } @@ -62,10 +64,26 @@ Widget _buildDemonstrationSection(BuildContext context) { children: [ WidgetbookSubsection( title: 'variant', - labels: ['power', 'product'], + labels: ['normal', 'power', 'product'], content: Column( spacing: 16, children: [ + WdsOption.normal( + items: [ + WdsNormalOptionItem( + label: '옵션 1', + onTap: () => debugPrint('Normal option 1 tapped'), + ), + WdsNormalOptionItem( + label: '옵션 2', + onTap: () => debugPrint('Normal option 2 tapped'), + ), + WdsNormalOptionItem( + label: '옵션 3', + onTap: () => debugPrint('Normal option 3 tapped'), + ), + ], + ), WdsOption.power( items: [ WdsPowerOptionItem( @@ -148,7 +166,14 @@ List _generateOptionItems( const String imagePath = 'https://cdn.winc.app/uploads/ppb/image/src/99824/ppb_image_file-c9a9df.jpg'; - if (variant == WdsOptionVariant.power) { + if (variant == WdsOptionVariant.normal) { + return List.generate(count, (index) { + return WdsNormalOptionItem( + label: '옵션 ${index + 1}', + onTap: () => debugPrint('Normal option ${index + 1} tapped'), + ); + }); + } else if (variant == WdsOptionVariant.power) { return List.generate(count, (index) { final label = index == 0 ? '0.00' : (-0.5 * index).toStringAsFixed(2); final hasTags = index % 3 == 1; @@ -173,6 +198,7 @@ List _generateOptionItems( ); }); } else { + // WdsOptionVariant.product return List.generate(count, (index) { return WdsProductOptionItem( index: '${index + 1}', From f81e34e5c4ad84aa7f34a030a8d2b35c510140ae Mon Sep 17 00:00:00 2001 From: yejin <7602yejin@gmail.com> Date: Mon, 5 Jan 2026 16:29:06 +0900 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20update=20version=20&=20CHANGELOG=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5525d0f..a45e568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 0.0.12 +- WdsOption > WdsOptionVaraint.normal 추가 + ### 0.0.11 - 메세지 UI (WdsToast, WdsSnackbar, WdsSectionMessage) 공통 컨트롤러 도입 - WdsHeader.search > widthFactor 수정 diff --git a/pubspec.yaml b/pubspec.yaml index af2e645..f912947 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: wds -version: 0.0.11 +version: 0.0.12 publish_to: none description: WINC Design System environment: