diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index d677b9b8..015e7958 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -119,8 +119,13 @@ class __ProductDetailPageState extends State color: Colors.white, child: Column( children: [ - Image.network( - widget.product.images[0].src.trim(), + if(widget.product.images.isNotEmpty) + Container( + height: MediaQuery.of(context).size.height*.40, + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) @@ -151,16 +156,17 @@ class __ProductDetailPageState extends State 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), - ), + Container( + + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), + child: Texts( + TranslationBase.of(context).specification, + fontSize: 15, + fontWeight: FontWeight.bold, ), + width: double.infinity, ), - Divider(color: Colors.grey), + // Divider(color: Colors.grey), ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 428f49e8..14b94269 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -1,8 +1,8 @@ - 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:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; @@ -17,7 +17,6 @@ class ProductNameAndPrice extends StatefulWidget { final Function addToWishlistFunction; final Function deleteFromWishlistFunction; - ProductNameAndPrice(this.context, this.item, {this.customerId, this.isInWishList, @@ -30,7 +29,6 @@ class ProductNameAndPrice extends StatefulWidget { } class _ProductNameAndPriceState extends State { - @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -38,78 +36,72 @@ class _ProductNameAndPriceState extends State { return Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.all(8.0), + SizedBox(height: 10,), + FractionallySizedBox( + widthFactor: 0.95, child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, 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), + Texts(widget.item.price.toString() + " " + "SAR", + fontWeight: FontWeight.bold, fontSize: 20 + ), + Texts( projectViewModel.isArabic + ? widget.item.stockAvailabilityn + : widget.item.stockAvailability, + fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green, ), - SizedBox(width: 20), + // SizedBox(width: 20), widget.item.stockAvailability == 'Out of stock' && - widget.customerId != null + 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, - ) - ]), - ) + onTap: () => + widget.notifyMeWhenAvailable(context, widget.item.id), + child: Row(children: [ + Texts( + TranslationBase.of(context).notifyMe, + decoration: TextDecoration.underline, + color: Colors.blue, + ), + 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(() {}); - }, - )), + margin: projectViewModel.isArabic + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[300], + 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(() {}); + }, + )), ], ), ), @@ -118,59 +110,74 @@ class _ProductNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: - projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, + alignment: projectViewModel.isArabic + ? Alignment.topRight + : Alignment.topLeft, child: Text( projectViewModel.isArabic - ? widget.item.fullDescriptionn - : widget.item.fullDescription, + ? widget.item.namen + : widget.item.name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), ), ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(right: 150), + FractionallySizedBox( + widthFactor: 0.95, + child: Row( + children: [ + Container( 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, + child: Row( + children: [ + RatingBar.readOnly( + initialRating:double.parse( widget.item.approvedRatingSum.toString()), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[400], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + SizedBox(width: 10,), + Texts( + "${widget.item.approvedTotalReviews}", + fontSize: 12, + ), + SizedBox(width: 30,), + Texts( + "(${widget.item.approvedTotalReviews} ${TranslationBase.of(context).review})", + fontSize: 12, + ), + ], ), ), ), - ), - 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(), - ], + 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(), + ], + ), ), + SizedBox(height: 10,), ], ); }