CartCardWidget

This commit is contained in:
PROF25-FINAL 2025-05-28 10:13:25 +03:00
parent a41d27d2e3
commit c114fcf28b
2 changed files with 95 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class StorybookApp extends StatelessWidget {
stories: [
BaseCardWidget.story,
PrimaryCardWidget.story,
CartCardWidget.story,
TabbarWidget.story,
InputWidget.story,
ChipsButtonWidget.story,

View File

@ -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,
);
},
);
}