first step of ProductDetailPage refactor

merge-requests/408/head
Elham Rababh 3 years ago
parent db277a62f5
commit c7a0d39aab

@ -13,16 +13,16 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// Pharmacy Production URLs
// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';
@ -551,7 +551,7 @@ const LAKUM_GET_USER_TERMS_AND_CONDITIONS =
"Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy";
const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList';
const GET_RECOMMENDED_PRODUCT = 'alsoProduct/';
const GET_MOST_VIEWED_PRODUCTS = "mostview?";
const GET_MOST_VIEWED_PRODUCTS = "mostview";
const GET_NEW_PRODUCTS = "newproducts?";
// Home Health Care

@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';

@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';

@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';

File diff suppressed because it is too large Load Diff

@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart';

@ -0,0 +1,114 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_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/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class AvailabilityInfo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductLocationData(),
builder: (_, model, wi) => model
.productLocationService
.length ==
0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context)
.noLocationAvailable,
),
// Text('No location Available'),
)
: 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(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
// crossAxisAlignment: CrossAxisAlignment.start,
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)
],
),
);
},
),
);
}
}

@ -0,0 +1,59 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class DetailsInfo extends StatelessWidget {
final PharmacyProduct product;
const DetailsInfo({Key key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
child: Text(
TranslationBase.of(context)
.description,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
SizedBox(
height: 10,
),
Divider(height: 1, color: Colors.grey),
SizedBox(
height: 15,
),
Container(
child: Text(
projectViewModel.isArabic
? product.fullDescriptionn
: product
.fullDescription ??
"",
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
),
),
SizedBox(
height: 20,
),
]),
);
}
}

@ -0,0 +1,48 @@
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 {
final PharmacyProduct product;
const DiscountDescription({Key key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 50,
color: Colors.yellowAccent,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerRight,
child: Text(
product
.discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
),
),
),
SizedBox(
width: 10,
),
Expanded(
flex: 0,
child: Container(
child: Image(
image: AssetImage(
'assets/images/offer.png'),
),
),
),
],
),
);
}
}

@ -0,0 +1,492 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import '../cart-order-page.dart';
class FooterWidget extends StatefulWidget {
final bool isAvailble;
final int maxQuantity;
final int minQuantity;
final int quantityLimit;
final PharmacyProduct item;
final Function addToCartFunction;
int price;
bool isOverQuantity;
FooterWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item, {this.price, this.isOverQuantity = false, this.addToCartFunction});
@override
_FooterWidgetState createState() => _FooterWidgetState();
}
class _FooterWidgetState extends State<FooterWidget> {
double quantityUI = 70;
bool showUI = false;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: quantityUI,
color: Colors.white,
child: Column(
children: [
showUI
? Container(
width: double.infinity,
height: 90,
color: Colors.white,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
TranslationBase.of(context).quantity,
style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
),
),
Container(
height: 50.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'1',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 1;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'2',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 2;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'3',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 3;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'4',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 4;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'5',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 5;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'6',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 6;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'7',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 7;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'8',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 8;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'9',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 9;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
InkWell(
child: Container(
alignment: Alignment.center,
width: 50.0,
color: Colors.white,
child: Text(
'10',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
onTap: () {
setState(() {
widget.price = 10;
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.price;
}
});
},
),
SizedBox(
width: 5,
),
Container(
width: 50.0,
child: TextField(
decoration:
InputDecoration(labelText: 'quantity #'),
onChanged: (text) {
print(widget.price);
print(widget.quantityLimit);
if (int.tryParse(text) == null) {
text = '';
} else {
setState(() {
widget.price = int.parse(text);
if (widget.price >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
}
});
}
},
),
),
],
),
)
],
),
),
)
: Container(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 70,
height: 50,
child: FlatButton(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 4,
child: Text(
widget.price.toString(),
style: TextStyle(fontSize: 20),
),
),
Expanded(
flex: 5,
child: Text(
TranslationBase.of(context).quantityShortcut,
style: TextStyle(fontSize: 16),
),
),
],
),
onPressed: () {
setState(() {
if (showUI) {
quantityUI = 70;
showUI = false;
} else {
quantityUI = 150;
showUI = true;
}
});
},
),
),
!widget.isAvailble && widget.price > 0 ||
widget.price > widget.quantityLimit ||
widget.item.rxMessage != null
? Container(
width: 190,
height: 46,
color: Colors.grey,
child: Align(
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).addToCart,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
)
: InkWell(
onTap: () {
widget.addToCartFunction(widget.price, widget.item.id, context);
},
child: Container(
alignment: Alignment.center,
width: 190,
height: 46,
color: Colors.green,
child: Text(
TranslationBase.of(context).addToCart,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
),
SizedBox(
width: 5,
),
!widget.isAvailble && widget.price > 0 ||
widget.price > widget.quantityLimit ||
widget.item.rxMessage != null
? Container(
width: 120,
height: 46,
color: Colors.grey,
child: Align(
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).buyNow,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
)
: InkWell(
onTap: () {
print('buy now');
widget.addToCartFunction(widget.price, widget.item.id, context);
Navigator.push(
context,
FadePage(page: CartOrderPage()),
);
},
child: Container(
alignment: Alignment.center,
width: 120,
height: 46,
color: Colors.blue,
child: Text(
TranslationBase.of(context).buyNow,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
),
],
),
],
),
);
}
}

@ -0,0 +1,842 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/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/recommended_products.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.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/others/app_scafold_detail_page.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import '../cart-order-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'availability_info.dart';
import 'details_info.dart';
import 'discount_description.dart';
import 'footer-widget.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 {
final PharmacyProduct product;
ProductDetailPage(this.product);
@override
__ProductDetailPageState createState() => __ProductDetailPageState();
}
class __ProductDetailPageState extends State<ProductDetailPage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isTrue = true;
bool isDetails = true;
bool isReviews = false;
bool isAvailability = false;
checkWishlist() async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel();
await x.checkWishlistData();
for (int i = 0; i < x.wishListItems.length; i++) {
if (itemID == x.wishListItems[i].product.id) {
isInWishList = true;
break;
} else {
isInWishList = false;
}
}
GifLoaderDialogUtils.hideDialog(context);
setState(() {});
}
void initState() {
price = 1;
specificationData = widget.product;
userInfo();
super.initState();
}
void userInfo() async {
print(specificationData);
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
itemID = widget.product.id;
checkWishlist();
}
setState(() {});
}
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return customerId != null
? DetailPageScafold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
body: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
color: Colors.white,
child: Column(
children: [
Image.network(
widget.product.images[0].src.trim(),
),
if (widget.product.discountDescription != null)
DiscountDescription(product: widget.product)
],
),
),
SizedBox(
height: 4,
),
Container(
width: 500,
height: 220,
color: Colors.white,
child: ProductNameAndPrice(
context,
widget.product,
customerId: customerId,
addToWishlistFunction: addToWishlistFunction,
deleteFromWishlistFunction: deleteFromWishlistFunction,
notifyMeWhenAvailable: notifyMeWhenAvailable,
isInWishList: isInWishList,
),
),
SizedBox(
height: 6,
),
Container(
width: 500,
height: 100,
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text(
TranslationBase.of(context).specification,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
Divider(color: Colors.grey),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text(
TranslationBase.of(context).noData,
),
),
),
],
),
),
SizedBox(
height: 6,
),
Container(
width: 500,
margin: EdgeInsets.only(bottom: 6),
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = true;
isReviews = false;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).details,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isDetails
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container()
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = false;
isReviews = true;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isReviews
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container(),
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = false;
isReviews = false;
isAvailability = true;
});
},
child: Text(
TranslationBase.of(context).availability,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isAvailability
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container(),
],
),
],
),
SizedBox(
height: 10,
),
isDetails
? DetailsInfo(
product: widget.product,
)
: isReviews
? ReviewsInfo(
product: widget.product,
)
: isAvailability
? AvailabilityInfo()
: Container(),
],
),
),
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)
],
),
),
bottomSheet: FooterWidget(
widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product,
price: price,
isOverQuantity: isOverQuantity,
addToCartFunction: addToCartFunction,
),
)
: AppScaffold(
appBarTitle: TranslationBase.of(context).productDetails,
isShowAppBar: true,
isPharmacy: true,
isShowDecPage: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
body: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
color: Colors.white,
child: Column(
children: [
Image.network(
widget.product.images[0].src.trim(),
),
widget.product.discountDescription != null
? Container(
width: double.infinity,
height: 50,
color: Colors.yellowAccent,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerRight,
child: projectViewModel.isArabic
? Text(
widget.product
.discountDescriptionn,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
)
: Text(
widget.product
.discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
),
),
),
SizedBox(
width: 10,
),
Expanded(
flex: 0,
child: Container(
child: Image(
image: AssetImage(
'assets/images/offer.png'),
),
),
),
],
),
)
: Container(),
],
),
),
SizedBox(
height: 4,
),
Container(
width: 500,
height: 150,
color: Colors.white,
child: ProductNameAndPrice(
context,
widget.product,
customerId: customerId,
addToWishlistFunction: addToWishlistFunction,
deleteFromWishlistFunction: deleteFromWishlistFunction,
notifyMeWhenAvailable: notifyMeWhenAvailable,
isInWishList: isInWishList,
),
),
SizedBox(
height: 6,
),
Container(
width: 500,
height: 120,
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text(
TranslationBase.of(context).specification,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
Divider(color: Colors.grey)
],
),
),
SizedBox(
height: 6,
),
Container(
width: 500,
margin: EdgeInsets.only(bottom: 100),
// height: 350,
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = true;
isReviews = false;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).details,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isDetails
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container()
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = false;
isReviews = true;
isAvailability = false;
});
},
child: Text(
TranslationBase.of(context).reviews,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isReviews
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container(),
],
),
SizedBox(
width: 20,
),
Column(
children: [
FlatButton(
onPressed: () {
setState(() {
isDetails = false;
isReviews = false;
isAvailability = true;
});
},
child: Text(
TranslationBase.of(context).availability,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
),
color: Colors.white,
),
isAvailability
? Container(
width: 100,
height: 5,
color: Colors.green,
)
: Container(),
],
),
],
),
SizedBox(
height: 10,
),
isDetails
? Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Text(
TranslationBase.of(context).description,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
SizedBox(
height: 6,
),
Divider(height: 1, color: Colors.grey),
SizedBox(
height: 10,
),
Container(
child: Text(
projectViewModel.isArabic
? widget.product.shortDescriptionn
: widget.product.shortDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
),
),
SizedBox(
height: 10,
),
Container(
child: Text(
TranslationBase.of(context).howToUse,
style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
),
),
SizedBox(
height: 6,
),
Divider(height: 2, color: Colors.grey),
SizedBox(
height: 10,
),
Container(
child: Text(
projectViewModel.isArabic
? widget.product.fullDescriptionn
: widget.product.fullDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
),
),
],
),
)
: isReviews
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductReviewsData(
widget.product.id),
builder: (_, model, wi) => 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),
],
),
);
},
)
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context)
.noReviewsAvailable),
),
)
: isAvailability
? BaseView<ProductDetailViewModel>(
onModelReady: (model) =>
model.getProductLocationData(),
builder: (_, model, wi) =>
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)
],
),
);
},
),
)
: Container(),
],
),
),
],
),
),
bottomSheet: FooterWidget(
widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product,
price: price,
isOverQuantity: isOverQuantity,
addToCartFunction: addToCartFunction,
),
);
}
}
convertCityName(txt) {
String stringTxt;
String newTxt;
stringTxt = txt.toString();
newTxt = stringTxt.split('.')[1];
return newTxt;
}
addToCartFunction(quantity, itemID, BuildContext context) async {
GifLoaderDialogUtils.showMyDialog(context);
ProductDetailViewModel x = new ProductDetailViewModel();
await x.addToCartData(quantity, itemID).then((value) {
GifLoaderDialogUtils.hideDialog(context);
});
}
notifyMeWhenAvailable(context, itemId) async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.notifyMe(customerId, itemId);
}
addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishList = true;
await x.addToWishlistData(itemID);
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishList = false;
await x.deletWishlistData(itemID);
}

@ -0,0 +1,177 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.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 'package:rating_bar/rating_bar.dart';
class ProductNameAndPrice extends StatefulWidget {
BuildContext context;
PharmacyProduct item;
final customerId;
final bool isInWishList;
final Function notifyMeWhenAvailable;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
ProductNameAndPrice(this.context, this.item,
{this.customerId,
this.isInWishList,
this.notifyMeWhenAvailable,
this.addToWishlistFunction,
this.deleteFromWishlistFunction});
@override
_ProductNameAndPriceState createState() => _ProductNameAndPriceState();
}
class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text(
widget.item.price.toString() + " " + "SAR",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
SizedBox(
width: 40,
),
Text(
projectViewModel.isArabic
? widget.item.stockAvailabilityn
: widget.item.stockAvailability,
style: widget.item.stockAvailability == 'Out of stock'
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
: TextStyle(
fontWeight: FontWeight.bold, color: Colors.green),
),
SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock' &&
widget.customerId != null
? InkWell(
onTap: () =>
widget.notifyMeWhenAvailable(context, widget.item.id),
child: Row(children: [
Text(
TranslationBase.of(context).notifyMe,
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
SizedBox(width: 4),
Icon(
FontAwesomeIcons.bell,
color: Colors.blue,
size: 15.0,
)
]),
)
: Container(
margin: projectViewModel.isArabic
? EdgeInsets.only(right: 25)
: EdgeInsets.only(left: 25),
width: 40,
height: 40,
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(30),
),
child: IconButton(
icon: Icon(!widget.isInWishList
? Icons.favorite_border
: Icons.favorite),
color: !widget.isInWishList ? Colors.white : Colors.red,
onPressed: () async {
if (widget.customerId != null) {
if (!widget.isInWishList) {
GifLoaderDialogUtils.showMyDialog(context);
await widget.addToWishlistFunction(widget.item.id);
GifLoaderDialogUtils.hideDialog(context);
} else {
await widget.deleteFromWishlistFunction(widget.item.id);
}
} else {
return;
}
setState(() {});
},
)),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment:
projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft,
child: Text(
projectViewModel.isArabic
? widget.item.fullDescriptionn
: widget.item.fullDescription,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
),
),
),
),
Row(
children: [
Expanded(
flex: 2,
child: Container(
margin: EdgeInsets.only(right: 150),
child: Align(
alignment: Alignment.bottomLeft,
child: RatingBar.readOnly(
initialRating: 3,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
),
Expanded(
flex: 1,
child: Container(
child: widget.item.rxMessage != null
? Text(
projectViewModel.isArabic
? widget.item.rxMessagen.toString()
: widget.item.rxMessage.toString(),
style: TextStyle(color: Colors.red, fontSize: 10),
)
: Container()),
),
widget.item.rxMessage != null
? Icon(
FontAwesomeIcons.questionCircle,
color: Colors.red,
size: 15.0,
)
: Container(),
],
),
],
);
}
}

@ -0,0 +1,388 @@
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,
),
],
),
),
),
),
),
],
),
),
);
}
}

@ -0,0 +1,92 @@
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:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class ReviewsInfo extends StatelessWidget {
final PharmacyProduct product;
const ReviewsInfo({Key key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
return BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductReviewsData(product.id),
builder: (_, model, wi) => 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),
],
),
);
},
)
: Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
child: Text(
TranslationBase.of(context).noReviewsAvailable,
),
// Text('No Reviews Available'),
),
);
}
}

@ -1,7 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';

@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';

@ -1,6 +1,6 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';

@ -6,7 +6,9 @@ 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';
@ -23,7 +25,7 @@ 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/product_detail.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 {
@ -219,4 +221,49 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
@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…
Cancel
Save