Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into fix_product_tile
Conflicts: lib/pages/pharmacies/ProductCheckTypeWidget.dart lib/pages/pharmacies/screens/cart-order-page.dart lib/pages/pharmacies/screens/pharmacy_module_page.dartmerge-requests/421/head
commit
0150bc4684
@ -1,66 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../cart-order-page.dart';
|
||||
import 'CustomIcon.dart';
|
||||
|
||||
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
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);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
IconWithBg(
|
||||
icon: Icons.shopping_cart,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartOrderPage()),
|
||||
);
|
||||
}),
|
||||
IconWithBg(
|
||||
icon: FontAwesomeIcons.ellipsisV,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
//TODO Elham*
|
||||
// settingModalBottomSheet(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
// TODO: implement preferredSize
|
||||
@override
|
||||
Size get preferredSize => Size(double.maxFinite, 50);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,388 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/screens/product-details/product-detail.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/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rating_bar/rating_bar.dart';
|
||||
|
||||
class RecommendedProducts extends StatefulWidget {
|
||||
final PharmacyProduct product;
|
||||
|
||||
const RecommendedProducts({Key key, this.product}) : super(key: key);
|
||||
|
||||
@override
|
||||
_RecommendedProductsState createState() => _RecommendedProductsState();
|
||||
}
|
||||
|
||||
class _RecommendedProductsState extends State<RecommendedProducts> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return SingleChildScrollView(
|
||||
child: Container(
|
||||
width: 410,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
height: 210,
|
||||
margin: EdgeInsets.only(bottom: 75),
|
||||
padding: EdgeInsets.only(bottom: 5),
|
||||
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
||||
child: BaseView<PharmacyModuleViewModel>(
|
||||
onModelReady: (model) => model
|
||||
.getRecommendedProducts(widget.product.id),
|
||||
builder: (_, model, wi) => Container(
|
||||
child:
|
||||
model.recommendedProductList.length != null
|
||||
? ListView.builder(
|
||||
scrollDirection:
|
||||
Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: model
|
||||
.recommendedProductList
|
||||
.length,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
GifLoaderDialogUtils
|
||||
.showMyDialog(
|
||||
context);
|
||||
RecommendedProductModel
|
||||
data =
|
||||
model.recommendedProductList[
|
||||
index];
|
||||
var json = data.toJson();
|
||||
PharmacyProduct product =
|
||||
new PharmacyProduct
|
||||
.fromJson(json);
|
||||
await Navigator
|
||||
.pushReplacement(
|
||||
context,
|
||||
FadePage(
|
||||
page:
|
||||
ProductDetailPage(
|
||||
product),
|
||||
),
|
||||
);
|
||||
GifLoaderDialogUtils
|
||||
.hideDialog(context);
|
||||
},
|
||||
child: Card(
|
||||
elevation: 2,
|
||||
shape:
|
||||
RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Colors
|
||||
.grey[300],
|
||||
width: 2),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(10),
|
||||
),
|
||||
margin:
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 0,
|
||||
),
|
||||
child: Container(
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius.circular(15),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 4),
|
||||
width: MediaQuery.of(
|
||||
context)
|
||||
.size
|
||||
.width /
|
||||
3,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
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 !=
|
||||
true) {
|
||||
GifLoaderDialogUtils.showMyDialog(
|
||||
context);
|
||||
await addToWishlistFunction(model
|
||||
.recommendedProductList[index]
|
||||
.id);
|
||||
// checkWishlist();
|
||||
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;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
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,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.rxMessage !=
|
||||
null
|
||||
? MediaQuery.of(context)
|
||||
.size
|
||||
.width /
|
||||
5
|
||||
: 0,
|
||||
padding:
|
||||
EdgeInsets
|
||||
.all(4),
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: Color(
|
||||
0xffb23838),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.only(
|
||||
topLeft: Radius
|
||||
.circular(
|
||||
6),
|
||||
),
|
||||
),
|
||||
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,
|
||||
)
|
||||
: Texts(""),
|
||||
),
|
||||
]),
|
||||
Container(
|
||||
margin: EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 0,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: [
|
||||
Text(
|
||||
projectViewModel
|
||||
.isArabic
|
||||
? model
|
||||
.recommendedProductList[
|
||||
index]
|
||||
.namen
|
||||
: model
|
||||
.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(
|
||||
"SAR ${model.recommendedProductList[index].price}",
|
||||
bold:
|
||||
true,
|
||||
fontSize:
|
||||
14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment
|
||||
.start,
|
||||
children: <
|
||||
Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
right:
|
||||
10),
|
||||
child:
|
||||
Align(
|
||||
alignment:
|
||||
Alignment
|
||||
.topLeft,
|
||||
child: RatingBar
|
||||
.readOnly(
|
||||
initialRating: model
|
||||
.recommendedProductList[index]
|
||||
.approvedRatingSum
|
||||
.toDouble(),
|
||||
size:
|
||||
13.0,
|
||||
filledColor:
|
||||
Colors.yellow[700],
|
||||
emptyColor:
|
||||
Colors.grey[500],
|
||||
isHalfAllowed:
|
||||
true,
|
||||
halfFilledIcon:
|
||||
Icons.star_half,
|
||||
filledIcon:
|
||||
Icons.star,
|
||||
emptyIcon:
|
||||
Icons.star,
|
||||
),
|
||||
),
|
||||
),
|
||||
Texts(
|
||||
"(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})",
|
||||
// bold: true,
|
||||
fontSize:
|
||||
12,
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
: Container(
|
||||
// color: Colors.white,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context)
|
||||
.nonRecommended,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,96 +1,90 @@
|
||||
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),
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
model.productDetailService[0].reviews[index]
|
||||
.reviewText,
|
||||
style: TextStyle(fontSize: 20),
|
||||
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: 50,
|
||||
),
|
||||
Divider(height: 1, color: Colors.grey),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: Container(
|
||||
padding: EdgeInsets.all(15),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
TranslationBase.of(context).noReviewsAvailable,
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
previousModel
|
||||
.productDetailService[0].reviews[index].reviewText,
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.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 'icon_with_bg.dart';
|
||||
|
||||
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
final PharmacyProduct product;
|
||||
|
||||
final ProductDetailViewModel model;
|
||||
final Function addToWishlistFunction;
|
||||
final Function deleteFromWishlistFunction;
|
||||
final int quantity;
|
||||
final bool isInWishList;
|
||||
|
||||
ProductAppBar(
|
||||
{Key key,
|
||||
this.product,
|
||||
this.model,
|
||||
this.addToWishlistFunction,
|
||||
this.quantity,
|
||||
this.deleteFromWishlistFunction,
|
||||
this.isInWishList})
|
||||
: super(key: key);
|
||||
|
||||
AuthenticatedUserObject authenticatedUserObject =
|
||||
locator<AuthenticatedUserObject>();
|
||||
|
||||
@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,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
if (authenticatedUserObject.isLogin)
|
||||
Row(
|
||||
children: [
|
||||
IconWithBg(
|
||||
icon: Icons.shopping_cart,
|
||||
color: Colors.grey[800],
|
||||
onPress: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartOrderPage()),
|
||||
);
|
||||
}),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
IconWithBg(
|
||||
icon: FontAwesomeIcons.ellipsisV,
|
||||
color: Colors.grey,
|
||||
onPress: () {
|
||||
settingModalBottomSheet(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
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: () async {
|
||||
if (quantity > 0) {
|
||||
{
|
||||
await addToCartFunction(
|
||||
quantity: quantity,
|
||||
itemID: itemID,
|
||||
context: context,
|
||||
model: model);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
AppToast.showErrorToast(
|
||||
message: "you should add quantity");
|
||||
}
|
||||
}),
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
!isInWishList ? Icons.favorite_border : Icons.favorite,
|
||||
color: !isInWishList ? Colors.white : Colors.red[800],
|
||||
),
|
||||
title: Text(
|
||||
isInWishList
|
||||
? TranslationBase.of(context).removeFromWishlist
|
||||
: TranslationBase.of(context).addToWishlist,
|
||||
),
|
||||
onTap: () async {
|
||||
if (isInWishList)
|
||||
await deleteFromWishlistFunction();
|
||||
else
|
||||
await addToWishlistFunction();
|
||||
Navigator.of(context).pop();
|
||||
}),
|
||||
ListTile(
|
||||
leading: Icon(Icons.compare),
|
||||
title: Text(
|
||||
TranslationBase.of(context).compare,
|
||||
),
|
||||
onTap: () {
|
||||
Provider.of<CompareList>(context, listen: false)
|
||||
.addItem(specificationData);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,281 +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/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: () => {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