Merge branch 'development' into pharmacy-payment-feature

merge-requests/273/head
mosazaid 5 years ago
commit c64769e422

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart';
@ -22,20 +23,20 @@ class PharmacyCategoriseService extends BaseService {
List<CategoriseParentModel> get parentCategoriseList => _parentCategoriseList;
//service three
List<ParentProductsModel> _parentProductsList = List();
List<ParentProductsModel> get parentProductsList => _parentProductsList;
List<PharmacyProduct> _parentProductsList = List();
List<PharmacyProduct> get parentProductsList => _parentProductsList;
//service four
List<SubCategoriesModel> _subCategoriseList = List();
List<SubCategoriesModel> get subCategoriseList => _subCategoriseList;
//service five
List<SubProductsModel> _subProductsList = List();
List<SubProductsModel> get subProductsList => _subProductsList;
List<PharmacyProduct> _subProductsList = List();
List<PharmacyProduct> get subProductsList => _subProductsList;
//service six
List<FinalProductsModel> _finalProducts = List();
List<FinalProductsModel> get finalProducts => _finalProducts;
List<PharmacyProduct> _finalProducts = List();
List<PharmacyProduct> get finalProducts => _finalProducts;
//service 7
@ -44,8 +45,8 @@ class PharmacyCategoriseService extends BaseService {
// service 8
List<SearchProductsModel> _searchList = List();
List<SearchProductsModel> get searchList => _searchList;
List<PharmacyProduct> _searchList = List();
List<PharmacyProduct> get searchList => _searchList;
List<ScanQrModel> _scanList = List();
List<ScanQrModel> get scanList => _scanList;
@ -101,7 +102,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_searchList.add(SearchProductsModel.fromJson(item));
_searchList.add(PharmacyProduct.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
@ -157,7 +158,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_parentProductsList.add(ParentProductsModel.fromJson(item));
_parentProductsList.add(PharmacyProduct.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
@ -197,7 +198,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_subProductsList.add(SubProductsModel.fromJson(item));
_subProductsList.add(PharmacyProduct.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
@ -216,7 +217,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item));
_finalProducts.add(PharmacyProduct.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
@ -235,25 +236,30 @@ class PharmacyCategoriseService extends BaseService {
GET_BRAND_ITEMS,
onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item));
_finalProducts.add(PharmacyProduct.fromJson(item));
});
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, queryParams: queryParams,
},
queryParams: queryParams,
);
}
Future getLastVisitedProducts() async {
String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) {
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
try {
await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) {
await baseAppClient
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited",
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item));
_finalProducts.add(PharmacyProduct.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -268,13 +274,14 @@ class PharmacyCategoriseService extends BaseService {
Future getBestSellerProducts() async {
Map<String, String> queryParams = {
'fields':
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews',
};
try {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) {
await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT,
onSuccess: (dynamic response, int statusCode) {
_finalProducts.clear();
response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item));
_finalProducts.add(PharmacyProduct.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart';
@ -16,22 +17,29 @@ import 'base_view_model.dart';
class PharmacyCategoriseViewModel extends BaseViewModel {
bool hasError = false;
PharmacyCategoriseService _pharmacyCategoriseService = locator<PharmacyCategoriseService>();
PharmacyCategoriseService _pharmacyCategoriseService =
locator<PharmacyCategoriseService>();
List<PharmacyCategorise> get categorise => _pharmacyCategoriseService.categoriseList;
List<PharmacyCategorise> get categorise =>
_pharmacyCategoriseService.categoriseList;
List<CategoriseParentModel> get categoriseParent => _pharmacyCategoriseService.parentCategoriseList;
List<CategoriseParentModel> get categoriseParent =>
_pharmacyCategoriseService.parentCategoriseList;
List<ParentProductsModel> get parentProducts => _pharmacyCategoriseService.parentProductsList;
List<PharmacyProduct> get parentProducts =>
_pharmacyCategoriseService.parentProductsList;
List<SubCategoriesModel> get subCategorise => _pharmacyCategoriseService.subCategoriseList;
List<SubCategoriesModel> get subCategorise =>
_pharmacyCategoriseService.subCategoriseList;
List<SubProductsModel> get subProducts => _pharmacyCategoriseService.subProductsList;
List<PharmacyProduct> get subProducts =>
_pharmacyCategoriseService.subProductsList;
List<FinalProductsModel> get finalProducts => _pharmacyCategoriseService.finalProducts;
List<PharmacyProduct> get finalProducts =>
_pharmacyCategoriseService.finalProducts;
List<BrandsModel> get brandsList => _pharmacyCategoriseService.brandsList;
List<SearchProductsModel> get searchList => _pharmacyCategoriseService.searchList;
List<PharmacyProduct> get searchList => _pharmacyCategoriseService.searchList;
List<ScanQrModel> get scanList => _pharmacyCategoriseService.scanList;

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/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/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'base/base_view.dart';
@ -20,9 +22,7 @@ class FinalProductsPage extends StatefulWidget {
class _FinalProductsPageState extends State<FinalProductsPage> {
String id;
_FinalProductsPageState({this.id});
String categoriseName = "Personal Care";
bool styleOne = true;
bool styleTwo = false;
@ -31,7 +31,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
color: Colors.blue,
size: 29.0,
);
@override
Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>(
@ -135,193 +134,220 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.finalProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
child: InkWell(
child: Card(
color: model.finalProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
),
color: Colors.white,
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
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: 80,
),
),
Container(
width: model
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin:
EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network(
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)),
.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: 80,
),
),
child: Texts(
model.finalProducts[index]
Container(
width: model
.finalProducts[
index]
.rxMessage !=
null
? model
.finalProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w600,
? 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: Texts(
model
.finalProducts[
index]
.rxMessage !=
null
? model
.finalProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w600,
),
),
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
],
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
if (model
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
if (model
.finalProducts[
index]
.discountName !=
null)
Container(
width:
double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
),
child: Center(
child: Texts(
model
.finalProducts[
index]
.discountName,
regular: true,
color:
Colors.white,
fontSize: 10.4,
),
),
),
Texts(
model
.finalProducts[
index]
.discountName !=
null)
Container(
width: double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color:
Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.finalProducts[
index]
.discountName,
regular: true,
color: Colors.white,
fontSize: 10.4,
),
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Texts(
model.finalProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
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,
)
],
),
),
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,
)
],
),
],
],
),
),
),
],
],
),
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[index]),
)),
},
));
},
),
@ -334,158 +360,186 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
itemCount: model.finalProducts.length,
itemBuilder:
(BuildContext context, int index) {
return Card(
child: Row(
children: [
Stack(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
return InkWell(
child: Card(
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(
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,
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 /
3.5
: 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: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
Column(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
width: model
.finalProducts[
index]
.rxMessage !=
null
? MediaQuery.of(context)
width:
MediaQuery.of(context)
.size
.width /
3.5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(6)),
),
.width *
0.65,
child: Texts(
model.finalProducts[index]
.rxMessage !=
null
? model
.finalProducts[
index]
.rxMessage
: "",
color: Colors.white,
.name,
regular: true,
fontSize: 10,
fontSize: 13.2,
fontWeight:
FontWeight.w600,
FontWeight.w500,
maxLines: 5,
),
),
],
),
],
),
Container(
height: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
height: 35.0,
width: 250.0,
child: Texts(
model.finalProducts[index]
.name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
maxLines: 2,
SizedBox(
height: 8.0,
),
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.finalProducts[index].price}",
bold: true,
fontSize: 14,
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,
)
],
),
],
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,
)
],
),
],
),
),
),
],
],
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[index]),
)),
},
);
}),
),

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -8,6 +9,7 @@ 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:provider/provider.dart';
import 'package:giffy_dialog/giffy_dialog.dart';
@ -111,10 +113,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context: context,
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context)
.size
.height *
0.89,
// height: MediaQuery.of(context)
// .size
// .height *
// 0.89,
color: Colors.white,
child: Center(
child: ListView.builder(
@ -130,7 +132,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Padding(
padding:
EdgeInsets.all(
8.0),
4.0),
child: InkWell(
child: Column(
crossAxisAlignment:
@ -229,10 +231,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.size
.width *
0.197,
height: MediaQuery.of(context)
.size
.height *
0.08,
// height: MediaQuery.of(context)
// .size
// .height *
// 0.08,
child: Center(
child: Texts(
projectViewModel.isArabic
@ -646,246 +648,260 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
(BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.parentProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
child: InkWell(
child: Card(
color: model.parentProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(110.0),
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(110.0),
),
color: Colors.white,
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
if (model
.parentProducts[
index]
.discountName !=
null)
RotatedBox(
quarterTurns: 4,
child: Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets
.only(
right: 5.0,
top: 20.0,
bottom: 5.0,
),
child: Texts(
'offer'
.toUpperCase(),
color:
Colors.red,
fontSize: 13.0,
fontWeight:
FontWeight
.w900,
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
if (model
.parentProducts[
index]
.discountName !=
null)
RotatedBox(
quarterTurns: 4,
child: Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets
.only(
right: 5.0,
top: 20.0,
bottom: 5.0,
),
child: Texts(
'offer'
.toUpperCase(),
color: Colors
.red,
fontSize:
13.0,
fontWeight:
FontWeight
.w900,
),
),
transform: new Matrix4
.rotationZ(
5.837200),
),
transform: new Matrix4
.rotationZ(
5.837200),
),
),
Container(
margin:
EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
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: 80,
),
),
Container(
width: model
Container(
margin: EdgeInsets
.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.parentProducts[
index]
.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)),
.images
.isNotEmpty
? model
.parentProducts[
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: 80,
),
),
child: Texts(
model
Container(
width: model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Texts(
model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
),
),
),
],
),
Container(
margin:
EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
],
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
if (model
Container(
margin:
EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
if (model
.parentProducts[
index]
.discountName !=
null)
Container(
width: double
.infinity,
height: 13.0,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
),
child: Center(
child: Texts(
model
.parentProducts[
index]
.discountName,
regular: true,
color: Colors
.white,
fontSize:
10.4,
),
),
),
Texts(
model
.parentProducts[
index]
.discountName !=
null)
Container(
width:
double.infinity,
height: 13.0,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
),
child: Center(
child: Texts(
model
.parentProducts[
index]
.discountName,
regular: true,
color: Colors
.white,
fontSize: 10.4,
),
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w700,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Texts(
model
.parentProducts[
index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w700,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
fontSize: 14,
Row(
children: [
StarRating(
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum.toDouble() /
model.parentProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars:
true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
)
],
),
),
Row(
children: [
StarRating(
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum.toDouble() /
model.parentProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars:
true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
)
],
),
],
],
),
),
),
],
],
),
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.parentProducts[
index]),
)),
},
));
},
),
@ -898,168 +914,191 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
itemCount: model.parentProducts.length,
itemBuilder:
(BuildContext context, int index) {
return Card(
child: Row(
children: [
Stack(
children: [
Column(
children: [
Container(
decoration:
BoxDecoration(),
child: Padding(
padding:
EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
return InkWell(
child: Card(
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(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.parentProducts[
index]
.images
.isNotEmpty
? model
.parentProducts[
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
Container(
margin: EdgeInsets
.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.parentProducts[
index]
.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)),
.images
.isNotEmpty
? model
.parentProducts[
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,
),
),
child: Texts(
model
],
),
Column(
children: [
Container(
width: model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "",
color: Colors.white,
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Expanded(
child: Texts(
model
.parentProducts[
index]
.rxMessage !=
null
? model
.parentProducts[
index]
.rxMessage
: "",
color:
Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
),
),
),
],
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
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
.parentProducts[
index]
.name,
regular: true,
fontSize: 10,
fontSize: 13.2,
fontWeight:
FontWeight.w400,
FontWeight.w500,
maxLines: 5,
),
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.parentProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum
.toDouble() /
model
.parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
],
),
Container(
height: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Texts(
model
.parentProducts[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.parentProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.parentProducts[
index]
.approvedRatingSum >
0
? (model.parentProducts[index].approvedRatingSum
.toDouble() /
model
.parentProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
],
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model
.parentProducts[index]),
)),
},
);
}),
)

File diff suppressed because it is too large Load Diff

@ -1,6 +1,8 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -8,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_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 'base/base_view.dart';
@ -45,13 +48,13 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
child: Row(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.79,
width: MediaQuery.of(context).size.width * 0.70,
child: Form(
key: _formKey,
child: TextFields(
autoFocus: true,
hintText: 'Search',
fontSize: 19.0,
fontSize: 14.5,
prefixIcon: Icon(Icons.search),
inputAction: TextInputAction.search,
onSaved: (value) {
@ -102,170 +105,192 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
child: NetworkBaseView(
baseViewModel: model,
child: model.searchList.isNotEmpty
? Container(
height: MediaQuery.of(context).size.height * 0.80,
child: GridView.builder(
//physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
),
itemCount: model.searchList.length,
itemBuilder: (BuildContext context, int index) {
return Card(
color: model.searchList[index].discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
? InkWell(
child: Container(
height: MediaQuery.of(context).size.height * 0.80,
child: GridView.builder(
//physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 1.0,
),
itemCount: model.searchList.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Card(
color: model.searchList[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
),
color: Colors.white,
),
padding:
EdgeInsets.symmetric(horizontal: 0),
width:
MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
),
color: Colors.white,
),
padding:
EdgeInsets.symmetric(horizontal: 0),
width:
MediaQuery.of(context).size.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.searchList[index].images
.isNotEmpty
? model.searchList[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: 80,
),
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.searchList[index]
.images.isNotEmpty
? model
.searchList[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: 80,
),
),
Container(
width: model.searchList[index]
.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: Texts(
model.searchList[index]
.rxMessage !=
null
? model
.searchList[index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),
),
],
),
Container(
width: model.searchList[index]
.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)),
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Texts(
model.searchList[index]
.rxMessage !=
null
? model.searchList[index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
model.searchList[index].name,
regular: true,
fontSize: 12,
fontWeight: FontWeight.w400,
),
Padding(
padding: const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.searchList[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
StarRating(
totalAverage: model
.searchList[
index]
.approvedRatingSum >
0
? (model
.searchList[
index]
.approvedRatingSum
.toDouble() /
model
.searchList[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.searchList[index].approvedTotalReviews})",
model
.searchList[index].name,
regular: true,
fontSize: 10,
fontSize: 12,
fontWeight: FontWeight.w400,
)
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.searchList[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.searchList[
index]
.approvedRatingSum >
0
? (model
.searchList[
index]
.approvedRatingSum
.toDouble() /
model
.searchList[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.searchList[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
],
),
),
],
),
],
),
),
),
);
},
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.searchList[index]),
)),
},
);
},
),
),
)
: Texts(msg),

@ -1,10 +1,12 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.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/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -607,168 +609,189 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.subProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
child: InkWell(
child: Card(
color: model.subProducts[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
left: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
bottom: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
),
),
top: BorderSide(
color: Colors.grey.shade300,
width: 1,
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
),
color: Colors.white,
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.subProducts[index]
.images.isNotEmpty
? model
.subProducts[
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: 80,
),
),
Container(
width: model
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin:
EdgeInsets.fromLTRB(
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.subProducts[
index]
.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)),
.images
.isNotEmpty
? model
.subProducts[
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: 80,
),
),
child: Texts(
model.subProducts[index]
Container(
width: model
.subProducts[
index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
),
),
],
),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Texts(
model.subProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
const EdgeInsets.only(
top: 4,
bottom: 4),
EdgeInsets.all(4),
decoration: BoxDecoration(
color:
Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
),
),
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Texts(
model.subProducts[index]
.name,
regular: true,
fontSize: 12,
fontWeight:
FontWeight.w400,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
),
),
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
],
),
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
)),
},
));
},
),
@ -780,158 +803,184 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subProducts.length,
itemBuilder:
(BuildContext context, int index) {
return Card(
child: Row(
children: [
Stack(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(),
child: Padding(
padding: EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
return InkWell(
child: Card(
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(
0, 0, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.subProducts[index]
.images.isNotEmpty
? model
.subProducts[
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,
Container(
margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
child: Image.network(
model
.subProducts[
index]
.images
.isNotEmpty
? model
.subProducts[
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
.subProducts[
index]
.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: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
),
),
],
),
],
),
Container(
height: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
Column(
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(context)
width:
MediaQuery.of(context)
.size
.width /
5
: 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(6)),
),
.width *
0.65,
child: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
: "",
color: Colors.white,
.name,
regular: true,
fontSize: 10,
fontSize: 13.2,
fontWeight:
FontWeight.w400,
FontWeight.w500,
maxLines: 5,
),
),
],
),
],
),
Container(
height: 100.0,
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
height: 35.0,
width: 250.0,
child: Texts(
model.subProducts[index]
.name,
regular: true,
fontSize: 13.2,
fontWeight: FontWeight.w500,
maxLines: 2,
SizedBox(
height: 8.0,
),
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts(
"SAR ${model.subProducts[index].price}",
bold: true,
fontSize: 14,
),
),
),
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model
.subProducts[
index]
.approvedRatingSum
.toDouble() /
model
.parentProducts[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model
.subProducts[
index]
.approvedRatingSum
.toDouble() /
model
.parentProducts[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0,
forceStars: true),
Texts(
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
)
],
),
],
),
),
),
],
],
),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
)),
},
);
}),
)

Loading…
Cancel
Save