fix recommended for you

merge-update-with-lab-changes
Fatimah Alshammari 5 years ago
parent 42bf76f712
commit e5829d8513

@ -33,13 +33,14 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_
bool isInWishlist = false; bool isInWishlist = false;
int price = 0; int price = 0;
dynamic itemID; var itemID;
var product; var product;
var customerId; var customerId;
var item; var item;
dynamic languageID; dynamic languageID;
List wishlistData; List wishlistData;
class PharmacyPage extends StatefulWidget { class PharmacyPage extends StatefulWidget {
// final PharmacyProduct product; // final PharmacyProduct product;
// PharmacyPage(this.product); // PharmacyPage(this.product);
@ -49,7 +50,7 @@ class PharmacyPage extends StatefulWidget {
} }
class _PharmacyPageState extends State<PharmacyPage> { class _PharmacyPageState extends State<PharmacyPage> {
dynamic wishlistVar; // dynamic wishlistVar;
getLanguageID() async { getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE); languageID = await sharedPref.getString(APP_LANGUAGE);
@ -61,7 +62,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
var model; var model;
// String ProductId="4561"; // String ProductId="4561";
//String id ="3608"; //String id ="3608";
String ProductId = ""; String productId = "";
String id = ""; String id = "";
@override @override
void initState() { void initState() {
@ -123,7 +124,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
? MediaQuery.of(context).size.height * 0.28 ? MediaQuery.of(context).size.height * 0.28
: 0, : 0,
padding: padding:
EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0),
// height: MediaQuery.of(context).size.height * 0.28, // height: MediaQuery.of(context).size.height * 0.28,
// width: 200.0, // width: 200.0,
// height: MediaQuery.of(context).size.height / 4 + 20, // height: MediaQuery.of(context).size.height / 4 + 20,
@ -221,11 +222,9 @@ class _PharmacyPageState extends State<PharmacyPage> {
BorderRadius.circular( BorderRadius.circular(
30.0)), 30.0)),
child: Text( child: Text(
model languageID == "ar"
.prescriptionsList[ ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString()
index] : model.prescriptionsList[index].isInOutPatientDescription.toString(),
.isInOutPatientDescription
.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
@ -341,257 +340,238 @@ class _PharmacyPageState extends State<PharmacyPage> {
: Container(), : Container(),
), ),
), ),
Container( // Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10), // margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
Texts( // Texts(
TranslationBase.of(context).recommended, // TranslationBase.of(context).recommended,
bold: true, // bold: true,
), // ),
BorderedButton( // BorderedButton(
TranslationBase.of(context).viewAll, // TranslationBase.of(context).viewAll,
hasBorder: true, // hasBorder: true,
borderColor: Colors.green, // borderColor: Colors.green,
textColor: Colors.green, // textColor: Colors.green,
vPadding: 6, // vPadding: 6,
hPadding: 4, // hPadding: 4,
handler: () { // handler: () {
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => // builder: (context) =>
RecommendedProductPage())); // RecommendedProductPage(productId : "2316")));
}, // },
), // ),
], // ],
), // ),
), // ),
Container( // Container(
height: model.recommendedProductList.length > 0 // height: model.recommendedProductList.length > 0
? MediaQuery.of(context).size.height * 0.30 // ? MediaQuery.of(context).size.height * 0.32
: 0, // : 0,
margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0), //// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0),
// margin: EdgeInsets.only(left: 10), //// margin: EdgeInsets.only(left: 10),
child: BaseView<PharmacyModuleViewModel>( // child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => // onModelReady: (model) =>
model.getRecommendedProducts(ProductId), // model.getRecommendedProducts(productId),
builder: (_, model, wi) => model // builder: (_, model, wi) => model
.recommendedProductList.length != // .recommendedProductList.length !=
null // null
? ListView.builder( // ? ListView.builder(
scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
shrinkWrap: true, // shrinkWrap: true,
physics: ScrollPhysics(), // physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(), // // physics: NeverScrollableScrollPhysics(),
itemCount: model.recommendedProductList.length, // itemCount: model.recommendedProductList.length,
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return Card( // return Card(
elevation: 2, // elevation: 2,
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
side: BorderSide( // side: BorderSide(
color: Colors.grey[300], width: 2), // color: Colors.grey[300], width: 2),
borderRadius: BorderRadius.circular(10)), // borderRadius: BorderRadius.circular(10)),
// // margin: EdgeInsets.symmetric(
margin: EdgeInsets.symmetric( // horizontal: 8,
horizontal: 8, // vertical: 0,
vertical: 4, // ),
), // child: Container(
child: Container( // decoration: BoxDecoration(
decoration: BoxDecoration( // borderRadius: BorderRadius.all(
borderRadius: BorderRadius.all( // Radius.circular(15),
Radius.circular(15), // ),
), // ),
), // padding: EdgeInsets.symmetric(horizontal: 4),
padding: EdgeInsets.symmetric(horizontal: 4), // width: MediaQuery.of(context).size.width / 3,
width: MediaQuery.of(context).size.width / 3, // child: Column(
// // crossAxisAlignment:
child: Column( // CrossAxisAlignment.start,
crossAxisAlignment: // children: [
CrossAxisAlignment.start, // Stack(children: [
children: [ // Container(
Stack(children: [ // child: Align(
Container( // alignment: Alignment.topRight,
child: Align( // child: //true
alignment: Alignment.topRight, // itemID.contains(model.recommendedProductList[index].id)
child: //true // // !isInWishlist
itemID.contains(model // ? IconButton(
.recommendedProductList[ // icon: Icon(Icons
index] // .favorite_border),
.id) // color: Colors.grey,
// !isInWishlist // iconSize: 30,
? IconButton( // onPressed: () {
icon: Icon(Icons // setState(() {
.favorite_border), // addToWishlistFunction(
color: Colors.grey, // itemID);
iconSize: 30, // });
onPressed: () { // },
setState(() { // )
addToWishlistFunction( // : IconButton(
itemID); // icon: Icon(
}); // Icons.favorite),
}, // color: Colors.red,
) // iconSize: 30,
: IconButton( // onPressed: () {
icon: Icon( // setState(() {
Icons.favorite), // deleteFromWishlistFunction(
color: Colors.red, // itemID);
iconSize: 30, // });
onPressed: () { // },
setState(() { // )
deleteFromWishlistFunction( ////
itemID); // ),
}); // ),
}, // Container(
) // margin: EdgeInsets.fromLTRB(
// // 0, 16, 10, 16),
), // alignment: Alignment.center,
), //// padding: EdgeInsets.only(left: 25, bottom: 20),
Container( // child: (model.recommendedProductList[index].images != null &&
margin: EdgeInsets.fromLTRB( // model.recommendedProductList[index].images.length > 0)
0, 16, 10, 16), // ? Image.network(
alignment: Alignment.center, // model.recommendedProductList[index].images[0].src.toString(),
// padding: EdgeInsets.only(left: 25, bottom: 20), //// item.images[0].src,
child: (model // fit: BoxFit.cover,
.recommendedProductList[ // height: 60,
index] // )
.images != // : Image.asset(
null && // "assets/images/no_image.png",
model // fit: BoxFit.cover,
.recommendedProductList[ // height: 60,
index] // ),
.images // ),
.length > // Container(
0) // width: model
? Image.network( // .recommendedProductList[
model // index]
.recommendedProductList[ // .rxMessage !=
index] // null
.images[0] // ? MediaQuery.of(context)
.src // .size
.toString(), // .width /
// item.images[0].src, // 5
fit: BoxFit.cover, // : 0,
height: 60, // padding: EdgeInsets.all(4),
) // decoration: BoxDecoration(
: Image.asset( // color: Color(0xffb23838),
"assets/images/no_image.png", // borderRadius: BorderRadius.only(
fit: BoxFit.cover, // topLeft: Radius.circular(6)),
height: 60, // ),
), // child: Texts(
), // model.recommendedProductList[index]
Container( // .rxMessage !=
width: model // null
.recommendedProductList[ // ? model
index] // .recommendedProductList[
.rxMessage != // index]
null // .rxMessage
? MediaQuery.of(context) // : "",
.size // color: Colors.white,
.width / // regular: true,
5 // fontSize: 10,
: 0, // fontWeight: FontWeight.w400,
padding: EdgeInsets.all(4), // ),
decoration: BoxDecoration( // ),
color: Color(0xffb23838), // ]),
borderRadius: BorderRadius.only( // Container(
topLeft: Radius.circular(6)), // margin: EdgeInsets.symmetric(
), // horizontal: 6,
child: Texts( // vertical: 0,
model.recommendedProductList[index] // ),
.rxMessage != // child: Column(
null // crossAxisAlignment:
? model // CrossAxisAlignment.start,
.recommendedProductList[ // children: [
index] // Text(
.rxMessage // languageID == "ar"
: "", // ? model.recommendedProductList[index].namen
color: Colors.white, // : model.recommendedProductList[index].name,
regular: true, // style: TextStyle(
fontSize: 10, // color: Colors.black,
fontWeight: FontWeight.w400, // fontSize: 13.0,
), //// fontWeight: FontWeight.bold,
), // ),
]), // ),
Container( // Padding(
margin: EdgeInsets.symmetric( //// padding: const EdgeInsets.only(top: 15, bottom: 10),
horizontal: 6, // padding: const EdgeInsets.only(
vertical: 0, // top: 10, bottom: 5),
), // child: Texts(
child: Column( // "SAR ${model.recommendedProductList[index].price}",
crossAxisAlignment: // bold: true,
CrossAxisAlignment.start, // fontSize: 14,
children: [ // ),
Text( // ),
model // ],
.recommendedProductList[index] // ),
.name, // ),
style: TextStyle( // Row(
color: Colors.black, // crossAxisAlignment:
fontSize: 13.0, // CrossAxisAlignment.start,
// fontWeight: FontWeight.bold, // children: <Widget>[
), // Container(
), // padding:
Padding( // EdgeInsets.only(right: 10),
// padding: const EdgeInsets.only(top: 15, bottom: 10), //// margin: EdgeInsets.only(left: 5),
padding: const EdgeInsets.only( // child: Align(
top: 10, bottom: 5), // alignment: Alignment.topLeft,
child: Texts( // child: RatingBar.readOnly(
"SAR ${model.recommendedProductList[index].price}", // initialRating: model
bold: true, // .recommendedProductList[
fontSize: 14, // index]
), // .approvedRatingSum
), // .toDouble(),
], //// initialRating: productRate,
), // size: 13.0,
), // filledColor:
Row( // Colors.yellow[700],
crossAxisAlignment: // emptyColor: Colors.grey[500],
CrossAxisAlignment.start, // isHalfAllowed: true,
children: <Widget>[ // halfFilledIcon:
Container( // Icons.star_half,
padding: // filledIcon: Icons.star,
EdgeInsets.only(right: 10), // emptyIcon: Icons.star,
// margin: EdgeInsets.only(left: 5), // ),
child: Align( // ),
alignment: Alignment.topLeft, // ),
child: RatingBar.readOnly( // Texts(
initialRating: model // "(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
.recommendedProductList[ //// bold: true,
index] // fontSize: 12,
.approvedRatingSum // ),
.toDouble(), // ]),
// initialRating: productRate, // ],
size: 13.0, // ),
filledColor: // ),
Colors.yellow[700], // );
emptyColor: Colors.grey[500], // })
isHalfAllowed: true, // : Container(
halfFilledIcon: //// child: Text("NO DATA"),
Icons.star_half, // ),
filledIcon: Icons.star, // ),
emptyIcon: Icons.star, // ),
),
),
),
Texts(
"(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
// bold: true,
fontSize: 12,
),
]),
],
),
),
);
})
: Container(
// child: Text("NO DATA"),
),
),
),
Container( Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 0), margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Row( child: Row(

File diff suppressed because it is too large Load Diff

@ -332,17 +332,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
child: productTile( child: productTile(
productName: model productName: languageID == "ar"
.orderListModel[0].orderItems[index].product.name ? model.orderListModel[0].orderItems[index].product.namen.toString()
: model.orderListModel[0].orderItems[index].product.name.toString(),
productPrice: model.orderListModel[0].orderItems[index].product.price
.toString(), .toString(),
productPrice: model productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum
.orderListModel[0].orderItems[index].product.price
.toString(),
productRate: model.orderListModel[0].orderItems[index]
.product.approvedRatingSum
.toDouble(), .toDouble(),
productReviews: model.orderListModel[0] productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews,
.orderItems[index].product.approvedTotalReviews,
totalPrice: totalPrice:
"${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}",
qyt: model qyt: model

Loading…
Cancel
Save