diff --git a/assets/app_icons/config.json b/assets/app_icons/config.json index e2e1afdb..ceb65b05 100644 --- a/assets/app_icons/config.json +++ b/assets/app_icons/config.json @@ -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" + ] } ] } \ No newline at end of file diff --git a/assets/app_icons/fonts/DQIcons.ttf b/assets/app_icons/fonts/DQIcons.ttf index bc92c83d..e0a15c88 100644 Binary files a/assets/app_icons/fonts/DQIcons.ttf and b/assets/app_icons/fonts/DQIcons.ttf differ diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index d81c125d..6b34255b 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -9,36 +9,15 @@ class PrescriptionService extends BaseService { bool isFinished = true; bool hasError = false; String errorMsg = ''; - String url = ""; List _prescriptionsList = List(); List 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 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) { diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index aab267e9..338fd339 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -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(() {}); diff --git a/lib/core/viewModels/pharmacyModule/BestSellerViewModel.dart b/lib/core/viewModels/pharmacyModule/BestSellerViewModel.dart new file mode 100644 index 00000000..f530999b --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/BestSellerViewModel.dart @@ -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(); + + List 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); + } + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/BrandViewModel.dart b/lib/core/viewModels/pharmacyModule/BrandViewModel.dart new file mode 100644 index 00000000..8ffc057a --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/BrandViewModel.dart @@ -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(); + + List 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(); + } +} diff --git a/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart b/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart new file mode 100644 index 00000000..efc628d6 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/LastVisitedViewModel.dart @@ -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(); + + List 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); + } + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart new file mode 100644 index 00000000..45fc8000 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -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(); + + List 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); + } + + } +} \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index 90439128..3f986bcc 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -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(); - PrescriptionService _prescriptionService = locator(); - - - RecommendedProductService _recommendedProductService = locator(); + RecommendedProductService _recommendedProductService = + locator(); List get bannerList => _pharmacyService.bannerItems; - List get manufacturerList => _pharmacyService.manufacturerList; - - List get bestSellerProduct => - _pharmacyService.bestSellerProducts; - - List get lastVisitedProducts => - _pharmacyService.lastVisitedProducts; - - List get recommendedProductList => + List get recommendedProductList => _recommendedProductService.recommendedList; -// List> get recommendedProductList => -// _recommendedProductService.recommendedList; - - List get prescriptionsList => - _prescriptionService.prescriptionsList; - - bool hasError = false; -// List 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); - await _pharmacyService.getBannerListList(); - if (_pharmacyService.hasError) { - error = _pharmacyService.error; - setState(ViewState.Error); - } else { - _getTopManufacturerList(); + if (bannerList.isEmpty) { + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + await _pharmacyService.getBannerListList(); + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (_pharmacyService.hasError) { + error = _pharmacyService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); } } @@ -109,41 +93,8 @@ 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); + getRecommendedProducts(productId) async { + setState(ViewState.Busy); await _recommendedProductService.getRecommendedProducts(productId); if (_recommendedProductService.hasError) { error = _recommendedProductService.error; @@ -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); -// } -// } - } diff --git a/lib/d_q_icons_icons.dart b/lib/d_q_icons_icons.dart index 5d1ff3c6..7376b1ca 100644 --- a/lib/d_q_icons_icons.dart +++ b/lib/d_q_icons_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DQIcons.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -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); } diff --git a/lib/locator.dart b/lib/locator.dart index 92c6bf63..b855e5a7 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -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( diff --git a/lib/main.dart b/lib/main.dart index 2f1e465f..dda4d57a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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 { navigatorObservers: [ GAnalytics.shared.navObserver() ], + navigatorKey: locator().navigatorKey, showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 687d6cf5..31747141 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -49,7 +49,6 @@ class _FinalProductsPageState extends State { Widget build(BuildContext context) { return BaseView( 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 { isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, - isShowDecPage: true, + isShowDecPage: false, baseViewModel: model, body: Container( height: MediaQuery.of(context).size.height * 5.87, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 9ba5ad9c..a34f3b57 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -826,7 +826,7 @@ class _HomePageState extends State { 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())); }); diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 45f60bb7..9f00e27c 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -110,35 +110,6 @@ class _LandingPagePharmacyState extends State { 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 { 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 { .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) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 70627f8d..2fc2100c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -68,6 +68,10 @@ class _Login extends State { if(BASE_URL.contains("uat.")){ nationalIDorFile.text = "2001273"; mobileNumberController.text = mobileNo = "0555416043"; + } else { + // TODO Mousa Sheeeloh + nationalIDorFile.text = "3376044"; + mobileNumberController.text = mobileNo = "0555416575"; } } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index d7249c6b..fb4b934f 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -26,7 +26,8 @@ class ParentCategorisePage extends StatefulWidget { ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -57,7 +58,10 @@ class _ParentCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategoriseParent(i: id), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( + allowAny: true, + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( appBarTitle: titleName, isBottomBar: false, isShowAppBar: true, @@ -108,7 +112,8 @@ class _ParentCategorisePageState extends State { child: InkWell( child: Container( child: Texts( - TranslationBase.of(context).viewCategorise, + TranslationBase.of(context) + .viewCategorise, // 'View All Categories', fontWeight: FontWeight.w300, ), @@ -126,22 +131,37 @@ class _ParentCategorisePageState extends State { color: Colors.white, child: Center( child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { + scrollDirection: + Axis.vertical, + itemCount: model + .categoriseParent.length, + itemBuilder: + (BuildContext context, + int index) { return Container( child: Padding( - padding: EdgeInsets.all(4.0), + padding: + EdgeInsets.all(4.0), child: InkWell( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - Texts(projectViewModel.isArabic - ? model.categoriseParent[index].namen - : model.categoriseParent[index].name), + Texts(projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name), Divider( thickness: 0.6, - color: Colors.black12, + color: Colors + .black12, ) ], ), @@ -149,9 +169,16 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: SubCategorisePage( - title: model.categoriseParent[index].name, - id: model.categoriseParent[index].id, + page: + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, parentId: id, )), ); @@ -185,22 +212,28 @@ class _ParentCategorisePageState extends State { child: Center( child: ListView.builder( scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, + itemCount: model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, itemBuilder: (BuildContext context, int index) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), + padding: + EdgeInsets.symmetric(horizontal: 8.0), child: InkWell( child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 13.0), + padding: EdgeInsets.symmetric( + horizontal: 13.0), child: Container( height: 60.0, width: 65.0, decoration: BoxDecoration( shape: BoxShape.circle, - color: Colors.orange.shade200.withOpacity(0.45), + color: Colors.orange.shade200 + .withOpacity(0.45), ), child: Center( child: Icon( @@ -211,7 +244,10 @@ class _ParentCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context).size.width * 0.197, + width: MediaQuery.of(context) + .size + .width * + 0.197, // height: MediaQuery.of(context) // .size // .height * @@ -219,8 +255,12 @@ class _ParentCategorisePageState extends State { child: Center( child: Texts( projectViewModel.isArabic - ? model.categoriseParent[index].namen - : model.categoriseParent[index].name, + ? model + .categoriseParent[index] + .namen + : model + .categoriseParent[index] + .name, fontSize: 13.4, fontWeight: FontWeight.w600, maxLines: 3, @@ -234,8 +274,10 @@ class _ParentCategorisePageState extends State { context, FadePage( page: SubCategorisePage( - title: model.categoriseParent[index].name, - id: model.categoriseParent[index].id, + title: model + .categoriseParent[index].name, + id: model + .categoriseParent[index].id, parentId: id, )), ); @@ -281,16 +323,21 @@ class _ParentCategorisePageState extends State { initialChildSize: 0.95, maxChildSize: 0.95, minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { + builder: (BuildContext context, + ScrollController scrollController) { return SingleChildScrollView( controller: scrollController, child: Container( color: Colors.white, - height: MediaQuery.of(context).size.height * 1.95, + height: MediaQuery.of(context) + .size + .height * + 1.95, child: Column( children: [ Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Row( children: [ Icon( @@ -301,7 +348,8 @@ class _ParentCategorisePageState extends State { ), Texts( 'Refine', - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, ), SizedBox( width: 250.0, @@ -310,11 +358,13 @@ class _ParentCategorisePageState extends State { child: Texts( 'Close', color: Colors.red, - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop(context); + Navigator.pop( + context); }, ), ], @@ -327,27 +377,37 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts('Categorise'), + title: + Texts('Categorise'), children: [ ProcedureListWidget( model: model, - masterList: model.categoriseParent, - removeHistory: (item) { + masterList: model + .categoriseParent, + removeHistory: + (item) { setState(() { - entityList.remove(item); + entityList + .remove( + item); }); }, - addHistory: (history) { + addHistory: + (history) { setState(() { - entityList.add(history); + entityList.add( + history); }); }, - addSelectedHistories: () { + addSelectedHistories: + () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => - isEntityListSelected(master), + isEntityListSelected: + (master) => + isEntityListSelected( + master), ) ], ), @@ -360,23 +420,33 @@ class _ParentCategorisePageState extends State { children: [ ProcedureListWidget( model: model, - masterList: model.brandsList, - removeHistory: (item) { + masterList: model + .brandsList, + removeHistory: + (item) { setState(() { - entityListBrands.remove(item); + entityListBrands + .remove( + item); }); }, - addHistory: (history) { + addHistory: + (history) { setState(() { - entityListBrands.add(history); + entityListBrands + .add( + history); }); }, - addSelectedHistories: () { + addSelectedHistories: + () { //TODO build your fun herr // widget.addSelectedHistories(); }, - isEntityListSelected: (master) => - isEntityListSelectedBrands(master), + isEntityListSelected: + (master) => + isEntityListSelectedBrands( + master), ) ], ), @@ -388,40 +458,63 @@ class _ParentCategorisePageState extends State { title: Texts('Price'), children: [ Container( - color: Color(0xffEEEEEE), + color: Color( + 0xffEEEEEE), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: + MainAxisAlignment + .spaceAround, children: [ Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ - Texts('Min'), + Texts( + 'Min'), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - controller: minField, + controller: + minField, ), ), ], ), Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ - Texts('Max'), + Texts( + 'Max'), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + color: Colors + .white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: + OutlineInputBorder(), ), - controller: maxField, + controller: + maxField, ), ), ], @@ -436,18 +529,26 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), SizedBox( - height: MediaQuery.of(context).size.height * 0.4, + height: MediaQuery.of( + context) + .size + .height * + 0.4, ), Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, children: [ Container( width: 100, child: Button( label: 'Reset', - backgroundColor: Colors.red, + backgroundColor: + Colors.red, ), ), SizedBox( @@ -456,38 +557,65 @@ class _ParentCategorisePageState extends State { Container( width: 200, child: Button( - onTap: () async { - String categoriesId = ""; - for (CategoriseParentModel category in entityList) { - if (categoriesId == "") { - categoriesId = category.id; + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = + category + .id; } else { - categoriesId = "$categoriesId,${category.id}"; + categoriesId = + "$categoriesId,${category.id}"; } } - String brandIds = ""; + String + brandIds = + ""; for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == "") { - brandIds = brand.id; + if (brandIds == + "") { + brandIds = + brand + .id; } else { - brandIds = "$brandIds,${brand.id}"; + brandIds = + "$brandIds,${brand.id}"; } } - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils + .showMyDialog( + context); await model.getFilteredProducts( - min: minField.text.toString(), - max: maxField.text.toString(), - categoryId: categoriesId, - brandId: brandIds); - GifLoaderDialogUtils.hideDialog(context); + min: minField + .text + .toString(), + max: maxField + .text + .toString(), + categoryId: + categoriesId, + brandId: + brandIds); + GifLoaderDialogUtils + .hideDialog( + context); - Navigator.pop(context); + Navigator.pop( + context); }, label: 'Apply', - backgroundColor: Colors.green, + backgroundColor: + Colors + .green, ), ), ], @@ -554,22 +682,28 @@ class _ParentCategorisePageState extends State { model.parentProducts.isNotEmpty ? styleOne == true ? Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, + height: model.parentProducts.length * + MediaQuery.of(context).size.height * + 0.15, child: GridView.builder( physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 0.5, mainAxisSpacing: 2.0, childAspectRatio: 0.9, ), itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.parentProducts[index].discountName != null + color: model.parentProducts[index] + .discountName != + null ? Color(0xffFFFF00) : Colors.white, elevation: 0, @@ -597,106 +731,187 @@ class _ParentCategorisePageState extends State { ), child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(110.0), ), color: Colors.white, ), - padding: EdgeInsets.symmetric(horizontal: 0), - width: MediaQuery.of(context).size.width / 3, + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Stack( children: [ - if (model.parentProducts[index].discountName != null) + if (model + .parentProducts[ + index] + .discountName != + null) RotatedBox( quarterTurns: 4, child: Container( - decoration: BoxDecoration(), + decoration: + BoxDecoration(), child: Padding( - padding: EdgeInsets.only( + padding: + EdgeInsets + .only( right: 5.0, top: 20.0, bottom: 5.0, ), child: Texts( - 'offer'.toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: FontWeight.w900, + 'offer' + .toUpperCase(), + color: Colors + .red, + fontSize: + 13.0, + fontWeight: + FontWeight + .w900, ), ), - transform: new Matrix4.rotationZ(5.837200), + transform: new Matrix4 + .rotationZ( + 5.837200), ), ), Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, + margin: EdgeInsets + .fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, child: Image.network( - model.parentProducts[index].images.isNotEmpty - ? model.parentProducts[index].images[0].thumb + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, height: 80, ), ), Container( - width: model.parentProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + BorderRadius.only( + topLeft: Radius + .circular( + 6)), ), child: Texts( - model.parentProducts[index].rxMessage != null - ? model.parentProducts[index].rxMessage + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), ), ], ), Container( - margin: EdgeInsets.symmetric( + margin: + EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - if (model.parentProducts[index].discountName != null) + if (model + .parentProducts[ + index] + .discountName != + null) Container( - width: double.infinity, + width: double + .infinity, height: 13.0, - decoration: BoxDecoration( - color: Color(0xff5AB145), + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), ), child: Center( child: Texts( - model.parentProducts[index].discountName, + model + .parentProducts[ + index] + .discountName, regular: true, - color: Colors.white, - fontSize: 10.4, + color: Colors + .white, + fontSize: + 10.4, ), ), ), Texts( - projectViewModel.isArabic - ? model.parentProducts[index].namen - : model.parentProducts[index].name, + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[ + index] + .name, regular: true, fontSize: 12, - fontWeight: FontWeight.w700, + fontWeight: + FontWeight.w700, ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -706,22 +921,25 @@ class _ParentCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.parentProducts[index].approvedRatingSum > 0 - ? (model.parentProducts[index] - .approvedRatingSum - .toDouble() / - model.parentProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / + model.parentProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), Texts( "(${model.parentProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight + .w400, ) ], ), @@ -736,7 +954,9 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.parentProducts[index]), + page: ProductDetailPage( + model.parentProducts[ + index]), )), }, )); @@ -744,11 +964,14 @@ class _ParentCategorisePageState extends State { ), ) : Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, + height: model.parentProducts.length * + MediaQuery.of(context).size.height * + 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -758,9 +981,11 @@ class _ParentCategorisePageState extends State { Column( children: [ Container( - decoration: BoxDecoration(), + decoration: + BoxDecoration(), child: Padding( - padding: EdgeInsets.only( + padding: + EdgeInsets.only( left: 9.0, top: 8.0, right: 10.0, @@ -768,11 +993,22 @@ class _ParentCategorisePageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, child: Image.network( - model.parentProducts[index].images.isNotEmpty - ? model.parentProducts[index].images[0].thumb + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.contain, height: 80, @@ -783,23 +1019,45 @@ class _ParentCategorisePageState extends State { Column( children: [ Container( - width: model.parentProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + BorderRadius.only( + topLeft: Radius + .circular( + 6)), ), child: Texts( - model.parentProducts[index].rxMessage != null - ? model.parentProducts[index].rxMessage + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), ), ], @@ -812,21 +1070,37 @@ class _ParentCategorisePageState extends State { vertical: 0, ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ SizedBox( height: 4.0, ), Container( - width: MediaQuery.of(context).size.width * 0.65, + width: MediaQuery.of( + context) + .size + .width * + 0.65, child: Texts( - projectViewModel.isArabic - ? model.parentProducts[index].namen - : model.parentProducts[index].name, + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[ + index] + .name, regular: true, fontSize: 13.2, - fontWeight: FontWeight.w500, + fontWeight: + FontWeight.w500, maxLines: 5, ), ), @@ -834,7 +1108,11 @@ class _ParentCategorisePageState extends State { height: 8.0, ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), child: Texts( "SAR ${model.parentProducts[index].price}", bold: true, @@ -844,21 +1122,26 @@ class _ParentCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.parentProducts[index].approvedRatingSum > 0 - ? (model.parentProducts[index].approvedRatingSum - .toDouble() / - model.parentProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum + .toDouble() / + model + .parentProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, forceStars: true), Texts( "(${model.parentProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ) ], ), @@ -872,7 +1155,8 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.parentProducts[index]), + page: ProductDetailPage(model + .parentProducts[index]), )), }, ); @@ -914,7 +1198,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = entityList.where((element) => masterKey.id == element.id); + Iterable history = + entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -922,7 +1207,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = + entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index 6c760fcd..c2ebf4b2 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -24,9 +24,10 @@ class CartOrderPage extends StatelessWidget { final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; AppScaffold appScaffold; return BaseView( - onModelReady: (model){ - model.getShoppingCart().then((value){ - appScaffold.appBar.badgeUpdater('${model.cartResponse.quantityCount ?? 0}'); + onModelReady: (model) { + model.getShoppingCart().then((value) { + appScaffold.appBar + .badgeUpdater('${model.cartResponse.quantityCount ?? 0}'); }); }, builder: (_, model, wi) => ChangeNotifierProvider.value( @@ -69,24 +70,40 @@ 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,21 +288,20 @@ class _OrderBottomWidgetState extends State { 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 ? null : Padding( - padding: const EdgeInsets.all(0.0), - child: Icon( - Icons.check, - color: Colors.white, - size: 25, - ), - ), + padding: const EdgeInsets.all(0.0), + child: Icon( + Icons.check, + color: Colors.white, + size: 25, + ), + ), ), ), Expanded( diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 6ede72a9..ee5c077f 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -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 { -// dynamic wishlistVar; - - getLanguageID() async { - languageID = await sharedPref.getString(APP_LANGUAGE); - } - -// List recommendedProductList = []; - List 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( - 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,603 +64,14 @@ class _PharmacyPageState extends State { width: double.infinity, child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + //crossAxisAlignment: CrossAxisAlignment.start, children: [ 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())); - }, - ), - ], - ), - ), - 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( - 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: [ - Row( - children: [ - 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: [ - 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: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - 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: [ - 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: [ - 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( -// 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: [ -// 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, - ), - ), + GridViewButtons(model), + PrescriptionsWidget(), + ShopByBrandWidget(), + RecentlyViewedWidget(), + BestSellerWidget(), ], ), ), @@ -688,217 +79,4 @@ class _PharmacyPageState extends State { ), ); } - - 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 { - @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); -// -// } diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index c2781a98..40895a00 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -52,102 +52,99 @@ 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) ), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - width: MediaQuery.of(context).size.width / 3, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, - child: (item.images != null && item.images.length > 0) - ? Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: 80, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 80, - ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 2.8, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Container( + margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + alignment: Alignment.center, + child: (item.images != null && item.images.length > 0) + ? Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: 80, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, ), - Container( - width: item.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: item.rxMessage != null ? Texts( - projectProvider.isArabic ? item.rxMessagen : item.rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ): Texts(""), + ), + Container( + width: item.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: item.rxMessage != null + ? Texts( + projectProvider.isArabic + ? item.rxMessagen + : item.rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, ) - ], + : Texts(""), + ) + ], + ), + SizedBox(height: 8,), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - projectProvider.isArabic ? item.namen : item.name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w400, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + projectProvider.isArabic ? item.namen : item.name, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w400, + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 4), + child: Texts( + "SAR ${item.price}", + fontWeight: FontWeight.w600, + fontSize: 14, ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${item.price}", - bold: true, - fontSize: 14, + ), + Row( + children: [ + Expanded( + child: StarRating( + totalAverage: item.approvedTotalReviews > 0 + ? (item.approvedRatingSum.toDouble() / + item.approvedTotalReviews.toDouble()) + .toDouble() + : 0, + forceStars: true), ), - ), - Row( - children: [ - Expanded( - child: StarRating( - totalAverage: item.approvedTotalReviews > 0 - ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .toDouble() - : 0, - forceStars: true), - ), - /*Texts( - "(${item.approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ),*/ - ], - ), - ], - ), - ) - ], - ), + ], + ), + ], + ), + ), + SizedBox(height: 5,), + ], ), ), ); diff --git a/lib/pages/pharmacies/widgets/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart similarity index 88% rename from lib/pages/pharmacies/widgets/BannerPager.dart rename to lib/pages/pharmacies/widgets/home/BannerPager.dart index b088eefb..29d409eb 100644 --- a/lib/pages/pharmacies/widgets/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -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 { .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 { item, fit: BoxFit.cover, ) - : Image.network( - item, + : CachedNetworkImage( + imageUrl: item, fit: BoxFit.cover, - ), + errorWidget: (context, url, error) => + SizedBox()), ), ), ), diff --git a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart new file mode 100644 index 00000000..5784acaa --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart @@ -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( + 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, + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart new file mode 100644 index 00000000..5d979136 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart @@ -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', + () {}), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/home/GridViewCard.dart b/lib/pages/pharmacies/widgets/home/GridViewCard.dart new file mode 100644 index 00000000..99425aa1 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/GridViewCard.dart @@ -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(); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart new file mode 100644 index 00000000..28556679 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -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( + onModelReady: (model) async { + if (Provider.of(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: [ + Row( + children: [ + 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: [ + 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: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + 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: [ + 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: [ + 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(), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart new file mode 100644 index 00000000..b07c6da6 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -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( + 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, + ), + ), + ], + ), + ), + )); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart b/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart new file mode 100644 index 00000000..3d892a43 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart @@ -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( + 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, + ), + ), + ], + ), + ), + )); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart new file mode 100644 index 00000000..25981466 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -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)); + }, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 918e9668..3cf28592 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -93,7 +93,7 @@ class _ProfilePageState extends State { }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, + isShowAppBar: false, isShowDecPage: false, isPharmacy: true, body: user != null diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index ff1920dc..b71c28ce 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -30,6 +30,7 @@ class _PharmacyCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategorise(), + allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index 5404a2bd..fb99e038 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -55,9 +55,10 @@ 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", + await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { diff --git a/lib/widgets/others/StarRating.dart b/lib/widgets/others/StarRating.dart index 5620b21a..74bdbfe3 100644 --- a/lib/widgets/others/StarRating.dart +++ b/lib/widgets/others/StarRating.dart @@ -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],) ] diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index dcac916b..87976dcb 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -225,34 +225,36 @@ class AppBarWidgetState extends State { centerTitle: true, actions: [ (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( diff --git a/lib/widgets/others/network_base_view.dart b/lib/widgets/others/network_base_view.dart index bca942f4..10b4da12 100644 --- a/lib/widgets/others/network_base_view.dart +++ b/lib/widgets/others/network_base_view.dart @@ -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{ return widget.child; break; case ViewState.Busy: - return Container( + if(widget.isLocalLoader) + return Container( + height: 100, + child: Center( + child:CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ); + else return Container( height: MediaQuery.of(context).size.height, child: Stack( diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart index 237b4cae..d1490d74 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -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 { - int _index = 0; - _changeIndex(int index) { widget.changeIndex(index); } @@ -43,41 +42,14 @@ class _BottomNavPharmacyBarState extends State { 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: [ -// 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 { 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) ], ), diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index bff756f1..76a829cd 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -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(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,