Merge branch 'product_detail_page' into 'development'
Product detail page See merge request Cloud_Solution/diplomatic-quarter!414merge-update-with-lab-changes
commit
48642a3c7c
@ -1,66 +1,134 @@
|
|||||||
|
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:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.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 '../cart-order-page.dart';
|
||||||
import 'CustomIcon.dart';
|
import 'CustomIcon.dart';
|
||||||
|
|
||||||
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||||
|
|
||||||
|
final PharmacyProduct product;
|
||||||
|
|
||||||
|
ProductAppBar({Key key, this.product}) : super(key: key);
|
||||||
|
|
||||||
|
AuthenticatedUserObject authenticatedUserObject =
|
||||||
|
locator<AuthenticatedUserObject>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
|
||||||
children: [
|
child: FractionallySizedBox(
|
||||||
SizedBox(
|
widthFactor: 0.95,
|
||||||
height: 30,
|
child: Column(
|
||||||
),
|
children: [
|
||||||
Row(
|
SizedBox(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
height: 30,
|
||||||
children: [
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
IconWithBg(
|
children: [
|
||||||
icon: Icons.arrow_back_ios,
|
Row(
|
||||||
color: Colors.grey,
|
children: [
|
||||||
onPress: () {
|
IconWithBg(
|
||||||
Navigator.pop(context);
|
icon: Icons.arrow_back_ios,
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
IconWithBg(
|
|
||||||
icon: Icons.shopping_cart,
|
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
onPress: () {
|
onPress: () {
|
||||||
Navigator.push(
|
Navigator.pop(context);
|
||||||
context,
|
},
|
||||||
MaterialPageRoute(
|
),
|
||||||
builder: (context) => CartOrderPage()),
|
],
|
||||||
);
|
),
|
||||||
}),
|
if(authenticatedUserObject.isLogin)
|
||||||
IconWithBg(
|
Row(
|
||||||
icon: FontAwesomeIcons.ellipsisV,
|
children: [
|
||||||
color: Colors.grey,
|
IconWithBg(
|
||||||
onPress: () {
|
icon: Icons.shopping_cart,
|
||||||
//TODO Elham*
|
color: Colors.grey,
|
||||||
// settingModalBottomSheet(context);
|
onPress: () {
|
||||||
},
|
Navigator.push(
|
||||||
),
|
context,
|
||||||
],
|
MaterialPageRoute(
|
||||||
)
|
builder: (context) => CartOrderPage()),
|
||||||
],
|
);
|
||||||
),
|
}),
|
||||||
],
|
SizedBox(width: 10,),
|
||||||
|
IconWithBg(
|
||||||
|
icon: FontAwesomeIcons.ellipsisV,
|
||||||
|
color: Colors.grey,
|
||||||
|
onPress: () {
|
||||||
|
settingModalBottomSheet(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
// TODO: implement preferredSize
|
// TODO: implement preferredSize
|
||||||
@override
|
@override
|
||||||
Size get preferredSize => Size(double.maxFinite, 50);
|
Size get preferredSize => Size(double.maxFinite, 50);
|
||||||
|
|
||||||
|
settingModalBottomSheet(context) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return Container(
|
||||||
|
child: new Wrap(
|
||||||
|
children: <Widget>[
|
||||||
|
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<CompareList>(context, listen: false)
|
||||||
|
.addItem(specificationData),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue