|
|
|
|
@ -25,19 +25,9 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
final bool isInWishList;
|
|
|
|
|
final Function addToCartFunction;
|
|
|
|
|
|
|
|
|
|
ProductAppBar({Key key, this.product, this.model, this.addToWishlistFunction, this.quantity, this.deleteFromWishlistFunction, this.isInWishList, this.addToCartFunction}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
ProductAppBar(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.product,
|
|
|
|
|
this.model,
|
|
|
|
|
this.addToWishlistFunction,
|
|
|
|
|
this.quantity,
|
|
|
|
|
this.deleteFromWishlistFunction,
|
|
|
|
|
this.isInWishList, this.addToCartFunction})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -75,25 +65,29 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
onPress: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => CartOrderPage()),
|
|
|
|
|
MaterialPageRoute(builder: (context) => CartOrderPage()),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
if(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount !=0)
|
|
|
|
|
Positioned(
|
|
|
|
|
top:0, right: -1.0,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.red[800],
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
|
|
|
|
|
if (Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount != 0)
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: -1.0,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.red[800],
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(left: 5, right: 4.5),
|
|
|
|
|
height: 18,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Texts(
|
|
|
|
|
Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(),
|
|
|
|
|
style: "caption",
|
|
|
|
|
medium: true,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.only(left: 5, right: 4.5),
|
|
|
|
|
height: 18,
|
|
|
|
|
child: Center(child: Texts(Provider.of<OrderPreviewViewModel>(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -135,16 +129,12 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (quantity > 0) {
|
|
|
|
|
{
|
|
|
|
|
await addToCartFunction(
|
|
|
|
|
quantity: quantity,
|
|
|
|
|
itemID: itemID,
|
|
|
|
|
model: model);
|
|
|
|
|
await addToCartFunction(quantity: quantity, itemID: itemID, model: model);
|
|
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: "you should add quantity");
|
|
|
|
|
AppToast.showErrorToast(message: "you should add quantity");
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
ListTile(
|
|
|
|
|
@ -153,9 +143,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
color: !isInWishList ? Colors.white : Colors.red[800],
|
|
|
|
|
),
|
|
|
|
|
title: Text(
|
|
|
|
|
isInWishList
|
|
|
|
|
? TranslationBase.of(context).removeFromWishlist
|
|
|
|
|
: TranslationBase.of(context).addToWishlist,
|
|
|
|
|
isInWishList ? TranslationBase.of(context).removeFromWishlist : TranslationBase.of(context).addToWishlist,
|
|
|
|
|
),
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (isInWishList)
|
|
|
|
|
@ -170,8 +158,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
|
|
|
|
TranslationBase.of(context).compare,
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Provider.of<CompareList>(context, listen: false)
|
|
|
|
|
.addItem(specificationData);
|
|
|
|
|
Provider.of<CompareList>(context, listen: false).addItem(specificationData);
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|