Merge branch 'pharmacy-bugs' into 'development'

pharmacy bugs fixed

See merge request Cloud_Solution/diplomatic-quarter!272
merge-requests/273/merge
Mohammad Aljammal 5 years ago
commit d84d60dc56

@ -1,5 +1,6 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.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/pharmacy/brands_model.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/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_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; List<CategoriseParentModel> get parentCategoriseList => _parentCategoriseList;
//service three //service three
List<ParentProductsModel> _parentProductsList = List(); List<PharmacyProduct> _parentProductsList = List();
List<ParentProductsModel> get parentProductsList => _parentProductsList; List<PharmacyProduct> get parentProductsList => _parentProductsList;
//service four //service four
List<SubCategoriesModel> _subCategoriseList = List(); List<SubCategoriesModel> _subCategoriseList = List();
List<SubCategoriesModel> get subCategoriseList => _subCategoriseList; List<SubCategoriesModel> get subCategoriseList => _subCategoriseList;
//service five //service five
List<SubProductsModel> _subProductsList = List(); List<PharmacyProduct> _subProductsList = List();
List<SubProductsModel> get subProductsList => _subProductsList; List<PharmacyProduct> get subProductsList => _subProductsList;
//service six //service six
List<FinalProductsModel> _finalProducts = List(); List<PharmacyProduct> _finalProducts = List();
List<FinalProductsModel> get finalProducts => _finalProducts; List<PharmacyProduct> get finalProducts => _finalProducts;
//service 7 //service 7
@ -44,8 +45,8 @@ class PharmacyCategoriseService extends BaseService {
// service 8 // service 8
List<SearchProductsModel> _searchList = List(); List<PharmacyProduct> _searchList = List();
List<SearchProductsModel> get searchList => _searchList; List<PharmacyProduct> get searchList => _searchList;
List<ScanQrModel> _scanList = List(); List<ScanQrModel> _scanList = List();
List<ScanQrModel> get scanList => _scanList; List<ScanQrModel> get scanList => _scanList;
@ -101,7 +102,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint, endPoint,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_searchList.add(SearchProductsModel.fromJson(item)); _searchList.add(PharmacyProduct.fromJson(item));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
@ -157,7 +158,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint, endPoint,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_parentProductsList.add(ParentProductsModel.fromJson(item)); _parentProductsList.add(PharmacyProduct.fromJson(item));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
@ -197,7 +198,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint, endPoint,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_subProductsList.add(SubProductsModel.fromJson(item)); _subProductsList.add(PharmacyProduct.fromJson(item));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
@ -216,7 +217,7 @@ class PharmacyCategoriseService extends BaseService {
endPoint, endPoint,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item)); _finalProducts.add(PharmacyProduct.fromJson(item));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
@ -235,25 +236,30 @@ class PharmacyCategoriseService extends BaseService {
GET_BRAND_ITEMS, GET_BRAND_ITEMS,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['products'].forEach((item) { response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item)); _finalProducts.add(PharmacyProduct.fromJson(item));
}); });
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, queryParams: queryParams, },
queryParams: queryParams,
); );
} }
Future getLastVisitedProducts() async { Future getLastVisitedProducts() async {
String lastVisited = ""; String lastVisited = "";
if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) !=
lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); null) {
lastVisited =
await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS);
try { 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(); _finalProducts.clear();
response['products'].forEach((item) { response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item)); _finalProducts.add(PharmacyProduct.fromJson(item));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
@ -271,10 +277,11 @@ class PharmacyCategoriseService extends BaseService {
'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 { 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(); _finalProducts.clear();
response['products'].forEach((item) { response['products'].forEach((item) {
_finalProducts.add(FinalProductsModel.fromJson(item)); _finalProducts.add(PharmacyProduct.fromJson(item));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; 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/brands_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_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 { class PharmacyCategoriseViewModel extends BaseViewModel {
bool hasError = false; 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<BrandsModel> get brandsList => _pharmacyCategoriseService.brandsList;
List<SearchProductsModel> get searchList => _pharmacyCategoriseService.searchList; List<PharmacyProduct> get searchList => _pharmacyCategoriseService.searchList;
List<ScanQrModel> get scanList => _pharmacyCategoriseService.scanList; List<ScanQrModel> get scanList => _pharmacyCategoriseService.scanList;

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.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_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.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/material.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -20,9 +22,7 @@ class FinalProductsPage extends StatefulWidget {
class _FinalProductsPageState extends State<FinalProductsPage> { class _FinalProductsPageState extends State<FinalProductsPage> {
String id; String id;
_FinalProductsPageState({this.id}); _FinalProductsPageState({this.id});
String categoriseName = "Personal Care"; String categoriseName = "Personal Care";
bool styleOne = true; bool styleOne = true;
bool styleTwo = false; bool styleTwo = false;
@ -31,7 +31,6 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
color: Colors.blue, color: Colors.blue,
size: 29.0, size: 29.0,
); );
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
@ -135,6 +134,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: InkWell(
child: Card( child: Card(
color: model.finalProducts[index] color: model.finalProducts[index]
.discountName != .discountName !=
@ -184,12 +184,17 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Stack( Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets.fromLTRB( margin:
EdgeInsets.fromLTRB(
0, 16, 0, 0), 0, 16, 0, 0),
alignment: Alignment.center, alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.finalProducts[index] model
.images.isNotEmpty .finalProducts[
index]
.images
.isNotEmpty
? model ? model
.finalProducts[ .finalProducts[
index] index]
@ -206,21 +211,27 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
2.8 2.8
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.finalProducts[index] model
.finalProducts[
index]
.rxMessage != .rxMessage !=
null null
? model ? model
@ -244,7 +255,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
if (model if (model
.finalProducts[ .finalProducts[
@ -252,12 +264,13 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
.discountName != .discountName !=
null) null)
Container( Container(
width: double.infinity, width:
double.infinity,
height: 13.0, height: 13.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color: Color(
Color(0xff5AB145), 0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
@ -266,13 +279,16 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
index] index]
.discountName, .discountName,
regular: true, regular: true,
color: Colors.white, color:
Colors.white,
fontSize: 10.4, fontSize: 10.4,
), ),
), ),
), ),
Texts( Texts(
model.finalProducts[index] model
.finalProducts[
index]
.name, .name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
@ -281,7 +297,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
.only(
top: 4, top: 4,
bottom: 4), bottom: 4),
child: Texts( child: Texts(
@ -322,6 +339,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
], ],
), ),
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[index]),
)),
},
)); ));
}, },
), ),
@ -334,7 +360,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
itemCount: model.finalProducts.length, itemCount: model.finalProducts.length,
itemBuilder: itemBuilder:
(BuildContext context, int index) { (BuildContext context, int index) {
return Card( return InkWell(
child: Card(
child: Row( child: Row(
children: [ children: [
Stack( Stack(
@ -342,9 +369,11 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
@ -352,12 +381,17 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: Alignment.center, alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.finalProducts[index] model
.images.isNotEmpty .finalProducts[
index]
.images
.isNotEmpty
? model ? model
.finalProducts[ .finalProducts[
index] index]
@ -378,21 +412,27 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
3.5 3.5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.finalProducts[index] model
.finalProducts[
index]
.rxMessage != .rxMessage !=
null null
? model ? model
@ -419,7 +459,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment
.spaceAround,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
@ -427,15 +468,19 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
height: 4.0, height: 4.0,
), ),
Container( Container(
height: 35.0, width:
width: 250.0, MediaQuery.of(context)
.size
.width *
0.65,
child: Texts( child: Texts(
model.finalProducts[index] model.finalProducts[index]
.name, .name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight:
maxLines: 2, FontWeight.w500,
maxLines: 5,
), ),
), ),
SizedBox( SizedBox(
@ -486,6 +531,15 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
), ),
], ],
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.finalProducts[index]),
)),
},
); );
}), }),
), ),

@ -39,7 +39,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
body: Container( body: model.categorise.length != 0
? Container(
//height: MediaQuery.of(context).size.height * 0.57, //height: MediaQuery.of(context).size.height * 0.57,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -63,7 +64,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: model.categorise.length, itemCount: model.categorise.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Row( child: Row(
@ -76,7 +78,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200 color: Colors
.orange.shade200
.withOpacity(0.45), .withOpacity(0.45),
), ),
child: Icon( child: Icon(
@ -85,18 +88,22 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context) width:
MediaQuery.of(context)
.size .size
.width * .width *
0.2, 0.2,
height: MediaQuery.of(context) height:
MediaQuery.of(context)
.size .size
.height * .height *
0.09, 0.09,
child: Center( child: Center(
child: Texts( child: Texts(
model.categorise[index].name, model.categorise[index]
fontWeight: FontWeight.w600, .name,
fontWeight:
FontWeight.w600,
fontSize: 13.8, fontSize: 13.8,
), ),
), ),
@ -105,11 +112,13 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
onTap: () { onTap: () {
model.getOffersProducts( model.getOffersProducts(
i: model.categorise[index].id); i: model
String ids = model.categorise[index].id; .categorise[index].id);
String ids =
model.categorise[index].id;
categoriseName = categoriseName = model
model.categorise[index].name; .categorise[index].name;
}), }),
], ],
), ),
@ -179,7 +188,9 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
styleOne == true styleOne == true
? Expanded( ? Expanded(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.50, height:
MediaQuery.of(context).size.height *
0.50,
child: GridView.builder( child: GridView.builder(
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount( SliverGridDelegateWithFixedCrossAxisCount(
@ -189,7 +200,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
childAspectRatio: 0.85, childAspectRatio: 0.85,
), ),
itemCount: model.products.length, itemCount: model.products.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Card( child: Card(
@ -224,8 +236,10 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container( child: Container(
height: 250.0, height: 250.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius:
topLeft: Radius.circular(110.0), BorderRadius.only(
topLeft: Radius.circular(
110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -237,11 +251,14 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
3, 3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Stack( Stack(
children: [ children: [
if (model.products[index] if (model
.products[
index]
.discountName != .discountName !=
null) null)
RotatedBox( RotatedBox(
@ -251,7 +268,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
BoxDecoration(), BoxDecoration(),
child: Padding( child: Padding(
padding: padding:
EdgeInsets.only( EdgeInsets
.only(
right: 5.0, right: 5.0,
top: 20.0, top: 20.0,
bottom: 5.0, bottom: 5.0,
@ -259,10 +277,13 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Texts( child: Texts(
'offer' 'offer'
.toUpperCase(), .toUpperCase(),
color: Colors.red, color: Colors
fontSize: 13.0, .red,
fontSize:
13.0,
fontWeight: fontWeight:
FontWeight.w900, FontWeight
.w900,
), ),
), ),
transform: new Matrix4 transform: new Matrix4
@ -271,14 +292,21 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets
0, 16, 0, 0), .fromLTRB(0, 16,
alignment: Alignment.center, 0, 0),
child: Image.network( alignment: Alignment
model.products[index] .center,
.images.isNotEmpty child:
Image.network(
model
.products[
index]
.images
.isNotEmpty
? model ? model
.products[index] .products[
index]
.images[0] .images[0]
.thumb .thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
@ -287,85 +315,112 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
Container( Container(
width: model.products[index] width: model
.products[
index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
decoration: BoxDecoration( EdgeInsets.all(
color: Color(0xffb23838), 4),
borderRadius: decoration:
BorderRadius.only( BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.products[index] model
.products[
index]
.rxMessage != .rxMessage !=
null null
? model ? model
.products[index] .products[
index]
.rxMessage .rxMessage
: "", : "",
color: Colors.white, color:
Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight
.w400,
), ),
), ),
], ],
), ),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets
.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
if (model.products[index] if (model
.products[
index]
.discountName != .discountName !=
null) null)
Container( Container(
width: double.infinity, width: double
.infinity,
height: 22.0, height: 22.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color: Color(
Color(0xff5AB145), 0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
model model
.products[index] .products[
index]
.discountName, .discountName,
regular: true, regular:
color: Colors.white, true,
fontSize: 12.0, color: Colors
.white,
fontSize:
12.0,
fontWeight: fontWeight:
FontWeight.w700, FontWeight
.w700,
), ),
), ),
), ),
Texts( Texts(
model model
.products[index].name, .products[
index]
.name,
regular: true, regular: true,
fontSize: 12.58, fontSize: 12.58,
fontWeight: fontWeight:
FontWeight.w600, FontWeight
.w600,
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
.only(
top: 4, top: 4,
bottom: 4), bottom:
4),
child: Texts( child: Texts(
"SAR ${model.products[index].price}", "SAR ${model.products[index].price}",
bold: true, bold: true,
@ -375,26 +430,20 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: model totalAverage: model.products[index].approvedRatingSum >
.products[
index]
.approvedRatingSum >
0 0
? (model.products[index].approvedRatingSum ? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble())
.toDouble() /
model
.products[index]
.approvedRatingSum
.toDouble())
.toDouble() .toDouble()
: 0, : 0,
forceStars: true), forceStars:
true),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight
.w400,
) )
], ],
), ),
@ -413,8 +462,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container( child: Container(
child: ListView.builder( child: ListView.builder(
itemCount: model.products.length, itemCount: model.products.length,
itemBuilder: itemBuilder: (BuildContext context,
(BuildContext context, int index) { int index) {
return Card( return Card(
// color: // color:
// model.products[index].discountName != // model.products[index].discountName !=
@ -427,7 +476,9 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
children: [ children: [
Column( Column(
children: [ children: [
if (model.products[index] if (model
.products[
index]
.discountName != .discountName !=
null) null)
Container( Container(
@ -435,21 +486,27 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
BoxDecoration(), BoxDecoration(),
child: Padding( child: Padding(
padding: padding:
EdgeInsets.only( EdgeInsets
.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
), ),
child: Container( child:
color: Colors.yellow, Container(
color: Colors
.yellow,
height: 25.0, height: 25.0,
width: 70.0, width: 70.0,
child: Center( child: Center(
child: Texts( child:
Texts(
'offer' 'offer'
.toUpperCase(), .toUpperCase(),
color: Colors.red, color: Colors
fontSize: 13.0, .red,
fontSize:
13.0,
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w900,
@ -457,19 +514,26 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
), ),
transform: transform: new Matrix4
new Matrix4.rotationZ( .rotationZ(
6.15099), 6.15099),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets
.fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: Alignment.center, alignment: Alignment
child: Image.network( .center,
model.products[index] child:
.images.isNotEmpty Image.network(
model
.products[
index]
.images
.isNotEmpty
? model ? model
.products[index] .products[
index]
.images[0] .images[0]
.thumb .thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
@ -482,35 +546,47 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
width: model.products[index] width: model
.products[
index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
decoration: BoxDecoration( EdgeInsets.all(
color: Color(0xffb23838), 4),
borderRadius: decoration:
BorderRadius.only( BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.products[index] model
.products[
index]
.rxMessage != .rxMessage !=
null null
? model ? model
.products[index] .products[
index]
.rxMessage .rxMessage
: "", : "",
color: Colors.white, color:
Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight
.w400,
), ),
), ),
], ],
@ -518,36 +594,45 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
], ],
), ),
Container( Container(
margin: EdgeInsets.symmetric( margin:
EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
if (model.products[index] if (model
.products[index]
.discountName != .discountName !=
null) null)
Container( Container(
width: 250.0, width: 250.0,
height: 22.5, height: 22.5,
decoration: BoxDecoration( decoration:
color: Color(0xff5AB145), BoxDecoration(
color: Color(
0xff5AB145),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets
EdgeInsets.symmetric( .symmetric(
horizontal: 5.5, horizontal: 5.5,
), ),
child: Texts( child: Texts(
model.products[index] model
.products[
index]
.discountName, .discountName,
regular: true, regular: true,
color: Colors.white, color: Colors
.white,
fontSize: 12.0, fontSize: 12.0,
fontWeight: fontWeight:
FontWeight.w700, FontWeight
.w700,
), ),
), ),
), ),
@ -555,18 +640,22 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
height: 4.0, height: 4.0,
), ),
Texts( Texts(
model.products[index].name, model.products[index]
.name,
regular: true, regular: true,
fontSize: 14.0, fontSize: 14.0,
fontWeight: FontWeight.w600, fontWeight:
FontWeight.w600,
), ),
SizedBox( SizedBox(
height: 8.0, height: 8.0,
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
top: 4, bottom: 4), .only(
top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.products[index].price}", "SAR ${model.products[index].price}",
bold: true, bold: true,
@ -581,25 +670,20 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
index] index]
.approvedRatingSum > .approvedRatingSum >
0 0
? (model ? (model.products[index].approvedRatingSum.toDouble() /
.products[ model.products[index].approvedRatingSum
index]
.approvedRatingSum
.toDouble() /
model
.products[
index]
.approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
: 0, : 0,
forceStars: true), forceStars:
true),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w500, FontWeight
.w500,
) )
], ],
), ),
@ -614,7 +698,11 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
) )
], ],
), ),
), )
)); : Center(
child: Texts(
"SORRY , there's no listed offers now :(",
color: Colors.green,
))));
} }
} }

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_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/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.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/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:giffy_dialog/giffy_dialog.dart';
@ -111,10 +113,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Container( return Container(
height: MediaQuery.of(context) // height: MediaQuery.of(context)
.size // .size
.height * // .height *
0.89, // 0.89,
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
@ -130,7 +132,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Padding( child: Padding(
padding: padding:
EdgeInsets.all( EdgeInsets.all(
8.0), 4.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
@ -229,10 +231,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.size .size
.width * .width *
0.197, 0.197,
height: MediaQuery.of(context) // height: MediaQuery.of(context)
.size // .size
.height * // .height *
0.08, // 0.08,
child: Center( child: Center(
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic
@ -646,6 +648,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
(BuildContext context, int index) { (BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: InkWell(
child: Card( child: Card(
color: model.parentProducts[index] color: model.parentProducts[index]
.discountName != .discountName !=
@ -677,7 +680,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius:
BorderRadius.only(
topLeft: topLeft:
Radius.circular(110.0), Radius.circular(110.0),
), ),
@ -716,9 +720,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
'offer' 'offer'
.toUpperCase(), .toUpperCase(),
color: color: Colors
Colors.red, .red,
fontSize: 13.0, fontSize:
13.0,
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w900,
@ -730,8 +735,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: margin: EdgeInsets
EdgeInsets.fromLTRB( .fromLTRB(
0, 16, 0, 0), 0, 16, 0, 0),
alignment: alignment:
Alignment.center, Alignment.center,
@ -767,8 +772,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
EdgeInsets.all(4), EdgeInsets.all(4),
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color: Color(
Color(0xffb23838), 0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
@ -812,8 +817,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.discountName != .discountName !=
null) null)
Container( Container(
width: width: double
double.infinity, .infinity,
height: 13.0, height: 13.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
@ -829,7 +834,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
regular: true, regular: true,
color: Colors color: Colors
.white, .white,
fontSize: 10.4, fontSize:
10.4,
), ),
), ),
), ),
@ -886,6 +892,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.parentProducts[
index]),
)),
},
)); ));
}, },
), ),
@ -898,7 +914,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
itemBuilder: itemBuilder:
(BuildContext context, int index) { (BuildContext context, int index) {
return Card( return InkWell(
child: Card(
child: Row( child: Row(
children: [ children: [
Stack( Stack(
@ -918,8 +935,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: margin: EdgeInsets
EdgeInsets.fromLTRB( .fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: alignment:
Alignment.center, Alignment.center,
@ -959,14 +976,15 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
EdgeInsets.all(4), EdgeInsets.all(4),
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color: Color(
Color(0xffb23838), 0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular( .circular(
6)), 6)),
), ),
child: Expanded(
child: Texts( child: Texts(
model model
.parentProducts[ .parentProducts[
@ -978,11 +996,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.rxMessage .rxMessage
: "", : "",
color: Colors.white, color:
Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight
.w400,
),
), ),
), ),
], ],
@ -990,7 +1011,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
Container( Container(
height: 100.0,
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
@ -1000,14 +1020,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
MainAxisAlignment MainAxisAlignment
.spaceAround, .spaceAround,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Texts( Container(
width: MediaQuery.of(
context)
.size
.width *
0.65,
child: Texts(
model model
.parentProducts[index] .parentProducts[
index]
.name, .name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
@ -1015,12 +1043,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
FontWeight.w500, FontWeight.w500,
maxLines: 5, maxLines: 5,
), ),
),
SizedBox( SizedBox(
height: 8.0, height: 8.0,
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
.only(
top: 4, top: 4,
bottom: 4), bottom: 4),
child: Texts( child: Texts(
@ -1060,6 +1090,15 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
], ],
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(model
.parentProducts[index]),
)),
},
); );
}), }),
) )

@ -80,12 +80,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: languageID == 'ar' child: languageID == 'ar'
? Text( ? Text(
widget.product.discountDescriptionn, widget.product
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), .discountDescriptionn,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
) )
: Text( : Text(
widget.product.discountDescription, widget.product
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), .discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
), ),
), ),
), ),
@ -96,7 +102,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
flex: 0, flex: 0,
child: Container( child: Container(
child: Image( child: Image(
image: AssetImage('assets/images/offer.png'), image: AssetImage(
'assets/images/offer.png'),
), ),
), ),
), ),
@ -174,7 +181,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -202,7 +211,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -230,7 +241,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -258,7 +271,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container( Container(
child: Text( child: Text(
TranslationBase.of(context).description, TranslationBase.of(context).description,
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
), ),
), ),
SizedBox( SizedBox(
@ -266,8 +282,13 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
languageID == 'ar' ? widget.product.shortDescriptionn : widget.product.shortDescription ?? "", languageID == 'ar'
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), ? widget.product.shortDescriptionn
: widget.product.shortDescription ??
"",
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
), ),
), ),
SizedBox( SizedBox(
@ -276,7 +297,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container( Container(
child: Text( child: Text(
TranslationBase.of(context).howToUse, TranslationBase.of(context).howToUse,
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
), ),
), ),
SizedBox( SizedBox(
@ -284,8 +308,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, languageID == 'ar'
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), ? widget.product.fullDescriptionn
: widget.product.fullDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
), ),
), ),
], ],
@ -293,41 +321,83 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
: isReviews : isReviews
? BaseView<ProductDetailViewModel>( ? BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductReviewsData(widget.product.id), onModelReady: (model) =>
builder: (_, model, wi) => model.getProductReviewsData(
model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 widget.product.id),
builder: (_, model, wi) => model
.productDetailService
.length !=
0 &&
model.productDetailService[0]
.reviews.length !=
0
? ListView.builder( ? ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: model.productDetailService[0].reviews.length, itemCount: model
.productDetailService[0]
.reviews
.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context,
int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
child: Row( child: Row(
children: [ children: [
Container( Container(
child: Text( child: Text(
model.productDetailService[0].reviews[index].customerId.toString(), model
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), .productDetailService[
0]
.reviews[
index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors
.grey,
fontWeight:
FontWeight
.w600),
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 210), margin:
child: RatingBar.readOnly( EdgeInsets.only(
initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), left: 210),
child: RatingBar
.readOnly(
initialRating: model
.productDetailService[
0]
.reviews[
index]
.rating
.toDouble(),
size: 15.0, size: 15.0,
filledColor: Colors.yellow[700], filledColor:
emptyColor: Colors.grey[500], Colors.yellow[
isHalfAllowed: true, 700],
halfFilledIcon: Icons.star_half, emptyColor: Colors
filledIcon: Icons.star, .grey[500],
emptyIcon: Icons.star, isHalfAllowed:
true,
halfFilledIcon:
Icons
.star_half,
filledIcon:
Icons.star,
emptyIcon:
Icons.star,
), ),
), ),
], ],
@ -338,14 +408,21 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
model.productDetailService[0].reviews[index].reviewText, model
style: TextStyle(fontSize: 20), .productDetailService[
0]
.reviews[index]
.reviewText,
style: TextStyle(
fontSize: 20),
), ),
), ),
SizedBox( SizedBox(
height: 50, height: 50,
), ),
Divider(height: 1, color: Colors.grey), Divider(
height: 1,
color: Colors.grey),
], ],
), ),
); );
@ -359,32 +436,47 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
: isAvailabilty : isAvailabilty
? BaseView<ProductDetailViewModel>( ? BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductLocationData(), onModelReady: (model) =>
builder: (_, model, wi) => model.productLocationService.length == 0 model.getProductLocationData(),
builder: (_, model, wi) => model
.productLocationService
.length ==
0
? Container( ? Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
alignment: Alignment.center, alignment: Alignment.center,
child: Text('No location Available'), child: Text(
'No location Available'),
) )
: ListView.builder( : ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemCount: model.productLocationService.length, itemCount: model
itemBuilder: (BuildContext context, int index) { .productLocationService
.length,
itemBuilder:
(BuildContext context,
int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding:
EdgeInsets.all(8.0),
child: Column( child: Column(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row( Row(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment
.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: Image.network(model.productLocationService[index].projectImageUrl), child: Image.network(model
.productLocationService[
index]
.projectImageUrl),
), ),
SizedBox( SizedBox(
width: 10, width: 10,
@ -392,31 +484,48 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded( Expanded(
flex: 4, flex: 4,
child: Text( child: Text(
model.productLocationService[index].locationDescription + model
.productLocationService[
index]
.locationDescription +
"\n" + "\n" +
fixingString(model.productLocationService[0].cityName.toString()), fixingString(model
style: TextStyle(fontSize: 12), .productLocationService[
0]
.cityName
.toString()),
style: TextStyle(
fontSize:
12),
), ),
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon(Icons.location_on), icon: Icon(Icons
color: Colors.red, .location_on),
onPressed: () {}, color:
Colors.red,
onPressed:
() {},
), ),
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon(Icons.phone), icon: Icon(Icons
color: Colors.red, .phone),
onPressed: () {}, color:
Colors.red,
onPressed:
() {},
), ),
), ),
], ],
), ),
Divider(height: 1.2, color: Colors.grey) Divider(
height: 1.2,
color: Colors.grey)
], ],
), ),
); );
@ -431,8 +540,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
], ],
), ),
), ),
bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, bottomSheet: footerWidget(
widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product),
) )
: AppScaffold( : AppScaffold(
appBarTitle: 'product detail page', appBarTitle: 'product detail page',
@ -465,12 +578,18 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: languageID == 'ar' child: languageID == 'ar'
? Text( ? Text(
widget.product.discountDescriptionn, widget.product
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), .discountDescriptionn,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
) )
: Text( : Text(
widget.product.discountDescription, widget.product
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), .discountDescription,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),
), ),
), ),
), ),
@ -481,7 +600,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
flex: 0, flex: 0,
child: Container( child: Container(
child: Image( child: Image(
image: AssetImage('assets/images/offer.png'), image: AssetImage(
'assets/images/offer.png'),
), ),
), ),
), ),
@ -551,7 +671,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).details, TranslationBase.of(context).details,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -579,7 +701,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).reviews, TranslationBase.of(context).reviews,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -607,7 +731,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
}, },
child: Text( child: Text(
TranslationBase.of(context).availability, TranslationBase.of(context).availability,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -635,7 +761,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Container( Container(
child: Text( child: Text(
TranslationBase.of(context).description, TranslationBase.of(context).description,
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), style: TextStyle(
fontSize: 17,
color: Colors.grey,
fontWeight: FontWeight.w600),
), ),
), ),
SizedBox( SizedBox(
@ -643,8 +772,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, languageID == 'ar'
style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), ? widget.product.fullDescriptionn
: widget.product.fullDescription,
style: TextStyle(
fontSize: 16,
fontFamily: 'WorkSans-Regular'),
), ),
), ),
], ],
@ -652,41 +785,83 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
: isReviews : isReviews
? BaseView<ProductDetailViewModel>( ? BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductReviewsData(widget.product.id), onModelReady: (model) =>
builder: (_, model, wi) => model.getProductReviewsData(
model.productDetailService.length != 0 && model.productDetailService[0].reviews.length != 0 widget.product.id),
builder: (_, model, wi) => model
.productDetailService
.length !=
0 &&
model.productDetailService[0]
.reviews.length !=
0
? ListView.builder( ? ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
itemCount: model.productDetailService[0].reviews.length, itemCount: model
.productDetailService[0]
.reviews
.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context,
int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
child: Row( child: Row(
children: [ children: [
Container( Container(
child: Text( child: Text(
model.productDetailService[0].reviews[index].customerId.toString(), model
style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), .productDetailService[
0]
.reviews[
index]
.customerId
.toString(),
style: TextStyle(
fontSize: 17,
color: Colors
.grey,
fontWeight:
FontWeight
.w600),
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 210), margin:
child: RatingBar.readOnly( EdgeInsets.only(
initialRating: model.productDetailService[0].reviews[index].rating.toDouble(), left: 210),
child: RatingBar
.readOnly(
initialRating: model
.productDetailService[
0]
.reviews[
index]
.rating
.toDouble(),
size: 15.0, size: 15.0,
filledColor: Colors.yellow[700], filledColor:
emptyColor: Colors.grey[500], Colors.yellow[
isHalfAllowed: true, 700],
halfFilledIcon: Icons.star_half, emptyColor: Colors
filledIcon: Icons.star, .grey[500],
emptyIcon: Icons.star, isHalfAllowed:
true,
halfFilledIcon:
Icons
.star_half,
filledIcon:
Icons.star,
emptyIcon:
Icons.star,
), ),
), ),
], ],
@ -697,14 +872,21 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
), ),
Container( Container(
child: Text( child: Text(
model.productDetailService[0].reviews[index].reviewText, model
style: TextStyle(fontSize: 20), .productDetailService[
0]
.reviews[index]
.reviewText,
style: TextStyle(
fontSize: 20),
), ),
), ),
SizedBox( SizedBox(
height: 50, height: 50,
), ),
Divider(height: 1, color: Colors.grey), Divider(
height: 1,
color: Colors.grey),
], ],
), ),
); );
@ -718,13 +900,17 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
) )
: isAvailabilty : isAvailabilty
? BaseView<ProductDetailViewModel>( ? BaseView<ProductDetailViewModel>(
onModelReady: (model) => model.getProductLocationData(), onModelReady: (model) =>
builder: (_, model, wi) => ListView.builder( model.getProductLocationData(),
builder: (_, model, wi) =>
ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemCount: model.productLocationService.length, itemCount: model
itemBuilder: (BuildContext context, int index) { .productLocationService.length,
itemBuilder: (BuildContext context,
int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Column( child: Column(
@ -733,11 +919,15 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
children: [ children: [
Row( Row(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: Image.network(model.productLocationService[index].projectImageUrl), child: Image.network(model
.productLocationService[
index]
.projectImageUrl),
), ),
SizedBox( SizedBox(
width: 10, width: 10,
@ -745,16 +935,25 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded( Expanded(
flex: 4, flex: 4,
child: Text( child: Text(
model.productLocationService[index].locationDescription + model
.productLocationService[
index]
.locationDescription +
"\n" + "\n" +
fixingString(model.productLocationService[0].cityName.toString()), fixingString(model
style: TextStyle(fontSize: 12), .productLocationService[
0]
.cityName
.toString()),
style: TextStyle(
fontSize: 12),
), ),
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon(Icons.location_on), icon: Icon(Icons
.location_on),
color: Colors.red, color: Colors.red,
onPressed: () {}, onPressed: () {},
), ),
@ -762,14 +961,17 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon(Icons.phone), icon:
Icon(Icons.phone),
color: Colors.red, color: Colors.red,
onPressed: () {}, onPressed: () {},
), ),
), ),
], ],
), ),
Divider(height: 1.2, color: Colors.grey) Divider(
height: 1.2,
color: Colors.grey)
], ],
), ),
); );
@ -784,8 +986,12 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
], ],
), ),
), ),
bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, bottomSheet: footerWidget(
widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), widget.product.stockAvailability != 'Out of stock',
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
widget.product.stockQuantity,
widget.product),
); );
} }
} }
@ -796,7 +1002,8 @@ class footerWidget extends StatefulWidget {
final int minQuantity; final int minQuantity;
final int quantityLimit; final int quantityLimit;
final PharmacyProduct item; final PharmacyProduct item;
footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item); footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item);
@override @override
_footerWidgetState createState() => _footerWidgetState(); _footerWidgetState createState() => _footerWidgetState();
} }
@ -826,7 +1033,8 @@ class _footerWidgetState extends State<footerWidget> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
TranslationBase.of(context).quantity, TranslationBase.of(context).quantity,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), style: TextStyle(
fontSize: 15, fontWeight: FontWeight.bold),
), ),
), ),
// ListView( // ListView(
@ -848,7 +1056,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'1', '1',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -873,7 +1083,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'2', '2',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -898,7 +1110,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'3', '3',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -923,7 +1137,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'4', '4',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -948,7 +1164,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'5', '5',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -973,7 +1191,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'6', '6',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -998,7 +1218,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'7', '7',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -1023,7 +1245,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'8', '8',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -1048,7 +1272,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'9', '9',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -1073,7 +1299,9 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.white, color: Colors.white,
child: Text( child: Text(
'10', '10',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
), ),
), ),
onTap: () { onTap: () {
@ -1094,7 +1322,8 @@ class _footerWidgetState extends State<footerWidget> {
Container( Container(
width: 50.0, width: 50.0,
child: TextField( child: TextField(
decoration: InputDecoration(labelText: 'quantity #'), decoration:
InputDecoration(labelText: 'quantity #'),
onChanged: (text) { onChanged: (text) {
print(price); print(price);
print(widget.quantityLimit); print(widget.quantityLimit);
@ -1173,7 +1402,10 @@ class _footerWidgetState extends State<footerWidget> {
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
TranslationBase.of(context).addToCart, TranslationBase.of(context).addToCart,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
), ),
), ),
) )
@ -1188,7 +1420,10 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.green, color: Colors.green,
child: Text( child: Text(
TranslationBase.of(context).addToCart, TranslationBase.of(context).addToCart,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
), ),
), ),
), ),
@ -1204,7 +1439,10 @@ class _footerWidgetState extends State<footerWidget> {
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
TranslationBase.of(context).buyNow, TranslationBase.of(context).buyNow,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
), ),
), ),
) )
@ -1214,7 +1452,8 @@ class _footerWidgetState extends State<footerWidget> {
addToCartFunction(price, widget.item.id); addToCartFunction(price, widget.item.id);
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => CartOrderPage()), MaterialPageRoute(
builder: (context) => CartOrderPage()),
); );
}, },
child: Container( child: Container(
@ -1224,7 +1463,10 @@ class _footerWidgetState extends State<footerWidget> {
color: Colors.blue, color: Colors.blue,
child: Text( child: Text(
TranslationBase.of(context).buyNow, TranslationBase.of(context).buyNow,
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 15),
), ),
), ),
), ),
@ -1265,12 +1507,15 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
widget.item.stockAvailability, widget.item.stockAvailability,
style: widget.item.stockAvailability == 'Out of stock' style: widget.item.stockAvailability == 'Out of stock'
? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red)
: TextStyle(fontWeight: FontWeight.bold, color: Colors.green), : TextStyle(
fontWeight: FontWeight.bold, color: Colors.green),
), ),
SizedBox(width: 20), SizedBox(width: 20),
widget.item.stockAvailability == 'Out of stock' && customerId != null widget.item.stockAvailability == 'Out of stock' &&
customerId != null
? InkWell( ? InkWell(
onTap: () => notifyMeWhenAvailable(context, widget.item.id), onTap: () =>
notifyMeWhenAvailable(context, widget.item.id),
child: Row(children: [ child: Row(children: [
Text( Text(
TranslationBase.of(context).notifyMe, TranslationBase.of(context).notifyMe,
@ -1288,7 +1533,9 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
]), ]),
) )
: Container( : Container(
margin: languageID == 'ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), margin: languageID == 'ar'
? EdgeInsets.only(right: 25)
: EdgeInsets.only(left: 25),
width: 40, width: 40,
height: 40, height: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -1324,9 +1571,12 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
child: Container( child: Container(
margin: EdgeInsets.only(left: 5), margin: EdgeInsets.only(left: 5),
child: Align( child: Align(
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, alignment:
languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
child: Text( child: Text(
languageID == 'ar' ? widget.item.fullDescriptionn : widget.item.fullDescription, languageID == 'ar'
? widget.item.fullDescriptionn
: widget.item.fullDescription,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
), ),
), ),
@ -1358,7 +1608,9 @@ class _productNameAndPriceState extends State<productNameAndPrice> {
child: Container( child: Container(
child: widget.item.rxMessage != null child: widget.item.rxMessage != null
? Text( ? Text(
languageID == 'ar' ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), languageID == 'ar'
? widget.item.rxMessagen.toString()
: widget.item.rxMessage.toString(),
style: TextStyle(color: Colors.red, fontSize: 10), style: TextStyle(color: Colors.red, fontSize: 10),
) )
: Container()), : Container()),
@ -1524,7 +1776,9 @@ slideDetail() {
), ),
color: Colors.white, color: Colors.white,
), ),
child: const Text('1', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF000000))), child: const Text('1',
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xFF000000))),
), ),
) )
], ],
@ -1606,7 +1860,13 @@ settingModalBottomSheet(context) {
leading: new Icon(Icons.shopping_cart), leading: new Icon(Icons.shopping_cart),
title: new Text('Add to cart'), title: new Text('Add to cart'),
onTap: () => { onTap: () => {
if (price > 0) {addToCartFunction(price, itemID)} else {AppToast.showErrorToast(message: "you should add quantity")} if (price > 0)
{addToCartFunction(price, itemID)}
else
{
AppToast.showErrorToast(
message: "you should add quantity")
}
}), }),
new ListTile( new ListTile(
leading: new Icon(Icons.favorite_border), leading: new Icon(Icons.favorite_border),
@ -1617,7 +1877,8 @@ settingModalBottomSheet(context) {
leading: new Icon(Icons.compare), leading: new Icon(Icons.compare),
title: new Text('Compare'), title: new Text('Compare'),
onTap: () => { onTap: () => {
Provider.of<CompareList>(context, listen: false).addItem(specificationData), Provider.of<CompareList>(context, listen: false)
.addItem(specificationData),
}, },
), ),
], ],

@ -1,6 +1,8 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.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/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.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/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.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/material.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -45,13 +48,13 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
child: Row( child: Row(
children: [ children: [
Container( Container(
width: MediaQuery.of(context).size.width * 0.79, width: MediaQuery.of(context).size.width * 0.70,
child: Form( child: Form(
key: _formKey, key: _formKey,
child: TextFields( child: TextFields(
autoFocus: true, autoFocus: true,
hintText: 'Search', hintText: 'Search',
fontSize: 19.0, fontSize: 14.5,
prefixIcon: Icon(Icons.search), prefixIcon: Icon(Icons.search),
inputAction: TextInputAction.search, inputAction: TextInputAction.search,
onSaved: (value) { onSaved: (value) {
@ -102,7 +105,8 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
child: NetworkBaseView( child: NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: model.searchList.isNotEmpty child: model.searchList.isNotEmpty
? Container( ? InkWell(
child: Container(
height: MediaQuery.of(context).size.height * 0.80, height: MediaQuery.of(context).size.height * 0.80,
child: GridView.builder( child: GridView.builder(
//physics: NeverScrollableScrollPhysics(), //physics: NeverScrollableScrollPhysics(),
@ -115,8 +119,10 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
), ),
itemCount: model.searchList.length, itemCount: model.searchList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Card( return InkWell(
color: model.searchList[index].discountName != child: Card(
color: model.searchList[index]
.discountName !=
null null
? Color(0xffFFFF00) ? Color(0xffFFFF00)
: Colors.white, : Colors.white,
@ -153,7 +159,8 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
padding: padding:
EdgeInsets.symmetric(horizontal: 0), EdgeInsets.symmetric(horizontal: 0),
width: width:
MediaQuery.of(context).size.width / 3, MediaQuery.of(context).size.width /
3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
@ -165,10 +172,12 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
0, 16, 0, 0), 0, 16, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.network( child: Image.network(
model.searchList[index].images model.searchList[index]
.isNotEmpty .images.isNotEmpty
? model.searchList[index] ? model
.images[0].thumb .searchList[index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
@ -186,15 +195,18 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: BorderRadius.only( borderRadius:
BorderRadius.only(
topLeft: topLeft:
Radius.circular(6)), Radius.circular(
6)),
), ),
child: Texts( child: Texts(
model.searchList[index] model.searchList[index]
.rxMessage != .rxMessage !=
null null
? model.searchList[index] ? model
.searchList[index]
.rxMessage .rxMessage
: "", : "",
color: Colors.white, color: Colors.white,
@ -215,13 +227,15 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
model.searchList[index].name, model
.searchList[index].name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding:
const EdgeInsets.only(
top: 4, bottom: 4), top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${model.searchList[index].price}", "SAR ${model.searchList[index].price}",
@ -254,7 +268,8 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
"(${model.searchList[index].approvedTotalReviews})", "(${model.searchList[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight:
FontWeight.w400,
) )
], ],
), ),
@ -264,9 +279,19 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
], ],
), ),
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.searchList[index]),
)),
},
); );
}, },
), ),
),
) )
: Texts(msg), : Texts(msg),
), ),

@ -1,10 +1,12 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_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/buttons/button.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/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.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/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -607,6 +609,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: InkWell(
child: Card( child: Card(
color: model.subProducts[index] color: model.subProducts[index]
.discountName != .discountName !=
@ -656,12 +659,17 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Stack( Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets.fromLTRB( margin:
EdgeInsets.fromLTRB(
0, 16, 0, 0), 0, 16, 0, 0),
alignment: Alignment.center, alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.subProducts[index] model
.images.isNotEmpty .subProducts[
index]
.images
.isNotEmpty
? model ? model
.subProducts[ .subProducts[
index] index]
@ -678,18 +686,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.subProducts[index] model.subProducts[index]
@ -716,7 +728,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment
.start,
children: [ children: [
Texts( Texts(
model.subProducts[index] model.subProducts[index]
@ -728,7 +741,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
.only(
top: 4, top: 4,
bottom: 4), bottom: 4),
child: Texts( child: Texts(
@ -769,6 +783,15 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
], ],
), ),
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
)),
},
)); ));
}, },
), ),
@ -780,7 +803,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: itemBuilder:
(BuildContext context, int index) { (BuildContext context, int index) {
return Card( return InkWell(
child: Card(
child: Row( child: Row(
children: [ children: [
Stack( Stack(
@ -788,9 +812,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
@ -798,12 +824,17 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: Alignment.center, alignment:
Alignment.center,
child: Image.network( child: Image.network(
model.subProducts[index] model
.images.isNotEmpty .subProducts[
index]
.images
.isNotEmpty
? model ? model
.subProducts[ .subProducts[
index] index]
@ -824,18 +855,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model.subProducts[index] model.subProducts[index]
@ -865,7 +900,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment
.spaceAround,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
@ -873,15 +909,19 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: 4.0, height: 4.0,
), ),
Container( Container(
height: 35.0, width:
width: 250.0, MediaQuery.of(context)
.size
.width *
0.65,
child: Texts( child: Texts(
model.subProducts[index] model.subProducts[index]
.name, .name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight:
maxLines: 2, FontWeight.w500,
maxLines: 5,
), ),
), ),
SizedBox( SizedBox(
@ -932,6 +972,15 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
], ],
), ),
),
onTap: () => {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
)),
},
); );
}), }),
) )

Loading…
Cancel
Save