updated new flutter version
This commit is contained in:
@@ -22,6 +22,7 @@ class AddRemoveButton extends StatefulWidget {
|
||||
final bool addOnly;
|
||||
final int cartLineItemIndex;
|
||||
final bool addToBasket;
|
||||
final bool onHovor;
|
||||
|
||||
AddRemoveButton({
|
||||
this.product,
|
||||
@@ -29,6 +30,7 @@ class AddRemoveButton extends StatefulWidget {
|
||||
this.addOnly = false,
|
||||
this.cartLineItemIndex = -1,
|
||||
this.addToBasket = false,
|
||||
this.onHovor = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -72,7 +74,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 5.0, bottom: 5.0, left: 32.0, right: 32.0),
|
||||
child: Text(
|
||||
'x$_qty'
|
||||
'x$_qty'
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -121,13 +123,16 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
padding: EdgeInsets.all(10),
|
||||
position: BadgePosition.topEnd(top: -15, end: -10),
|
||||
badgeColor: Colors.lightBlueAccent,
|
||||
child: RaisedButton.icon(
|
||||
padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20),
|
||||
elevation: 2.0,
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(10.0),
|
||||
child: ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.redAccent,
|
||||
onPrimary: Colors.white,
|
||||
padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20),
|
||||
elevation: 2.0,
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(10.0),
|
||||
),
|
||||
),
|
||||
color: Colors.redAccent,
|
||||
icon: Icon(
|
||||
Icons.shopping_basket_outlined,
|
||||
size: 32.0,
|
||||
@@ -147,13 +152,15 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return RaisedButton.icon(
|
||||
padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20),
|
||||
elevation: 2.0,
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(10.0),
|
||||
return ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.redAccent,
|
||||
padding: EdgeInsets.only(left: 32, right: 32, top: 20, bottom: 20),
|
||||
elevation: 2.0,
|
||||
shape: new RoundedRectangleBorder(
|
||||
borderRadius: new BorderRadius.circular(10.0),
|
||||
),
|
||||
),
|
||||
color: Colors.redAccent,
|
||||
icon: Icon(
|
||||
Icons.shopping_basket_outlined,
|
||||
size: 32.0,
|
||||
@@ -172,7 +179,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
},
|
||||
);
|
||||
}
|
||||
}else if (widget.addOnly) {
|
||||
} else if (widget.addOnly) {
|
||||
return Container(
|
||||
key: startKey,
|
||||
padding: EdgeInsets.all(0.0),
|
||||
@@ -235,6 +242,9 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
],
|
||||
);
|
||||
} else {
|
||||
if (!widget.onHovor && _qty == 0) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
return new Row(
|
||||
key: startKey,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
@@ -337,28 +347,28 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
if (widget.cartLineItemIndex != -1) {
|
||||
if (cartInfo.productList[widget.cartLineItemIndex].quantity <= 1) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).warning),
|
||||
content: Text(S.of(context).are_you_sure_to_remove_the_item),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text(S.of(context).cancel),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(S.of(context).yes_i_am_sure),
|
||||
onPressed: () {
|
||||
_removeCartLineItem();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(S.of(context).warning),
|
||||
content: Text(S.of(context).are_you_sure_to_remove_the_item),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text(S.of(context).cancel),
|
||||
onPressed: () {
|
||||
Navigator.of(context).maybePop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(S.of(context).yes_i_am_sure),
|
||||
onPressed: () {
|
||||
_removeCartLineItem();
|
||||
Navigator.of(context).maybePop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
_removeCartLineItem();
|
||||
|
||||
Reference in New Issue
Block a user