From c114fcf28bd270a0a2a0a3b2f81c2db55baa8c68 Mon Sep 17 00:00:00 2001 From: PROF25-FINAL Date: Wed, 28 May 2025 10:13:25 +0300 Subject: [PATCH] CartCardWidget --- example/lib/storybook.dart | 1 + lib/src/presentation/widgets/card_widget.dart | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/example/lib/storybook.dart b/example/lib/storybook.dart index 9dc5a3d..381f1c2 100644 --- a/example/lib/storybook.dart +++ b/example/lib/storybook.dart @@ -14,6 +14,7 @@ class StorybookApp extends StatelessWidget { stories: [ BaseCardWidget.story, PrimaryCardWidget.story, + CartCardWidget.story, TabbarWidget.story, InputWidget.story, ChipsButtonWidget.story, diff --git a/lib/src/presentation/widgets/card_widget.dart b/lib/src/presentation/widgets/card_widget.dart index 2d87e37..84a6a8d 100644 --- a/lib/src/presentation/widgets/card_widget.dart +++ b/lib/src/presentation/widgets/card_widget.dart @@ -165,3 +165,97 @@ class PrimaryCardWidget extends BaseCardWidget { }, ); } + +class CartCardWidget extends BaseCardWidget { + final String label; + final int price; + final int count; + + CartCardWidget({ + super.key, + required super.theme, + required this.label, + required this.price, + required this.count, + }) : super( + width: 335.w, + height: null, + child: Padding( + padding: EdgeInsets.all(16.r), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 34.h, + children: [ + Row( + children: [ + Flexible( + child: Text( + label, + style: theme.styles.headlineMedium16.copyWith( + color: theme.palette.blackOld, + ), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 4.h), + child: Text( + "$price ₽", + style: theme.styles.title3Medium17.copyWith( + color: theme.palette.blackOld, + ), + ), + ), + Padding( + padding: EdgeInsets.only(right: 106.w), + child: Text( + "$count штук", + style: theme.styles.textRegular15.copyWith( + color: theme.palette.blackOld, + ), + ), + ), + ], + ), + ], + ), + ), + ); + + static Story get story => Story( + name: "CartCard", + builder: (BuildContext context) { + var theme = CustomTheme.of(context); + String label = context.knobs.text( + label: "Label", + initial: "Рубашка воскресенье для машинного вязания", + ); + int price = context.knobs.sliderInt( + label: "Price", + initial: 300, + min: 0, + max: 300000, + ); + int count = context.knobs.sliderInt( + label: "Count", + initial: 1, + min: 1, + max: 300, + ); + + return CartCardWidget( + theme: theme, + label: label, + price: price, + count: count, + ); + }, + ); +}