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: [

@ -1,78 +1,47 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/recommended-product-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/manufacturerItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import '../../final_products_page.dart'; import '../../final_products_page.dart';
import 'lacum-activitaion-vida-page.dart';
bool isInWishlist = false;
int price = 0;
var itemID;
var product;
var customerId;
var item;
dynamic languageID;
List wishlistData;
class PharmacyPage extends StatefulWidget { class PharmacyPage extends StatefulWidget {
// final PharmacyProduct product;
// PharmacyPage(this.product);
@override @override
_PharmacyPageState createState() => _PharmacyPageState(); _PharmacyPageState createState() => _PharmacyPageState();
} }
class _PharmacyPageState extends State<PharmacyPage> { class _PharmacyPageState extends State<PharmacyPage> {
// dynamic wishlistVar;
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
// List<RecommendedProductModel> recommendedProductList = [];
List<ProductDetailViewModel> wishList = [];
var model;
// String ProductId="4561";
//String id ="3608";
String productId = "";
String id = "";
@override
void initState() {
checkWishlist();
// userInfo(widget.product.id, widget.product);
userInfo(id, product);
getLanguageID();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PharmacyModuleViewModel>( return BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPharmacyHomeData(), onModelReady: (model) async {
// GifLoaderDialogUtils.showMyDialog(context);
await model.getSavedLanguage();
await model.getBannerList();
// GifLoaderDialogUtils.hideDialog(context);
},
allowAny: true, allowAny: true,
builder: (_, model, wi) => AppScaffold( builder: (_, model, wi) => AppScaffold(
title: "", title: "",
@ -84,17 +53,21 @@ class _PharmacyPageState extends State<PharmacyPage> {
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, //crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
BannerPager(model), BannerPager(model),
// GridViewButtons(model), GridViewButtons(model),
//PrescriptionsWidget(),
ShopByBrandWidget(),
RecentlyViewedWidget(),
// TODO MOUSA
Container( Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10), margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Texts( Texts(
TranslationBase.of(context).myPrescription, TranslationBase.of(context).bestSellers,
bold: true, bold: true,
), ),
BorderedButton( BorderedButton(
@ -104,30 +77,233 @@ class _PharmacyPageState extends State<PharmacyPage> {
textColor: Colors.green, textColor: Colors.green,
vPadding: 6, vPadding: 6,
hPadding: 4, hPadding: 4,
handler: () { handler: () => {
Navigator.push( Navigator.push(
context, FadePage(page: HomePrescriptionsPage())); context,
FadePage(
page: FinalProductsPage(
id: "",
//TODO Elham* handel this to understans form where the number comming
productType: 20,
),
),
),
}, },
), ),
], ],
), ),
), ),
Container( Container(
height: MediaQuery.of(context).size.height / 4 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i]),
scrollDirection: Axis.horizontal,
itemCount: model.bestSellerProduct.length,
),
),
],
),
),
),
),
);
}
}
class GridViewButtons extends StatelessWidget {
final PharmacyModuleViewModel model;
GridViewButtons(this.model);
@override
Widget build(BuildContext context) {
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
return Container(
child: SizedBox(
height: gridHeight,
child: GridView.count(
childAspectRatio: 2.2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
controller: new ScrollController(keepScrollOffset: false),
shrinkWrap: true,
padding: const EdgeInsets.all(4.0),
crossAxisCount: 2,
children: [
DashboardItem(
imageName: 'pharmacy_module/bg_1.png',
hasColorFilter: false,
opacity: 0.8,
child: GridViewCard(
TranslationBase.of(context).offersAndPromotions,
'assets/images/pharmacy_module/offer_icon.png', () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_2.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () {
// model.checkUserIsActivated().then((isActivated) {
// if (isActivated) {
// Navigator.push(context, FadePage(page: LakumMainPage()));
// } else {
// Navigator.push(
// context, FadePage(page: LakumActivationVidaPage()));
// }
// });
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_3.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).myPrescriptions,
'assets/images/pharmacy_module/prescription_icon.png', () {
Navigator.push(
context, FadePage(page: HomePrescriptionsPage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_4.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(
TranslationBase.of(context).searchAndScanMedication,
'assets/images/pharmacy_module/search_scan_icon.png',
() {}),
),
],
),
),
);
}
}
class GridViewCard extends StatelessWidget {
final String text;
final String cardImage;
final Function handler;
GridViewCard(this.text, this.cardImage, this.handler);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: Container(
child: Row(
children: [
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(6),
child: Texts(
text,
color: Colors.white,
fontSize: SizeConfig.textMultiplier * 1.5,
),
),
),
Row(
children: [
BorderedButton(
TranslationBase.of(context).viewAll,
handler: handler,
tPadding: 0,
bPadding: 0,
),
Expanded(child: Container()),
],
),
],
),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Image.asset(
cardImage,
fit: BoxFit.cover,
),
),
),
],
),
),
);
}
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
}
}
class PrescriptionsWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionViewModel>(
onModelReady: (model) async {
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) {
model.getPrescription();
}
},
allowAny: true,
builder: (_, model, wi) => model.prescriptionsList.length != 0
? Container(
height: model.prescriptionsList.length > 0 height: model.prescriptionsList.length > 0
? MediaQuery.of(context).size.height * 0.28 ? MediaQuery.of(context).size.height * 0.28
: 0, : 0,
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).myPrescription,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePrescriptionsPage()));
},
),
],
),
),
Container(
padding: padding:
EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0), EdgeInsets.symmetric(horizontal: 18.0, vertical: 14.0),
// height: MediaQuery.of(context).size.height * 0.28,
// width: 200.0,
// height: MediaQuery.of(context).size.height / 4 + 20,
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
child: BaseView<PharmacyModuleViewModel>( child: ListView.builder(
onModelReady: (model) => model.getPrescription(),
builder: (_, model, wi) => model.prescriptionsList.length !=
0
// model.getPrescription();
? ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: true, shrinkWrap: true,
physics: ScrollPhysics(), physics: ScrollPhysics(),
@ -135,9 +311,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
itemCount: model.prescriptionsList.length, itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return Container(
// width: 160.0, height: MediaQuery.of(context).size.height * 0.3,
height:
MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0), bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0), margin: EdgeInsets.only(right: 10.0),
@ -150,8 +324,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(10.0)), borderRadius: BorderRadius.circular(10.0)),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
@ -165,8 +338,7 @@ class _PharmacyPageState extends State<PharmacyPage> {
), ),
child: CircleAvatar( child: CircleAvatar(
radius: 30, radius: 30,
backgroundColor: backgroundColor: Colors.transparent,
Colors.transparent,
child: Image.network( child: Image.network(
model.prescriptionsList[index] model.prescriptionsList[index]
.doctorImageURL, .doctorImageURL,
@ -176,38 +348,16 @@ class _PharmacyPageState extends State<PharmacyPage> {
), ),
), ),
]), ]),
// Column(
// // crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Container(
// margin: EdgeInsets.only(left: 1),
// padding: EdgeInsets.only(
// top: 10.0,
// left: 10.0,
// right: 3.0,
// bottom: 15.0,
// ),
// child: Image.network(
// model.prescriptionsList[index]
// .doctorImageURL,
// width: 60,
// height: 60,
// ),
// ),
// ]),
Column( Column(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.only(left: 1),
EdgeInsets.only(left: 1),
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 15.0, right: 15.0), left: 15.0, right: 15.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Colors.green, color: Colors.green,
style: style: BorderStyle.solid,
BorderStyle.solid,
width: 4.0, width: 4.0,
), ),
color: Colors.green, color: Colors.green,
@ -215,13 +365,20 @@ class _PharmacyPageState extends State<PharmacyPage> {
BorderRadius.circular( BorderRadius.circular(
30.0)), 30.0)),
child: Text( child: Text(
languageID == "ar" model.languageID == "ar"
? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() ? model
: model.prescriptionsList[index].isInOutPatientDescription.toString(), .prescriptionsList[
index]
.isInOutPatientDescriptionN
.toString()
: model
.prescriptionsList[
index]
.isInOutPatientDescription
.toString(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 15.0, fontSize: 15.0,
// fontWeight: FontWeight.bold,
), ),
)), )),
Row(children: <Widget>[ Row(children: <Widget>[
@ -231,10 +388,8 @@ class _PharmacyPageState extends State<PharmacyPage> {
height: 30, height: 30,
), ),
Text( Text(
DateUtil.convertStringToDate( DateUtil.convertStringToDate(model
model .prescriptionsList[index]
.prescriptionsList[
index]
.appointmentDate .appointmentDate
.toString()) .toString())
.toString() .toString()
@ -242,7 +397,6 @@ class _PharmacyPageState extends State<PharmacyPage> {
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 15.0, fontSize: 15.0,
// fontWeight: FontWeight.bold,
), ),
) )
]), ]),
@ -315,12 +469,10 @@ class _PharmacyPageState extends State<PharmacyPage> {
.toDouble(), .toDouble(),
// initialRating: productRate, // initialRating: productRate,
size: 15.0, size: 15.0,
filledColor: filledColor: Colors.yellow[700],
Colors.yellow[700],
emptyColor: Colors.grey[500], emptyColor: Colors.grey[500],
isHalfAllowed: true, isHalfAllowed: true,
halfFilledIcon: halfFilledIcon: Icons.star_half,
Icons.star_half,
filledIcon: Icons.star, filledIcon: Icons.star,
emptyIcon: Icons.star, emptyIcon: Icons.star,
), ),
@ -329,32 +481,151 @@ class _PharmacyPageState extends State<PharmacyPage> {
]), ]),
]), ]),
); );
}) }),
: Container(),
), ),
],
), ),
// Container( )
// margin: EdgeInsets.fromLTRB(10, 10, 10, 10), : Container(),
// child: Row( );
// mainAxisAlignment: MainAxisAlignment.spaceBetween, }
// children: [ }
// Texts(
// TranslationBase.of(context).recommended, class ShopByBrandWidget extends StatelessWidget {
// bold: true, @override
// ), Widget build(BuildContext context) {
// BorderedButton( return BaseView<BrandViewModel>(
// TranslationBase.of(context).viewAll, onModelReady: (model) => model.getTopManufacturerList(),
// hasBorder: true, allowAny: true,
// borderColor: Colors.green, builder: (_, model, wi) => NetworkBaseView(
// textColor: Colors.green, isLocalLoader: true,
// vPadding: 6, baseViewModel: model,
// hPadding: 4, child: Container(
// handler: () { child: Column(
// Navigator.push( children: [
// context, Container(
// MaterialPageRoute( margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
// builder: (context) => child: Row(
// RecommendedProductPage(productId : "2316"))); mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).shopByBrands,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () => {
Navigator.push(
context, FadePage(page: ProductBrandsPage())),
},
),
],
),
),
Container(
height: 100,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ManufacturerItem(model.manufacturerList[i]),
scrollDirection: Axis.horizontal,
itemCount: model.manufacturerList.length,
),
),
],
),
),
));
}
}
class RecentlyViewedWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<LastVisitedViewModel>(
onModelReady: (model) => model.getLastVisitedProducts(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: Column(
children: [
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).recentlyViewed,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: "",
productType: 3,
),
),
);
},
),
],
),
),
Container(
height: model.lastVisitedProducts.length > 0
? MediaQuery.of(context).size.height / 4 + 20
: 0,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.lastVisitedProducts[i]),
scrollDirection: Axis.horizontal,
itemCount: model.lastVisitedProducts.length,
),
),
],
),
),
));
}
}
// Container(
// margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(
// TranslationBase.of(context).recommended,
// bold: true,
// ),
// BorderedButton(
// TranslationBase.of(context).viewAll,
// hasBorder: true,
// borderColor: Colors.green,
// textColor: Colors.green,
// vPadding: 6,
// hPadding: 4,
// handler: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// RecommendedProductPage(productId : "2316")));
// }, // },
// ), // ),
// ], // ],
@ -565,339 +836,3 @@ class _PharmacyPageState extends State<PharmacyPage> {
// ), // ),
// ), // ),
// ), // ),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).shopByBrands,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () => {
Navigator.push(
context, FadePage(page: ProductBrandsPage())),
},
),
],
),
),
Container(
height: 60,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ManufacturerItem(model.manufacturerList[i]),
scrollDirection: Axis.horizontal,
itemCount: model.manufacturerList.length,
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).recentlyViewed,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
vPadding: 6,
hPadding: 4,
borderColor: Colors.green,
textColor: Colors.green,
handler: () {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: "",
productType: 3,
),
),
);
},
),
],
),
),
Container(
height: model.lastVisitedProducts.length > 0
? MediaQuery.of(context).size.height / 4 + 20
: 0,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.lastVisitedProducts[i]),
scrollDirection: Axis.horizontal,
itemCount: model.lastVisitedProducts.length,
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).bestSellers,
bold: true,
),
BorderedButton(
TranslationBase.of(context).viewAll,
hasBorder: true,
borderColor: Colors.green,
textColor: Colors.green,
vPadding: 6,
hPadding: 4,
handler: () => {
Navigator.push(
context,
FadePage(
page: FinalProductsPage(
id: "",
productType: 4,
),
),
),
},
),
],
),
),
Container(
height: MediaQuery.of(context).size.height / 4 + 20,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ProductTileItem(model.bestSellerProduct[i]),
scrollDirection: Axis.horizontal,
itemCount: model.bestSellerProduct.length,
),
),
],
),
),
),
),
);
}
addToWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = true;
await x.addToWishlistData(itemID);
}
deleteFromWishlistFunction(itemID) async {
ProductDetailViewModel x = new ProductDetailViewModel();
isInWishlist = false;
await x.addToWishlistData(itemID);
}
checkWishlist() async {
ProductDetailViewModel x = new ProductDetailViewModel();
await x.checkWishlistData();
for (int i = 0; i < x.wishListItems.length; i++) {
// itemID = x.wishListItems[i].id;
print("-------------wishlist---------------");
print(itemID);
// print(product.id);
print(x.wishListItems[i].productId);
if (itemID == x.wishListItems[i].productId) {
isInWishlist = true;
// print('in wishlist');
break;
} else {
isInWishlist = false;
// print('not in wishlist');
}
}
}
Future userInfo(id, product) async {
customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
if (customerId != null) {
itemID = id;
product = product;
checkWishlist();
}
print("customerId:$customerId");
return customerId;
}
}
class GridViewButtons extends StatelessWidget {
final PharmacyModuleViewModel model;
GridViewButtons(this.model);
@override
Widget build(BuildContext context) {
final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8;
return Container(
child: SizedBox(
height: gridHeight,
child: GridView.count(
childAspectRatio: 2.2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
controller: new ScrollController(keepScrollOffset: false),
shrinkWrap: true,
padding: const EdgeInsets.all(4.0),
crossAxisCount: 2,
children: [
DashboardItem(
imageName: 'pharmacy_module/bg_1.png',
hasColorFilter: false,
opacity: 0.8,
child: GridViewCard(
TranslationBase.of(context).offersAndPromotions,
'assets/images/pharmacy_module/offer_icon.png', () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_2.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).medicationRefill,
'assets/images/pharmacy_module/medication_icon.png', () {
model.checkUserIsActivated().then((isActivated) {
if (isActivated) {
Navigator.push(context, FadePage(page: LakumMainPage()));
} else {
Navigator.push(
context, FadePage(page: LakumActivationVidaPage()));
}
});
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_3.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(TranslationBase.of(context).myPrescriptions,
'assets/images/pharmacy_module/prescription_icon.png', () {
Navigator.push(
context, FadePage(page: PharmacyAddressesPage()));
}),
),
DashboardItem(
imageName: 'pharmacy_module/bg_4.png',
opacity: 0,
hasColorFilter: false,
child: GridViewCard(
TranslationBase.of(context).searchAndScanMedication,
'assets/images/pharmacy_module/search_scan_icon.png',
() {}),
),
],
),
),
);
}
}
class GridViewCard extends StatelessWidget {
final String text;
final String cardImage;
final Function handler;
GridViewCard(this.text, this.cardImage, this.handler);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: Container(
child: Row(
children: [
Expanded(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 2,
child: Padding(
padding: const EdgeInsets.all(6),
child: Texts(
text,
color: Colors.white,
fontSize: SizeConfig.textMultiplier * 1.5,
),
),
),
Row(
children: [
BorderedButton(
TranslationBase.of(context).viewAll,
handler: handler,
tPadding: 0,
bPadding: 0,
),
Expanded(child: Container()),
],
),
],
),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Image.asset(
cardImage,
fit: BoxFit.cover,
),
),
),
],
),
),
);
}
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString();
}
}
class test extends StatefulWidget {
@override
_testState createState() => _testState();
}
class _testState extends State<test> {
@override
Widget build(BuildContext context) {
return Container();
}
}
//addWishlistData() async {
// ProductDetailViewModel x = new ProductDetailViewModel();
// await wishlistData.add(x.checkWishlistData());
// print("-------------testWishlist---------------");
//
//}
// checkWishlist() async {
// ProductDetailViewModel x = new ProductDetailViewModel();
// wishlistVar = await x.checkWishlistData();
// print("wishlistVar>>>>>>>>>>>>>>>");
// print(wishlistVar);
//
// }

@ -52,16 +52,14 @@ 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(
elevation: 2,
shape: Border(right: BorderSide(color: Colors.grey.shade300, width: 1)),
margin: EdgeInsets.symmetric(
horizontal: 8,
vertical: 0,
),
child: Container( child: Container(
margin: EdgeInsets.all(7),
decoration: BoxDecoration(
border:Border.all(color: Colors.grey.shade300,width: 0.5),
borderRadius: BorderRadius.circular(8)
),
padding: EdgeInsets.symmetric(horizontal: 4), padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 3, width: MediaQuery.of(context).size.width / 2.8,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -92,16 +90,21 @@ class ProductTileItem extends StatelessWidget {
borderRadius: borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)), BorderRadius.only(topLeft: Radius.circular(6)),
), ),
child: item.rxMessage != null ? Texts( child: item.rxMessage != null
projectProvider.isArabic ? item.rxMessagen : item.rxMessage, ? Texts(
projectProvider.isArabic
? item.rxMessagen
: item.rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
): Texts(""), )
: Texts(""),
) )
], ],
), ),
SizedBox(height: 8,),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
@ -120,7 +123,7 @@ class ProductTileItem extends StatelessWidget {
padding: const EdgeInsets.only(top: 4, bottom: 4), padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${item.price}", "SAR ${item.price}",
bold: true, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
), ),
), ),
@ -135,19 +138,13 @@ class ProductTileItem extends StatelessWidget {
: 0, : 0,
forceStars: true), forceStars: true),
), ),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),*/
], ],
), ),
], ],
), ),
)
],
), ),
SizedBox(height: 5,),
],
), ),
), ),
); );

@ -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,21 +24,25 @@ 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( 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), padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network( child: Image.network(
item.image.src, item.image.src,
@ -45,7 +50,6 @@ class ManufacturerItem extends StatelessWidget {
), ),
), ),
), ),
),
); );
} }
} }

@ -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:
if(widget.isLocalLoader)
return Container( 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