From 001d29975006863e8c7f044d1354832b70e621b5 Mon Sep 17 00:00:00 2001 From: User3 Date: Wed, 28 May 2025 11:01:30 +0300 Subject: [PATCH] #sprint-4 --- example/lib/card_section.dart | 1 + lib/cards/primary_card.dart | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/example/lib/card_section.dart b/example/lib/card_section.dart index dadc52a..c939e27 100644 --- a/example/lib/card_section.dart +++ b/example/lib/card_section.dart @@ -15,6 +15,7 @@ class _CardSectionState extends State { title: 'Рубашка Воскресенье для машинного вязания', category: 'Мужская одежда', price: '300', + onPressed: (VAL) {}, ), CartCard( title: 'Рубашка воскресенье для машинного вязания', diff --git a/lib/cards/primary_card.dart b/lib/cards/primary_card.dart index f40a51d..ff2012e 100644 --- a/lib/cards/primary_card.dart +++ b/lib/cards/primary_card.dart @@ -7,10 +7,12 @@ class PrimaryCard extends StatefulWidget { required this.title, required this.category, required this.price, + required this.onPressed, }); final String title; final String category; final String price; + final Function(bool isCart) onPressed; @override State createState() => _PrimaryCardState(); @@ -43,6 +45,7 @@ class _PrimaryCardState extends State { inCart ? ButtonWidget( onPressed: () { + widget.onPressed; setState(() { inCart = !inCart; }); @@ -53,6 +56,7 @@ class _PrimaryCardState extends State { ) : ButtonWidget( onPressed: () { + widget.onPressed; setState(() { inCart = !inCart; });