first step from design

merge-update-with-lab-changes
Elham Rababh 5 years ago
parent 2839af658a
commit 6fe41382c0

@ -119,8 +119,13 @@ class __ProductDetailPageState extends State<ProductDetailPage>
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [ children: [
Image.network( if(widget.product.images.isNotEmpty)
Container(
height: MediaQuery.of(context).size.height*.40,
child: Image.network(
widget.product.images[0].src.trim(), widget.product.images[0].src.trim(),
fit: BoxFit.contain,
),
), ),
if (widget.product.discountDescription != null) if (widget.product.discountDescription != null)
DiscountDescription(product: widget.product) DiscountDescription(product: widget.product)
@ -151,16 +156,17 @@ class __ProductDetailPageState extends State<ProductDetailPage>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Container(
padding: const EdgeInsets.all(8.0),
child: Container( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: Text( child: Texts(
TranslationBase.of(context).specification, TranslationBase.of(context).specification,
style: TextStyle(fontWeight: FontWeight.bold), fontSize: 15,
), fontWeight: FontWeight.bold,
), ),
width: double.infinity,
), ),
Divider(color: Colors.grey), // Divider(color: Colors.grey),
], ],
), ),
), ),

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -17,7 +17,6 @@ class ProductNameAndPrice extends StatefulWidget {
final Function addToWishlistFunction; final Function addToWishlistFunction;
final Function deleteFromWishlistFunction; final Function deleteFromWishlistFunction;
ProductNameAndPrice(this.context, this.item, ProductNameAndPrice(this.context, this.item,
{this.customerId, {this.customerId,
this.isInWishList, this.isInWishList,
@ -30,7 +29,6 @@ class ProductNameAndPrice extends StatefulWidget {
} }
class _ProductNameAndPriceState extends State<ProductNameAndPrice> { class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -38,39 +36,31 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Padding( SizedBox(height: 10,),
padding: const EdgeInsets.all(8.0), FractionallySizedBox(
widthFactor: 0.95,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Texts(widget.item.price.toString() + " " + "SAR",
widget.item.price.toString() + " " + "SAR", fontWeight: FontWeight.bold, fontSize: 20
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
), ),
SizedBox( Texts( projectViewModel.isArabic
width: 40,
),
Text(
projectViewModel.isArabic
? widget.item.stockAvailabilityn ? widget.item.stockAvailabilityn
: widget.item.stockAvailability, : widget.item.stockAvailability,
style: widget.item.stockAvailability == 'Out of stock' fontWeight: FontWeight.bold, fontSize: 15, color: widget.item.stockAvailability == 'Out of stock'?Colors.red:Colors.green,
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
: TextStyle(
fontWeight: FontWeight.bold, color: Colors.green),
), ),
SizedBox(width: 20), // SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock' && widget.item.stockAvailability == 'Out of stock' &&
widget.customerId != null widget.customerId != null
? InkWell( ? InkWell(
onTap: () => onTap: () =>
widget.notifyMeWhenAvailable(context, widget.item.id), widget.notifyMeWhenAvailable(context, widget.item.id),
child: Row(children: [ child: Row(children: [
Text( Texts(
TranslationBase.of(context).notifyMe, TranslationBase.of(context).notifyMe,
style: TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
), color: Colors.blue,
), ),
SizedBox(width: 4), SizedBox(width: 4),
Icon( Icon(
@ -87,7 +77,7 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
width: 40, width: 40,
height: 40, height: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.grey, color: Colors.grey[300],
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
), ),
child: IconButton( child: IconButton(
@ -99,10 +89,12 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
if (widget.customerId != null) { if (widget.customerId != null) {
if (!widget.isInWishList) { if (!widget.isInWishList) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.addToWishlistFunction(widget.item.id); await widget
.addToWishlistFunction(widget.item.id);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} else { } else {
await widget.deleteFromWishlistFunction(widget.item.id); await widget
.deleteFromWishlistFunction(widget.item.id);
} }
} else { } else {
return; return;
@ -118,35 +110,48 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
child: Container( child: Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Align( child: Align(
alignment: alignment: projectViewModel.isArabic
projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, ? Alignment.topRight
: Alignment.topLeft,
child: Text( child: Text(
projectViewModel.isArabic projectViewModel.isArabic
? widget.item.fullDescriptionn ? widget.item.namen
: widget.item.fullDescription, : widget.item.name,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
), ),
), ),
), ),
), ),
Row( FractionallySizedBox(
widthFactor: 0.95,
child: Row(
children: [ children: [
Expanded( Container(
flex: 2,
child: Container(
margin: EdgeInsets.only(right: 150),
child: Align( child: Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: RatingBar.readOnly( child: Row(
initialRating: 3, children: [
RatingBar.readOnly(
initialRating:double.parse( widget.item.approvedRatingSum.toString()),
size: 15.0, size: 15.0,
filledColor: Colors.yellow[700], filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500], emptyColor: Colors.grey[400],
isHalfAllowed: true, isHalfAllowed: true,
halfFilledIcon: Icons.star_half, halfFilledIcon: Icons.star_half,
filledIcon: Icons.star, filledIcon: Icons.star,
emptyIcon: 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,
),
],
), ),
), ),
), ),
@ -171,6 +176,8 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
: Container(), : Container(),
], ],
), ),
),
SizedBox(height: 10,),
], ],
); );
} }

Loading…
Cancel
Save