fix ontap on prodcut card

merge-update-with-lab-changes
hussam al-habibeh 4 years ago
parent 3c97122308
commit 1984400239

@ -77,226 +77,230 @@ class ProductTileItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return Container(
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300, width: 0.2),
borderRadius: BorderRadius.circular(10),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0xffF1F1F1),
spreadRadius: 4,
blurRadius: 5.5,
offset: Offset(0, 3), // changes position of shadow
),
],
),
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 2.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Stack(
// children: [
// Container(
// margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
// alignment: Alignment.center,
// child: (item.images != null && item.images.length > 0)
// ? Image.network(
// item.images[0].src,
// fit: BoxFit.cover,
// height: itemHeight / 2,
// )
// : Image.asset(
// "assets/images/no_image.png",
// fit: BoxFit.cover,
// height: itemHeight / 2,
// ),
// ),
// ],
// ),
return InkWell(
onTap: () => productOnClick(context),
child: Container(
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300, width: 0.2),
borderRadius: BorderRadius.circular(10),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0xffF1F1F1),
spreadRadius: 4,
blurRadius: 5.5,
offset: Offset(0, 3), // changes position of shadow
),
],
),
padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 2.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Stack(
// children: [
// Container(
// margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
// alignment: Alignment.center,
// child: (item.images != null && item.images.length > 0)
// ? Image.network(
// item.images[0].src,
// fit: BoxFit.cover,
// height: itemHeight / 2,
// )
// : Image.asset(
// "assets/images/no_image.png",
// fit: BoxFit.cover,
// height: itemHeight / 2,
// ),
// ),
// ],
// ),
Container(
width: double.infinity,
height: MediaQuery.of(context).size.width * 0.3,
padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7),
color: Colors.white,
child: Container(
Container(
width: double.infinity,
height: double.infinity,
clipBehavior: Clip.antiAlias,
decoration: containerRadiusWithGradientServices(0,
lightColor: Colors.transparent,
darkColor: Colors.transparent),
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
//clipBehavior: Clip.antiAlias,
// decoration: projectProvider.isArabic
// ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent)
// : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey.shade300, width: 1.1),
borderRadius: BorderRadius.only(
topRight: Radius.circular(
item.rxMessage != null &&
projectProvider.isArabic
? 20
: 8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
topLeft: Radius.circular(item.rxMessage != null &&
!projectProvider.isArabic
? 25
: 8),
height: MediaQuery.of(context).size.width * 0.3,
padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7),
color: Colors.white,
child: Container(
width: double.infinity,
height: double.infinity,
clipBehavior: Clip.antiAlias,
decoration: containerRadiusWithGradientServices(0,
lightColor: Colors.transparent,
darkColor: Colors.transparent),
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
//clipBehavior: Clip.antiAlias,
// decoration: projectProvider.isArabic
// ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent)
// : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green),
child: Stack(
children: [
Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey.shade300, width: 1.1),
borderRadius: BorderRadius.only(
topRight: Radius.circular(
item.rxMessage != null &&
projectProvider.isArabic
? 20
: 8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
topLeft: Radius.circular(
item.rxMessage != null &&
!projectProvider.isArabic
? 25
: 8),
),
),
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
child:
(item.images != null && item.images.length > 0)
? Padding(
padding: EdgeInsets.all(12.0),
child: Image.network(
item.images[0].src,
fit: BoxFit.cover,
height: itemHeight / 2,
),
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: itemHeight / 2,
),
),
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
child: (item.images != null && item.images.length > 0)
? Padding(
padding: EdgeInsets.all(12.0),
child: Image.network(
item.images[0].src,
fit: BoxFit.cover,
height: itemHeight / 2,
],
),
),
if (item.rxMessage != null)
projectProvider.isArabic
? Positioned(
right: -16,
top: 2,
child: Transform.rotate(
angle: math.pi / 4,
child: Container(
padding: EdgeInsets.only(
left: 18, right: 18, top: 6, bottom: 3),
color: CustomColors.accentColor,
child: Padding(
padding: EdgeInsets.all(2.0),
child: Text(
"الوصفة\n مطلوبة",
style: TextStyle(
color: Colors.white,
fontSize: 7.5,
height: 0.8,
fontWeight: FontWeight.bold,
letterSpacing: -0.27,
),
),
),
)
: Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: itemHeight / 2,
),
),
],
),
),
if (item.rxMessage != null)
projectProvider.isArabic
? Positioned(
right: -16,
top: 2,
child: Transform.rotate(
angle: math.pi / 4,
child: Container(
padding: EdgeInsets.only(
left: 18, right: 18, top: 6, bottom: 3),
color: CustomColors.accentColor,
child: Padding(
padding: EdgeInsets.all(2.0),
),
)
: Positioned(
left: -24,
top: 2,
child: Transform.rotate(
angle: -math.pi / 4,
child: Container(
padding: EdgeInsets.only(
left: 18, right: 18, top: 6, bottom: 3),
color: CustomColors.accentColor,
child: Text(
"الوصفة\n مطلوبة",
"\n E-Prescription \n Is required",
style: TextStyle(
color: Colors.white,
fontSize: 7.5,
height: 0.8,
fontWeight: FontWeight.bold,
letterSpacing: -0.27,
//letterSpacing: -0.27,
height: 1.2,
fontWeight: FontWeight.w600,
),
),
),
),
),
)
: Positioned(
left: -24,
top: 2,
child: Transform.rotate(
angle: -math.pi / 4,
child: Container(
padding: EdgeInsets.only(
left: 18, right: 18, top: 6, bottom: 3),
color: CustomColors.accentColor,
child: Text(
"\n E-Prescription \n Is required",
style: TextStyle(
color: Colors.white,
fontSize: 7.5,
//letterSpacing: -0.27,
height: 1.2,
fontWeight: FontWeight.w600,
),
),
),
),
),
],
],
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
height: MediaQuery.of(context).size.height * 0.075,
child: Texts(
projectProvider.isArabic ? item.namen : item.name,
//regular: true,
fontSize: 10,
color: Color(0xff2B353E),
fontWeight: FontWeight.w500,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
height: MediaQuery.of(context).size.height * 0.075,
child: Texts(
projectProvider.isArabic ? item.namen : item.name,
//regular: true,
fontSize: 10,
color: Color(0xff2B353E),
fontWeight: FontWeight.w500,
),
),
),
),
SizedBox(
height: 7.0,
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 4,
vertical: 0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
child: Texts(
"SAR ${item.price}",
fontWeight: FontWeight.bold,
fontSize: 11,
color: Color(0xff2B353E),
SizedBox(
height: 7.0,
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 4,
vertical: 0,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 2),
child: Texts(
"SAR ${item.price}",
fontWeight: FontWeight.bold,
fontSize: 11,
color: Color(0xff2B353E),
),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 5),
child: Row(
children: [
// Expanded(
RatingBar.readOnly(
initialRating: item.approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
),
Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 5),
child: Row(
children: [
// Expanded(
RatingBar.readOnly(
initialRating: item.approvedRatingSum.toDouble(),
size: 15.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
),
Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),
SizedBox(
width: 10.0,
),
Icon(
Icons.arrow_forward,
size: 15,
color: Color(0xff2D2F39),
),
SizedBox(
width: 10.0,
),
Icon(
Icons.arrow_forward,
size: 15,
color: Color(0xff2D2F39),
),
// StarRating(
// totalAverage: item.approvedTotalReviews > 0
@ -305,18 +309,19 @@ class ProductTileItem extends StatelessWidget {
// .toDouble()
// : 0,
// forceStars: true),
// ),
],
// ),
],
),
),
),
],
],
),
),
),
),
SizedBox(
height: 1,
),
],
SizedBox(
height: 1,
),
],
),
),
);
}

Loading…
Cancel
Save