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