import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import '../../../../locator.dart'; import '../../compare-list.dart'; import '../cart-order-page.dart'; import 'CustomIcon.dart'; class ProductAppBar extends StatelessWidget with PreferredSizeWidget { final PharmacyProduct product; ProductAppBar({Key key, this.product}) : super(key: key); AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { return Container( color: Colors.white, child: FractionallySizedBox( widthFactor: 0.95, child: Column( children: [ SizedBox( height: 30, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ IconWithBg( icon: Icons.arrow_back_ios, color: Colors.grey, onPress: () { Navigator.pop(context); }, ), ], ), if(authenticatedUserObject.isLogin) Row( children: [ IconWithBg( icon: Icons.shopping_cart, color: Colors.grey, onPress: () { Navigator.push( context, MaterialPageRoute( builder: (context) => CartOrderPage()), ); }), SizedBox(width: 10,), IconWithBg( icon: FontAwesomeIcons.ellipsisV, color: Colors.grey, onPress: () { settingModalBottomSheet(context); }, ), ], ) ], ), ], ), ), ); } @override // TODO: implement preferredSize @override Size get preferredSize => Size(double.maxFinite, 50); settingModalBottomSheet(context) { showModalBottomSheet( context: context, builder: (BuildContext bc) { return Container( child: new Wrap( children: [ if( product.stockAvailability != 'Out of stock') new ListTile( leading: Icon(Icons.shopping_cart), title: Text( TranslationBase.of(context).addToCart, ), onTap: () => { if (price > 0) {addToCartFunction(price, itemID, context)} else { AppToast.showErrorToast( message: "you should add quantity") } }), ListTile( leading: Icon(Icons.favorite_border), title: Text( TranslationBase.of(context).addToWishlist, ), onTap: () => {addToWishlistFunction(itemID)}, ), ListTile( leading: Icon(Icons.compare), title: Text( TranslationBase.of(context).compare, ), onTap: () => { Provider.of(context, listen: false) .addItem(specificationData), }, ), ], ), ); }); } }