Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into pharmacy_fix_bugs

 Conflicts:
	lib/pages/pharmacies/screens/product-details/product-detail.dart
	lib/pages/pharmacies/screens/product-details/recommended_products.dart
	lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart
	lib/widgets/others/app_scafold_detail_page.dart
merge-update-with-lab-changes
mosazaid 4 years ago
commit 4d37bc2958

@ -38,7 +38,7 @@ class ProductDetailViewModel extends BaseViewModel{
Future getProductLocationData() async {
hasError = false;
setState(ViewState.Busy);
setState(ViewState.BusyLocal);
await _productDetailService.getProductAvailabiltyDetail();
if (_productDetailService.hasError) {
error = _productDetailService.error;

@ -51,6 +51,9 @@ class _PickupLocationState extends State<PickupLocation> {
void initState() {
super.initState();
_getCurrentLocation();
setState(() {
});
}
_getCurrentLocation() async {
@ -61,6 +64,7 @@ class _PickupLocationState extends State<PickupLocation> {
_longitude = 0;
_latitude = 0;
});
}
@override
@ -89,8 +93,8 @@ class _PickupLocationState extends State<PickupLocation> {
context,
FadePage(
page: PickupLocationFromMap(
latitude: _latitude,
longitude: _longitude,
latitude: _latitude??0,
longitude: _longitude??0,
onPick: (value) {
setState(() {
_result = value;

@ -49,7 +49,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) {
//TODO Elham* fix all services in order handel errors in better way in the service
if (widget.productType == 1) {
model.getFinalProducts(i: id);
appBarTitle = TranslationBase.of(context).products;

@ -137,7 +137,7 @@ reviewDetails(data, rate, myRate) {
: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: data.product.price.toString() +
text: data.product.quantity.toString() +
" " +
data.product.currency,
style: TextStyle(

@ -6,80 +6,85 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
class AvailabilityInfo extends StatelessWidget {
final ProductDetailViewModel previousModel;
const AvailabilityInfo({Key key, this.previousModel}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductLocationData(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
baseViewModel: model,
child: model.productLocationService.length == 0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noLocationAvailable,
),
)
: ListView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Image.network(model
.productLocationService[index].projectImageUrl),
),
SizedBox(
width: 10,
),
Expanded(
flex: 4,
child: Text(
model.productLocationService[index]
.locationDescription +
"\n" +
convertCityName(
model.productLocationService[0].cityName
.toString(),
),
style: TextStyle(fontSize: 12),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {},
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
),
],
),
Divider(height: 1.2, color: Colors.grey)
],
return previousModel.productLocationService.length == 0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noLocationAvailable,
),
)
: ListView.builder(
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: previousModel.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Image.network(previousModel
.productLocationService[index].projectImageUrl),
),
SizedBox(
width: 10,
),
Expanded(
flex: 4,
child: Text(
previousModel.productLocationService[index]
.locationDescription +
"\n" +
convertCityName(
previousModel.productLocationService[0].cityName
.toString(),
),
style: TextStyle(fontSize: 12),
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.location_on),
color: Colors.red,
onPressed: () {},
),
),
Expanded(
flex: 1,
child: IconButton(
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {},
),
);
},
),
],
),
),
Divider(height: 1.2, color: Colors.grey)
],
),
);
},
);
}
convertCityName(txt) {
String stringTxt;
String newTxt;
stringTxt = txt.toString();
newTxt = stringTxt.split('.')[1];
return newTxt;
}
}

@ -1,5 +1,4 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:flutter/material.dart';
class DiscountDescription extends StatelessWidget {

@ -1,8 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
@ -22,12 +19,12 @@ class FooterWidget extends StatefulWidget {
final PharmacyProduct item;
final Function addToCartFunction;
int price;
int quantity;
bool isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
{this.price, this.isOverQuantity = false, this.addToCartFunction});
{this.quantity, this.isOverQuantity = false, this.addToCartFunction});
@override
_FooterWidgetState createState() => _FooterWidgetState();
@ -100,7 +97,7 @@ class _FooterWidgetState extends State<FooterWidget> {
QuantityBox(
label: i,
onTapFunc: onChangeValue,
isSelected: widget.price == i),
isSelected: widget.quantity == i),
Column(
children: [
Container(
@ -114,14 +111,14 @@ class _FooterWidgetState extends State<FooterWidget> {
decoration: InputDecoration(
labelText: 'quantity #'),
onChanged: (text) {
print(widget.price);
print(widget.quantity);
print(widget.quantityLimit);
if (int.tryParse(text) == null) {
text = '';
} else {
setState(() {
widget.price = int.parse(text);
if (widget.price >=
widget.quantity = int.parse(text);
if (widget.quantity >=
widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
@ -159,7 +156,7 @@ class _FooterWidgetState extends State<FooterWidget> {
Expanded(
flex: 4,
child: Text(
widget.price.toString(),
widget.quantity.toString(),
style: TextStyle(fontSize: 20),
),
),
@ -189,17 +186,18 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.45,
child: SecondaryButton(
label: TranslationBase.of(context).addToCart.toUpperCase(),
disabled: !widget.isAvailable && widget.price > 0 ||
widget.price > widget.quantityLimit ||
disabled: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null,
onTap: () {
disableColor: Colors.green[400],
onTap: () async {
if (!authenticatedUserObject.isLogin) {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
} else
widget.addToCartFunction(
widget.price, widget.item.id, context);
await widget.addToCartFunction(
widget.quantity, widget.item.id, context);
},
borderRadius: 5,
color: Colors.green,
@ -212,20 +210,21 @@ class _FooterWidgetState extends State<FooterWidget> {
width: MediaQuery.of(context).size.width * 0.35,
child: SecondaryButton(
label: TranslationBase.of(context).buyNow.toUpperCase(),
disabled: !widget.isAvailable && widget.price > 0 ||
widget.price > widget.quantityLimit ||
disabled: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null,
onTap: () {
widget.addToCartFunction(
widget.price, widget.item.id, context);
onTap: () async {
await widget.addToCartFunction(
widget.quantity, widget.item.id, context);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
borderRadius: 5,
color: !widget.isAvailable && widget.price > 0 ||
widget.price > widget.quantityLimit ||
disableColor: Colors.grey[700],
color: !widget.isAvailable && widget.quantity > 0 ||
widget.quantity > widget.quantityLimit ||
widget.item.rxMessage != null
? Colors.grey
: Colors.grey[800],
@ -240,13 +239,12 @@ class _FooterWidgetState extends State<FooterWidget> {
onChangeValue(int i) {
setState(() {
///TODO Elham* Check this if its good
widget.price = i;
if (widget.price >= widget.quantityLimit) {
widget.quantity = i;
if (widget.quantity >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
return widget.quantity;
}
});
}

@ -2,33 +2,27 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'ProductAppBar.dart';
import 'availability_info.dart';
import 'details_info.dart';
import 'discount_description.dart';
import 'footor/footer-widget.dart';
import 'shared/product_details_app_bar.dart';
int price = 0;
bool isOverQuantity = false;
bool isInWishList = false;
bool isSelected = true;
String itemID;
var customerId;
CompareList compareItems = new CompareList();
PharmacyProduct specificationData;
class ProductDetailPage extends StatefulWidget {
@ -40,23 +34,27 @@ class ProductDetailPage extends StatefulWidget {
__ProductDetailPageState createState() => __ProductDetailPageState();
}
class __ProductDetailPageState extends State<ProductDetailPage>
with SingleTickerProviderStateMixin {
TabController _tabController;
class __ProductDetailPageState extends State<ProductDetailPage>{
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isTrue = true;
bool isDetails = true;
bool isReviews = false;
bool isAvailability = false;
String customerId;
bool isSelected = true;
bool isOverQuantity = false;
bool isInWishList = false;
int quantity = 0;
checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel();
await x.checkWishlistData();
ProductDetailViewModel model = new ProductDetailViewModel();
await model.checkWishlistData();
for (int i = 0; i < x.wishListItems.length; i++) {
if (itemID == x.wishListItems[i].product.id) {
for (int i = 0; i < model.wishListItems.length; i++) {
if (itemID == model.wishListItems[i].product.id) {
isInWishList = true;
break;
} else {
@ -68,9 +66,8 @@ class __ProductDetailPageState extends State<ProductDetailPage>
}
void initState() {
price = 1;
quantity = 1;
specificationData = widget.product;
_tabController = TabController(length: 3, vsync: this);
userInfo();
super.initState();
@ -78,7 +75,6 @@ class __ProductDetailPageState extends State<ProductDetailPage>
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@ -93,17 +89,21 @@ class __ProductDetailPageState extends State<ProductDetailPage>
}
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
final screenSize = MediaQuery.of(context).size;
return BaseView<ProductDetailViewModel>(
builder: (_, model, wi) => AppScaffold(
allowAny: true,
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
isPharmacy: true,
baseViewModel: model,
isShowDecPage: false,
customAppBar: ProductAppBar(product: widget.product,),
customAppBar: ProductAppBar(
product: widget.product,
model: model,
addToWishlistFunction: (item) {
addToWishlistFunction(itemID:item,model:model);
setState(() {});
},
),
body: SingleChildScrollView(
child: Column(
children: [
@ -135,19 +135,15 @@ class __ProductDetailPageState extends State<ProductDetailPage>
widget.product,
customerId: customerId,
addToWishlistFunction: (item) {
model.addToWishlistData(itemID);
setState(() {
});
addToWishlistFunction(itemID:item,model:model);
setState(() {});
},
deleteFromWishlistFunction: (item) {
model.deletWishlistData(itemID);
setState(() {
});
deleteFromWishlistFunction(itemID: item, model: model);
setState(() {});
},
notifyMeWhenAvailable: (context, itemId) {
notifyMeWhenAvailable(context, itemId);
notifyMeWhenAvailable(itemId:itemId, customerId: customerId, model: model);
},
isInWishList: isInWishList,
),
@ -178,78 +174,6 @@ class __ProductDetailPageState extends State<ProductDetailPage>
SizedBox(
height: 6,
),
// Container(
// height: 500,
// color: Colors.white,
// child: Scaffold(
// backgroundColor: Colors.white,
// extendBodyBehindAppBar: false,
// appBar: PreferredSize(
// preferredSize: Size.fromHeight(
// MediaQuery.of(context).size.height * 0.070),
// child: Container(
// height: MediaQuery.of(context).size.height * 0.070,
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Theme.of(context).dividerColor,
// width: 0.5), //width: 0.7
// ),
// color: Colors.white),
// child: Center(
// child: TabBar(
// isScrollable: false,
// controller: _tabController,
// // indicatorColor: Colors.transparent,
// indicatorWeight: 1.0,
// indicatorSize: TabBarIndicatorSize.tab,
// indicatorColor:Colors.green,
// labelColor: Theme.of(context).primaryColor,
// labelPadding: EdgeInsets.only(
// top: 0, left: 0, right: 0, bottom: 0),
// unselectedLabelColor: Colors.grey[800],
// tabs: [
// tabWidget(screenSize, _activeTab == 0,
// TranslationBase.of(context).details,
// ),
// tabWidget(screenSize, _activeTab == 1,
// TranslationBase.of(context).review,
// ),
// tabWidget(screenSize, _activeTab == 2,
// TranslationBase.of(context).availability),
// ],
// ),
// ),
// ),
// ),
// body: Column(
// children: [
// Expanded(
// child: TabBarView(
// physics: BouncingScrollPhysics(),
// controller: _tabController,
// children: [
// DetailsInfo(
// product: widget.product,
// ),
// ReviewsInfo(
// product: widget.product,
// ),
// AvailabilityInfo()
// ],
// ),
// ),
//
// ],
// ),
// ),
// ),
SizedBox(
height: 6,
),
//TODO Elham* Remove this
Container(
// width: 500,
margin: EdgeInsets.only(bottom: 6),
@ -291,7 +215,14 @@ class __ProductDetailPageState extends State<ProductDetailPage>
Column(
children: [
FlatButton(
onPressed: () {
onPressed: () async {
if(widget.product.approvedTotalReviews>0) {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getProductReviewsData(
widget.product.id);
GifLoaderDialogUtils.hideDialog(context);
}
setState(() {
isDetails = false;
isReviews = true;
@ -319,7 +250,12 @@ class __ProductDetailPageState extends State<ProductDetailPage>
Column(
children: [
FlatButton(
onPressed: () {
onPressed: () async {
GifLoaderDialogUtils.showMyDialog(
context);
await model.getProductLocationData();
GifLoaderDialogUtils.hideDialog(context);
setState(() {
isDetails = false;
isReviews = false;
@ -353,32 +289,16 @@ class __ProductDetailPageState extends State<ProductDetailPage>
: isReviews
? ReviewsInfo(
product: widget.product,
previousModel: model,
)
: isAvailability
? AvailabilityInfo()
? AvailabilityInfo(
previousModel: model,
)
: Container(),
],
),
),
///TODO Elham* check if we need recommanded
// Row(
// children: [
// customerId != null
// ? Container(
// width: 410,
// height: 50,
// color: Colors.white,
// child: Texts(
// TranslationBase.of(context).recommended,
// bold: true,
// ),
// )
// : Container(),
// ],
// ),
// RecommendedProducts(product: widget.product)
SizedBox(
height: 80,
)
@ -391,83 +311,33 @@ class __ProductDetailPageState extends State<ProductDetailPage>
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product,
price: price,
quantity: quantity,
isOverQuantity: isOverQuantity,
addToCartFunction: addToCartFunction,
),
),
);
));
}
}
class CustomDivider extends StatelessWidget {
const CustomDivider({
Key key,
this.color,
}) : super(key: key);
final Color color;
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = true;
await model.addToWishlistData(itemID);
}
@override
Widget build(BuildContext context) {
return Container(
width: 120,
height: 2,
color: color,
);
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
isInWishList = false;
await model.deletWishlistData(itemID);
}
}
convertCityName(txt) {
String stringTxt;
String newTxt;
stringTxt = txt.toString();
newTxt = stringTxt.split('.')[1];
return newTxt;
}
addToCartFunction(quantity, itemID, BuildContext context) async {
addToCartFunction({quantity, itemID, BuildContext context,ProductDetailViewModel model}) async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID).then((value) {
GifLoaderDialogUtils.hideDialog(context);
});
await model.addToCartData(quantity, itemID);
GifLoaderDialogUtils.hideDialog(context);
}
notifyMeWhenAvailable(context, itemId) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.notifyMe(customerId, itemId);
notifyMeWhenAvailable({itemId, customerId,ProductDetailViewModel model }) async {
await model.notifyMe(customerId, itemId);
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishList = false;
await x.deletWishlistData(itemID);
}
//TODO Elham* move to file
Widget tabWidget(
Size screenSize,
bool isActive,
String title,
) {
return Center(
child: Container(
height: screenSize.height * 0.070,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
title,
fontSize: SizeConfig.textMultiplier * 1.5,
// color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
],
),
),
);
}

@ -10,7 +10,7 @@ import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../../../locator.dart';
import 'CustomIcon.dart';
import 'shared/icon_with_bg.dart';
class ProductNameAndPrice extends StatefulWidget {
BuildContext context;

@ -15,9 +15,23 @@ import 'package:rating_bar/rating_bar.dart';
class RecommendedProducts extends StatefulWidget {
final PharmacyProduct product;
final ProductDetailViewModel productDetailModel;
final String customerId;
final ProductDetailViewModel productDetailViewModel;
final bool isOverQuantity;
final bool isInWishList;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
const RecommendedProducts({Key key, this.product, this.productDetailModel}) : super(key: key);
RecommendedProducts(
{Key key,
this.product,
this.productDetailViewModel,
this.customerId,
this.isOverQuantity = false,
this.isInWishList = false,
this.addToWishlistFunction,
this.deleteFromWishlistFunction})
: super(key: key);
@override
_RecommendedProductsState createState() => _RecommendedProductsState();
@ -41,273 +55,235 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
padding: EdgeInsets.only(bottom: 5),
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model
.getRecommendedProducts(widget.product.id),
onModelReady: (model) =>
model.getRecommendedProducts(widget.product.id),
builder: (_, model, wi) => Container(
child:
model.recommendedProductList.length != null
child: model.recommendedProductList.length != null
? ListView.builder(
scrollDirection:
Axis.horizontal,
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model
.recommendedProductList
.length,
itemCount: model.recommendedProductList.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () async {
GifLoaderDialogUtils
.showMyDialog(
context);
RecommendedProductModel
data =
model.recommendedProductList[
index];
GifLoaderDialogUtils.showMyDialog(context);
RecommendedProductModel data =
model.recommendedProductList[index];
var json = data.toJson();
PharmacyProduct product =
new PharmacyProduct
.fromJson(json);
await Navigator
.pushReplacement(
new PharmacyProduct.fromJson(json);
await Navigator.pushReplacement(
context,
FadePage(
page:
ProductDetailPage(
product),
page: ProductDetailPage(product),
),
);
GifLoaderDialogUtils
.hideDialog(context);
GifLoaderDialogUtils.hideDialog(context);
},
child: Card(
elevation: 2,
shape:
RoundedRectangleBorder(
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors
.grey[300],
width: 2),
borderRadius:
BorderRadius
.circular(10),
color: Colors.grey[300], width: 2),
borderRadius: BorderRadius.circular(10),
),
margin:
EdgeInsets.symmetric(
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
),
child: Container(
decoration:
BoxDecoration(
borderRadius:
BorderRadius.all(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(15),
),
),
padding: EdgeInsets
.symmetric(
horizontal: 4),
width: MediaQuery.of(
context)
.size
.width /
3,
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
CrossAxisAlignment.start,
children: [
Stack(children: [
Container(
child: Align(
alignment:
Alignment
.topRight,
child:
IconButton(
icon: Icon(model.recommendedProductList[index].isinwishlist !=
true
? Icons
.favorite_border
: Icons
.favorite),
color: model.recommendedProductList[index].isinwishlist !=
true
? Colors
.grey
: Colors
.red,
onPressed:
() async {
if (customerId !=
null) {
if (!isInWishList &&
model.recommendedProductList[index].isinwishlist !=
alignment: Alignment.topRight,
child: IconButton(
icon: Icon(model
.recommendedProductList[
index]
.isinwishlist !=
true
? Icons.favorite_border
: Icons.favorite),
color: model
.recommendedProductList[
index]
.isinwishlist !=
true
? Colors.grey
: Colors.red,
onPressed: () async {
if (widget.customerId != null) {
if (!widget.isInWishList &&
model
.recommendedProductList[
index]
.isinwishlist !=
true) {
GifLoaderDialogUtils.showMyDialog(
context);
await widget.productDetailModel.addToWishlistData(model
.recommendedProductList[index]
.id);
GifLoaderDialogUtils
.showMyDialog(context);
await widget.addToWishlistFunction(
itemID: model
.recommendedProductList[
index]
.id,
model: widget
.productDetailViewModel);
// checkWishlist();
GifLoaderDialogUtils.hideDialog(
context);
setState(
() {
model.recommendedProductList[index].isinwishlist =
true;
});
GifLoaderDialogUtils
.hideDialog(context);
setState(() {
model
.recommendedProductList[
index]
.isinwishlist = true;
});
} else {
GifLoaderDialogUtils.showMyDialog(
context);
await deleteFromWishlistFunction(model
.recommendedProductList[index]
.id);
GifLoaderDialogUtils.hideDialog(
context);
setState(
() {
model.recommendedProductList[index].isinwishlist =
false;
});
GifLoaderDialogUtils
.showMyDialog(context);
await widget.deleteFromWishlistFunction(
itemID: model
.recommendedProductList[
index]
.id,
model: widget
.productDetailViewModel);
GifLoaderDialogUtils
.hideDialog(context);
setState(() {
model
.recommendedProductList[
index]
.isinwishlist = false;
});
}
} else {
return;
}
setState(
() {
// checkWishlist();
});
setState(() {
// checkWishlist();
});
},
),
),
),
Container(
margin: EdgeInsets
.fromLTRB(
0,
16,
10,
16),
alignment:
Alignment
.center,
child: (model.recommendedProductList[index].images !=
null &&
model.recommendedProductList[index].images.length >
0)
? Image
.network(
model
.recommendedProductList[index]
.images[0]
.src
.toString(),
fit: BoxFit
.cover,
height:
60,
)
: Image
.asset(
"assets/images/no_image.png",
fit: BoxFit
.cover,
height:
60,
),
margin: EdgeInsets.fromLTRB(
0, 16, 10, 16),
alignment: Alignment.center,
child: (model
.recommendedProductList[
index]
.images !=
null &&
model
.recommendedProductList[
index]
.images
.length >
0)
? Image.network(
model
.recommendedProductList[
index]
.images[0]
.src
.toString(),
fit: BoxFit.cover,
height: 60,
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: 60,
),
),
Container(
width: model
.recommendedProductList[
index]
.rxMessage !=
null
.recommendedProductList[
index]
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
5
.size
.width /
5
: 0,
padding:
EdgeInsets
.all(4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius:
BorderRadius
.only(
topLeft: Radius
.circular(
6),
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
),
),
child: model.recommendedProductList[index]
.rxMessage !=
null
child: model
.recommendedProductList[
index]
.rxMessage !=
null
? Texts(
projectViewModel.isArabic
? model.recommendedProductList[index].rxMessagen
: model.recommendedProductList[index].rxMessage,
color: Colors
.white,
regular:
true,
fontSize:
10,
fontWeight:
FontWeight.w400,
)
projectViewModel.isArabic
? model
.recommendedProductList[
index]
.rxMessagen
: model
.recommendedProductList[
index]
.rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
)
: Texts(""),
),
]),
Container(
margin: EdgeInsets
.symmetric(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
CrossAxisAlignment.start,
children: [
Text(
projectViewModel
.isArabic
projectViewModel.isArabic
? model
.recommendedProductList[
index]
.namen
.recommendedProductList[
index]
.namen
: model
.recommendedProductList[index]
.name,
style:
TextStyle(
color: Colors
.black,
fontSize:
13.0,
.recommendedProductList[
index]
.name,
style: TextStyle(
color: Colors.black,
fontSize: 13.0,
// fontWeight: FontWeight.bold,
),
),
Padding(
// padding: const EdgeInsets.only(top: 15, bottom: 10),
padding: const EdgeInsets
.only(
top: 10,
bottom:
5),
child:
Texts(
padding: const EdgeInsets.only(
top: 10, bottom: 5),
child: Texts(
"SAR ${model.recommendedProductList[index].price}",
bold:
true,
fontSize:
14,
bold: true,
fontSize: 14,
),
),
],
@ -315,47 +291,35 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
),
Row(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <
Widget>[
CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(
right:
10),
child:
Align(
alignment:
Alignment
.topLeft,
child: RatingBar
.readOnly(
padding:
EdgeInsets.only(right: 10),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.recommendedProductList[index]
.recommendedProductList[
index]
.approvedRatingSum
.toDouble(),
size:
13.0,
size: 13.0,
filledColor:
Colors.yellow[700],
emptyColor:
Colors.grey[500],
isHalfAllowed:
true,
Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon:
Icons.star_half,
filledIcon:
Icons.star,
emptyIcon:
Icons.star,
Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
Texts(
"(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})",
// bold: true,
fontSize:
12,
fontSize: 12,
),
]),
],
@ -365,20 +329,18 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
);
})
: Container(
// color: Colors.white,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Texts(
TranslationBase.of(context)
.nonRecommended,
color: Colors.black,
// color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Texts(
TranslationBase.of(context).nonRecommended,
color: Colors.black,
),
],
),
),
],
),
),
),
),
),

@ -1,97 +1,89 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class ReviewsInfo extends StatelessWidget {
final PharmacyProduct product;
final ProductDetailViewModel previousModel;
const ReviewsInfo({Key key, this.product}) : super(key: key);
const ReviewsInfo({Key key, this.product, this.previousModel}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductReviewsData(product.id),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
baseViewModel:model ,
child: model.productDetailService.length != 0 &&
model.productDetailService[0].reviews.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: model.productDetailService[0].reviews.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
child: Text(
model.productDetailService[0].reviews[index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
Container(
margin: EdgeInsets.only(left: 210),
child: RatingBar.readOnly(
initialRating: model.productDetailService[0]
.reviews[index].rating
.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
],
),
),
SizedBox(
height: 10,
),
Container(
child: Text(
model.productDetailService[0].reviews[index]
.reviewText,
style: TextStyle(fontSize: 20),
),
),
SizedBox(
height: 50,
),
Divider(height: 1, color: Colors.grey),
],
return previousModel.productDetailService.length != 0 &&
previousModel.productDetailService[0].reviews.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: previousModel.productDetailService[0].reviews.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Row(
children: [
Container(
child: Text(
previousModel.productDetailService[0].reviews[index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
);
},
)
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
Container(
margin: EdgeInsets.only(left: 210),
child: RatingBar.readOnly(
initialRating: previousModel.productDetailService[0]
.reviews[index].rating
.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
],
),
),
SizedBox(
height: 10,
),
Container(
child: Text(
TranslationBase.of(context).noReviewsAvailable,
previousModel.productDetailService[0].reviews[index]
.reviewText,
style: TextStyle(fontSize: 20),
),
// Text('No Reviews Available'),
),
SizedBox(
height: 50,
),
Divider(height: 1, color: Colors.grey),
],
),
);
},
)
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noReviewsAvailable,
),
// Text('No Reviews Available'),
);
}
}

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
class CustomDivider extends StatelessWidget {
const CustomDivider({
Key key,
this.color,
}) : super(key: key);
final Color color;
@override
Widget build(BuildContext context) {
return Container(
width: 120,
height: 2,
color: color,
);
}
}

@ -11,7 +11,6 @@ class IconWithBg extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
// margin: EdgeInsets.only(left: 25),
width: 40,
height: 40,
decoration: BoxDecoration(

@ -8,26 +8,28 @@ 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';
import '../../../../../locator.dart';
import '../../../compare-list.dart';
import '../../cart-order-page.dart';
import 'icon_with_bg.dart';
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
final PharmacyProduct product;
final ProductDetailViewModel model;
final Function addToWishlistFunction;
final int quantity;
ProductAppBar({Key key, this.product, this.model}) : super(key: key);
ProductAppBar({Key key, this.product, this.model, this.addToWishlistFunction, this.quantity})
: super(key: key);
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
child: FractionallySizedBox(
widthFactor: 0.95,
child: Column(
@ -49,29 +51,31 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
),
],
),
if(authenticatedUserObject.isLogin)
Row(
children: [
IconWithBg(
icon: Icons.shopping_cart,
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: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
}),
SizedBox(width: 10,),
IconWithBg(
icon: FontAwesomeIcons.ellipsisV,
color: Colors.grey,
onPress: () {
settingModalBottomSheet(context);
},
),
],
)
settingModalBottomSheet(context);
},
),
],
)
],
),
],
@ -80,10 +84,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
);
}
@override
// TODO: implement preferredSize
@override
Size get preferredSize => Size(double.maxFinite, 50);
@ -94,27 +95,34 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
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")
}
}),
if (product.stockAvailability != 'Out of stock')
new ListTile(
leading: Icon(Icons.shopping_cart),
title: Text(
TranslationBase.of(context).addToCart,
),
onTap: () => {
if (quantity > 0)
{
addToCartFunction(
quantity: quantity,
itemID: itemID,
context: context,
model: model)
}
else
{
AppToast.showErrorToast(
message: "you should add quantity")
}
}),
ListTile(
leading: Icon(Icons.favorite_border),
title: Text(
TranslationBase.of(context).addToWishlist,
),
onTap: () => {model.addToWishlistData(itemID)},
onTap: () =>
{addToWishlistFunction(itemID: itemID, model: model)},
),
ListTile(
leading: Icon(Icons.compare),
@ -132,5 +140,3 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
});
}
}

@ -35,8 +35,14 @@ class _AddAddressPageState extends State<AddAddressPage> {
} else {
_getCurrentLocation();
}
setState(() {
});
}
_getCurrentLocation() async {
await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude;
@ -44,9 +50,12 @@ class _AddAddressPageState extends State<AddAddressPage> {
}).catchError((e) {
_longitude = 0;
_latitude = 0;
});
}
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
@ -63,8 +72,8 @@ class _AddAddressPageState extends State<AddAddressPage> {
body: Container(
height: height * 1,
child: PickupLocationFromMap(
latitude: _latitude,
longitude: _longitude,
latitude: _latitude??0,
longitude: _longitude??0,
isWithAppBar: false,
buttonColor: Color(0xFF5AB145),
buttonLabel: TranslationBase.of(context).save,

@ -29,7 +29,7 @@ class SecondaryButton extends StatefulWidget {
this.small = false,
this.disabled = false,
this.borderColor,
this.noBorderRadius = false, this.borderRadius})
this.noBorderRadius = false, this.borderRadius, this.disableColor})
: super(key: key);
final String label;
@ -44,6 +44,7 @@ class SecondaryButton extends StatefulWidget {
final bool disabled;
final bool noBorderRadius;
final double borderRadius;
final Color disableColor;
@ -183,7 +184,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
height: 100,
decoration: BoxDecoration(
color: widget.disabled
? Colors.grey
? widget.disableColor??Colors.grey
: widget.color ?? Theme.of(context).buttonColor),
),
),

@ -1,282 +0,0 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../locator.dart';
import 'floating_button_search.dart';
import '../progress_indicator/app_loader_widget.dart';
import 'arrow_back.dart';
import 'network_base_view.dart';
import 'not_auh_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
class DetailPageScafold extends StatefulWidget {
final String appBarTitle;
final Widget body;
final Widget bottomSheet;
final bool isLoading;
final bool isShowAppBar;
final bool hasAppBarParam;
final BaseViewModel baseViewModel;
final bool isBottomBar;
final Widget floatingActionButton;
final bool isPharmacy;
final String title;
final String description;
final String image;
final bool isShowDecPage;
final List<String> infoList;
final Color backgroundColor;
final double preferredSize;
final List<Widget> appBarIcons;
final PreferredSizeWidget appBarWidget;
DetailPageScafold(
{@required this.body,
this.appBarTitle = '',
this.isLoading = false,
this.isShowAppBar = false,
this.hasAppBarParam,
this.bottomSheet,
this.baseViewModel,
this.floatingActionButton,
this.isPharmacy = false,
this.title,
this.description,
this.isShowDecPage = true,
this.isBottomBar,
this.backgroundColor,
this.preferredSize = 0.0,
this.appBarIcons,
this.appBarWidget,
this.image,
this.infoList});
@override
_DetailPageScafoldState createState() => _DetailPageScafoldState();
}
class _DetailPageScafoldState extends State<DetailPageScafold> {
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
PreferredSizeWidget appBar;
if (this.widget.appBarWidget == null) {
PreferredSizeWidget appBarWidget = AppBarWidget(
widget.appBarTitle,
widget.appBarIcons,
widget.isShowAppBar,
isPharmacy: widget.isPharmacy,
isShowDecPage: widget.isShowDecPage,
image: widget.image,
);
appBar = widget.preferredSize == 0
? appBarWidget
: PreferredSize(
child: appBarWidget,
preferredSize: Size.fromHeight(widget.preferredSize));
} else {
appBar = this.widget.appBarWidget;
}
return Scaffold(
backgroundColor:
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: appBar,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
widget.isShowDecPage)
? NotAutPage(
title: widget.appBarTitle,
description: widget.description,
infoList: widget.infoList,
)
: widget.baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(),
baseViewModel: widget.baseViewModel,
)
: buildBodyWidget(),
bottomSheet: widget.bottomSheet,
//floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
// floatingActionButton: FloatingSearchButton(),
);
}
buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container();
}
buildBodyWidget() {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[
widget.body, /*FloatingSearchButton()*/
]);
}
}
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
final String appBarTitle;
final List<Widget> appBarIcons;
final bool isShowAppBar;
final bool isPharmacy;
final bool isShowDecPage;
final String image;
AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar,
{this.isPharmacy = true, this.isShowDecPage = true, this.image});
@override
Widget build(BuildContext context) {
return buildAppBar(context);
}
Widget buildAppBar(BuildContext context) {
return isShowAppBar
? AppBar(
elevation: 0,
backgroundColor: Colors.white,
// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme(
headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
),
title: Texts(
authenticatedUserObject.isLogin || !isShowDecPage
? appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,
color: Colors.white,
bold: true,
),
leading: Builder(
builder: (BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => Navigator.pop(context),
child: Icon(Icons.arrow_back_ios, color: Colors.grey),
);
},
),
centerTitle: true,
actions: <Widget>[
/// TODO Elham* fix this
if(isPharmacy)
IconButton(
icon: Icon(Icons.shopping_cart),
color: Colors.grey,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
}),
image != null
? InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: InsuranceUpdate(),
),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
image,
height: SizeConfig.heightMultiplier * 5,
width: SizeConfig.heightMultiplier * 5,
color: Colors.grey,
),
),
)
: IconButton(
icon: Icon(FontAwesomeIcons.ellipsisV),
color: Colors.grey,
onPressed: () {
settingModalBottomSheet(context);
},
),
if (appBarIcons != null) ...appBarIcons
],
)
: Container(
height: 0,
width: 0,
);
}
@override
Size get preferredSize => Size(double.maxFinite, 60);
settingModalBottomSheet(context) {
showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return Container(
child: new Wrap(
children: <Widget>[
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: () => {locator<ProductDetailViewModel>().addToWishlistData(itemID)},
),
ListTile(
leading: Icon(Icons.compare),
title: Text(
TranslationBase.of(context).compare,
),
onTap: () => {
Provider.of<CompareList>(context, listen: false)
.addItem(specificationData),
},
),
],
),
);
});
}
}
Loading…
Cancel
Save