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

 Conflicts:
	lib/pages/pharmacies/screens/pharmacy_module_page.dart
	lib/widgets/others/app_scaffold_widget.dart
merge-requests/408/head
Elham Rababh 3 years ago
commit 65cf4316ab

@ -271,6 +271,184 @@
"search": [
"roboticon"
]
},
{
"uid": "8ce732688587909ad0a9d8323eaca8ad",
"css": "marquee",
"code": 59590,
"src": "fontelico"
},
{
"uid": "ec8496ef645f3be7b28147ec60cd9ab1",
"css": "crown-minus",
"code": 59589,
"src": "fontelico"
},
{
"uid": "36ef9feb0754335302784521267a9ad4",
"css": "crown-plus",
"code": 59588,
"src": "fontelico"
},
{
"uid": "186dec7a13156bbe2550790c158fb85d",
"css": "crown",
"code": 59587,
"src": "fontelico"
},
{
"uid": "2a46f1d1c9bd036e17a74e46613c1636",
"css": "ie",
"code": 59586,
"src": "fontelico"
},
{
"uid": "9c2b737b16ae2c8d66b7bfd29ba5ecd8",
"css": "chrome",
"code": 59584,
"src": "fontelico"
},
{
"uid": "45861dd1e5ce4fde338bcccf01eeb808",
"css": "opera",
"code": 59585,
"src": "fontelico"
},
{
"uid": "2bd5f98482d86649958312ea2ab5bb40",
"css": "emo-laugh",
"code": 59576,
"src": "fontelico"
},
{
"uid": "fc92480dedc439d274d4e3e4b425edf4",
"css": "emo-squint",
"code": 59575,
"src": "fontelico"
},
{
"uid": "4843d0d6050dd508d4c101a334f46db2",
"css": "emo-shoot",
"code": 59574,
"src": "fontelico"
},
{
"uid": "04688d76a33ce7a7950e40fae79c08ac",
"css": "emo-cry",
"code": 59573,
"src": "fontelico"
},
{
"uid": "e4b163acaaa08255819f2f78afe8f075",
"css": "cart_menu_icon",
"code": 59412,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4",
"width": 1140
},
"search": [
"cart_menu_icon"
]
},
{
"uid": "45f50872f02e050e19f0910ca3e0e8e6",
"css": "categories_menu_icon",
"code": 59413,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z",
"width": 1000
},
"search": [
"categories_menu_icon"
]
},
{
"uid": "de65d94899c08a719eb8f9b723f73fc4",
"css": "hmg_logo_icon",
"code": 59414,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z",
"width": 999
},
"search": [
"hmg_logo_icon"
]
},
{
"uid": "baf8798b7336aad03b1d61cacc015142",
"css": "user_menu_icon",
"code": 59415,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M853.6 146.4A500 500 0 0 0 146.4 853.6 500 500 0 0 0 853.6 146.4ZM217 838.5A286.1 286.1 0 0 1 500 586.7 285 285 0 0 1 783 838.5 440.5 440.5 0 0 1 217 838.5ZM500 526.3A151.8 151.8 0 1 1 651.8 374.5 152.1 152.1 0 0 1 500 526.3ZM833.4 788.8A344.4 344.4 0 0 0 617.6 548.7 210.5 210.5 0 1 0 382.1 548.7 344.2 344.2 0 0 0 166.3 788.7 441.4 441.4 0 1 1 833.2 788.7ZM833.4 788.8",
"width": 1000
},
"search": [
"user_menu_icon"
]
},
{
"uid": "d3f621623139837ff2fb5fe09cf16994",
"css": "cart_menu_icon-1",
"code": 59416,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M367.1 624.3H972.6A33.2 33.2 0 0 0 1004.7 601.7L1138.2 164.7A29.6 29.6 0 0 0 1132.9 137.3 34.3 34.3 0 0 0 1106.3 124.9H289.9L266.3 24.5A33 33 0 0 0 233.7 0H33.4A32.4 32.4 0 0 0 0 31.2 32.4 32.4 0 0 0 33.4 62.4H206.9L327.4 569.6A93.8 93.8 0 0 0 267.1 655.5 97.1 97.1 0 0 0 367.2 749.1H972.6A31.3 31.3 0 1 0 972.6 686.7H367.2A31.3 31.3 0 1 1 367.2 624.3ZM1061.9 187.3L947.4 561.9H394L305 187.3ZM1061.9 187.3M315.3 894.6A105.4 105.4 0 1 0 420.7 789.2 105.4 105.4 0 0 0 315.3 894.6ZM420.7 859.4A35.2 35.2 0 1 1 385.6 894.6 35.2 35.2 0 0 1 420.7 859.4ZM420.7 859.4M735.4 894.6A105.4 105.4 0 1 0 840.9 789.2 105.4 105.4 0 0 0 735.4 894.6ZM840.9 859.4A35.2 35.2 0 1 1 805.7 894.6 35.2 35.2 0 0 1 840.9 859.4ZM840.9 859.4",
"width": 1140
},
"search": [
"cart_menu_icon"
]
},
{
"uid": "6aac6f399374da0b9c4811b6a7110627",
"css": "categories_menu_icon-1",
"code": 59417,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M332.7 458.9H126.3A126.3 126.3 0 0 1 0 332.7V126.3A126.3 126.3 0 0 1 126.3 0H332.7A126.3 126.3 0 0 1 459 126.3V332.7A126.3 126.3 0 0 1 332.7 458.9ZM126.3 61.2A65.1 65.1 0 0 0 61.2 126.3V332.7A65.1 65.1 0 0 0 126.3 397.8H332.7A65.1 65.1 0 0 0 397.8 332.7V126.3A65.1 65.1 0 0 0 332.7 61.2ZM873.8 458.9H667.3A126.3 126.3 0 0 1 541 332.6V126.3A126.3 126.3 0 0 1 667.3 0H873.9A126.3 126.3 0 0 1 1000.2 126.3V332.7A126.3 126.3 0 0 1 873.8 458.9ZM667.3 61.2A65.1 65.1 0 0 0 602.2 126.3V332.7A65.1 65.1 0 0 0 667.3 397.8H873.9A65.1 65.1 0 0 0 938.9 332.7V126.3A65.1 65.1 0 0 0 873.9 61.3ZM332.7 999.9H126.3A126.3 126.3 0 0 1 0 873.7V667.3A126.3 126.3 0 0 1 126.3 541H332.7A126.3 126.3 0 0 1 459 667.3V873.9A126.3 126.3 0 0 1 332.7 999.9ZM126.3 602.2A65.1 65.1 0 0 0 61.2 667.3V873.9A65.1 65.1 0 0 0 126.3 938.8H332.7A65.1 65.1 0 0 0 397.8 873.8V667.3A65.1 65.1 0 0 0 332.7 602.3ZM873.8 999.9H667.3A126.3 126.3 0 0 1 541 873.7V667.3A126.3 126.3 0 0 1 667.3 541H873.8A126.3 126.3 0 0 1 1000.1 667.3V873.9A126.3 126.3 0 0 1 873.8 999.9ZM667.3 602.2A65.1 65.1 0 0 0 602.2 667.3V873.9A65.1 65.1 0 0 0 667.3 938.8H873.8A65.1 65.1 0 0 0 938.8 873.8V667.3A65.1 65.1 0 0 0 873.8 602.3Z",
"width": 1000
},
"search": [
"categories_menu_icon"
]
},
{
"uid": "0a4cf1ff2671b9ea852d635e27df1e69",
"css": "hmg_logo_icon-1",
"code": 59418,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M146 835.7S180.9 835.5 205.5 835.5L392.2 836.4C414.4 836.4 433 812.7 434 778.5L434 622.5C434 589.3 448.9 563.3 472 561.7L529.2 561.2C552.3 562.7 568.1 588.9 568.1 622L568.1 778.9C569.2 813.1 584.7 835.5 607.1 835.5L858.4 836.1 858.8 643.3C858.8 610.2 842.9 584.4 819.8 583L718.8 582.5C696.5 582.5 678.9 558.9 677.9 524.7L677.5 472.6C678.6 438.4 696.4 414.8 718.7 414.8L820.2 415.1C843.3 413.6 858.3 386.4 858.3 353.3L858.5 112.8A102.4 102.4 0 0 1 780.8 161.4L610.2 161.4C587.9 161.4 569.4 185.7 568.3 219.9V374.6C567.2 408.8 549.8 432.9 527.5 432.9L475.8 432C453.4 432 435.6 408.6 434.5 374.7L434.5 218.4C433.4 184.3 415.6 161.2 393.4 161.2L145.6 161.2 145.6 353.4C145.6 386.6 161.2 413.1 184.3 414.7L285.8 414.3C308.8 415.8 325.1 443.2 325.1 476.2L324.8 520.7C324.8 553.8 309.1 580.4 286 581.9L184.3 581.7C161.2 583.3 145.6 609.5 145.6 642.6ZM999.3 99.1V902.8A102.2 102.2 0 0 1 896 1000H102.8A101.9 101.9 0 0 1 0 902.8L0 97.6A102.3 102.3 0 0 1 103 0L895.4 0.3A104 104 0 0 1 999.3 99.1Z",
"width": 999
},
"search": [
"hmg_logo_icon"
]
},
{
"uid": "d19eb878f1dee49848276b6d0faa6602",
"css": "wishlist_menu_icon",
"code": 59411,
"src": "custom_icons",
"selected": false,
"svg": {
"path": "M877.6 0A394.8 394.8 0 0 0 600.7 112.2 394.8 394.8 0 0 0 323.8 0 332.4 332.4 0 0 0 0 349 515.4 515.4 0 0 0 138.3 679.5 1351.1 1351.1 0 0 0 580.3 995.3 46.9 46.9 0 0 0 621.1 995.3 1351.1 1351.1 0 0 0 1063.1 679.5 515.4 515.4 0 0 0 1201.4 349 332.5 332.5 0 0 0 877.6 0ZM991.8 618.5A1233.8 1233.8 0 0 1 600.7 900.8 1233.7 1233.7 0 0 1 209.5 618.5 418.4 418.4 0 0 1 93.8 349 239.1 239.1 0 0 1 323.8 93.8 297.2 297.2 0 0 1 500.6 150.7 283.5 283.5 0 0 1 562 209.5 46.5 46.5 0 0 0 600.5 230H600.5A46.9 46.9 0 0 0 639.1 209.3 301.2 301.2 0 0 1 877.2 93.8 239.2 239.2 0 0 1 1107.1 349 418.4 418.4 0 0 1 991.8 618.5Z",
"width": 1201
},
"search": [
"wishlist_menu_icon"
]
}
]
}

@ -9,36 +9,15 @@ class PrescriptionService extends BaseService {
bool isFinished = true;
bool hasError = false;
String errorMsg = '';
String url = "";
List<Prescriptions> _prescriptionsList = List();
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 {
url = PRESCRIPTION;
print("Print PRESCRIPTION url" + url);
hasError = false;
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
print("Print PRESCRIPTION url" + url);
await baseAppClient.post(url,
await baseAppClient.post(PRESCRIPTION,
onSuccess: (dynamic response, int statusCode) {
_prescriptionsList.clear();
response['PatientPrescriptionList'].forEach((prescriptions) {

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

@ -0,0 +1,26 @@
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 BestSellerViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
List<PharmacyProduct> get bestSellerProduct =>
_pharmacyService.bestSellerProducts;
getBestSellerProducts() async {
setState(ViewState.Busy);
await _pharmacyService.getBestSellerProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -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,27 @@
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 '../../../locator.dart';
class PrescriptionViewModel extends BaseViewModel {
PrescriptionService _prescriptionService = locator<PrescriptionService>();
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
getPrescription() async {
setState(ViewState.Busy);
await getSavedLanguage();
await _prescriptionService.getPrescription();
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -6,48 +6,41 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart';
//import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import '../../../locator.dart';
class PharmacyModuleViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyService = locator<PharmacyModuleService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
RecommendedProductService _recommendedProductService = locator<RecommendedProductService>();
RecommendedProductService _recommendedProductService =
locator<RecommendedProductService>();
List<PharmacyImageObject> get bannerList => _pharmacyService.bannerItems;
List<Manufacturer> get manufacturerList => _pharmacyService.manufacturerList;
List<PharmacyProduct> get bestSellerProduct =>
_pharmacyService.bestSellerProducts;
List<PharmacyProduct> get lastVisitedProducts =>
_pharmacyService.lastVisitedProducts;
List<RecommendedProductModel> get recommendedProductList =>
_recommendedProductService.recommendedList;
// List<Map<String, dynamic>> get recommendedProductList =>
// _recommendedProductService.recommendedList;
List<Prescriptions> get prescriptionsList =>
_prescriptionService.prescriptionsList;
bool hasError = false;
// List<PharmacyProduct> get pharmacyPrescriptionsList => PharmacyProduct.pharmacyPrescriptionsList ;
Future generatePharmacyToken() async {
setState(ViewState.Busy);
await _pharmacyService.generatePharmacyToken();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future getPharmacyHomeData() async {
if(authenticatedUserObject.isLogin)
await generatePharmacyToken();
Future verifyCustomer() async {
if (authenticatedUserObject.isLogin) await generatePharmacyToken();
var data = await sharedPref.getObject(USER_PROFILE);
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
@ -55,20 +48,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
setState(ViewState.Busy);
if (authenticatedUserObject.isLogin && data != null && customerId == null) {
await _pharmacyService.makeVerifyCustomer(data);
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
await getBannerList();
}
} else {
await getBannerList();
}
}
Future createUser() async {
setState(ViewState.Busy);
await _pharmacyService.createUser();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
@ -77,9 +57,9 @@ class PharmacyModuleViewModel extends BaseViewModel {
}
}
Future generatePharmacyToken() async {
Future createUser() async {
setState(ViewState.Busy);
await _pharmacyService.generatePharmacyToken();
await _pharmacyService.createUser();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.ErrorLocal);
@ -89,13 +69,17 @@ class PharmacyModuleViewModel extends BaseViewModel {
}
Future getBannerList() async {
setState(ViewState.Busy);
if (bannerList.isEmpty) {
GifLoaderDialogUtils.showMyDialog(
locator<NavigationService>().navigatorKey.currentContext);
await _pharmacyService.getBannerListList();
GifLoaderDialogUtils.hideDialog(
locator<NavigationService>().navigatorKey.currentContext);
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
_getTopManufacturerList();
} else
setState(ViewState.Idle);
}
}
@ -109,40 +93,7 @@ class PharmacyModuleViewModel extends BaseViewModel {
return images;
}
_getTopManufacturerList() async {
await _pharmacyService.getTopManufacturerList();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
_getBestSellerProducts();
}
}
_getBestSellerProducts() async {
await _pharmacyService.getBestSellerProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
_getLastVisitedProducts();
}
}
_getLastVisitedProducts() async {
await _pharmacyService.getLastVisitedProducts();
if (_pharmacyService.hasError) {
error = _pharmacyService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
//////////////////////////////////////////RecommendedProducts
getRecommendedProducts(productId) async {
hasError = false;
setState(ViewState.Busy);
await _recommendedProductService.getRecommendedProducts(productId);
if (_recommendedProductService.hasError) {
@ -166,32 +117,4 @@ class PharmacyModuleViewModel extends BaseViewModel {
return false;
}
}
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
// getPrescriptions() async {
// setState(ViewState.Busy);
// await _prescriptionsService.getPrescriptions();
// if (_prescriptionsService.hasError) {
// error = _prescriptionsService.error;
// setState(ViewState.Error);
// } else {
// _filterList();
// await _getPrescriptionsOrders();
// setState(ViewState.Idle);
// }
// }
}

@ -19,25 +19,80 @@ class DQIcons {
DQIcons._();
static const _kFontFam = 'DQIcons';
static const _kFontPkg = null;
static const String _kFontPkg = null;
static const IconData blood_pressure = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bmi = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData heart = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData outline = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData thermometer = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_scale = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData parking_icon = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_type_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height_icon = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData online_payment_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData search_medicine_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData vital_sign_icon = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_icon = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData my_medical_file = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData family = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData calendar__2_ = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData roboticon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_pressure =
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood =
IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bmi =
IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData heart =
IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height =
IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData outline =
IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData thermometer =
IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_scale =
IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData parking_icon =
IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blood_type_icon =
IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData height_icon =
IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData online_payment_icon =
IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData search_medicine_icon =
IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData vital_sign_icon =
IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData weight_icon =
IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData my_medical_file =
IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData family =
IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData calendar__2_ =
IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData roboticon =
IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData cart_menu_icon =
IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData categories_menu_icon =
IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData hmg_logo_icon =
IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData user_menu_icon =
IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData cart_menu_icon_1 =
IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData categories_menu_icon_1 =
IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData hmg_logo_icon_1 =
IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_cry =
IconData(0xe8b5, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_shoot =
IconData(0xe8b6, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_squint =
IconData(0xe8b7, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData emo_laugh =
IconData(0xe8b8, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData chrome =
IconData(0xe8c0, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData opera =
IconData(0xe8c1, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData ie =
IconData(0xe8c2, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown =
IconData(0xe8c3, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown_plus =
IconData(0xe8c4, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown_minus =
IconData(0xe8c5, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData marquee =
IconData(0xe8c6, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}

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

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart';
import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
@ -84,6 +85,7 @@ class _MyApp extends State<MyApp> {
navigatorObservers: [
GAnalytics.shared.navObserver()
],
navigatorKey: locator<NavigationService>().navigatorKey,
showSemanticsDebugger: false,
title: 'Diplomatic Quarter App',
locale: projectProvider.appLocal,

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

@ -826,7 +826,7 @@ class _HomePageState extends State<HomePage> {
GifLoaderDialogUtils.showMyDialog(context);
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
if (pharmacyModuleViewModel.error.isNotEmpty) {
await pharmacyModuleViewModel.createUser().then((value) {
await pharmacyModuleViewModel.verifyCustomer().then((value) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
});

@ -110,35 +110,6 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
centerTitle: true,
)
: 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,
body: PageView(
physics: NeverScrollableScrollPhysics(),
@ -146,14 +117,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
children: [
PharmacyPage(),
PharmacyCategorisePage(),
// OffersCategorisePage(),
WishlistPage(false),
PharmacyProfilePage(),
// Container(
// child: Text('text'),
// ),
CartOrderPage(),
], // Please do not remove the BookingOptions from this array
],
),
bottomNavigationBar: BottomNavPharmacyBar(
changeIndex: _changeCurrentTab,
@ -172,7 +138,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) {
print(response);
product = PharmacyProduct.fromJson(response["products"][0]);
var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, FadePage(page: ProductDetailPage(product)));
}, onFailure: (String error, int statusCode) {

@ -68,6 +68,10 @@ class _Login extends State<Login> {
if(BASE_URL.contains("uat.")){
nationalIDorFile.text = "2001273";
mobileNumberController.text = mobileNo = "0555416043";
} else {
// TODO Mousa Sheeeloh
nationalIDorFile.text = "3376044";
mobileNumberController.text = mobileNo = "0555416575";
}
}

File diff suppressed because it is too large Load Diff

@ -26,7 +26,8 @@ class CartOrderPage extends StatelessWidget {
return BaseView<OrderPreviewViewModel>(
onModelReady: (model) {
model.getShoppingCart().then((value) {
appScaffold.appBar.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
appScaffold.appBar
.badgeUpdater('${model.cartResponse.quantityCount ?? 0}');
});
},
builder: (_, model, wi) => ChangeNotifierProvider.value(
@ -69,21 +70,37 @@ class CartOrderPage extends StatelessWidget {
child: Column(
children: [
...List.generate(
cart.shoppingCarts != null ? cart.shoppingCarts.length : 0,
cart.shoppingCarts != null
? cart.shoppingCarts.length
: 0,
(index) => ProductOrderItem(
cart.shoppingCarts[index], () {print(cart.shoppingCarts[index].quantity);
model.changeProductQuantity(cart.shoppingCarts[index]).then((value) {
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
cart.shoppingCarts[index], () {
print(cart.shoppingCarts[index]
.quantity);
model
.changeProductQuantity(
cart.shoppingCarts[index])
.then((value) {
if (model.state !=
ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
if (model.state ==
ViewState.ErrorLocal) {Utils.showErrorToast(model.error);}
ViewState.ErrorLocal) {
Utils.showErrorToast(
model.error);
}
});
},
() {
model.deleteProduct(cart.shoppingCarts[index]).then((value){
if (model.state != ViewState.Error) {
appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}');
}, () {
model
.deleteProduct(
cart.shoppingCarts[index])
.then((value) {
if (model.state !=
ViewState.Error) {
appScaffold.appBar.badgeUpdater(
'${value.quantityCount ?? 0}');
}
});
}))
@ -200,7 +217,8 @@ class CartOrderPage extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noData,
child: Text(
TranslationBase.of(context).noData,
// 'There is no data',
style: TextStyle(fontSize: 30),
),
@ -270,9 +288,8 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
width: 25.0,
height: widget.height * 0.070,
decoration: new BoxDecoration(
color: !isAgree
? Color(0xffeeeeee)
: Colors.green,
color:
!isAgree ? Color(0xffeeeeee) : Colors.green,
shape: BoxShape.circle,
),
child: !isAgree

@ -1,9 +1,12 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.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/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/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
@ -13,66 +16,43 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/pr
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/widgets/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BestSellerWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewButtons.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/PrescriptionsWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ShopByBrandWidget.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/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.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 {
// final PharmacyProduct product;
// PharmacyPage(this.product);
@override
_PharmacyPageState createState() => _PharmacyPageState();
}
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
Widget build(BuildContext context) {
return BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPharmacyHomeData(),
onModelReady: (model) async {
// GifLoaderDialogUtils.showMyDialog(context);
await model.getSavedLanguage();
await model.getBannerList();
// GifLoaderDialogUtils.hideDialog(context);
},
allowAny: true,
builder: (_, model, wi) => AppScaffold(
title: "",
@ -84,821 +64,19 @@ class _PharmacyPageState extends State<PharmacyPage> {
width: double.infinity,
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
BannerPager(model),
// GridViewButtons(model),
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, FadePage(page: HomePrescriptionsPage()));
},
),
GridViewButtons(model),
PrescriptionsWidget(),
ShopByBrandWidget(),
RecentlyViewedWidget(),
BestSellerWidget(),
],
),
),
Container(
height: model.prescriptionsList.length > 0
? MediaQuery.of(context).size.height * 0.28
: 0,
padding:
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),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) => model.getPrescription(),
builder: (_, model, wi) => model.prescriptionsList.length !=
0
// model.getPrescription();
? ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) {
return Container(
// width: 160.0,
height:
MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0,
),
color: Colors.white,
borderRadius: BorderRadius.circular(10.0)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(children: [
Container(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 10.0,
bottom: 15.0,
),
child: CircleAvatar(
radius: 30,
backgroundColor:
Colors.transparent,
child: Image.network(
model.prescriptionsList[index]
.doctorImageURL,
width: 60,
height: 60,
),
),
),
]),
// 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(
// crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin:
EdgeInsets.only(left: 1),
padding: EdgeInsets.only(
left: 15.0, right: 15.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style:
BorderStyle.solid,
width: 4.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(
30.0)),
child: Text(
languageID == "ar"
? model.prescriptionsList[index].isInOutPatientDescriptionN.toString()
: model.prescriptionsList[index].isInOutPatientDescription.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)),
Row(children: <Widget>[
Image.asset(
'assets/images/Icon-awesome-calendar.png',
width: 30,
height: 30,
),
Text(
DateUtil.convertStringToDate(
model
.prescriptionsList[
index]
.appointmentDate
.toString())
.toString()
.substring(0, 10),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
)
]),
],
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Row(children: <Widget>[
Text(
model.prescriptionsList[index]
.doctorTitle
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
model.prescriptionsList[index]
.doctorName
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
model.prescriptionsList[index]
.clinicDescription
.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.prescriptionsList[index]
.actualDoctorRate
.toDouble(),
// initialRating: productRate,
size: 15.0,
filledColor:
Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon:
Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
)
]),
]),
);
})
: Container(),
),
),
// 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")));
// },
// ),
// ],
// ),
// ),
// Container(
// height: model.recommendedProductList.length > 0
// ? MediaQuery.of(context).size.height * 0.32
// : 0,
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
//// padding: EdgeInsets.symmetric(horizontal: 5.0, vertical: 22.0),
//// margin: EdgeInsets.only(left: 10),
// child: BaseView<PharmacyModuleViewModel>(
// onModelReady: (model) =>
// model.getRecommendedProducts(productId),
// builder: (_, model, wi) => model
// .recommendedProductList.length !=
// null
// ? ListView.builder(
// scrollDirection: Axis.horizontal,
// shrinkWrap: true,
// physics: ScrollPhysics(),
// // physics: NeverScrollableScrollPhysics(),
// itemCount: model.recommendedProductList.length,
// itemBuilder: (context, index) {
// return Card(
// elevation: 2,
// shape: RoundedRectangleBorder(
// side: BorderSide(
// color: Colors.grey[300], width: 2),
// borderRadius: BorderRadius.circular(10)),
// margin: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 0,
// ),
// child: Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(
// Radius.circular(15),
// ),
// ),
// padding: EdgeInsets.symmetric(horizontal: 4),
// width: MediaQuery.of(context).size.width / 3,
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Stack(children: [
// Container(
// child: Align(
// alignment: Alignment.topRight,
// child: //true
// itemID.contains(model.recommendedProductList[index].id)
// // !isInWishlist
// ? IconButton(
// icon: Icon(Icons
// .favorite_border),
// color: Colors.grey,
// iconSize: 30,
// onPressed: () {
// setState(() {
// addToWishlistFunction(
// itemID);
// });
// },
// )
// : IconButton(
// icon: Icon(
// Icons.favorite),
// color: Colors.red,
// iconSize: 30,
// onPressed: () {
// setState(() {
// deleteFromWishlistFunction(
// itemID);
// });
// },
// )
////
// ),
// ),
// Container(
// margin: EdgeInsets.fromLTRB(
// 0, 16, 10, 16),
// alignment: Alignment.center,
//// padding: EdgeInsets.only(left: 25, bottom: 20),
// child: (model.recommendedProductList[index].images != null &&
// model.recommendedProductList[index].images.length > 0)
// ? Image.network(
// model.recommendedProductList[index].images[0].src.toString(),
//// item.images[0].src,
// fit: BoxFit.cover,
// height: 60,
// )
// : Image.asset(
// "assets/images/no_image.png",
// fit: BoxFit.cover,
// height: 60,
// ),
// ),
// Container(
// width: model
// .recommendedProductList[
// index]
// .rxMessage !=
// null
// ? MediaQuery.of(context)
// .size
// .width /
// 5
// : 0,
// padding: EdgeInsets.all(4),
// decoration: BoxDecoration(
// color: Color(0xffb23838),
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(6)),
// ),
// child: Texts(
// model.recommendedProductList[index]
// .rxMessage !=
// null
// ? model
// .recommendedProductList[
// index]
// .rxMessage
// : "",
// color: Colors.white,
// regular: true,
// fontSize: 10,
// fontWeight: FontWeight.w400,
// ),
// ),
// ]),
// Container(
// margin: EdgeInsets.symmetric(
// horizontal: 6,
// vertical: 0,
// ),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// languageID == "ar"
// ? model.recommendedProductList[index].namen
// : model.recommendedProductList[index].name,
// style: TextStyle(
// color: Colors.black,
// fontSize: 13.0,
//// fontWeight: FontWeight.bold,
// ),
// ),
// Padding(
//// padding: const EdgeInsets.only(top: 15, bottom: 10),
// padding: const EdgeInsets.only(
// top: 10, bottom: 5),
// child: Texts(
// "SAR ${model.recommendedProductList[index].price}",
// bold: true,
// fontSize: 14,
// ),
// ),
// ],
// ),
// ),
// Row(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: <Widget>[
// Container(
// padding:
// EdgeInsets.only(right: 10),
//// margin: EdgeInsets.only(left: 5),
// child: Align(
// alignment: Alignment.topLeft,
// child: RatingBar.readOnly(
// initialRating: model
// .recommendedProductList[
// index]
// .approvedRatingSum
// .toDouble(),
//// initialRating: productRate,
// size: 13.0,
// filledColor:
// Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon:
// Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
// ),
// ),
// Texts(
// "(${model.recommendedProductList[index].approvedTotalReviews.toString()})",
//// bold: true,
// fontSize: 12,
// ),
// ]),
// ],
// ),
// ),
// );
// })
// : Container(
//// child: Text("NO DATA"),
// ),
// ),
// ),
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: 100,
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: "",
//TODO Elham* handel this to understans form where the number comming
productType: 20,
),
),
),
},
),
],
),
),
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(
onTap: () => productOnClick(context),
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(
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),
width: MediaQuery.of(context).size.width / 3,
width: MediaQuery.of(context).size.width / 2.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -92,16 +90,21 @@ class ProductTileItem extends StatelessWidget {
borderRadius:
BorderRadius.only(topLeft: Radius.circular(6)),
),
child: item.rxMessage != null ? Texts(
projectProvider.isArabic ? item.rxMessagen : item.rxMessage,
child: item.rxMessage != null
? Texts(
projectProvider.isArabic
? item.rxMessagen
: item.rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
): Texts(""),
)
: Texts(""),
)
],
),
SizedBox(height: 8,),
Container(
margin: EdgeInsets.symmetric(
horizontal: 6,
@ -120,7 +123,7 @@ class ProductTileItem extends StatelessWidget {
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${item.price}",
bold: true,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
@ -135,19 +138,13 @@ class ProductTileItem extends StatelessWidget {
: 0,
forceStars: true),
),
/*Texts(
"(${item.approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
),*/
],
),
],
),
)
],
),
SizedBox(height: 5,),
],
),
),
);

@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart';
@ -43,7 +44,8 @@ class _BannerPagerState extends State<BannerPager> {
.mapIndexed(
(item, index) => InkWell(
onTap: () {
Navigator.push(context, FadePage(page: OffersCategorisePage()));
Navigator.push(
context, FadePage(page: OffersCategorisePage()));
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 1.0),
@ -55,10 +57,11 @@ class _BannerPagerState extends State<BannerPager> {
item,
fit: BoxFit.cover,
)
: Image.network(
item,
: CachedNetworkImage(
imageUrl: item,
fit: BoxFit.cover,
),
errorWidget: (context, url, error) =>
SizedBox()),
),
),
),

@ -0,0 +1,43 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BestSellerViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../../final_products_page.dart';
import '../ProductTileItem.dart';
import 'ViewAllHomeWidget.dart';
class BestSellerWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<BestSellerViewModel>(
onModelReady: (model) => model.getBestSellerProducts(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).bestSellers,
FinalProductsPage(
id: "",
productType: 20,
)),
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,
),
),
],
),
),
));
}
}

@ -0,0 +1,81 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import '../../../offers_categorise_page.dart';
import 'GridViewCard.dart';
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',
() {}),
),
],
),
),
);
}
}

@ -0,0 +1,78 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
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();
}
}

@ -0,0 +1,233 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
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
? NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
height: model.prescriptionsList.length > 0
? MediaQuery.of(context).size.height * 0.28
: 0,
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).myPrescription,
HomePrescriptionsPage()),
Container(
padding: EdgeInsets.symmetric(
horizontal: 18.0, vertical: 14.0),
margin: EdgeInsets.only(left: 10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionsList.length,
itemBuilder: (context, index) {
return Container(
height: MediaQuery.of(context).size.height * 0.3,
padding: EdgeInsets.only(
bottom: 5.0, left: 5.0, right: 8.0),
margin: EdgeInsets.only(right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey,
style: BorderStyle.solid,
width: 1.0,
),
color: Colors.white,
borderRadius: BorderRadius.circular(10.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Column(children: [
Container(
padding: EdgeInsets.only(
top: 10.0,
left: 10.0,
right: 10.0,
bottom: 15.0,
),
child: CircleAvatar(
radius: 30,
backgroundColor:
Colors.transparent,
child: Image.network(
model.prescriptionsList[index]
.doctorImageURL,
width: 60,
height: 60,
),
),
),
]),
Column(
children: [
Container(
margin:
EdgeInsets.only(left: 1),
padding: EdgeInsets.only(
left: 15.0, right: 15.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.green,
style: BorderStyle.solid,
width: 4.0,
),
color: Colors.green,
borderRadius:
BorderRadius.circular(
30.0)),
child: Text(
model.languageID == "ar"
? model
.prescriptionsList[
index]
.isInOutPatientDescriptionN
.toString()
: model
.prescriptionsList[
index]
.isInOutPatientDescription
.toString(),
style: TextStyle(
color: Colors.white,
fontSize: 15.0,
),
)),
Row(children: <Widget>[
Image.asset(
'assets/images/Icon-awesome-calendar.png',
width: 30,
height: 30,
),
Text(
DateUtil.convertStringToDate(
model
.prescriptionsList[
index]
.appointmentDate
.toString())
.toString()
.substring(0, 10),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
),
)
]),
],
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Row(children: <Widget>[
Text(
model.prescriptionsList[index]
.doctorTitle
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
model.prescriptionsList[index]
.doctorName
.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
]),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Text(
model.prescriptionsList[index]
.clinicDescription
.toString(),
style: TextStyle(
color: Colors.green,
fontSize: 15.0,
// fontWeight: FontWeight.bold,
),
),
),
],
),
Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.prescriptionsList[index]
.actualDoctorRate
.toDouble(),
// initialRating: productRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
)
]),
]),
);
}),
),
],
),
),
)
: Container(),
);
}
}

@ -0,0 +1,45 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/LastVisitedViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../../final_products_page.dart';
import '../ProductTileItem.dart';
import 'ViewAllHomeWidget.dart';
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: [
ViewAllHomeWidget(
TranslationBase.of(context).recentlyViewed,
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,
),
),
],
),
),
));
}
}

@ -0,0 +1,40 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/BrandViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
import '../../product-brands.dart';
import '../manufacturerItem.dart';
import 'ViewAllHomeWidget.dart';
class ShopByBrandWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BaseView<BrandViewModel>(
onModelReady: (model) => model.getTopManufacturerList(),
allowAny: true,
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
child: Container(
child: Column(
children: [
ViewAllHomeWidget(
TranslationBase.of(context).shopByBrands,
ProductBrandsPage()),
Container(
height: 100,
child: ListView.builder(
itemBuilder: (ctx, i) =>
ManufacturerItem(model.manufacturerList[i]),
scrollDirection: Axis.horizontal,
itemCount: model.manufacturerList.length,
),
),
],
),
),
));
}
}

@ -0,0 +1,44 @@
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
class ViewAllHomeWidget extends StatelessWidget {
final String title;
final Widget navigationWidget;
ViewAllHomeWidget(this.title, this.navigationWidget);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
title,
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) =>
navigationWidget));
},
),
],
),
);
}
}

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

@ -30,6 +30,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(),
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
AppScaffold(

@ -55,7 +55,8 @@ class WishListService extends BaseService {
// }
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;
await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2",
onSuccess: (dynamic response, int statusCode) {

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

@ -225,34 +225,36 @@ class AppBarWidgetState extends State<AppBarWidget> {
centerTitle: true,
actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart)
? IconButton(
icon: Badge(
shape: BadgeShape.circle,
badgeContent:
? Container()
// ? IconButton(
// icon: Badge(
// shape: BadgeShape.circle,
// badgeContent:
Text(_badgeText, style: TextStyle(color: Colors.white)),
child: Icon(Icons.shopping_cart)),
color: Colors.white,
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
})
// child: Icon(Icons.shopping_cart)),
// color: Colors.white,
// onPressed: () {
// Navigator.of(context).popUntil(ModalRoute.withName('/'));
// })
: Container(),
(widget.isOfferPackages && widget.showOfferPackagesCart)
? IconButton(
icon: Badge(
position: BadgePosition.topStart(top: -15, start: -10),
badgeContent: Text(
_badgeText,
style: TextStyle(
fontSize: 9,
color: Colors.white,
fontWeight: FontWeight.normal),
),
child: Icon(Icons.shopping_cart)),
color: Colors.white,
onPressed: () {
// Cart Click Event
if (_onCartClick != null) _onCartClick();
})
? Container()
// ? IconButton(
// icon: Badge(
// position: BadgePosition.topStart(top: -15, start: -10),
// badgeContent: Text(
// _badgeText,
// style: TextStyle(
// fontSize: 9,
// color: Colors.white,
// fontWeight: FontWeight.normal),
// ),
// child: Icon(Icons.shopping_cart)),
// color: Colors.white,
// onPressed: () {
// // Cart Click Event
// if (_onCartClick != null) _onCartClick();
// })
: Container(),
if (widget.showHomeAppBarIcon)
IconButton(

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

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/d_q_icons_icons.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
@ -17,8 +18,6 @@ class BottomNavPharmacyBar extends StatefulWidget {
}
class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
int _index = 0;
_changeIndex(int index) {
widget.changeIndex(index);
}
@ -43,41 +42,14 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0,
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(
icon: EvaIcons.list,
activeIcon: EvaIcons.list,
icon: DQIcons.categories_menu_icon,
activeIcon: DQIcons.categories_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 1,
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(
icon: EvaIcons.home,
activeIcon: EvaIcons.home,
@ -86,21 +58,20 @@ class _BottomNavPharmacyBarState extends State<BottomNavPharmacyBar> {
currentIndex: 0,
isHome: true,
title: TranslationBase.of(context).home),
BottomNavPharmacyItem(
icon: EvaIcons.person,
activeIcon: EvaIcons.person,
icon: DQIcons.user_menu_icon,
activeIcon: DQIcons.user_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 3,
currentIndex: 2,
title: TranslationBase.of(context).myAccount,
),
BottomNavPharmacyItem(
icon: EvaIcons.shoppingCartOutline,
activeIcon: EvaIcons.shoppingCartOutline,
icon: DQIcons.cart_menu_icon,
activeIcon: DQIcons.cart_menu_icon,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 4,
currentIndex: 3,
title: TranslationBase.of(context).cart)
],
),

@ -1,6 +1,10 @@
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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class BottomNavPharmacyItem extends StatelessWidget {
final String title;
@ -33,7 +37,17 @@ class BottomNavPharmacyItem extends StatelessWidget {
child: InkWell(
highlightColor: 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(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,

Loading…
Cancel
Save