|
|
|
|
@ -17,7 +17,6 @@ import 'package:rating_bar/rating_bar.dart';
|
|
|
|
|
|
|
|
|
|
import 'dart:math' as math;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProductTileItem extends StatelessWidget {
|
|
|
|
|
final AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
final PharmacyProduct item;
|
|
|
|
|
@ -46,13 +45,13 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(items.length >= 15){
|
|
|
|
|
if (items.length >= 15) {
|
|
|
|
|
items.removeAt(0);
|
|
|
|
|
// lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lastVisited = "";
|
|
|
|
|
for(int i = items.length - 1; i >= 0; i--){
|
|
|
|
|
for (int i = items.length - 1; i >= 0; i--) {
|
|
|
|
|
if (lastVisited == "") {
|
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
|
lastVisited = "${items[i]}";
|
|
|
|
|
@ -62,7 +61,6 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isIdExist) {
|
|
|
|
|
if (lastVisited == "") {
|
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
|
@ -84,9 +82,8 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(7),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border:Border.all(color: Colors.grey.shade300,width: 0.5),
|
|
|
|
|
borderRadius: BorderRadius.circular(8)
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(color: Colors.grey.shade300, width: 0.5),
|
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
|
|
|
width: MediaQuery.of(context).size.width / 2.8,
|
|
|
|
|
child: Column(
|
|
|
|
|
@ -115,16 +112,18 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: MediaQuery.of(context).size.width * 0.3,
|
|
|
|
|
padding: EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
},
|
|
|
|
|
onTap: () {},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
decoration: containerRadiusWithGradientServices(33, lightColor: Colors.transparent, darkColor: Colors.transparent),
|
|
|
|
|
decoration: containerRadiusWithGradientServices(33,
|
|
|
|
|
lightColor: Colors.transparent,
|
|
|
|
|
darkColor: Colors.transparent),
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
@ -139,95 +138,101 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: (item.images != null && item.images.length > 0)
|
|
|
|
|
child: (item.images != null &&
|
|
|
|
|
item.images.length > 0)
|
|
|
|
|
? Image.network(
|
|
|
|
|
item.images[0].src,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: itemHeight / 2,
|
|
|
|
|
)
|
|
|
|
|
item.images[0].src,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: itemHeight / 2,
|
|
|
|
|
)
|
|
|
|
|
: Image.asset(
|
|
|
|
|
"assets/images/no_image.png",
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: itemHeight / 2,
|
|
|
|
|
),
|
|
|
|
|
"assets/images/no_image.png",
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: itemHeight / 2,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
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: Text(
|
|
|
|
|
"E-Prescription Is required",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 9,
|
|
|
|
|
height: 0.8,
|
|
|
|
|
letterSpacing: -0.27,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: 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-Pr5escription \n Is required",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 7,
|
|
|
|
|
//letterSpacing: -0.27,
|
|
|
|
|
height: 1.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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: 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: EdgeInsets.fromLTRB(1,1,1,1),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: item.rxMessage != null
|
|
|
|
|
? MediaQuery.of(context).size.width / 1.0
|
|
|
|
|
: 0,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8,2,8,2),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
child: item.rxMessage != null
|
|
|
|
|
? Texts(
|
|
|
|
|
projectProvider.isArabic
|
|
|
|
|
? item.rxMessagen
|
|
|
|
|
: item.rxMessage,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
: Texts(""),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// SizedBox(height: 4,),
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(1, 1, 1, 1),
|
|
|
|
|
// child: Container(
|
|
|
|
|
// width: item.rxMessage != null
|
|
|
|
|
// ? MediaQuery.of(context).size.width / 1.0
|
|
|
|
|
// : 0,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(8, 2, 8, 2),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: Color(0xffb23838),
|
|
|
|
|
// ),
|
|
|
|
|
// child: item.rxMessage != null
|
|
|
|
|
// ? Texts(
|
|
|
|
|
// projectProvider.isArabic
|
|
|
|
|
// ? item.rxMessagen
|
|
|
|
|
// : item.rxMessage,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// regular: true,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// fontWeight: FontWeight.w400,
|
|
|
|
|
// )
|
|
|
|
|
// : Texts(""),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 4,),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
@ -257,17 +262,17 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
RatingBar.readOnly(
|
|
|
|
|
initialRating: item.approvedRatingSum.toDouble(),
|
|
|
|
|
size: 15.0,
|
|
|
|
|
filledColor: Colors.yellow[700],
|
|
|
|
|
emptyColor: Colors.grey[500],
|
|
|
|
|
isHalfAllowed: true,
|
|
|
|
|
halfFilledIcon: Icons.star_half,
|
|
|
|
|
filledIcon: Icons.star,
|
|
|
|
|
emptyIcon: Icons.star,
|
|
|
|
|
),
|
|
|
|
|
// Expanded(
|
|
|
|
|
RatingBar.readOnly(
|
|
|
|
|
initialRating: item.approvedRatingSum.toDouble(),
|
|
|
|
|
size: 15.0,
|
|
|
|
|
filledColor: Color(0xffD02127),
|
|
|
|
|
emptyColor: Colors.grey[500],
|
|
|
|
|
isHalfAllowed: true,
|
|
|
|
|
halfFilledIcon: Icons.star_half,
|
|
|
|
|
filledIcon: Icons.star,
|
|
|
|
|
emptyIcon: Icons.star,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${item.approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
@ -281,14 +286,16 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
|
// .toDouble()
|
|
|
|
|
// : 0,
|
|
|
|
|
// forceStars: true),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 5,),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|