|
|
|
@ -1,15 +1,23 @@
|
|
|
|
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
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/pages/pharmacies/screens/product-details/product-detail.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'dart:math' as math;
|
|
|
|
|
|
|
|
|
|
|
|
class ProductTileItem extends StatelessWidget {
|
|
|
|
class ProductTileItem extends StatelessWidget {
|
|
|
|
final AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
final AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
final PharmacyProduct item;
|
|
|
|
final PharmacyProduct item;
|
|
|
|
@ -38,13 +46,13 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(items.length >= 15){
|
|
|
|
if (items.length >= 15) {
|
|
|
|
items.removeAt(0);
|
|
|
|
items.removeAt(0);
|
|
|
|
// lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), '');
|
|
|
|
// lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), '');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lastVisited = "";
|
|
|
|
lastVisited = "";
|
|
|
|
for(int i = items.length - 1; i >= 0; i--){
|
|
|
|
for (int i = items.length - 1; i >= 0; i--) {
|
|
|
|
if (lastVisited == "") {
|
|
|
|
if (lastVisited == "") {
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
lastVisited = "${items[i]}";
|
|
|
|
lastVisited = "${items[i]}";
|
|
|
|
@ -54,7 +62,6 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isIdExist) {
|
|
|
|
if (!isIdExist) {
|
|
|
|
if (lastVisited == "") {
|
|
|
|
if (lastVisited == "") {
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
// it means there is no lastVisited yet
|
|
|
|
@ -76,20 +83,64 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.all(7),
|
|
|
|
margin: EdgeInsets.all(7),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border:Border.all(color: Colors.grey.shade300,width: 0.5),
|
|
|
|
border: Border.all(color: Colors.grey.shade300, width: 0.5),
|
|
|
|
borderRadius: BorderRadius.circular(8)
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
),
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 4),
|
|
|
|
width: MediaQuery.of(context).size.width / 2.8,
|
|
|
|
width: MediaQuery.of(context).size.width / 2.8,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
// 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: 20, right: 20, top: 14, bottom: 14),
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
child: InkWell(
|
|
|
|
|
|
|
|
onTap: () {},
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
|
|
|
decoration: containerRadiusWithGradientServices(33,
|
|
|
|
|
|
|
|
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: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: (item.images != null && item.images.length > 0)
|
|
|
|
child: (item.images != null &&
|
|
|
|
|
|
|
|
item.images.length > 0)
|
|
|
|
? Image.network(
|
|
|
|
? Image.network(
|
|
|
|
item.images[0].src,
|
|
|
|
item.images[0].src,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
@ -101,54 +152,87 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
height: itemHeight / 2,
|
|
|
|
height: itemHeight / 2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// Container(
|
|
|
|
|
|
|
|
// width: item.rxMessage != null
|
|
|
|
|
|
|
|
// ? MediaQuery.of(context).size.width / 5
|
|
|
|
|
|
|
|
// : 0,
|
|
|
|
|
|
|
|
// padding: EdgeInsets.all(4),
|
|
|
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
|
|
|
// color: Color(0xffb23838),
|
|
|
|
|
|
|
|
// borderRadius:
|
|
|
|
|
|
|
|
// BorderRadius.only(topLeft: Radius.circular(6)),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// child: item.rxMessage != null
|
|
|
|
|
|
|
|
// ? Texts(
|
|
|
|
|
|
|
|
// projectProvider.isArabic
|
|
|
|
|
|
|
|
// ? item.rxMessagen
|
|
|
|
|
|
|
|
// : item.rxMessage,
|
|
|
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
|
|
|
// regular: true,
|
|
|
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w400,
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// : Texts(""),
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
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
|
|
|
|
if (item.rxMessage != null)
|
|
|
|
? Texts(
|
|
|
|
|
|
|
|
projectProvider.isArabic
|
|
|
|
projectProvider.isArabic
|
|
|
|
? item.rxMessagen
|
|
|
|
? Positioned(
|
|
|
|
: item.rxMessage,
|
|
|
|
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,
|
|
|
|
color: Colors.white,
|
|
|
|
regular: true,
|
|
|
|
fontSize: 7.5,
|
|
|
|
fontSize: 10,
|
|
|
|
height: 0.8,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
letterSpacing: -0.27,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: Texts(""),
|
|
|
|
: 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,),
|
|
|
|
// SizedBox(height: 4,),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
|
|
|
@ -183,7 +267,7 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
RatingBar.readOnly(
|
|
|
|
RatingBar.readOnly(
|
|
|
|
initialRating: item.approvedRatingSum.toDouble(),
|
|
|
|
initialRating: item.approvedRatingSum.toDouble(),
|
|
|
|
size: 15.0,
|
|
|
|
size: 15.0,
|
|
|
|
filledColor: Colors.yellow[700],
|
|
|
|
filledColor: Color(0xffD02127),
|
|
|
|
emptyColor: Colors.grey[500],
|
|
|
|
emptyColor: Colors.grey[500],
|
|
|
|
isHalfAllowed: true,
|
|
|
|
isHalfAllowed: true,
|
|
|
|
halfFilledIcon: Icons.star_half,
|
|
|
|
halfFilledIcon: Icons.star_half,
|
|
|
|
@ -195,7 +279,16 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
regular: true,
|
|
|
|
regular: true,
|
|
|
|
fontSize: 10,
|
|
|
|
fontSize: 10,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 20.0,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Icon(
|
|
|
|
|
|
|
|
Icons.arrow_forward,
|
|
|
|
|
|
|
|
size: 18,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
// StarRating(
|
|
|
|
// StarRating(
|
|
|
|
// totalAverage: item.approvedTotalReviews > 0
|
|
|
|
// totalAverage: item.approvedTotalReviews > 0
|
|
|
|
// ? (item.approvedRatingSum.toDouble() /
|
|
|
|
// ? (item.approvedRatingSum.toDouble() /
|
|
|
|
@ -210,7 +303,9 @@ class ProductTileItem extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 5,),
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|