|
|
|
|
@ -4,17 +4,17 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/src/widgets/image.dart' as flutterImage;
|
|
|
|
|
|
|
|
|
|
import 'base/base_view.dart';
|
|
|
|
|
|
|
|
|
|
dynamic languageID;
|
|
|
|
|
@ -22,8 +22,7 @@ dynamic languageID;
|
|
|
|
|
class FinalProductsPage extends StatefulWidget {
|
|
|
|
|
final String id;
|
|
|
|
|
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
FinalProductsPage({this.id, this.productType = 1});
|
|
|
|
|
|
|
|
|
|
@ -33,7 +32,9 @@ class FinalProductsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
String id;
|
|
|
|
|
|
|
|
|
|
_FinalProductsPageState({this.id});
|
|
|
|
|
|
|
|
|
|
String categoriseName = "Personal Care";
|
|
|
|
|
String appBarTitle = "";
|
|
|
|
|
bool styleOne = true;
|
|
|
|
|
@ -77,11 +78,10 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
allowAny: true,
|
|
|
|
|
builder: (BuildContext context, PharmacyCategoriseViewModel model,
|
|
|
|
|
Widget child) =>
|
|
|
|
|
PharmacyAppScaffold(
|
|
|
|
|
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
appBarTitle: appBarTitle,
|
|
|
|
|
isBottomBar: false,
|
|
|
|
|
isBottomBar: true,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
@ -91,16 +91,13 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
//Expanded widget heree if nassery
|
|
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"$appBarTitle " +
|
|
|
|
|
TranslationBase.of(context).products,
|
|
|
|
|
"$appBarTitle " + TranslationBase.of(context).products,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -154,29 +151,21 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: model.finalProducts.length > 0
|
|
|
|
|
? Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
3.90,
|
|
|
|
|
height: MediaQuery.of(context).size.height * 3.90,
|
|
|
|
|
child: GridView.builder(
|
|
|
|
|
gridDelegate:
|
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
crossAxisSpacing: 0.5,
|
|
|
|
|
mainAxisSpacing: 2.0,
|
|
|
|
|
childAspectRatio: 1.0,
|
|
|
|
|
),
|
|
|
|
|
itemCount: model.finalProducts.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Card(
|
|
|
|
|
color:
|
|
|
|
|
model.finalProducts[index]
|
|
|
|
|
.discountName !=
|
|
|
|
|
null
|
|
|
|
|
? Color(0xffFFFF00)
|
|
|
|
|
: Colors.white,
|
|
|
|
|
color: model.finalProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
shape: Border(
|
|
|
|
|
right: BorderSide(
|
|
|
|
|
@ -198,226 +187,84 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 8,
|
|
|
|
|
vertical: 1,
|
|
|
|
|
// vertical: 2,
|
|
|
|
|
vertical: 4,
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.only(
|
|
|
|
|
topLeft: Radius.circular(
|
|
|
|
|
110.0),
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
topLeft: Radius.circular(110.0),
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 4,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 0),
|
|
|
|
|
width: MediaQuery.of(context).size.width / 3,
|
|
|
|
|
// width: MediaQuery.of(context)
|
|
|
|
|
// .size
|
|
|
|
|
// .width /
|
|
|
|
|
// 1,
|
|
|
|
|
// height: MediaQuery.of(context)
|
|
|
|
|
// .size
|
|
|
|
|
// .width /
|
|
|
|
|
// 1,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets
|
|
|
|
|
.fromLTRB(0, 1,
|
|
|
|
|
0, 0),
|
|
|
|
|
alignment: Alignment
|
|
|
|
|
.center,
|
|
|
|
|
child:
|
|
|
|
|
Image.network(
|
|
|
|
|
model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images
|
|
|
|
|
.isNotEmpty
|
|
|
|
|
? model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images[0]
|
|
|
|
|
.thumb
|
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Image.network(
|
|
|
|
|
model.finalProducts[index].images.isNotEmpty
|
|
|
|
|
? model.finalProducts[index].images[0].thumb
|
|
|
|
|
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: 70,
|
|
|
|
|
height: 80,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// Container(
|
|
|
|
|
// width: model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessage !=
|
|
|
|
|
// null
|
|
|
|
|
// ? MediaQuery.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .size
|
|
|
|
|
// .width /
|
|
|
|
|
// 2.8
|
|
|
|
|
// : 0,
|
|
|
|
|
// padding:
|
|
|
|
|
// EdgeInsets.all(
|
|
|
|
|
// 4),
|
|
|
|
|
// decoration:
|
|
|
|
|
// BoxDecoration(
|
|
|
|
|
// color: Color(
|
|
|
|
|
// 0xffb23838),
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// topLeft: Radius
|
|
|
|
|
// .circular(
|
|
|
|
|
// 6)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessage !=
|
|
|
|
|
// null
|
|
|
|
|
// ? Texts(
|
|
|
|
|
// languageID ==
|
|
|
|
|
// 'ar'
|
|
|
|
|
// ? model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessagen
|
|
|
|
|
// : model
|
|
|
|
|
// .finalProducts[index]
|
|
|
|
|
// .rxMessage,
|
|
|
|
|
// color: Colors
|
|
|
|
|
// .white,
|
|
|
|
|
// regular:
|
|
|
|
|
// true,
|
|
|
|
|
// fontSize:
|
|
|
|
|
// 10,
|
|
|
|
|
// fontWeight:
|
|
|
|
|
// FontWeight
|
|
|
|
|
// .w600,
|
|
|
|
|
// )
|
|
|
|
|
// : Texts(""),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets
|
|
|
|
|
.symmetric(
|
|
|
|
|
horizontal: 0,
|
|
|
|
|
vertical: 2,
|
|
|
|
|
),
|
|
|
|
|
width: model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? MediaQuery.of(
|
|
|
|
|
context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
2.0
|
|
|
|
|
: 0,
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.fromLTRB(8,4,8,4),
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(
|
|
|
|
|
color: Color(
|
|
|
|
|
0xffb23838),
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// topLeft: Radius
|
|
|
|
|
// .circular(
|
|
|
|
|
// 6)),
|
|
|
|
|
Container(
|
|
|
|
|
width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0,
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
|
|
|
|
|
),
|
|
|
|
|
child: model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
child: model.finalProducts[index].rxMessage != null
|
|
|
|
|
? Texts(
|
|
|
|
|
languageID ==
|
|
|
|
|
'ar'
|
|
|
|
|
? model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessagen
|
|
|
|
|
: model
|
|
|
|
|
.finalProducts[index]
|
|
|
|
|
.rxMessage,
|
|
|
|
|
color: Colors
|
|
|
|
|
.white,
|
|
|
|
|
regular:
|
|
|
|
|
true,
|
|
|
|
|
fontSize:
|
|
|
|
|
10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w600,
|
|
|
|
|
languageID == 'ar' ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
)
|
|
|
|
|
: Texts(""),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets
|
|
|
|
|
.symmetric(
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 6,
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
if (model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.discountName !=
|
|
|
|
|
null)
|
|
|
|
|
if (model.finalProducts[index].discountName != null)
|
|
|
|
|
Container(
|
|
|
|
|
width: double
|
|
|
|
|
.infinity,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 13.0,
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(
|
|
|
|
|
color: Color(
|
|
|
|
|
0xff5AB145),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xff5AB145),
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Texts(
|
|
|
|
|
model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.discountName,
|
|
|
|
|
regular:
|
|
|
|
|
true,
|
|
|
|
|
color: Colors
|
|
|
|
|
.white,
|
|
|
|
|
fontSize:
|
|
|
|
|
10.4,
|
|
|
|
|
model.finalProducts[index].discountName,
|
|
|
|
|
regular: true,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10.4,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.name,
|
|
|
|
|
model.finalProducts[index].name,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets
|
|
|
|
|
.only(
|
|
|
|
|
top: 4,
|
|
|
|
|
bottom:
|
|
|
|
|
4),
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 4),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.finalProducts[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
@ -427,20 +274,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StarRating(
|
|
|
|
|
totalAverage: model.finalProducts[index].approvedRatingSum >
|
|
|
|
|
0
|
|
|
|
|
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
totalAverage: model.finalProducts[index].approvedRatingSum > 0
|
|
|
|
|
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
forceStars:
|
|
|
|
|
true),
|
|
|
|
|
forceStars: true),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.finalProducts[index].approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -455,9 +297,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: ProductDetailPage(
|
|
|
|
|
model.finalProducts[
|
|
|
|
|
index]),
|
|
|
|
|
page: ProductDetailPage(model.finalProducts[index]),
|
|
|
|
|
)),
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
@ -466,10 +306,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
@ -493,285 +331,143 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
: Expanded(
|
|
|
|
|
child: model.finalProducts.length > 0
|
|
|
|
|
? Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
5.0,
|
|
|
|
|
height: MediaQuery.of(context).size.height * 5.0,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
itemCount: model.finalProducts.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: Card(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets
|
|
|
|
|
.only(
|
|
|
|
|
left: 2.0,
|
|
|
|
|
top: 2.0,
|
|
|
|
|
right: 2.0,
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 9.0,
|
|
|
|
|
top: 8.0,
|
|
|
|
|
right: 10.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// margin: EdgeInsets
|
|
|
|
|
// .fromLTRB(
|
|
|
|
|
// 8, 0, 8, 0),
|
|
|
|
|
alignment: Alignment
|
|
|
|
|
.center,
|
|
|
|
|
child:
|
|
|
|
|
Image.network(
|
|
|
|
|
model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images
|
|
|
|
|
.isNotEmpty
|
|
|
|
|
? model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images[0]
|
|
|
|
|
.thumb
|
|
|
|
|
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
|
|
|
|
|
fit: BoxFit
|
|
|
|
|
.contain,
|
|
|
|
|
height: 70,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Image.network(
|
|
|
|
|
model.finalProducts[index].images.isNotEmpty
|
|
|
|
|
? model.finalProducts[index].images[0].thumb
|
|
|
|
|
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
height: 80,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// Container(
|
|
|
|
|
// width: model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessage !=
|
|
|
|
|
// null
|
|
|
|
|
// ? MediaQuery.of(
|
|
|
|
|
// context)
|
|
|
|
|
// .size
|
|
|
|
|
// .width /
|
|
|
|
|
// 5.3
|
|
|
|
|
// : 0,
|
|
|
|
|
// padding:
|
|
|
|
|
// EdgeInsets.all(
|
|
|
|
|
// 4),
|
|
|
|
|
// decoration:
|
|
|
|
|
// BoxDecoration(
|
|
|
|
|
// color: Color(
|
|
|
|
|
// 0xffb23838),
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// topLeft: Radius
|
|
|
|
|
// .circular(
|
|
|
|
|
// 6)),
|
|
|
|
|
// ),
|
|
|
|
|
// child: Texts(
|
|
|
|
|
// model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessage !=
|
|
|
|
|
// null
|
|
|
|
|
// ? model
|
|
|
|
|
// .finalProducts[
|
|
|
|
|
// index]
|
|
|
|
|
// .rxMessage
|
|
|
|
|
// : "",
|
|
|
|
|
// color:
|
|
|
|
|
// Colors.white,
|
|
|
|
|
// regular: true,
|
|
|
|
|
// fontSize: 10,
|
|
|
|
|
// fontWeight:
|
|
|
|
|
// FontWeight
|
|
|
|
|
// .w600,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 130.0,
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 0,
|
|
|
|
|
vertical: 6,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment
|
|
|
|
|
.spaceAround,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets
|
|
|
|
|
.symmetric(
|
|
|
|
|
horizontal: 4,
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
width: model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? MediaQuery.of(
|
|
|
|
|
context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
2.0
|
|
|
|
|
: 0,
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(
|
|
|
|
|
4),
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(
|
|
|
|
|
color: Color(
|
|
|
|
|
0xffb23838),
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// topLeft: Radius
|
|
|
|
|
// .circular(
|
|
|
|
|
// 6)),
|
|
|
|
|
width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0,
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
|
|
|
|
|
),
|
|
|
|
|
child: model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? Texts(
|
|
|
|
|
languageID ==
|
|
|
|
|
'ar'
|
|
|
|
|
? model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessagen
|
|
|
|
|
: model
|
|
|
|
|
.finalProducts[index]
|
|
|
|
|
.rxMessage,
|
|
|
|
|
color: Colors
|
|
|
|
|
.white,
|
|
|
|
|
regular:
|
|
|
|
|
true,
|
|
|
|
|
fontSize:
|
|
|
|
|
10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w600,
|
|
|
|
|
)
|
|
|
|
|
: Texts(""),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(
|
|
|
|
|
context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.65,
|
|
|
|
|
child: Texts(
|
|
|
|
|
model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.name,
|
|
|
|
|
model.finalProducts[index].rxMessage != null ? model.finalProducts[index].rxMessage : "",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 13.2,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w500,
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8.0,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets
|
|
|
|
|
.only(
|
|
|
|
|
top: 4,
|
|
|
|
|
bottom: 4),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.finalProducts[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StarRating(
|
|
|
|
|
totalAverage: model
|
|
|
|
|
.finalProducts[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum >
|
|
|
|
|
0
|
|
|
|
|
? (model.finalProducts[index].approvedRatingSum.toDouble() /
|
|
|
|
|
model.finalProducts[index].approvedRatingSum
|
|
|
|
|
.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
forceStars:
|
|
|
|
|
true),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.finalProducts[index].approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w400,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 100.0,
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 6,
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
widget.authenticatedUserObject.isLogin
|
|
|
|
|
? Container(
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(Icons.shopping_cart,
|
|
|
|
|
size: 18,
|
|
|
|
|
color: Colors.blue,),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if(model.finalProducts[index].rxMessage == null){
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await addToCartFunction(1, model.finalProducts[index].id);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(page: CartOrderPage()));
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
|
|
|
|
|
}
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 4.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.65,
|
|
|
|
|
child: Texts(
|
|
|
|
|
model.finalProducts[index].name,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 13.2,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8.0,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 4),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.finalProducts[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StarRating(
|
|
|
|
|
totalAverage: model.finalProducts[index].approvedRatingSum > 0
|
|
|
|
|
? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
forceStars: true),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.finalProducts[index].approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
widget.authenticatedUserObject.isLogin
|
|
|
|
|
? Container(
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.shopping_cart,
|
|
|
|
|
size: 18,
|
|
|
|
|
color: Colors.blue,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (model.finalProducts[index].rxMessage == null) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await addToCartFunction(1, model.finalProducts[index].id);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Navigator.push(context, FadePage(page: CartOrderPage()));
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
):Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: () => {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: ProductDetailPage(
|
|
|
|
|
model.finalProducts[
|
|
|
|
|
index]),
|
|
|
|
|
page: ProductDetailPage(model.finalProducts[index]),
|
|
|
|
|
)),
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -779,10 +475,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
|