Merge branch 'development' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into pharmacy_fix

merge-update-with-lab-changes
hussam al-habibeh 5 years ago
commit cb2b9db0ab

@ -121,9 +121,9 @@ class PharmacyModuleService extends BaseService {
manufacturerList.clear(); manufacturerList.clear();
response['manufacturer'].forEach((item) { response['manufacturer'].forEach((item) {
Manufacturer manufacturer = Manufacturer.fromJson(item); Manufacturer manufacturer = Manufacturer.fromJson(item);
if (manufacturer.image != null) { // if (manufacturer.image != null) {
manufacturerList.add(Manufacturer.fromJson(item)); manufacturerList.add(Manufacturer.fromJson(item));
} // }
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

@ -9,36 +9,15 @@ class PrescriptionService extends BaseService {
bool isFinished = true; bool isFinished = true;
bool hasError = false; bool hasError = false;
String errorMsg = ''; String errorMsg = '';
String url = "";
List<Prescriptions> _prescriptionsList = List(); List<Prescriptions> _prescriptionsList = List();
List<Prescriptions> get prescriptionsList => _prescriptionsList; List<Prescriptions> get prescriptionsList => _prescriptionsList;
// Future getPrescription() async {
// hasError = false;
// url = PRESCRIPTION;
// print("Print PRESCRIPTION url" + url);
// await baseAppClient.get(url,
// onSuccess: (dynamic response, int statusCode) {
// _prescriptionsList.clear();
// response['PatientPrescriptionList'].forEach((item) {
// _prescriptionsList.add(Prescriptions.fromJson(item));
// });
// print(_prescriptionsList.length);
// print(response);
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// });
// }
Future getPrescription() async { Future getPrescription() async {
url = PRESCRIPTION;
print("Print PRESCRIPTION url" + url);
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false; body['isDentalAllowedBackend'] = false;
print("Print PRESCRIPTION url" + url); await baseAppClient.post(PRESCRIPTION,
await baseAppClient.post(url,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_prescriptionsList.clear(); _prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) { response['PatientPrescriptionList'].forEach((prescriptions) {

@ -344,6 +344,7 @@ class PharmacyCategoriseService extends BaseService {
} }
Future getMostViewedProducts() async { Future getMostViewedProducts() async {
hasError = false;
Map<String, String> queryParams = { Map<String, String> queryParams = {
'fields': 'fields':
'mostview?fields=id,discount_ids,name,reviews,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', 'mostview?fields=id,discount_ids,name,reviews,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',
@ -362,7 +363,9 @@ class PharmacyCategoriseService extends BaseService {
super.error = error; super.error = error;
}, queryParams: queryParams); }, queryParams: queryParams);
} catch (error) { } catch (error) {
throw error; hasError = true;
super.error = error.toString();
// throw error;
} }
} }

@ -15,6 +15,7 @@ class BaseViewModel extends ChangeNotifier {
ViewState get state => _state; ViewState get state => _state;
String error = ""; String error = "";
String languageID = "en";
AuthenticatedUser user; AuthenticatedUser user;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
@ -51,6 +52,10 @@ class BaseViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future getSavedLanguage() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
@override @override
void dispose() { void dispose() {
removeListener(() {}); removeListener(() {});

@ -0,0 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
class BestSellerViewModel extends BaseViewModel {
}

@ -0,0 +1,29 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class BrandViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
Future getTopManufacturerList() async {
setState(ViewState.Busy);
await _pharmacyService.getTopManufacturerList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
@override
void dispose() {
super.dispose();
}
}

@ -0,0 +1,25 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../../locator.dart';
class LastVisitedViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts;
getLastVisitedProducts() async {
setState(ViewState.Busy);
await _pharmacyService.getLastVisitedProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -0,0 +1,30 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:provider/provider.dart';
import '../../../locator.dart';
import '../project_view_model.dart';
class PrescriptionViewModel extends BaseViewModel {
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
getPrescription() async {
await getSavedLanguage();
/*
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}*/
}
}

@ -16,34 +16,30 @@ import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProdu
import '../../../locator.dart'; import '../../../locator.dart';
class PharmacyModuleViewModel extends BaseViewModel { class PharmacyModuleViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
RecommendedProductService _recommendedProductService = locator<RecommendedProductService>(); RecommendedProductService _recommendedProductService = locator<RecommendedProductService>();
List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems; List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems;
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
List<PharmacyProduct> get bestSellerProduct => List<PharmacyProduct> get bestSellerProduct =>
_pharmacyService.bestSellerProducts; _pharmacyService.bestSellerProducts;
List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts;
List <RecommendedProductModel> get recommendedProductList => List <RecommendedProductModel> get recommendedProductList =>
_recommendedProductService.recommendedList; _recommendedProductService.recommendedList;
// List<Map<String, dynamic>> get recommendedProductList =>
// _recommendedProductService.recommendedList;
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
bool hasError = false; Future getBannerList() async {
// List<PharmacyProduct> get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ; setState(ViewState.BusyLocal);
await _pharmacyService.getBannerListList();
if (_pharmacyService.hasError)
//{
error = _pharmacyService.error;
// setState(ViewState.Error);
// }else
// setState(ViewState.Idle);
}
Future getPharmacyHomeData() async { Future getPharmacyHomeData() async {
if(authenticatedUserObject.isLogin) if(authenticatedUserObject.isLogin)
@ -58,11 +54,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
if (_pharmacyService.hasError) { if (_pharmacyService.hasError) {
error = _pharmacyService.error; error = _pharmacyService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else {
await getBannerList();
} }
} else {
await getBannerList();
} }
} }
@ -76,7 +68,6 @@ class PharmacyModuleViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future generatePharmacyToken() async { Future generatePharmacyToken() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _pharmacyService.generatePharmacyToken(); await _pharmacyService.generatePharmacyToken();
@ -88,16 +79,6 @@ class PharmacyModuleViewModel extends BaseViewModel {
} }
} }
Future getBannerList() async {
setState(ViewState.Busy);
await _pharmacyService.getBannerListList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
_getTopManufacturerList();
}
}
List<String> getBannerImagesUrl() { List<String> getBannerImagesUrl() {
List<String> images = List(); List<String> images = List();
@ -109,40 +90,18 @@ class PharmacyModuleViewModel extends BaseViewModel {
return images; return images;
} }
_getTopManufacturerList() async { getBestSellerProducts() async {
await _pharmacyService.getTopManufacturerList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
_getBestSellerProducts();
}
}
_getBestSellerProducts() async {
await _pharmacyService.getBestSellerProducts(); await _pharmacyService.getBestSellerProducts();
if (_pharmacyService.hasError) { if (_pharmacyService.hasError) {
error = _pharmacyService.error; error = _pharmacyService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
_getLastVisitedProducts();
} }
} }
_getLastVisitedProducts() async {
await _pharmacyService.getLastVisitedProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
//////////////////////////////////////////RecommendedProducts
getRecommendedProducts(productId) async { getRecommendedProducts(productId) async {
hasError = false;
setState(ViewState.Busy); setState(ViewState.Busy);
await _recommendedProductService.getRecommendedProducts(productId); await _recommendedProductService.getRecommendedProducts(productId);
if (_recommendedProductService.hasError) { if (_recommendedProductService.hasError) {
@ -167,18 +126,6 @@ class PharmacyModuleViewModel extends BaseViewModel {
} }
} }
getPrescription() async {
print("Print PRESCRIPTION url");
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
///////////////////////or ///////////////////////or
// getPrescriptions() async { // getPrescriptions() async {

@ -120,6 +120,10 @@ import 'core/viewModels/pharmacies_view_model.dart';
import 'core/service/pharmacies_service.dart'; import 'core/service/pharmacies_service.dart';
import 'core/service/insurance_service.dart'; import 'core/service/insurance_service.dart';
import 'core/viewModels/insurance_card_View_model.dart'; import 'core/viewModels/insurance_card_View_model.dart';
import 'core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
import 'core/viewModels/pharmacyModule/brand_view_model.dart'; import 'core/viewModels/pharmacyModule/brand_view_model.dart';
import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'core/viewModels/pharmacyModule/product_detail_view_model.dart';
@ -302,6 +306,11 @@ void setupLocator() {
locator.registerFactory(() => OffersCategoriseViewModel()); locator.registerFactory(() => OffersCategoriseViewModel());
locator.registerFactory(() => BariatricsViewModel()); locator.registerFactory(() => BariatricsViewModel());
locator.registerFactory(() => PrescriptionViewModel());
locator.registerFactory(() => BrandViewModel());
locator.registerFactory(() => BestSellerViewModel());
locator.registerFactory(() => LastVisitedViewModel());
// Offer And Packages // Offer And Packages
//---------------------- //----------------------
locator.registerLazySingleton( locator.registerLazySingleton(

@ -49,6 +49,8 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) { onModelReady: (model) {
//TODO Elham* fix all services in order handel errors in better way in the service
if (widget.productType == 1) { if (widget.productType == 1) {
model.getFinalProducts(i: id); model.getFinalProducts(i: id);
appBarTitle = TranslationBase.of(context).products; appBarTitle = TranslationBase.of(context).products;
@ -76,7 +78,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: true,
baseViewModel: model, baseViewModel: model,
body: Container( body: Container(
height: MediaQuery.of(context).size.height * 5.87, height: MediaQuery.of(context).size.height * 5.87,

@ -110,35 +110,6 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
centerTitle: true, centerTitle: true,
) )
: null, : null,
// : AppBar(
// backgroundColor: Color(0xff5AB145),
// elevation: 0,
// textTheme: TextTheme(
// headline6: TextStyle(
// color: Colors.white, fontWeight: FontWeight.bold),
// ),
// title: Text(getText(currentTab).toUpperCase()),
// leading: Builder(
// builder: (BuildContext context) {
// return IconButton(
// icon: Icon(Icons.arrow_back),
// color: Colors.white,
// onPressed: () => Scaffold.of(context).openDrawer(),
// );
// },
// ),
// actions: [
// // IconButton(
// // iconSize: 70,
// // icon: SvgPicture.asset('assets/images/svg/robort_svg.svg',
// // height: 100, width: 100, fit: BoxFit.cover),
// // onPressed: () {
// // triggerRobot();
// // } //do something,
// // )
// ],
// centerTitle: true,
// ),
extendBody: false, extendBody: false,
body: PageView( body: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
@ -146,14 +117,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
children: [ children: [
PharmacyPage(), PharmacyPage(),
PharmacyCategorisePage(), PharmacyCategorisePage(),
// OffersCategorisePage(),
WishlistPage(false),
PharmacyProfilePage(), PharmacyProfilePage(),
// Container(
// child: Text('text'),
// ),
CartOrderPage(), CartOrderPage(),
], // Please do not remove the BookingOptions from this array ],
), ),
bottomNavigationBar: BottomNavPharmacyBar( bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab, changeIndex: _changeCurrentTab,
@ -172,7 +138,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print(response); print(response);
product = PharmacyProduct.fromJson(response["products"][0]); var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product))); Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {

@ -93,12 +93,10 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
if (customerId != null) { if (customerId != null) {
itemID = widget.product.id; itemID = widget.product.id;
checkWishlist(); checkWishlist();
// getSpecificationData(itemID);
} }
print("customerId:$customerId"); print("customerId:$customerId");
setState(() {}); setState(() {});
// getSpecificationData(itemID);
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -943,6 +941,8 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
isShowAppBar: true, isShowAppBar: true,
isPharmacy: true, isPharmacy: true,
isShowDecPage: false, isShowDecPage: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [

File diff suppressed because it is too large Load Diff

@ -52,102 +52,99 @@ class ProductTileItem extends StatelessWidget {
return InkWell( return InkWell(
onTap: () => productOnClick(context), onTap: () => productOnClick(context),
splashColor: Theme.of(context).primaryColor, splashColor: Theme.of(context).primaryColor,
child: Card( child: Container(
elevation: 2, margin: EdgeInsets.all(7),
shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)), decoration: BoxDecoration(
margin: EdgeInsets.symmetric( border:Border.all(color: Colors.grey.shade300,width: 0.5),
horizontal: 8, borderRadius: BorderRadius.circular(8)
vertical: 0,
), ),
child: Container( padding: EdgeInsets.symmetric(horizontal: 4),
padding: EdgeInsets.symmetric(horizontal: 4), width: MediaQuery.of(context).size.width / 2.8,
width: MediaQuery.of(context).size.width / 3, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Stack(
Stack( children: [
children: [ Container(
Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center,
alignment: Alignment.center, child: (item.images != null && item.images.length > 0)
child: (item.images != null && item.images.length > 0) ? Image.network(
? Image.network( item.images[0].src,
item.images[0].src, fit: BoxFit.cover,
fit: BoxFit.cover, height: 80,
height: 80, )
) : Image.asset(
: Image.asset( "assets/images/no_image.png",
"assets/images/no_image.png", fit: BoxFit.cover,
fit: BoxFit.cover, height: 80,
height: 80,
),
), ),
Container( ),
width: item.rxMessage != null Container(
? MediaQuery.of(context).size.width / 5 width: item.rxMessage != null
: 0, ? MediaQuery.of(context).size.width / 5
padding: EdgeInsets.all(4), : 0,
decoration: BoxDecoration( padding: EdgeInsets.all(4),
color: Color(0xffb23838), decoration: BoxDecoration(
borderRadius: color: Color(0xffb23838),
BorderRadius.only(topLeft: Radius.circular(6)), borderRadius:
), BorderRadius.only(topLeft: Radius.circular(6)),
child: item.rxMessage != null ? Texts( ),
projectProvider.isArabic ? item.rxMessagen : item.rxMessage, child: item.rxMessage != null
color: Colors.white, ? Texts(
regular: true, projectProvider.isArabic
fontSize: 10, ? item.rxMessagen
fontWeight: FontWeight.w400, : item.rxMessage,
): Texts(""), color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
) )
], : Texts(""),
)
],
),
SizedBox(height: 8,),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
), ),
Container( child: Column(
margin: EdgeInsets.symmetric( crossAxisAlignment: CrossAxisAlignment.start,
horizontal: 6, children: [
vertical: 0, Texts(
), projectProvider.isArabic ? item.namen : item.name,
child: Column( regular: true,
crossAxisAlignment: CrossAxisAlignment.start, fontSize: 12,
children: [ fontWeight: FontWeight.w400,
Texts( ),
projectProvider.isArabic ? item.namen : item.name, Padding(
regular: true, padding: const EdgeInsets.only(top: 4, bottom: 4),
fontSize: 12, child: Texts(
fontWeight: FontWeight.w400, "SAR ${item.price}",
fontWeight: FontWeight.w600,
fontSize: 14,
), ),
Padding( ),
padding: const EdgeInsets.only(top: 4, bottom: 4), Row(
child: Texts( children: [
"SAR ${item.price}", Expanded(
bold: true, child: StarRating(
fontSize: 14, totalAverage: item.approvedTotalReviews > 0
? (item.approvedRatingSum.toDouble() /
item.approvedTotalReviews.toDouble())
.toDouble()
: 0,
forceStars: true),
), ),
), ],
Row( ),
children: [ ],
Expanded( ),
child: StarRating( ),
totalAverage: item.approvedTotalReviews > 0 SizedBox(height: 5,),
? (item.approvedRatingSum.toDouble() / ],
item.approvedTotalReviews.toDouble())
.toDouble()
: 0,
forceStars: true),
),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),*/
],
),
],
),
)
],
),
), ),
), ),
); );

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -23,28 +24,31 @@ class ManufacturerItem extends StatelessWidget {
), ),
); );
}, },
child: Card( child: Container(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 8, horizontal: 12,
vertical: 4, vertical: 4,
), ),
child: Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius:BorderRadius.circular(12) ,
border: Border( border: Border(
right: BorderSide(color: Colors.grey.shade300, width: 1), right: BorderSide(color: Colors.grey.shade300, width: 1),
bottom: BorderSide(color: Colors.grey.shade300, width: 1), bottom: BorderSide(color: Colors.grey.shade300, width: 1),
left: BorderSide(color: Colors.grey.shade300, width: 1), left: BorderSide(color: Colors.grey.shade300, width: 1),
top: BorderSide(color: Colors.grey.shade300, width: 1)), top: BorderSide(color: Colors.grey.shade300, width: 1)),
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network(
item.image.src,
fit: BoxFit.cover,
),
),
), ),
child: item.image == null
? Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
child: AppText(item.name, fontWeight: FontWeight.w500,fontSize: 14,),
)
: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network(
item.image.src,
fit: BoxFit.cover,
),
),
), ),
); );
} }

@ -93,7 +93,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
}, },
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).myAccount, appBarTitle: TranslationBase.of(context).myAccount,
isShowAppBar: true, isShowAppBar: false,
isShowDecPage: false, isShowDecPage: false,
isPharmacy: true, isPharmacy: true,
body: user != null body: user != null

@ -55,9 +55,10 @@ class WishListService extends BaseService {
// } // }
Future getWishlist() async { Future getWishlist() async {
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); //TODO we need to check why the customer id comes null
String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0";
hasError = false; hasError = false;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId+"?shopping_cart_type=2", await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
_wishListProducts.clear(); _wishListProducts.clear();
response['shopping_carts'].forEach((item) { response['shopping_carts'].forEach((item) {

@ -30,7 +30,7 @@ class StarRating extends StatelessWidget {
) )
), ),
if (totalCount!=null) if (totalCount!=null)
SizedBox(width: 9.0), SizedBox(width: 5.0),
if (totalCount!=null) if (totalCount!=null)
Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],) Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],)
] ]

@ -183,20 +183,6 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
), ),
centerTitle: true, centerTitle: true,
actions: <Widget>[ actions: <Widget>[
isPharmacy
? IconButton(
icon: Icon(Icons.shopping_cart),
color: Colors.grey,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CartOrderPage()),
);
// Navigator.of(context)
// .popUntil(ModalRoute.withName('/'));
})
: Container(),
image != null image != null
? InkWell( ? InkWell(
onTap: () => Navigator.push( onTap: () => Navigator.push(

@ -9,8 +9,9 @@ import 'package:flutter_gifimage/flutter_gifimage.dart';
class NetworkBaseView extends StatefulWidget { class NetworkBaseView extends StatefulWidget {
final BaseViewModel baseViewModel; final BaseViewModel baseViewModel;
final Widget child; final Widget child;
final bool isLocalLoader;
NetworkBaseView({Key key, this.baseViewModel, this.child}); NetworkBaseView({Key key, this.baseViewModel, this.child, this.isLocalLoader = false});
@override @override
_NetworkBaseViewState createState() => _NetworkBaseViewState(); _NetworkBaseViewState createState() => _NetworkBaseViewState();
@ -42,7 +43,19 @@ class _NetworkBaseViewState extends State<NetworkBaseView>{
return widget.child; return widget.child;
break; break;
case ViewState.Busy: case ViewState.Busy:
return Container( if(widget.isLocalLoader)
return Container(
height: 100,
child: Center(
child:CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.red,
),
),
),
);
else return Container(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Stack( child: Stack(

@ -17,7 +17,6 @@ class BottomNavPharmacyBar extends StatefulWidget {
} }
class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> { class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
int _index = 0;
_changeIndex(int index) { _changeIndex(int index) {
widget.changeIndex(index); widget.changeIndex(index);
@ -43,19 +42,6 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0, currentIndex: 0,
title: TranslationBase.of(context).Alhabibapp, title: TranslationBase.of(context).Alhabibapp,
), ),
// Container(
// height: 65.0,
// child: Center(
// child: VerticalDivider(
// color: Colors.grey,
// thickness: 0.5,
// width: 0.3,
// indent: 25.5,
// ),
// ),
// ),
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.list, icon: EvaIcons.list,
activeIcon: EvaIcons.list, activeIcon: EvaIcons.list,
@ -64,20 +50,6 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 1, currentIndex: 1,
title: TranslationBase.of(context).categorise, title: TranslationBase.of(context).categorise,
), ),
// Expanded(
// child: SizedBox(
// height: 50,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// SizedBox(height: 22),
// ],
// ),
// ),
// ),
// Added Calendar Icon to access book appointment flow
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.home, icon: EvaIcons.home,
activeIcon: EvaIcons.home, activeIcon: EvaIcons.home,
@ -86,13 +58,12 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0, currentIndex: 0,
isHome: true, isHome: true,
title: TranslationBase.of(context).home), title: TranslationBase.of(context).home),
BottomNavPharmacyItem( BottomNavPharmacyItem(
icon: EvaIcons.person, icon: EvaIcons.person,
activeIcon: EvaIcons.person, activeIcon: EvaIcons.person,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: widget.index, index: widget.index,
currentIndex: 3, currentIndex: 2,
title: TranslationBase.of(context).myAccount, title: TranslationBase.of(context).myAccount,
), ),
BottomNavPharmacyItem( BottomNavPharmacyItem(
@ -100,7 +71,7 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
activeIcon: EvaIcons.shoppingCartOutline, activeIcon: EvaIcons.shoppingCartOutline,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: widget.index, index: widget.index,
currentIndex: 4, currentIndex: 3,
title: TranslationBase.of(context).cart) title: TranslationBase.of(context).cart)
], ],
), ),

@ -1,6 +1,10 @@
import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/Constants.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class BottomNavPharmacyItem extends StatelessWidget { class BottomNavPharmacyItem extends StatelessWidget {
final String title; final String title;
@ -33,7 +37,16 @@ class BottomNavPharmacyItem extends StatelessWidget {
child: InkWell( child: InkWell(
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
splashColor: Colors.transparent, splashColor: Colors.transparent,
onTap: () => changeIndex(currentIndex), onTap: () {
if(!Provider.of<ProjectViewModel>(context, listen: false).isLogin && (currentIndex == 2|| currentIndex == 3))
Navigator.push(
context,
FadePage(page: WelcomeLogin()),
);
else
changeIndex(currentIndex);
},
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

Loading…
Cancel
Save