diff --git a/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa b/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa new file mode 100644 index 00000000..ca720a76 Binary files /dev/null and b/Runner 2021-01-01 21-59-41/DiplomaticQuarter.ipa differ 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/assets/images/new/Comprehensive checkup.svg b/assets/images/new/Comprehensive checkup.svg new file mode 100644 index 00000000..b3f2feb1 --- /dev/null +++ b/assets/images/new/Comprehensive checkup.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/Live Care.svg b/assets/images/new/Live Care.svg new file mode 100644 index 00000000..b5a367d7 --- /dev/null +++ b/assets/images/new/Live Care.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/assets/images/new/blood donation.svg b/assets/images/new/blood donation.svg new file mode 100644 index 00000000..95d0904f --- /dev/null +++ b/assets/images/new/blood donation.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/book appointment.svg b/assets/images/new/book appointment.svg new file mode 100644 index 00000000..590ea8de --- /dev/null +++ b/assets/images/new/book appointment.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/new/child vaccines.svg b/assets/images/new/child vaccines.svg new file mode 100644 index 00000000..d3f38a5e --- /dev/null +++ b/assets/images/new/child vaccines.svg @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/covid drive thru.svg b/assets/images/new/covid drive thru.svg new file mode 100644 index 00000000..563de151 --- /dev/null +++ b/assets/images/new/covid drive thru.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/health calculator.svg b/assets/images/new/health calculator.svg new file mode 100644 index 00000000..ac73e868 --- /dev/null +++ b/assets/images/new/health calculator.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/assets/images/new/health converter.svg b/assets/images/new/health converter.svg new file mode 100644 index 00000000..961adc51 --- /dev/null +++ b/assets/images/new/health converter.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/new/latest news.svg b/assets/images/new/latest news.svg new file mode 100644 index 00000000..5b9cd805 --- /dev/null +++ b/assets/images/new/latest news.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/medical file.svg b/assets/images/new/medical file.svg new file mode 100644 index 00000000..0849b7a0 --- /dev/null +++ b/assets/images/new/medical file.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/my family.svg b/assets/images/new/my family.svg new file mode 100644 index 00000000..41d0b8a9 --- /dev/null +++ b/assets/images/new/my family.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/not_found.svg b/assets/images/new/not_found.svg new file mode 100644 index 00000000..80aed53a --- /dev/null +++ b/assets/images/new/not_found.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/parking details.svg b/assets/images/new/parking details.svg new file mode 100644 index 00000000..dc25eb0e --- /dev/null +++ b/assets/images/new/parking details.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/reach us.svg b/assets/images/new/reach us.svg new file mode 100644 index 00000000..b4634170 --- /dev/null +++ b/assets/images/new/reach us.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/new/referral.svg b/assets/images/new/referral.svg new file mode 100644 index 00000000..fb6b8591 --- /dev/null +++ b/assets/images/new/referral.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/new/smart watch.svg b/assets/images/new/smart watch.svg new file mode 100644 index 00000000..0667e31d --- /dev/null +++ b/assets/images/new/smart watch.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/new/todo.svg b/assets/images/new/todo.svg new file mode 100644 index 00000000..be869c1d --- /dev/null +++ b/assets/images/new/todo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/update insurance card.svg b/assets/images/new/update insurance card.svg new file mode 100644 index 00000000..0139e27d --- /dev/null +++ b/assets/images/new/update insurance card.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/new/virtual tour.svg b/assets/images/new/virtual tour.svg new file mode 100644 index 00000000..733f433e --- /dev/null +++ b/assets/images/new/virtual tour.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/pharmacy_module/bg_1.png b/assets/images/pharmacy_module/bg_1.png index 9505e556..0155a7b3 100644 Binary files a/assets/images/pharmacy_module/bg_1.png and b/assets/images/pharmacy_module/bg_1.png differ diff --git a/assets/images/pharmacy_module/bg_2.png b/assets/images/pharmacy_module/bg_2.png index 96cfd3bc..0a1bc5cb 100644 Binary files a/assets/images/pharmacy_module/bg_2.png and b/assets/images/pharmacy_module/bg_2.png differ diff --git a/assets/images/pharmacy_module/bg_3.png b/assets/images/pharmacy_module/bg_3.png index 127c2669..3a28d5f9 100644 Binary files a/assets/images/pharmacy_module/bg_3.png and b/assets/images/pharmacy_module/bg_3.png differ diff --git a/assets/images/pharmacy_module/bg_4.png b/assets/images/pharmacy_module/bg_4.png index 423ab421..234ebe7b 100644 Binary files a/assets/images/pharmacy_module/bg_4.png and b/assets/images/pharmacy_module/bg_4.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index acb8d80a..a6565ecf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; const MAX_SMALL_SCREEN = 660; // PACKAGES and OFFERS -const EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000'; +const EXA_CART_API_BASE_URL = 'http://10.50.100.217:1010/offersdiscounts'; // http://10.200.101.75:9000 const PACKAGES_CATEGORIES = '/api/categories'; const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; @@ -19,7 +19,7 @@ const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; -// Pharmacy Production URLs +// // Pharmacy Production URLs const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; @@ -420,8 +420,8 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHa const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; -const GET_MOST_VIEWED_PRODUCTS = "mostview?"; -const GET_NEW_PRODUCTS = "newproducts?"; +const GET_MOST_VIEWED_PRODUCTS = "mostview"; +const GET_NEW_PRODUCTS = "newproducts"; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; @@ -438,9 +438,19 @@ const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews'; const BLOOD_DONATION_REGISTER_BLOOD_TYPE = 'Services/PatientVarification.svc/REST/BloodDonation_RegisterBloodType'; const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/REST/AddUserAgreementForBloodDonation'; +// HHC RC SERVICES +const HHC_GET_ALL_SERVICES_RC = "rc/api/HHC/getallhhc"; +const ADD_HHC_ORDER_RC = "rc/api/HHC/add"; +const GET_ALL_HHC_ORDERS_RC = 'rc/api/hhc/list'; + // CMC RC SERVICES const GET_ALL_CMC_SERVICES_RC = 'rc/api/cmc/getallcmc'; const ADD_CMC_ORDER_RC = 'rc/api/cmc/add'; +const GET_ALL_CMC_ORDERS_RC = 'rc/api/cmc/list'; +const UPDATE_CMC_ORDER_RC = 'rc/api/cmc/update'; + +// RRT RC SERVICES +const ADD_RRT_ORDER_RC = "rc/api/rrt/add"; //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8c86993f..d9080ddb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -105,13 +105,15 @@ const Map localizedValues = { 'add': {'en': 'Add', 'ar': 'إضافة'}, 'reminder': {'en': 'Reminder', 'ar': 'تذكير'}, 'location': {'en': 'Locations', 'ar': 'مواقعنا'}, - 'online': {'en': 'Online', 'ar': 'الالكترونية'}, + 'online': {'en': 'Online', 'ar': 'الالكتروني'}, 'payment': {'en': 'Payment', 'ar': 'الدفع'}, + 'onlinePayment': {'en': 'Online', 'ar': 'الدفع'}, + 'onlinePaymentSubtitle': {'en': 'Payment', 'ar': 'الالكتروني'}, 'cancel-nocaps': {'en': 'Cancel', 'ar': 'الغاء'}, 'set-reminder': {'en': 'Set Reminder', 'ar': 'إضافة تذكير'}, "national-id-number": {"en": "National ID Number", "ar": "رقم الهوية الوطنية / الاقامة"}, "medical-file-number": {"en": "Medical File Number", "ar": "رقم الملف الطبي"}, - 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, + 'login': {'en': 'Login', 'ar': 'دخول'}, 'loginregister': {'en': 'Login / Register', 'ar': 'دخول/ تسجيل'}, 'poweredBy': {'en': 'Powered by', 'ar': 'مشغل بواسطة'}, "welcome": {"en": "Welcome", "ar": "مرحبا"}, @@ -309,23 +311,24 @@ const Map localizedValues = { "branch": {"en": "Branch:", "ar": "الفرع"}, "emergencyServices": {"en": "Emergency Services", "ar": "خدمات الطوارئ"}, "nearester": {"en": "Nearest ER", "ar": "أقرب طوارى"}, - "locationa": {"en": "location", "ar": "الموقع"}, + "locationa": {"en": "Location", "ar": "الموقع"}, + "call_now": {"en": "Call now", "ar": "اتصل الان"}, "ambulancerequest": {"en": "Ambulance", "ar": "طلب نقل "}, "requestA": {"en": "Request", "ar": "اسعاف"}, - "MyAppointments": {"en": "My", "ar": "مواعيدي"}, "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم يتم حضورها"}, - "MyAppointmentsList": {"en": "Appointments", "ar": "قائمة بمواعيدي"}, + "MyAppointmentsList": {"en": "Appointments", "ar": "بمواعيدي"}, + "MyAppointments": {"en": "My", "ar": "قائمة"}, "Radiology": {"en": "Radiology", "ar": "الأشعة"}, "RadiologySubtitle": {"en": "Result", "ar": "صور وتقارير"}, - "Lab": {"en": "Lab", "ar": "تحليل المختبر"}, - "LabSubtitle": {"en": "Result", "ar": "نتائج"}, + "Lab": {"en": "Lab", "ar": "نتائج"}, + "LabSubtitle": {"en": "Results", "ar": "تحليل المختبر"}, "Medicines": {"en": "Medicines", "ar": "الوصفات"}, - "MedicinesSubtitle": {"en": "Prescriptions", "ar": "الوصفات الطبية"}, - "VitalSigns": {"en": "Vital Signs", "ar": "المؤشرات الحيوية"}, - "VitalSignsSubTitle": {"en": "Reports", "ar": "قراءات"}, - "MyMedical": {"en": "Active", "ar": "قراءات"}, + "MedicinesSubtitle": {"en": "Prescriptions", "ar": "الطبية"}, + "VitalSigns": {"en": "Vital Signs", "ar": "المؤشرات"}, + "VitalSignsSubTitle": {"en": "Reports", "ar": "الحيوية"}, + "MyMedical": {"en": "Active", "ar": "الأدوية"}, "MyMedicalSubtitle": {"en": "Medications", "ar": "النشطة"}, "MyDoctor": {"en": "My Doctor", "ar": "اطبائي"}, "MyDoctorSubtitle": {"en": "List", "ar": "قمت بزيارتهم"}, @@ -333,26 +336,26 @@ const Map localizedValues = { "EyeSubtitle": {"en": "Measurement", "ar": "النظر"}, "Insurance": {"en": "Insurance", "ar": "بطاقات"}, "InsuranceSubtitle": {"en": "Card", "ar": "التأمين"}, - "UpdateInsurance": {"en": "Update Insurance", "ar": "تحديث التأمين"}, - "UpdateInsuranceSubtitle": {"en": "Card", "ar": "التأمين"}, - "InsuranceApproval": {"en": "Insurance Approval", "ar": "موافقات"}, - "InsuranceApprovalSubtitle": {"en": "Approvals", "ar": "موافقات التأمين"}, - "Allergies": {"en": "Allergies", "ar": "الحساسية"}, - "AllergiesSubtitle": {"en": "Diagnosed", "ar": "مسجلة"}, - "MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"}, - "MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"}, + "UpdateInsurance": {"en": "Update", "ar": "تحديث"}, + "UpdateInsuranceSubtitle": {"en": "Insurance", "ar": "التأمين"}, + "InsuranceApproval": {"en": "Insurance", "ar": "موافقات"}, + "InsuranceApprovalSubtitle": {"en": "Approvals", "ar": "التأمين"}, + "Allergies": {"en": "Allergies", "ar": "قائمة"}, + "AllergiesSubtitle": {"en": "List", "ar": "الحساسية"}, + "MyVaccines": {"en": "My Vaccines", "ar": "قائمة"}, + "MyVaccinesSubtitle": {"en": "List", "ar": "تطعيماتي"}, "Medical": {"en": "Medical", "ar": "التقارير"}, "MedicalSubtitle": {"en": "Report", "ar": "الطبية"}, - "Monthly": {"en": "Monthly", "ar": "تقارير"}, + "Monthly": {"en": "Monthly", "ar": "التقارير"}, "MonthlySubtitle": {"en": "Report", "ar": "الشهرية"}, "Sick": {"en": "Sick", "ar": "الإجازات"}, "SickSubtitle": {"en": "Leaves", "ar": "المرضية"}, - "MyBalance": {"en": "My Balance", "ar": "رصيدي"}, - "MyBalanceSubtitle": {"en": "Credit", "ar": "المبالغ"}, + "MyBalance": {"en": "My Balance", "ar": "رصيد"}, + "MyBalanceSubtitle": {"en": "Credit", "ar": "محفظتي"}, "PatientCall": {"en": "Patient Call", "ar": "النداء للموعد"}, "PatientCallSubtitle": {"en": "Service", "ar": "خدمة"}, "SmartWatches": {"en": "Smart Watches", "ar": "الساعات الذكية"}, - "SmartWatchesSubtitle": {"en": "Pairing", "ar": "ربط البيانات"}, + "SmartWatchesSubtitle": {"en": "Pairing", "ar": "ربط بيانات"}, "MyTrackers": {"en": "My Trackers", "ar": "تتبع قراءاتي"}, "MyTrackersSubtitle": {"en": "Service", "ar": "الطبية"}, "AskYour": {"en": "Ask Your", "ar": "إسال طبيبك"}, @@ -395,17 +398,19 @@ const Map localizedValues = { "MyBalances": {"en": "My Balances", "ar": "رصيدي"}, "BalanceAmount": {"en": "Wallet Amount", "ar": "مبلغ المحفظة"}, "TotalBalance": {"en": "Total Amount", "ar": "المبلغ الإجمالي"}, - "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "إعادة شحن المحفظة"}, + "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "شحن المحفظة"}, "AdvancePayment": {"en": "Advance Payment", "ar": "الدفع مقدما"}, "AdvancePaymentLabel": {"en": "You can create and add an Advanced Payment for your account or other accounts.", "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين"}, "FileNumber": {"en": "File Number", "ar": "رقم الملف"}, - "Amount": {"en": "Amount *", "ar": "الكمية *"}, + "Amount": {"en": "Amount *", "ar": "المبلغ *"}, "DepositorEmail": {"en": "Depositor Email *", "ar": "البريد الإلكتروني للمودع *"}, "Notes": {"en": "Notes", "ar": "ملاحظات"}, "SelectPatientName": {"en": "Select Patient Name", "ar": "اختر اسم المريض"}, "SelectFamilyPatientName": {"en": "Family Members", "ar": "أفراد الأسرة"}, "SelectHospital": {"en": "Select Hospital", "ar": "اختر المستشفى"}, "selectCity": {"en": "Select City", "ar": "اختر المدينة"}, + "city": {"en": "City", "ar": "مدينة"}, + "distance": {"en": "Distance", "ar": "مسافه"}, "MyAccount": {"en": "My Account", "ar": "حسابي"}, "OtherAccount": {"en": "Other Account", "ar": "حساب آخر"}, "SelectBeneficiary": {"en": "Select Beneficiary", "ar": "حدد المستفيد"}, @@ -414,8 +419,9 @@ const Map localizedValues = { "MobileNumber": {"en": "Mobile Number", "ar": "رقم الجوال"}, "phone-number": {"en": "Phone Number", "ar": "رقم الجوال"}, "country": {"en": "Country", "ar": "دولة"}, - "Ok": {"en": "Ok", "ar": "حسنا"}, + "Ok": {"en": "Ok", "ar": "موافق"}, "averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"}, + "waitingTime": {"en": "Waiting Time:", "ar": "وقت الانتظار:"}, "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires in", "ar": "تنتهي صلاحية رمز التحقق في"}, @@ -508,13 +514,13 @@ const Map localizedValues = { "review": {"en": " reviews", "ar": "تقييمات"}, "viewMedicalFile": {"en": "View Details", "ar": "عرض الملف الطبي"}, "viewAllServices": {"en": "View All Services", "ar": "عرض جميع الخدمات"}, - "medicalFile": {"en": "Medical File", "ar": "ملف طبي"}, + "medicalFile": {"en": "Medical File", "ar": "ملفي الطبي"}, "verified": {"en": "Verified", "ar": "تم التحقق"}, "checkup": {"en": "Checkup", "ar": "فحص"}, "hhcHome": {"en": "Home", "ar": "الرعاية"}, "refferal": {"en": "E-Refferal", "ar": "الإحالة الإلكترونية"}, "healthCare": {"en": "Health Care", "ar": "الصحية المزلية"}, - "emergency": {"en": "Emergency", "ar": "طارئ"}, + "emergency": {"en": "Emergency", "ar": "الطوارئ"}, "cantSeeProfile": {"en": "Can’t see your medical File?", "ar": "لا تستطيع رؤية ملفك الطبي؟"}, "loginRegisterNow": {"en": "Login or Register Now", "ar": "تسجيل الدخول أو التسجيل الآن"}, "HMGPharmacy": {"en": "HMG Pharmacy", "ar": "صيدلية HMG"}, @@ -751,6 +757,8 @@ const Map localizedValues = { "permissions": {"en": "Permission", "ar": "الصلاحيات"}, "camera-permission": {"en": "Camera", "ar": "الكاميرا"}, "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, + "needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"}, + "outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"}, "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, @@ -766,7 +774,7 @@ const Map localizedValues = { "ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"}, "Ports": {"en": "Ports", "ar": "المنافذ"}, "Way": {"en": "Way", "ar": "الطريقة"}, - "Average": {"en": "Average", "ar": "المعدل"}, + "Average": {"en": "Average", "ar": "متوسط"}, "DailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"}, "Period": {"en": "Period", "ar": "الفترة"}, "duration": {"en": "Duration", "ar": "المدة"}, @@ -835,8 +843,8 @@ const Map localizedValues = { "report": {"en": "Radiology Report", "ar": "تقرير الاشعة"}, "open-rad": {"en": "Open Image", "ar": "فتح صور الاشعة"}, "send-copy": {"en": "Email the Report", "ar": "أرسل التقرير"}, - "appoSurvey": {"en": "Survey", "ar": "إستبيان"}, - "appoSurveySubtitle": {"en": "Survey", "ar": "إستبيان"}, + "appoSurvey": {"en": "Survey", "ar": "الاستبيان"}, + "appoSurveySubtitle": {"en": "Survey", "ar": "الاستبيان"}, "labResults": {"en": "Lab Results", "ar": "نتيجة المختبر"}, "doctorRating": {"en": "Doctor Rating", "ar": "تقييم الطبيب"}, "good": {"en": "Good", "ar": "جيد"}, @@ -1030,6 +1038,7 @@ const Map localizedValues = { "quantitySize": {"en": "Quantity", "ar": "كميه"}, "addToCart": {"en": "Add to Cart", "ar": "إضف للسلة"}, "addToWishlist": {"en": "Add to Wishlist", "ar": "اضف للمفضلة"}, + "removeFromWishlist": {"en": "Remove From Wishlist", "ar": "احذف للمفضلة"}, "noData": {"en": "There is no data", "ar": "لايوجد بيانات"}, "no_data": {"en": "No data", "ar": "لايوجد بيانات"}, "buyNow": {"en": "buy now", "ar": "إشتري الان"}, @@ -1357,8 +1366,8 @@ const Map localizedValues = { "en": "This service allows you to make an online virtual consultation via video call directly with the doctor from anywhere at any time.", "ar": "تتيح لك هذه الخدمة إجراء استشارة عبر مكالمة فيديو مباشرة مع الطبيب من أي مكان وفي أي وقت" }, - "my-invoice": {"en": "My Invoice", "ar": "فواتيري"}, - "invoice-list": {"en": "Invoices List", "ar": "فائمة الفواتير"}, + "my-invoice": {"en": "List", "ar": "فواتيري"}, + "invoice-list": {"en": "My Invoice", "ar": "قائمة"}, "thisItemIsNotAvailable": {"en": "This item is not available", "ar": "هذا العنصر غير متوفر"}, "beforeAfterImages": {"en": "Before & After Images", "ar": "الصور قبل وبعد"}, "clinic-accept-livecare": { @@ -1499,7 +1508,7 @@ const Map localizedValues = { "selectSlot": {"en": "Please select Time Slot to continue", "ar": "الرجاء تحديد فترة زمنية للمتابعة"}, "years": {"en": "Years", "ar": "سنوات"}, "respirationBPM": {"en": "bpm", "ar": "نفس"}, - "extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"}, + "extremeObese": {"en": "Extreme Obese", "ar": "سمنة مفرطة"}, "invoiceDetails": {"en": "Invoice Details", "ar": "تفاصيل الفاتورة"}, "appoDetails": {"en": "Appointment Details", "ar": "تفاصيل الموعد"}, "appoPaymentConfirm": {"en": "Are you sure you Want to make payment for this appointment?", "ar": "هل أنت متأكد من أنك تريد سداد هذا الموعد؟"}, @@ -1523,4 +1532,34 @@ const Map localizedValues = { "inPrgress": {"en": "In Progress", "ar": "في تقدم"}, "locked": {"en": "Locked", "ar": "مقفل"}, "personalInfo": {"en": "Personal Information", "ar": "معلومات شخصية"}, + "cmcTitle": {"en": "Comprehensive", "ar": "خدمة"}, + "cmcSubtitle": {"en": "Medical Checkup", "ar": "الفحص الشامل"}, + "emergencyTitle": {"en": "Emergency", "ar": "خدمات"}, + "emergencySubtitle": {"en": "Services", "ar": "الطوارئ"}, + "ereferralTitle": {"en": "E-Referral", "ar": "خدمة"}, + "ereferralSubtitle": {"en": "Service", "ar": "الإحالة الإلكترونية"}, + "medicalFileTitle": {"en": "Medical File", 'ar': 'الملف الطبي'}, + "My_File_Details": {"en": "My File Details", "ar": "تفاصيل ملفي"}, + "Ecommerce": {"en": "Ecommerce", "ar": "التجارة الإلكترونية"}, + "Family_Files": {"en": "Family Files", "ar": "ملفات العائلة"}, + "My_Child": {"en": "My Child", "ar": "طفلي"}, + "Vaccines": {"en": "Vaccines", "ar": "اللقاحات"}, + "Todo": {"en": "Todo", "ar": "لكى يفعل"}, + "List": {"en": "List", "ar": "قائمة"}, + "Blood": {"en": "Blood", "ar": "دم"}, + "Donation": {"en": "Donation", "ar": "هبة"}, + "Health": {"en": "Health", "ar": "الصحة"}, + "Calculator": {"en": "Calculator", "ar": "آلة حاسبة"}, + "Converter": {"en": "Converter", "ar": "محول"}, + "Smart": {"en": "Smart", "ar": "ذكي"}, + "Watches": {"en": "Watches", "ar": "ساعات"}, + "Parking": {"en": "Parking", "ar": "موقف سيارات"}, + "Details": {"en": "Details", "ar": "تفاصيل"}, + "Virtual": {"en": "Virtual", "ar": "افتراضية"}, + "News": {"en": "News", "ar": "أخبار"}, + "Latest": {"en": "Latest", "ar": "أحدث"}, + "Tour": {"en": "Tour", "ar": "رحلة"}, + "mostViewed": {"en": "Most Viewed", "ar": "الأكثر مشاهدة"}, + "newProducts": {"en": "New Products", "ar": "منتجات جديدة"}, + "paymentSelected": {"en": "Selected", "ar": "المحدد"}, }; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart new file mode 100644 index 00000000..341d9e52 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart @@ -0,0 +1,345 @@ +class GetCMCAllOrdersResponseModel { + int iD; + int patientId; + int patientOutSa; + bool isOutPatient; + int projectId; + int nearestProjectId; + dynamic longitude; + dynamic latitude; + dynamic appointmentNo; + dynamic dischargeId; + int statusId; + int serviceId; + int channel; + Orderpayment orderpayment; + dynamic orderselectedservice; + dynamic wforder; + dynamic orderapprovalobj; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + String statusText; + int paymentStatus; + dynamic clientRequestid; + dynamic paymentStatusText; + String projectName; + String nearestProjectName; + dynamic paymentAmount; + WFOrder wFOrder; + String serviceText; + bool isSentForApproval; + int exaCartOrderId; + bool isTimer; + int timeSeconds; + int totalPendingSeconds; + int timeMinute; + int timeHour; + int timeTotalSeconds; + int timeTotalMinute; + int timeTotalHour; + dynamic approvalStatus; + bool isActive; + int clickButton; + List procedures; + dynamic pickupLocation; + dynamic dropOffLocation; + dynamic clinicName; + dynamic doctorName; + dynamic branch; + dynamic time; + dynamic notes; + + GetCMCAllOrdersResponseModel( + {this.iD, + this.patientId, + this.patientOutSa, + this.isOutPatient, + this.projectId, + this.nearestProjectId, + this.longitude, + this.latitude, + this.appointmentNo, + this.dischargeId, + this.statusId, + this.serviceId, + this.channel, + this.orderpayment, + this.orderselectedservice, + this.wforder, + this.orderapprovalobj, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted, + this.statusText, + this.paymentStatus, + this.clientRequestid, + this.paymentStatusText, + this.projectName, + this.nearestProjectName, + this.paymentAmount, + this.wFOrder, + this.serviceText, + this.isSentForApproval, + this.exaCartOrderId, + this.isTimer, + this.timeSeconds, + this.totalPendingSeconds, + this.timeMinute, + this.timeHour, + this.timeTotalSeconds, + this.timeTotalMinute, + this.timeTotalHour, + this.approvalStatus, + this.isActive, + this.clickButton, + this.procedures, + this.pickupLocation, + this.dropOffLocation, + this.clinicName, + this.doctorName, + this.branch, + this.time, + this.notes}); + + GetCMCAllOrdersResponseModel.fromJson(Map json) { + iD = json['ID']; + patientId = json['PatientId']; + patientOutSa = json['PatientOutSa']; + isOutPatient = json['IsOutPatient']; + projectId = json['ProjectId']; + nearestProjectId = json['NearestProjectId']; + longitude = json['Longitude']; + latitude = json['Latitude']; + appointmentNo = json['AppointmentNo']; + dischargeId = json['DischargeId']; + statusId = json['StatusId']; + serviceId = json['ServiceId']; + channel = json['Channel']; + orderpayment = json['orderpayment'] != null + ? new Orderpayment.fromJson(json['orderpayment']) + : null; + orderselectedservice = json['orderselectedservice']; + wforder = json['wforder']; + orderapprovalobj = json['orderapprovalobj']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + statusText = json['StatusText']; + paymentStatus = json['PaymentStatus']; + clientRequestid = json['ClientRequestid']; + paymentStatusText = json['PaymentStatusText']; + projectName = json['ProjectName']; + nearestProjectName = json['NearestProjectName']; + paymentAmount = json['PaymentAmount']; + wFOrder = json['WF_order'] != null + ? new WFOrder.fromJson(json['WF_order']) + : null; + serviceText = json['ServiceText']; + isSentForApproval = json['isSentForApproval']; + exaCartOrderId = json['ExaCart_OrderId']; + isTimer = json['isTimer']; + timeSeconds = json['TimeSeconds']; + totalPendingSeconds = json['TotalPendingSeconds']; + timeMinute = json['TimeMinute']; + timeHour = json['TimeHour']; + timeTotalSeconds = json['TimeTotalSeconds']; + timeTotalMinute = json['TimeTotalMinute']; + timeTotalHour = json['TimeTotalHour']; + approvalStatus = json['ApprovalStatus']; + isActive = json['isActive']; + clickButton = json['ClickButton']; + pickupLocation = json['PickupLocation']; + dropOffLocation = json['DropOffLocation']; + clinicName = json['clinicName']; + doctorName = json['DoctorName']; + branch = json['Branch']; + time = json['Time']; + notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientId'] = this.patientId; + data['PatientOutSa'] = this.patientOutSa; + data['IsOutPatient'] = this.isOutPatient; + data['ProjectId'] = this.projectId; + data['NearestProjectId'] = this.nearestProjectId; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['AppointmentNo'] = this.appointmentNo; + data['DischargeId'] = this.dischargeId; + data['StatusId'] = this.statusId; + data['ServiceId'] = this.serviceId; + data['Channel'] = this.channel; + if (this.orderpayment != null) { + data['orderpayment'] = this.orderpayment.toJson(); + } + data['orderselectedservice'] = this.orderselectedservice; + + data['wforder'] = this.wforder; + data['orderapprovalobj'] = this.orderapprovalobj; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + data['StatusText'] = this.statusText; + data['PaymentStatus'] = this.paymentStatus; + data['ClientRequestid'] = this.clientRequestid; + data['PaymentStatusText'] = this.paymentStatusText; + data['ProjectName'] = this.projectName; + data['NearestProjectName'] = this.nearestProjectName; + data['PaymentAmount'] = this.paymentAmount; + if (this.wFOrder != null) { + data['WF_order'] = this.wFOrder.toJson(); + } + data['ServiceText'] = this.serviceText; + data['isSentForApproval'] = this.isSentForApproval; + data['ExaCart_OrderId'] = this.exaCartOrderId; + data['isTimer'] = this.isTimer; + data['TimeSeconds'] = this.timeSeconds; + data['TotalPendingSeconds'] = this.totalPendingSeconds; + data['TimeMinute'] = this.timeMinute; + data['TimeHour'] = this.timeHour; + data['TimeTotalSeconds'] = this.timeTotalSeconds; + data['TimeTotalMinute'] = this.timeTotalMinute; + data['TimeTotalHour'] = this.timeTotalHour; + data['ApprovalStatus'] = this.approvalStatus; + data['isActive'] = this.isActive; + data['ClickButton'] = this.clickButton; + data['PickupLocation'] = this.pickupLocation; + data['DropOffLocation'] = this.dropOffLocation; + data['clinicName'] = this.clinicName; + data['DoctorName'] = this.doctorName; + data['Branch'] = this.branch; + data['Time'] = this.time; + data['Notes'] = this.notes; + return data; + } +} + +class Orderpayment { + int iD; + int orderId; + dynamic clientRequestId; + dynamic totalAmount; + int paymentStatus; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + + Orderpayment( + {this.iD, + this.orderId, + this.clientRequestId, + this.totalAmount, + this.paymentStatus, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); + + Orderpayment.fromJson(Map json) { + iD = json['ID']; + orderId = json['OrderId']; + clientRequestId = json['ClientRequestId']; + totalAmount = json['TotalAmount']; + paymentStatus = json['PaymentStatus']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['ClientRequestId'] = this.clientRequestId; + data['TotalAmount'] = this.totalAmount; + data['PaymentStatus'] = this.paymentStatus; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + return data; + } +} + +class WFOrder { + dynamic wfButtonsDTO; + int iD; + int orderId; + int previousStep; + int nextStep; + int serviceId; + dynamic order; + String created; + dynamic createdBy; + dynamic modified; + dynamic modifiedBy; + bool isDeleted; + + WFOrder( + {this.wfButtonsDTO, + this.iD, + this.orderId, + this.previousStep, + this.nextStep, + this.serviceId, + this.order, + this.created, + this.createdBy, + this.modified, + this.modifiedBy, + this.isDeleted}); + + WFOrder.fromJson(Map json) { + wfButtonsDTO = json['wf_ButtonsDTO']; + iD = json['ID']; + orderId = json['OrderId']; + previousStep = json['PreviousStep']; + nextStep = json['NextStep']; + serviceId = json['ServiceId']; + order = json['Order']; + created = json['Created']; + createdBy = json['CreatedBy']; + modified = json['Modified']; + modifiedBy = json['ModifiedBy']; + isDeleted = json['IsDeleted']; + } + + Map toJson() { + final Map data = new Map(); + data['wf_ButtonsDTO'] = this.wfButtonsDTO; + data['ID'] = this.iD; + data['OrderId'] = this.orderId; + data['PreviousStep'] = this.previousStep; + data['NextStep'] = this.nextStep; + data['ServiceId'] = this.serviceId; + data['Order'] = this.order; + data['Created'] = this.created; + data['CreatedBy'] = this.createdBy; + data['Modified'] = this.modified; + data['ModifiedBy'] = this.modifiedBy; + data['IsDeleted'] = this.isDeleted; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart index 8cece1f5..7c621f35 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart @@ -73,12 +73,10 @@ class CMCInsertPresOrderRequestModel { data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; - data['patientOutSa'] = this.patientOutSA; data['isOutPatient'] = this.patientOutSA == 0 ? false : true; data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; - data['patientId'] = this.patientID.toString(); data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; diff --git a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart index 42d2fb99..335366cd 100644 --- a/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart @@ -1,5 +1,5 @@ class GetCMCServicesResponseModel { - int id; + int iD; String serviceID; int orderServiceID; String text; @@ -12,7 +12,7 @@ class GetCMCServicesResponseModel { int quantity; GetCMCServicesResponseModel( - {this.id, + {this.iD, this.serviceID, this.orderServiceID, this.text, @@ -25,32 +25,32 @@ class GetCMCServicesResponseModel { this.quantity}); GetCMCServicesResponseModel.fromJson(Map json) { - id = json['id']; - serviceID = json['serviceID']; - orderServiceID = json['orderServiceID']; - text = json['text']; - textN = json['textN']; - price = json['price']; - priceVAT = json['priceVAT']; - priceTotal = json['priceTotal']; - isEnabled = json['isEnabled']; - orderId = json['orderId']; - quantity = json['quantity']; + iD = json['ID']; + serviceID = json['ServiceID']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); - data['id'] = this.id; - data['serviceID'] = this.serviceID; - data['orderServiceID'] = this.orderServiceID; - data['text'] = this.text; - data['textN'] = this.textN; - data['price'] = this.price; - data['priceVAT'] = this.priceVAT; - data['priceTotal'] = this.priceTotal; - data['isEnabled'] = this.isEnabled; - data['orderId'] = this.orderId; - data['quantity'] = this.quantity; + data['ID'] = this.iD; + data['ServiceID'] = this.serviceID; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart index e2f39733..bc5c4b97 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart @@ -1,32 +1,56 @@ class HHCGetAllServicesResponseModel { int iD; - int serviceID; - String description; - String descriptionN; - bool isActive; + String serviceID; + int orderServiceID; + String text; + String textN; + dynamic price; + dynamic priceVAT; + dynamic priceTotal; + bool isEnabled; + int orderId; + int quantity; HHCGetAllServicesResponseModel( {this.iD, this.serviceID, - this.description, - this.descriptionN, - this.isActive}); + this.orderServiceID, + this.text, + this.textN, + this.price, + this.priceVAT, + this.priceTotal, + this.isEnabled, + this.orderId, + this.quantity}); HHCGetAllServicesResponseModel.fromJson(Map json) { iD = json['ID']; serviceID = json['ServiceID']; - description = json['Description']; - descriptionN = json['DescriptionN']; - isActive = json['IsActive']; + orderServiceID = json['OrderServiceID']; + text = json['Text']; + textN = json['TextN']; + price = json['Price']; + priceVAT = json['PriceVAT']; + priceTotal = json['PriceTotal']; + isEnabled = json['IsEnabled']; + orderId = json['OrderId']; + quantity = json['Quantity']; } Map toJson() { final Map data = new Map(); data['ID'] = this.iD; data['ServiceID'] = this.serviceID; - data['Description'] = this.description; - data['DescriptionN'] = this.descriptionN; - data['IsActive'] = this.isActive; + data['OrderServiceID'] = this.orderServiceID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['Price'] = this.price; + data['PriceVAT'] = this.priceVAT; + data['PriceTotal'] = this.priceTotal; + data['IsEnabled'] = this.isEnabled; + data['OrderId'] = this.orderId; + data['Quantity'] = this.quantity; return data; } } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart index bc5a4ddf..0fe85c6a 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart @@ -16,7 +16,7 @@ class PatientERHHCInsertServicesList { Map toJson() { final Map data = new Map(); data['RecordID'] = this.recordID; - data['ServiceID'] = this.serviceID; + data['ServiceID'] = this.serviceID.toString(); data['ServiceName'] = this.serviceName; return data; } diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart index 6987ee44..bc57a88f 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/patient_er_insert_pres_order_request_model.dart @@ -76,7 +76,8 @@ class PatientERInsertPresOrderRequestModel { data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; - data['PatientOutSA'] = this.patientOutSA; + data['isOutPatient'] = this.patientOutSA == 0 ? false : true; + // data['PatientOutSA'] = this.patientOutSA; data['SessionID'] = this.sessionID; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['DeviceTypeID'] = this.deviceTypeID; @@ -84,12 +85,12 @@ class PatientERInsertPresOrderRequestModel { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['Latitude'] = this.latitude; - data['Longitude'] = this.longitude; - data['CreatedBy'] = this.createdBy; + data['latitude'] = this.latitude; + data['longitude'] = this.longitude; + // data['CreatedBy'] = this.createdBy; data['OrderServiceID'] = this.orderServiceID; if (this.patientERHHCInsertServicesList != null) { - data['PatientER_HHC_InsertServicesList'] = + data['procedures'] = this.patientERHHCInsertServicesList.map((v) => v.toJson()).toList(); } return data; diff --git a/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart b/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart index 3b0ef151..68be644d 100644 --- a/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart +++ b/lib/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart @@ -71,7 +71,8 @@ class UpdatePresOrderRequestModel { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; - data['PresOrderID'] = this.presOrderID; + data['Id'] = this.presOrderID; + data['ClickButton'] = 14; data['PresOrderStatus'] = this.presOrderStatus; data['EditedBy'] = this.editedBy; data['RejectionReason'] = this.rejectionReason; diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index f69d035b..dbef5737 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -108,10 +108,10 @@ class PharmacyProduct { List manufacturerIds; List reviews; List images; - List attributes; + List attributes; List specifications; - List associatedProductIds; - List tags; + List associatedProductIds; + List tags; int vendorId; String seName; @@ -367,7 +367,7 @@ class PharmacyProduct { }); } if (json['attributes'] != null) { - attributes = new List(); + attributes = new List(); json['attributes'].forEach((v) { attributes.add(v); }); diff --git a/lib/core/model/pharmacies/ShoppingCartResponse.dart b/lib/core/model/pharmacies/ShoppingCartResponse.dart index 96b751ae..332f63b6 100644 --- a/lib/core/model/pharmacies/ShoppingCartResponse.dart +++ b/lib/core/model/pharmacies/ShoppingCartResponse.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; import 'package:flutter/material.dart'; -class ShoppingCartResponse with ChangeNotifier { +class ShoppingCartResponse { int itemCount; int quantityCount; double subtotal; @@ -11,17 +11,15 @@ class ShoppingCartResponse with ChangeNotifier { List shoppingCarts; ShoppingCartResponse( - {this.itemCount, - this.quantityCount, - this.subtotal, - this.subtotalWithVat, - this.subtotalVatAmount, - this.subtotalVatRate, + {this.itemCount =0, + this.quantityCount =0, + this.subtotal=0.0, + this.subtotalWithVat = 0.0, + this.subtotalVatAmount = 0.0, + this.subtotalVatRate = 0.0 , this.shoppingCarts}); - void updateShoppingCard() { - notifyListeners(); - } + ShoppingCartResponse.fromJson(Map json) { itemCount = json['item_count']; diff --git a/lib/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart index dd9e0e54..5d91c829 100644 --- a/lib/core/model/pharmacies/payment-checkout-data.dart +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'ShippingOption.dart'; -class PaymentCheckoutData with ChangeNotifier{ +class PaymentCheckoutData { Addresses address; PaymentOption paymentOption; LacumAccountInformation lacumInformation; @@ -15,7 +15,5 @@ class PaymentCheckoutData with ChangeNotifier{ PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); - void updateData() { - notifyListeners(); - } + } diff --git a/lib/core/service/AlHabibMedicalService/cmc_service.dart b/lib/core/service/AlHabibMedicalService/cmc_service.dart index b79b6fdb..7fc23cc9 100644 --- a/lib/core/service/AlHabibMedicalService/cmc_service.dart +++ b/lib/core/service/AlHabibMedicalService/cmc_service.dart @@ -1,12 +1,12 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/get_cmc_service_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; @@ -15,7 +15,7 @@ import '../base_service.dart'; class CMCService extends BaseService { List cmcAllServicesList = List(); - List cmcAllPresOrdersList = List(); + List cmcAllPresOrdersList = List(); List cmcAllOrderDetail = List(); List checkupItemsList = List(); @@ -30,7 +30,7 @@ class CMCService extends BaseService { // RC IMPLEMENTATION await baseAppClient.post(GET_ALL_CMC_SERVICES_RC + "?patientID=" + user.patientID.toString(), isAllowAny: true, onSuccess: (dynamic response, int statusCode) { cmcAllServicesList.clear(); - response.forEach((data) { + response['response'].forEach((data) { cmcAllServicesList.add(GetCMCServicesResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { @@ -55,8 +55,8 @@ class CMCService extends BaseService { await baseAppClient.post(GET_PATIENT_ALL_PRES_ORDERS, onSuccess: (dynamic response, int statusCode) { cmcAllPresOrdersList.clear(); cmcAllOrderDetail.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + response['response'].forEach((data) { + if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); }); }, onFailure: (String error, int statusCode) { hasError = true; @@ -64,6 +64,26 @@ class CMCService extends BaseService { }, body: getHHCAllPresOrdersRequestModel.toJson()); } + Future getCmcAllPresOrdersRC() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); + hasError = false; + await baseAppClient.post(GET_ALL_CMC_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + cmcAllPresOrdersList.clear(); + cmcAllOrderDetail.clear(); + + response['response'].forEach((data) { + cmcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); + }); + + // response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + // if (data['ServiceID'] == OrderService.Comprehensive_Medical_Checkup.getIdOrderService()) cmcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + // }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); + } + Future getOrderDetailByOrderID(GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel) async { hasError = false; await baseAppClient.post(GET_CMC_ORDER_DETAIL_BY_ID, onSuccess: (dynamic response, int statusCode) { @@ -100,12 +120,22 @@ class CMCService extends BaseService { }, body: updatePresOrderRequestModel.toJson()); } + Future updateCmcPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + hasError = false; + await baseAppClient.post(UPDATE_CMC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); + } + Future insertCMCOrderRC({CMCInsertPresOrderRequestModel order}) async { hasError = false; String reqId = ""; await baseAppClient.post(ADD_CMC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { isOrderUpdated = true; - reqId = response['RequestNo'].toString(); + reqId = response['response'].toString(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index 5c0b13f4..00d44f6a 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hHC_all_pres_orders_request_model.dart'; @@ -13,7 +14,7 @@ import '../base_service.dart'; class HomeHealthCareService extends BaseService { List hhcAllServicesList = List(); - List hhcAllPresOrdersList = List(); + List hhcAllPresOrdersList = List(); List hhcAllOrderDetail = List(); List addressesList = List(); @@ -21,6 +22,7 @@ class HomeHealthCareService extends BaseService { bool isOrderUpdated; CustomerInfo customerInfo; int requestNo; + Future getHHCAllServices(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { hasError = false; await baseAppClient.post(HHC_GET_ALL_SERVICES, onSuccess: (dynamic response, int statusCode) { @@ -34,14 +36,42 @@ class HomeHealthCareService extends BaseService { }, body: hHCGetAllServicesRequestModel.toJson()); } + Future getHHCAllServicesRC(HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel) async { + hasError = false; + await baseAppClient.post(HHC_GET_ALL_SERVICES_RC + "?PatientID=" + user.patientID.toString(), onSuccess: (dynamic response, int statusCode) { + hhcAllServicesList.clear(); + response['response'].forEach((data) { + hhcAllServicesList.add(HHCGetAllServicesResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: hHCGetAllServicesRequestModel.toJson()); + } + + Future getHHCAllPresOrdersRC() async { + GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); + hasError = false; + await baseAppClient.post(GET_ALL_HHC_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + hhcAllPresOrdersList.clear(); + hhcAllOrderDetail.clear(); + response['response'].forEach((data) { + hhcAllPresOrdersList.add(GetCMCAllOrdersResponseModel.fromJson(data)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getHHCAllPresOrdersRequestModel.toJson()); + } + Future getHHCAllPresOrders() async { GetHHCAllPresOrdersRequestModel getHHCAllPresOrdersRequestModel = GetHHCAllPresOrdersRequestModel(); hasError = false; await baseAppClient.post(GET_PATIENT_ALL_PRES_ORD, onSuccess: (dynamic response, int statusCode) { hhcAllPresOrdersList.clear(); - response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { - if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); - }); + // response['PatientER_GetPatientAllPresOrdersList'].forEach((data) { + // if (data['ServiceID'] == OrderService.HOME_HEALTH_CARE.getIdOrderService()) hhcAllPresOrdersList.add(GetHHCAllPresOrdersResponseModel.fromJson(data)); + // }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -84,4 +114,15 @@ class HomeHealthCareService extends BaseService { super.error = error; }, body: order.toJson()); } + + Future insertHHCOrderRC({PatientERInsertPresOrderRequestModel order}) async { + hasError = false; + await baseAppClient.post(ADD_HHC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + hhcResponse = response; + requestNo = response["response"]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: order.toJson()); + } } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index ac96e35e..0dd5c750 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -29,7 +29,8 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = locator(); +AuthenticatedUserObject authenticatedUserObject = + locator(); VitalSignService _vitalSignService = locator(); class BaseAppClient { @@ -113,18 +114,8 @@ class BaseAppClient { } } - // For RC Services - // if(body.containsKey("patientId")) - // body.remove("PatientID"); - // - // if(body.containsKey("patientOutSa")) - // body.remove("PatientOutSA"); - // // body['PatientID'] = 1018977; // body['TokenID'] = "@dm!n"; - // body['IdentificationNo'] = "1009199553"; - // body['MobileNo'] = "966545156035"; - // body['PatientMobileNumber'] = "966545156035"; print("URL : $url"); final jsonBody = json.encode(body); @@ -162,12 +153,12 @@ class BaseAppClient { } else if (parsed['Result'] == 'OK') { onSuccess(parsed, statusCode); } else { - if (parsed != null) { - onSuccess(parsed, statusCode); - } else { + // if (parsed != null) { + // onSuccess(parsed, statusCode); + // } else { onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); - logout(); - } + // logout(); + // } } } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); @@ -445,13 +436,14 @@ class BaseAppClient { 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", + 'Host': "mdlaboratories.com", }); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode == 401) { - AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).pharmacyRelogin); + onFailure(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode); Navigator.of(AppGlobal.context).pushNamed(HOME); } else { onFailure('Error While Fetching data', statusCode); @@ -706,7 +698,8 @@ class BaseAppClient { final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { - onFailure('Error While Fetching data', statusCode); + var parsed = json.decode(utf8.decode(response.bodyBytes)); + onFailure(parsed['error']['ErrorEndUserMsg'] ??'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 37c0c7be..67ebc641 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -83,9 +83,24 @@ class FeedbackService extends BaseService { Future searchFeedback(String countryCode, String phoneNumber, int type, String idNumber) async { hasError = false; Map body = new Map(); - body['IdentificationNo'] = idNumber; + if (type == 1) { + body['IdentificationNo'] = 0; + body['PatientID'] = num.tryParse(idNumber); + body['ItemID'] = 0; + } else if (type == 2) { + body['IdentificationNo'] = idNumber; + body['PatientID'] = 0; + body['ItemID'] = 0; + } else { + body['IdentificationNo'] = 0; + body['PatientID'] = 0; + body['ItemID'] = idNumber; + } + + body['PatientOutSA'] = countryCode.contains("966") ? 0 : 1; + body['MobileNo'] = countryCode + Utils.getPhoneNumberWithoutZero(phoneNumber); - body['Searching_type'] = "$type"; + body['Searching_type'] = type; if (BASE_URL.contains('uat')) { body['ForDemo'] = true; } diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 0ada84e7..0364d64f 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -62,6 +62,8 @@ class OrderPreviewService extends BaseService { Future getShoppingCart() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId == null) return null; + Map queryParams = {'shopping_cart_type': '1'}; dynamic localRes; hasError = false; @@ -94,8 +96,8 @@ class OrderPreviewService extends BaseService { Map body = Map(); body["shopping_cart_item"] = choppingCartObject; - await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", isExternal: false, - onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost("$GET_SHOPPING_CART$productId", + isExternal: false, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -112,8 +114,8 @@ class OrderPreviewService extends BaseService { Map body = Map(); - await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", isExternal: false, - onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost("$DELETE_SHOPPING_CART$productId", + isExternal: false, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -225,8 +227,9 @@ class OrderPreviewService extends BaseService { body['order'] = orderBody; try { - await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, isExternal: false, isAllowAny: true, - onSuccess: (response, statusCode) async { + await baseAppClient.pharmacyPost(ORDER_SHOPPING_CART, + isExternal: false, + isAllowAny: true, onSuccess: (response, statusCode) async { orderList.clear(); response['orders'].forEach((item) { orderList.add(OrderDetailModel.fromJson(item)); @@ -263,24 +266,22 @@ class OrderPreviewService extends BaseService { } } - Future getDriverLocation(dynamic driverId) async{ + Future getDriverLocation(dynamic driverId) async { Map jsonBody = Map(); jsonBody['DriverID'] = driverId; LatLng coordinates; await baseAppClient.post(DRIVER_LOCATION, onSuccess: (response, statusCode) async { - if(statusCode == 200){ - dynamic locationObject = response['PatientER_GetDriverLocationList'][0]; - double lat = locationObject['Latitude']; - double lon = locationObject['Longitude']; - if(lat != null && lon != null){ - coordinates = LatLng(lat,lon); - } - } - }, onFailure: (String error, int statusCode) { - - }, body: jsonBody); + if (statusCode == 200) { + dynamic locationObject = response['PatientER_GetDriverLocationList'][0]; + double lat = locationObject['Latitude']; + double lon = locationObject['Longitude']; + if (lat != null && lon != null) { + coordinates = LatLng(lat, lon); + } + } + }, onFailure: (String error, int statusCode) {}, body: jsonBody); return coordinates; } diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 58ce50f5..6969deac 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -108,17 +108,18 @@ class PharmacyModuleService extends BaseService { } Future getTopManufacturerList() async { - hasError = false; + if (manufacturerList.isNotEmpty) return; Map queryParams = {'page': '1', 'limit': '8'}; try { await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { Manufacturer manufacturer = Manufacturer.fromJson(item); - if (manufacturer.image != null) { - manufacturerList.add(Manufacturer.fromJson(item)); - } + // if (manufacturer.image != null) { + manufacturerList.add(Manufacturer.fromJson(item)); + // } }); + hasError = false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -129,6 +130,8 @@ class PharmacyModuleService extends BaseService { } Future getBestSellerProducts() async { + if (bestSellerProducts.isNotEmpty) return; + Map queryParams = { 'fields': 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', @@ -139,6 +142,7 @@ class PharmacyModuleService extends BaseService { response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); }); + hasError = false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -150,16 +154,21 @@ class PharmacyModuleService extends BaseService { Future getLastVisitedProducts() async { String lastVisited = ""; - if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { - lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != + null) { + lastVisited = + await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + // lastVisited = "2458,4561"; try { await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { lastVisitedProducts.clear(); response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); }); + hasError = false; }, onFailure: (String error, int statusCode) { - hasError = true; + hasError = + true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); super.error = error; }); } catch (error) { diff --git a/lib/core/service/parmacyModule/prescription_service.dart b/lib/core/service/parmacyModule/prescription_service.dart index 37a50c33..9011496c 100644 --- a/lib/core/service/parmacyModule/prescription_service.dart +++ b/lib/core/service/parmacyModule/prescription_service.dart @@ -1,42 +1,23 @@ import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; class PrescriptionService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); 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; - await baseAppClient.post(url, + await baseAppClient.post(PRESCRIPTION, onSuccess: (dynamic response, int statusCode) { _prescriptionsList.clear(); response['PatientPrescriptionList'].forEach((prescriptions) { diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index a68a900f..023d0859 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -90,8 +90,9 @@ class PharmacyCategoriseService extends BaseService { Future searchProducts({String productName}) async { hasError = false; _searchList.clear(); - String endPoint = - productName != null ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' : GET_SEARCH_PRODUCTS + ""; + String endPoint = productName != null + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + : GET_SEARCH_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -126,7 +127,8 @@ class PharmacyCategoriseService extends BaseService { Future getCategoriseParent({String id}) async { hasError = false; _parentCategoriseList.clear(); - String endPoint = id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + ""; + String endPoint = + id != null ? GET_CATEGORISE_PARENT + "$id" : GET_CATEGORISE_PARENT + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -144,7 +146,9 @@ class PharmacyCategoriseService extends BaseService { Future getParentProducts({String id}) async { hasError = false; _parentProductsList.clear(); - String endPoint = id != null ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' : GET_PARENT_PRODUCTS + ""; + String endPoint = id != null + ? GET_PARENT_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_PARENT_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -163,7 +167,8 @@ class PharmacyCategoriseService extends BaseService { hasError = false; _subCategoriseList.clear(); - String endPoint = id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + ""; + String endPoint = + id != null ? GET_SUB_CATEGORISE + "$id" : GET_SUB_CATEGORISE + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -181,7 +186,9 @@ class PharmacyCategoriseService extends BaseService { Future getSubProducts({String id}) async { hasError = false; _subProductsList.clear(); - String endPoint = id != null ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' : GET_SUB_PRODUCTS + ""; + String endPoint = id != null + ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' + : GET_SUB_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -199,7 +206,8 @@ class PharmacyCategoriseService extends BaseService { Future getFinalProducts({String id}) async { hasError = false; _finalProducts.clear(); - String endPoint = id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + ""; + String endPoint = + id != null ? GET_FINAL_PRODUCTS + "$id" : GET_FINAL_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -236,11 +244,15 @@ class PharmacyCategoriseService extends BaseService { Future getLastVisitedProducts() async { String lastVisited = ""; - if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { - lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + _finalProducts.clear(); + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != + null) { + lastVisited = + await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); try { - await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient + .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", + onSuccess: (dynamic response, int statusCode) { _finalProducts.clear(); response['products'].forEach((item) { _finalProducts.add(PharmacyProduct.fromJson(item)); @@ -261,7 +273,8 @@ class PharmacyCategoriseService extends BaseService { 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', }; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, + onSuccess: (dynamic response, int statusCode) { _finalProducts.clear(); response['products'].forEach((item) { _finalProducts.add(PharmacyProduct.fromJson(item)); @@ -275,7 +288,8 @@ class PharmacyCategoriseService extends BaseService { } } - Future getFilteredProducts({String categoryId, String brandId, String min, String max}) async { + Future getFilteredProducts( + {String categoryId, String brandId, String min, String max}) async { hasError = false; String endPoint; @@ -299,7 +313,8 @@ class PharmacyCategoriseService extends BaseService { ); } - Future getFilteredSubProducts({String categoryId, String brandId, String min, String max}) async { + Future getFilteredSubProducts( + {String categoryId, String brandId, String min, String max}) async { hasError = false; String endPoint; @@ -324,12 +339,14 @@ class PharmacyCategoriseService extends BaseService { } Future getMostViewedProducts() async { + hasError = false; Map queryParams = { 'fields': - 'id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage', + 'mostview?fields=id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage', }; try { - await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, + onSuccess: (dynamic response, int statusCode) { _finalProducts.clear(); response['products'].forEach((item) { _finalProducts.add(PharmacyProduct.fromJson(item)); @@ -341,16 +358,20 @@ class PharmacyCategoriseService extends BaseService { super.error = error; }, queryParams: queryParams); } catch (error) { - throw error; + hasError = true; + super.error = error.toString(); + // throw error; } } Future getNewProducts() async { Map queryParams = { - 'fields': 'Id,name,namen,localized_names,price,images,sku,stock_availability,published', + 'fields': + 'Id,name,namen,localized_names,price,images,sku,stock_availability,published', }; try { - await baseAppClient.getPharmacy(GET_NEW_PRODUCTS, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_NEW_PRODUCTS, + onSuccess: (dynamic response, int statusCode) { _finalProducts.clear(); response['products'].forEach((item) { _finalProducts.add(PharmacyProduct.fromJson(item)); diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index 8080ddec..10edbeb8 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; @@ -24,7 +25,7 @@ class CMCViewModel extends BaseViewModel { List get cmcAllServicesList => _cMCService.cmcAllServicesList; - List get cmcAllPresOrders => _cMCService.cmcAllPresOrdersList; + List get cmcAllPresOrders => _cMCService.cmcAllPresOrdersList; List get cmcAllOrderDetail => _cMCService.cmcAllOrderDetail; @@ -32,7 +33,7 @@ class CMCViewModel extends BaseViewModel { PharmacyModuleService _pharmacyModuleService = locator(); - GetHHCAllPresOrdersResponseModel pendingOrder; + GetCMCAllOrdersResponseModel pendingOrder; bool get isOrderUpdated => _cMCService.isOrderUpdated; @@ -58,14 +59,15 @@ class CMCViewModel extends BaseViewModel { Future getCmcAllPresOrders() async { setState(ViewState.Busy); - await _cMCService.getCmcAllPresOrders(); + // await _cMCService.getCmcAllPresOrders(); + await _cMCService.getCmcAllPresOrdersRC(); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.Error); } else { - pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); + pendingOrder = _cMCService.cmcAllPresOrdersList.firstWhere((element) => element.statusId == 1 || element.statusId == 2, orElse: () => null); if (pendingOrder != null) { - await getOrderDetailByOrderID(pendingOrder); + // await getOrderDetailByOrderID(pendingOrder); setState(ViewState.Idle); } else { getCMCAllServices(); @@ -75,7 +77,8 @@ class CMCViewModel extends BaseViewModel { Future updateCmcPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.BusyLocal); - await _cMCService.updateCmcPresOrder(updatePresOrderRequestModel); + // await _cMCService.updateCmcPresOrder(updatePresOrderRequestModel); + await _cMCService.updateCmcPresOrderRC(updatePresOrderRequestModel); if (_cMCService.hasError) { error = _cMCService.error; setState(ViewState.ErrorLocal); @@ -84,7 +87,7 @@ class CMCViewModel extends BaseViewModel { } } - Future getOrderDetailByOrderID(GetHHCAllPresOrdersResponseModel order) async { + Future getOrderDetailByOrderID(GetCMCAllOrdersResponseModel order) async { GetOrderDetailByOrderIDRequestModel getOrderDetailByOrderIDRequestModel = GetOrderDetailByOrderIDRequestModel(presOrderID: order.iD); await _cMCService.getOrderDetailByOrderID(getOrderDetailByOrderIDRequestModel); } diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 91465b11..d27827e4 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/enum/OrderService.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_request_modle.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/HHC_get_all_services_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/PatientERHHCInsertServicesList.dart'; @@ -24,7 +25,7 @@ class HomeHealthCareViewModel extends BaseViewModel { List get addressesList => _customerAddressesService.addressesList; - List get hhcAllPresOrders => _homeHealthCareService.hhcAllPresOrdersList; + List get hhcAllPresOrders => _homeHealthCareService.hhcAllPresOrdersList; List get hhcAllOrderDetail => _homeHealthCareService.hhcAllOrderDetail; @@ -33,14 +34,15 @@ class HomeHealthCareViewModel extends BaseViewModel { bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; int get orderId => _homeHealthCareService.requestNo; - GetHHCAllPresOrdersResponseModel pendingOrder; + GetCMCAllOrdersResponseModel pendingOrder; List patientERHHCInsertServicesList = List(); dynamic get hhcResponse => _homeHealthCareService.hhcResponse; + Future getHHCAllServices() async { HHCGetAllServicesRequestModel hHCGetAllServicesRequestModel = new HHCGetAllServicesRequestModel(); - //setState(ViewState.Busy); - await _homeHealthCareService.getHHCAllServices(hHCGetAllServicesRequestModel); + // await _homeHealthCareService.getHHCAllServices(hHCGetAllServicesRequestModel); + await _homeHealthCareService.getHHCAllServicesRC(hHCGetAllServicesRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); @@ -52,14 +54,14 @@ class HomeHealthCareViewModel extends BaseViewModel { Future getHHCAllPresOrders() async { pendingOrder = null; setState(ViewState.Busy); - await _homeHealthCareService.getHHCAllPresOrders(); + await _homeHealthCareService.getHHCAllPresOrdersRC(); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.Error); } else { - pendingOrder = _homeHealthCareService.hhcAllPresOrdersList.firstWhere((element) => element.status == 1 || element.status == 2, orElse: () => null); + pendingOrder = _homeHealthCareService.hhcAllPresOrdersList.firstWhere((element) => element.statusId == 1 || element.statusId == 2, orElse: () => null); if (pendingOrder != null) { - await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); + // await _homeHealthCareService.getOrderDetailByOrderID(pendingOrder.iD); setState(ViewState.Idle); } else { getHHCAllServices(); @@ -82,7 +84,8 @@ class HomeHealthCareViewModel extends BaseViewModel { setState(ViewState.Busy); order.createdBy = user.patientID; order.orderServiceID = OrderService.HOME_HEALTH_CARE.getIdOrderService(); - await _homeHealthCareService.insertPresPresOrder(order: order); + // await _homeHealthCareService.insertPresPresOrder(order: order); + await _homeHealthCareService.insertHHCOrderRC(order: order); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.ErrorLocal); 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/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index 19179313..83732ebd 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -43,9 +43,7 @@ class RRTViewModel extends BaseViewModel { body['NationalityID'] = user.nationalityID; body['CreatedBy'] = user.patientIdentificationType; body['OrderServiceID'] = 5; - var localRes; - int requestNo; await _service.baseAppClient.post(PATIENT_ER_INSERT_PRES_ORDER, body: body, onSuccess: (response, statusCode) { requestNo = response['RequestNo']; @@ -55,6 +53,21 @@ class RRTViewModel extends BaseViewModel { return requestNo; } + Future createOrderRC(Map body) async { + // body['IdentificationNo'] = user.patientIdentificationNo; + // body['NationalityID'] = user.nationalityID; + // body['CreatedBy'] = user.patientIdentificationType; + // body['OrderServiceID'] = 5; + var localRes; + int requestNo; + await _service.baseAppClient.post(ADD_RRT_ORDER_RC, body: body, onSuccess: (response, statusCode) { + requestNo = response['response']; + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + }); + return requestNo; + } + // Service ID: 4 == RRT Future<_RRTServiceData> getAllOrders() async { await _service.baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, body: {}, onSuccess: (response, statusCode) { diff --git a/lib/core/viewModels/medical/blood_pressure_view_model.dart b/lib/core/viewModels/medical/blood_pressure_view_model.dart index 3d772095..548f4b62 100644 --- a/lib/core/viewModels/medical/blood_pressure_view_model.dart +++ b/lib/core/viewModels/medical/blood_pressure_view_model.dart @@ -39,9 +39,10 @@ class BloodPressureViewMode extends BaseViewModel { }); for (int index = 0; index < bloodPressureService.monthDiabtectResultAverageList.length; index++) { - weighMonthTimeSeriesDataTop.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); - - weighMonthTimeSeriesDataLow.add(TimeSeriesSales3(index, bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + // weighMonthTimeSeriesDataTop.add(TimeSeriesSales3("Week " + (index + 1).toString(), bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + // weighMonthTimeSeriesDataLow.add(TimeSeriesSales3("Week " + (index + 1).toString(), bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); + weighMonthTimeSeriesDataTop.add(TimeSeriesSales3(bloodPressureService.monthDiabtectResultAverageList[index].weekDesc, bloodPressureService.monthDiabtectResultAverageList[index].weekDiastolicPressureAverageResult.toDouble())); + weighMonthTimeSeriesDataLow.add(TimeSeriesSales3(bloodPressureService.monthDiabtectResultAverageList[index].weekDesc, bloodPressureService.monthDiabtectResultAverageList[index].weekSystolicePressureAverageResult.toDouble())); } bloodPressureService.yearDiabtecResultAverageList.forEach((element) { diff --git a/lib/core/viewModels/pharmacyModule/BestSellerViewModel.dart b/lib/core/viewModels/pharmacyModule/BestSellerViewModel.dart new file mode 100644 index 00000000..b03ee5b9 --- /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.BusyLocal); + 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..c1cdc8bc --- /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.BusyLocal); + 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..568e56f8 --- /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.BusyLocal); + 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/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index ae218369..f2f87712 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -16,12 +18,14 @@ class OrderPreviewViewModel extends BaseViewModel { OrderPreviewService _orderService = locator(); List get addresses => _orderService.addresses; + LacumAccountInformation get lacumInformation => _orderService.lacumInformation; + List get orderListModel => _orderService.orderList; PharmacyModuleViewModel pharmacyModuleViewModel = - locator(); + locator(); ShoppingCartResponse cartResponse = ShoppingCartResponse(); PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData(); @@ -38,23 +42,32 @@ class OrderPreviewViewModel extends BaseViewModel { } } + void update() { + notifyListeners(); + } + Future getShoppingCart() async { - setState(ViewState.Busy); + // setState(ViewState.Busy); + // GifLoaderDialogUtils.showMyDialog( + // locator().navigatorKey.currentContext); await _orderService.getShoppingCart().then((res) { - _handleGetShoppingCartResponse(res); + if (res != null) _handleGetShoppingCartResponse(res); }); if (_orderService.hasError) { error = _orderService.error; - setState(ViewState.Error); + // setState(ViewState.Error); } else { if (paymentCheckoutData != null) { paymentCheckoutData.cartDataVisible = true; } + // GifLoaderDialogUtils.hideDialog( + // locator().navigatorKey.currentContext); setState(ViewState.Idle); } } - Future changeProductQuantity(ShoppingCart product) async { + Future changeProductQuantity( + ShoppingCart product) async { setState(ViewState.Busy); var resp = await _orderService.changeProductQuantity(product.id, product); var object = _handleGetShoppingCartResponse(resp); @@ -110,9 +123,9 @@ class OrderPreviewViewModel extends BaseViewModel { res["shopping_carts"].forEach((item) { ShoppingCart shoppingCart = ShoppingCart.fromJson(item); cartResponse.shoppingCarts.add(shoppingCart); - totalAdditionalShippingCharge += shoppingCart.product.additionalShippingCharge; + totalAdditionalShippingCharge += + shoppingCart.product.additionalShippingCharge; }); - cartResponse.updateShoppingCard(); return cartResponse; } @@ -163,7 +176,8 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Busy); await _orderService.getLacumGroupInformation(); paymentCheckoutData.lacumInformation = _orderService.lacumGroupInformation; - paymentCheckoutData.usedLakumPoints = paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; + paymentCheckoutData.usedLakumPoints = paymentCheckoutData + .lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount; if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); @@ -174,9 +188,11 @@ class OrderPreviewViewModel extends BaseViewModel { getShippingOption() async { setState(ViewState.Busy); - await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { - paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); - paymentCheckoutData.updateData(); + await _orderService + .getShippingOption(paymentCheckoutData.address) + .then((res) { + paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); + setState(ViewState.Idle); }); if (_orderService.hasError) { error = _orderService.error; @@ -190,7 +206,8 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Busy); await pharmacyModuleViewModel.generatePharmacyToken(); - await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + await _orderService.makeOrder( + paymentCheckoutData, cartResponse.shoppingCarts); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.ErrorLocal); @@ -198,6 +215,17 @@ class OrderPreviewViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + bool isCartItemsOutOfStock() { + bool outOfStock = false; + for (int i = 0; i < cartResponse.shoppingCarts.length; i++) { + if (cartResponse.shoppingCarts[i].product.stockQuantity == 0) { + outOfStock = true; + break; + } + } + return outOfStock; + } } enum PaymentOption { meda, sadad, visa, mastercard, installments } diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart new file mode 100644 index 00000000..86a320e6 --- /dev/null +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -0,0 +1,28 @@ +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 { + await getSavedLanguage(); + if(prescriptionsList.isNotEmpty){ + setState(ViewState.Busy); + 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 5062a010..facccf1e 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -5,47 +5,42 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.d 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); @@ -53,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); @@ -75,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); @@ -87,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); } } @@ -107,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; @@ -164,31 +117,4 @@ class PharmacyModuleViewModel extends BaseViewModel { return false; } } - - getPrescription() async { - 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/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index 01695b10..828aa8e4 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; + import 'package:diplomaticquarterapp/services/pharmacy_services/product_detail_service.dart'; import '../../../locator.dart'; @@ -35,7 +38,7 @@ class ProductDetailViewModel extends BaseViewModel{ Future getProductLocationData() async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _productDetailService.getProductAvailabiltyDetail(); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -46,7 +49,7 @@ class ProductDetailViewModel extends BaseViewModel{ Future notifyMe(customerId, itemID) async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _productDetailService.notifyMe(customerId, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -57,7 +60,7 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToCartData(quantity, itemID) async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _productDetailService.addToCart(quantity, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; @@ -68,8 +71,13 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToWishlistData(itemID) async { hasError = false; - setState(ViewState.Busy); + setState(ViewState.BusyLocal); + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); await _productDetailService.addToWishlist(itemID); + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -89,10 +97,15 @@ class ProductDetailViewModel extends BaseViewModel{ } - Future deletWishlistData(itemID) async { + Future deleteWishlistData(itemID) async { hasError = false; - setState(ViewState.Busy); - await _productDetailService.delteItemFromWishlist(itemID); + setState(ViewState.BusyLocal); + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + await _productDetailService.deleteItemFromWishlist(itemID); + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); @@ -112,4 +125,10 @@ class ProductDetailViewModel extends BaseViewModel{ setState(ViewState.Idle); } + clearReview(){ + + productDetailService.clear(); + + } + } \ No newline at end of file diff --git a/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart index 788b7f3c..9a619357 100644 --- a/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/wishlist_view_model.dart @@ -12,20 +12,9 @@ class WishListViewModel extends BaseViewModel{ bool hasError = false; -// Future getWishlistData() async { -// setState(ViewState.Busy); -// await _wishlistService.getWishlist(); -// if (_wishlistService.hasError) { -// error = _wishlistService.error; -// setState(ViewState.Error); -// } else { -// setState(ViewState.Idle); -// } -// } - - Future getWishlistData() async { + Future getWishlistData({isLocalLoader = false}) async { hasError = false; - setState(ViewState.Busy); + setState(isLocalLoader ? ViewState.BusyLocal:ViewState.Busy); await _wishlistService.getWishlist(); if (_wishlistService.hasError) { error = _wishlistService.error; diff --git a/lib/core/viewModels/product_categories_view_model.dart b/lib/core/viewModels/product_categories_view_model.dart new file mode 100644 index 00000000..fa31accd --- /dev/null +++ b/lib/core/viewModels/product_categories_view_model.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/service/pharmacy_categorise_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; + +class ProductCategoriesViewModel extends BaseViewModel { + bool hasError = false; + + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); + + List get categorise => + _pharmacyCategoriseService.categoriseList; + + Future getCategorise() async { + hasError = false; + // _insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _pharmacyCategoriseService.getCategorise(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.ErrorLocal); + } else + 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 ee9ea18d..30d1f788 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/viewModels/ancillary_orders_view_model import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/product_categories_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; @@ -121,6 +122,10 @@ import 'core/viewModels/offers_Categorise_view_model.dart'; import 'core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.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/lacum-registration-viewModel.dart'; import 'core/viewModels/pharmacyModule/lacum-trasnfer-viewModel.dart'; @@ -284,24 +289,29 @@ void setupLocator() { locator.registerFactory(() => ProductDetailViewModel()); locator.registerFactory(() => WeatherViewModel()); - locator.registerFactory(() => OrderPreviewViewModel()); + // locator.registerFactory(() => OrderPreviewViewModel()); locator.registerFactory(() => LacumViewModel()); locator.registerFactory(() => LacumTranferViewModel()); locator.registerFactory(() => LacumRegistrationViewModel()); locator.registerFactory(() => EdOnlineViewModel()); + locator.registerFactory(() => ProductCategoriesViewModel()); //pharmacy locator.registerFactory(() => PharmacyCategoriseViewModel()); locator.registerFactory(() => OffersCategoriseViewModel()); locator.registerFactory(() => BariatricsViewModel()); + locator.registerFactory(() => PrescriptionViewModel()); + locator.registerFactory(() => BrandViewModel()); + locator.registerFactory(() => BestSellerViewModel()); + locator.registerFactory(() => LastVisitedViewModel()); + // Offer And Packages //---------------------- locator.registerLazySingleton(() => OffersAndPackagesServices()); // offerPackagesServices Service locator.registerFactory(() => OfferCategoriesViewModel()); // Categories View Model locator.registerFactory(() => PackagesViewModel()); // Products View Model - //pharmacy // locator.registerFactory(() => PharmacyCategoriseViewModel()); // locator.registerFactory(() => OffersCategoriseViewModel()); diff --git a/lib/main.dart b/lib/main.dart index 49d37919..71420951 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ -import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; +import 'dart:io'; + import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; @@ -8,14 +9,17 @@ import 'package:diplomaticquarterapp/theme/theme_notifier.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:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:in_app_update/in_app_update.dart'; import 'package:provider/provider.dart'; import 'config/size_config.dart'; +import 'core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; @@ -34,12 +38,27 @@ class MyApp extends StatefulWidget { } class _MyApp extends State { + AppUpdateInfo _updateInfo; + + Future checkForUpdate() async { + InAppUpdate.checkForUpdate().then((info) { + if (info.updateAvailable) { + InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString())); + } + }).catchError((e) { + print(e.toString()); + }); + } + @override void initState() { // ProjectViewModel projectProvider; // projectProvider = Provider.of(context); // var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans'; + // Re-enable once going live + // if (Platform.isAndroid) checkForUpdate(); + ThemeNotifier(defaultTheme()); super.initState(); } @@ -82,10 +101,14 @@ class _MyApp extends State { initialData: RobotProvider().setValue({}), ), ChangeNotifierProvider(create: (context) => CompareList()), + ChangeNotifierProvider(create: (context) => OrderPreviewViewModel()), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( - navigatorObservers: [GAnalytics.shared.navObserver()], + // navigatorObservers: [ + // GAnalytics.shared.navObserver() + // ], + navigatorKey: locator().navigatorKey, showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart index 5c0c5d3f..6d47c0cf 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart @@ -13,7 +13,10 @@ Future showCMCConfirmDialog(BuildContext context, String requestId, {Funct child: Column( mainAxisSize: MainAxisSize.min, children: [ - ConfirmDialog(requestId,onClick: onClick,), + ConfirmDialog( + requestId, + onClick: onClick, + ), ], ), ); @@ -36,7 +39,16 @@ class ConfirmDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Container( + width: 40, + height: 40, + margin: EdgeInsets.only(top: 20), + decoration: containerRadius(CustomColors.green, 200,), + child: Icon(Icons.done,color: Colors.white,), + ), mFlex(1), IconButton( icon: Icon( @@ -49,6 +61,7 @@ class ConfirmDialog extends StatelessWidget { ), ], ), + mHeight(12), Text( TranslationBase.of(context).RRTRequestSuccess, textAlign: TextAlign.start, diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 5093729c..5ef5089c 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_order_detail_by_order_iD_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; @@ -11,7 +12,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; @@ -85,13 +86,13 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { _context = context; ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage(CMCViewModel model, GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmCancelOrderDialog( - model: model, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); Future.delayed(new Duration(milliseconds: 300)).then((value) async { GifLoaderDialogUtils.showMyDialog(_context); await model.updateCmcPresOrder(updatePresOrderRequestModel); @@ -108,38 +109,53 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { )); } + int status = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusId : 0; + String _statusDisp = widget.model.pendingOrder != null ? widget.model.pendingOrder.statusText : ""; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } + return Scaffold( body: SafeArea( child: Container( - child: widget.model.cmcAllOrderDetail.length != 0 && widget.model.pendingOrder != null + child: widget.model.pendingOrder != null ? Column( children: [ Container( width: double.infinity, padding: EdgeInsets.only(left: 12, right: 12, top: 12), - child: Card( - shape: cardRadius(12), - elevation: 2, + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, - color: Color(0xffcd9e1b), clipBehavior: Clip.antiAlias, child: Container( // decoration: containerColorRadiusLeft(Colors.white, 12), - margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), - padding: EdgeInsets.all(12), - // color: Colors.white, + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), decoration: BoxDecoration( - shape: BoxShape.rectangle, color: Colors.white, + border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), ), // clipBehavior: Clip.antiAlias, child: Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Column( @@ -147,70 +163,82 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - // TranslationBase.of(context).OrderStatus + - // ' ' + - (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - color: Color(0xffcd9e1b), - fontWeight: FontWeight.w700, - ), + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), ), - mHeight(12), + SizedBox(height: 6), Text( - TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - style: TextStyle( - fontSize: 16, - letterSpacing: -0.48, - fontWeight: FontWeight.w700, - ), + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), - Text( - TranslationBase.of(context).serviceName, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w500, - ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).hospital + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + widget.model.pendingOrder.projectName.trim().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], ), - Text( - !projectViewModel.isArabic ? widget.model.cmcAllOrderDetail[0].description.toString() : widget.model.cmcAllOrderDetail[0].descriptionN.toString(), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w700, - ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Text( + widget.model.pendingOrder.serviceText.trim().toString(), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), + ), + ), + ], ), ], ), ), Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.cmcAllOrderDetail[0].createdOn)), - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w700, - ), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), - mHeight(8), - SecondaryButton( - onTap: () { - showConfirmMessage(widget.model, widget.model.cmcAllOrderDetail[0]); - }, - label: TranslationBase.of(context).cancel, - color: Colors.red[900], - small: true, - ) + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: Color(0xffD02127), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(10), + ), + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), ], ), ], ), ), ), - ), + ) ], ) : Container( diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart index a1b7ccee..cc83abdb 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_three_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_v import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -92,9 +93,8 @@ class _NewCMCStepThreePageState extends State { SizedBox( height: 12, ), - Card( - shape: cardRadius(12), - elevation: 4, + Container( + decoration: cardRadius(12), child: Container( padding: EdgeInsets.all(8), child: Column( @@ -118,10 +118,9 @@ class _NewCMCStepThreePageState extends State { height: 200, decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey), clipBehavior: Clip.antiAlias, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), clipBehavior: Clip.antiAlias, - elevation: 0, margin: const EdgeInsets.all(0), // child: GoogleMap( // mapType: MapType.normal, @@ -214,7 +213,9 @@ class _NewCMCStepThreePageState extends State { Navigator.pop(context); }, ); - } else {} + } else { + AppToast.showErrorToast(message: widget.model.error); + } }, textColor: Theme.of(context).backgroundColor), ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 5a1fe867..0d859690 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -161,10 +161,9 @@ class _NewCMCStepTowPageState extends State { body: Column( children: [ if (widget.model.addressesList.isNotEmpty) - Card( + Container( margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12), - shape: cardRadius(12), - elevation: 3, + decoration: cardRadius(12), child: Container( child: InkWell( onTap: () => confirmSelectLocationDialog(widget.model.addressesList), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index ac0a8599..a5c89c17 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; @@ -28,7 +29,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage(CMCViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, child: ConfirmWithMessageDialog( @@ -89,10 +90,10 @@ class OrdersLogDetailsPage extends StatelessWidget { padding: EdgeInsets.all(21), physics: BouncingScrollPhysics(), itemBuilder: (context, index) { - GetHHCAllPresOrdersResponseModel order = model.cmcAllPresOrders[index]; + GetCMCAllOrdersResponseModel order = model.cmcAllPresOrders[index]; - int status = order.status; - String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description; + int status = order.statusId; + String _statusDisp = order.statusText; Color _color; if (status == 1) { //pending @@ -103,7 +104,7 @@ class OrdersLogDetailsPage extends StatelessWidget { } else if (status == 3) { //completed _color = Color(0xff359846); - } else if (status == 4) { + } else if (status == 4 || status == 6 || status == 7) { //cancel // Rejected _color = Color(0xffD02127); } @@ -162,7 +163,8 @@ class OrdersLogDetailsPage extends StatelessWidget { ), Expanded( child: Text( - !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + // !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + order.projectName.trim().toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -176,11 +178,11 @@ class OrdersLogDetailsPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), - if (order.status == 1 || order.status == 2) + if (order.statusId == 1 || order.statusId == 2) InkWell( onTap: () { showConfirmMessage(model, order); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 0ae7c202..16f599d7 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -171,10 +171,9 @@ class _NewEReferralStepOnePageState extends State { ), ), ), - Card( + Container( margin: EdgeInsets.zero, - shape: cardRadius(0), - elevation: 20, + decoration: cardRadius(0), child: Container( // color: Theme.of(context).scaffoldBackgroundColor, padding: EdgeInsets.all(12), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 5bf031fe..9135eda9 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -166,10 +166,9 @@ class _NewEReferralStepTowPageState extends State { ), ), ), - Card( + Container( margin: EdgeInsets.zero, - shape: cardRadius(0), - elevation: 20, + decoration: cardRadius(0), child: Container( width: double.infinity, padding: EdgeInsets.all(12), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart index a519e720..fe920748 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart @@ -29,9 +29,8 @@ class _ReferralDetailsState extends State { children: [ Container( width: double.infinity, - child: Card( - elevation: 0.0, - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index 78b5455d..b3fffa4b 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -12,6 +12,8 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; @@ -202,9 +204,8 @@ class _SearchForReferralsPageState extends State { ), ); }, - child: Card( - elevation: 0.0, - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Row( @@ -217,9 +218,9 @@ class _SearchForReferralsPageState extends State { style: TextStyle(fontSize: 14.0, letterSpacing: -0.56, fontWeight: FontWeight.bold)), Container( margin: EdgeInsets.only(top: 5.0), - child: myRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName, projectViewModel.isArabic)), - myRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName, projectViewModel.isArabic), - myRichText(TranslationBase.of(context).referralDate + ": ", + child: MyRichText(TranslationBase.of(context).patientName + ": ", model.allReferral[index].patientName, projectViewModel.isArabic)), + MyRichText(TranslationBase.of(context).hospital + ": ", model.allReferral[index].preferredBranchName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).referralDate + ": ", DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(model.allReferral[index].referralDate)), projectViewModel.isArabic), ], ), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index b429ca4a..b401a127 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -7,9 +7,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -49,6 +47,7 @@ class _NewHomeHealthCareStepOnePageState extends State Container( @@ -138,13 +155,23 @@ class _NewHomeHealthCareStepThreePageState extends State Utils.route(route, equalsTo: HomeHealthCarePage)); - Navigator.push(context, FadePage(page: HomeHealthCarePage())); - }, - ); + if (widget.model.state != ViewState.ErrorLocal) { + if (widget.model.orderId != null) { + showCMCConfirmDialog( + context, + widget.model.orderId.toString(), + onClick: () { + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: HomeHealthCarePage)); + Navigator.push(context, FadePage(page: HomeHealthCarePage())); + }, + ); + } + } else { + AppToast.showErrorToast(message: widget.model.error); } }); }, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 696af81b..31518f61 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -141,10 +141,9 @@ class _NewHomeHealthCareStepTowPageState extends State confirmSelectLocationDialog(widget.model.addressesList), diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 4a2234c6..c4e82766 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -147,7 +147,7 @@ class _NewHomeHealthCarePageState extends State with Tick crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + widget.model.pendingOrder.statusText, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 6), @@ -188,11 +188,11 @@ class _NewHomeHealthCarePageState extends State with Tick crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), - if (widget.model.pendingOrder.status == 1 || widget.model.pendingOrder.status == 2) + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) InkWell( onTap: () { showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index 948ee8d6..919c566a 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; @@ -24,7 +25,7 @@ class OrdersLogDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - void showConfirmMessage(HomeHealthCareViewModel model, GetHHCAllPresOrdersResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, child: ConfirmWithMessageDialog( @@ -75,10 +76,10 @@ class OrdersLogDetailsPage extends StatelessWidget { padding: EdgeInsets.all(21), physics: BouncingScrollPhysics(), itemBuilder: (context, index) { - GetHHCAllPresOrdersResponseModel order = model.hhcAllPresOrders[index]; + GetCMCAllOrdersResponseModel order = model.hhcAllPresOrders[index]; - int status = order.status; - String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description; + int status = order.statusId; + String _statusDisp = order.statusText; Color _color; if (status == 1) { //pending @@ -148,7 +149,7 @@ class OrdersLogDetailsPage extends StatelessWidget { ), Expanded( child: Text( - !projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(), + order.nearestProjectName.toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -162,11 +163,11 @@ class OrdersLogDetailsPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.createdOn)), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(order.created)), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), - if (order.status == 1 || order.status == 2) + if (order.statusId == 1 || order.statusId == 2) InkWell( onTap: () { showConfirmMessage(model, order); diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index ce3bde14..8f130d93 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; @@ -277,7 +278,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: ChildVaccinesPage()), + FadePage(page: ChildVaccinePage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', title: TranslationBase.of(context).childVaccine, diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart new file mode 100644 index 00000000..6aff12d7 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart @@ -0,0 +1,238 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/weather_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/hmg_services.dart'; +import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:provider/provider.dart'; + +import 'health-weather/health-weather-indicator.dart'; + +class AllHabibMedicalSevicePage2 extends StatefulWidget { + @override + _AllHabibMedicalSevicePage2State createState() => _AllHabibMedicalSevicePage2State(); +} + +class _AllHabibMedicalSevicePage2State extends State { + List hmgServices = []; + LocationUtils locationUtils; + var weather = '--'; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + WeatherService _weatherService = WeatherService(); + double weatherNum = 30; + + @override + void initState() { + // TODO: implement initState + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); + }); + // getPatientAppointmentHistory1(); + // getFamilyFiles(); + } + + initialiseHmgServices(bool isLogin) { + hmgServices.clear(); + + hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).findUs, TranslationBase.of(context).reachUs, "assets/images/new/reach_us.svg", isLogin)); + hmgServices.add(new HmgServices(9, TranslationBase.of(context).medicalFile, TranslationBase.of(context).My_File_Details, "assets/images/new/medical file.svg", isLogin)); + hmgServices.add(new HmgServices(10, TranslationBase.of(context).book, TranslationBase.of(context).appointment, "assets/images/new/book appointment.svg", isLogin)); + hmgServices.add(new HmgServices(11, TranslationBase.of(context).online, TranslationBase.of(context).pharmacy, "assets/images/new/Pharmacy.svg", isLogin)); + hmgServices.add(new HmgServices(12, TranslationBase.of(context).updateInsurance, TranslationBase.of(context).updateInsuranceSubtitle, "assets/images/new/update insurance card.svg", isLogin)); + hmgServices.add(new HmgServices(13, TranslationBase.of(context).myFamily, TranslationBase.of(context).Family_Files, "assets/images/new/my family.svg", isLogin)); + hmgServices.add(new HmgServices(14, TranslationBase.of(context).My_Child, TranslationBase.of(context).Vaccines, "assets/images/new/child vaccines.svg", isLogin)); + hmgServices.add(new HmgServices(15, TranslationBase.of(context).Todo, TranslationBase.of(context).list, "assets/images/new/todo.svg", isLogin)); + hmgServices.add(new HmgServices(16, TranslationBase.of(context).Blood, TranslationBase.of(context).Donation, "assets/images/new/blood donation.svg", isLogin)); + hmgServices.add(new HmgServices(17, TranslationBase.of(context).Health, TranslationBase.of(context).Calculator, "assets/images/new/health calculator.svg", isLogin)); + hmgServices.add(new HmgServices(18, TranslationBase.of(context).Health, TranslationBase.of(context).Converter, "assets/images/new/health converter.svg", isLogin)); + hmgServices.add(new HmgServices(19, TranslationBase.of(context).Smart, TranslationBase.of(context).Watches, "assets/images/new/smart watch.svg", isLogin)); + hmgServices.add(new HmgServices(20, TranslationBase.of(context).Parking, TranslationBase.of(context).Details, "assets/images/new/parking details.svg", isLogin)); + hmgServices.add(new HmgServices(21, TranslationBase.of(context).Virtual, TranslationBase.of(context).Tour, "assets/images/new/virtual tour.svg", isLogin)); + hmgServices.add(new HmgServices(22, TranslationBase.of(context).News, TranslationBase.of(context).Latest, "assets/images/new/latest news.svg", isLogin)); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + initialiseHmgServices(false); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: TranslationBase.of(context).alhabiServices, + body: Container( + width: double.infinity, + height: double.infinity, + child: SingleChildScrollView( + child: Column( + children: [ + AspectRatio( + aspectRatio: 1.8, + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), + child: Padding( + padding: const EdgeInsets.all(30.0), + child: Stack( + alignment: projectViewModel.isArabic ? Alignment.centerLeft : Alignment.centerRight, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Directionality( + textDirection: TextDirection.ltr, + child: Text( + weather, + style: TextStyle( + fontSize: 30, + letterSpacing: -0.83, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + Text( + DateUtil.getMonthDayYearDateFormatted(new DateTime.now()), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + mFlex(1), + Text( + TranslationBase.of(context).healthWeatherIndicators, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + Text( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Padding( + padding: const EdgeInsets.only(top: 8, bottom: 8), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 12, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, decoration: TextDecoration.underline), + ), + ), + ) + ], + ), + Image.asset( + "assets/images/Weather_ico.png", + color: Colors.white.withOpacity(0.5), + ), + ], + ), + ), + ), + ), + mHeight(16), + Padding( + padding: const EdgeInsets.only( + left: 16, + right: 16, + top: 0, + ), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServicesView(hmgServices[index], index); + }, + ), + ), + mHeight(16), + ], + ), + ), + ), + ); + } + + void setLocation(Position position) { + this.sharedPref.setDouble(USER_LAT, position.latitude ?? 0.0); + this.sharedPref.setDouble(USER_LONG, position.longitude ?? 0.0); + getAuthUser(); + } + + getAuthUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + var data = await this.sharedPref.getObject(WEATHER); + if (data == null) { + var d = await _weatherService.getWeatherData(); + + print(d); + weatherNum = d.temperature; + setState(() { + weather = d != null ? d.temperature.toString() + '\u2103' : '--'; + }); + } else { + setState(() { + weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; + }); + } + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index 2221ea5c..904f4183 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -6,6 +6,7 @@ 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/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -266,18 +267,19 @@ class _H2oSettingState extends State { SizedBox(height: 12), _containerWidget( _commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + List list = [ + for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), + ]; + showDialog( context: context, - child: CommonRadioButtonDialog( - list: _activityLevelListEng, - title: TranslationBase.of(context).activityLevel, - onSelect: (index) { - Navigator.pop(context); - setState(() { - _selectedActiveLevel = index + 1; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedActiveLevel, + onValueSelected: (index) { + _selectedActiveLevel = index; + setState(() {}); }, - selectedIndex: _selectedActiveLevel - 1, ), ); }), @@ -296,17 +298,19 @@ class _H2oSettingState extends State { SizedBox(height: 12), _containerWidget( _commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { + List list = [ + for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), + ]; + showDialog( context: context, - child: CommonRadioButtonDialog( - list: _remindedTimeListEng, - onSelect: (index) { - Navigator.pop(context); - setState(() { - _selectedRemindedTime = index; - }); - }, + child: RadioSelectionDialog( + listData: list, selectedIndex: _selectedRemindedTime, + onValueSelected: (index) { + _selectedRemindedTime = index; + setState(() {}); + }, ), ); }), @@ -493,36 +497,6 @@ class _H2oSettingState extends State { ), ], ); - - return Row(children: [ - Expanded( - child: SizedBox( - height: 40, - child: RaisedButton( - color: checkParam ? Theme.of(context).appBarTheme.color : Colors.white, - child: Text( - rightText, - style: TextStyle(color: checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), - ), - onPressed: () => callBack(true), - ), - ), - ), - SizedBox(width: 12), - Expanded( - child: SizedBox( - height: 40, - child: RaisedButton( - color: !checkParam ? Theme.of(context).appBarTheme.color : Colors.white, - child: Text( - leftText, - style: TextStyle(color: !checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600), - ), - onPressed: () => callBack(false), - ), - ), - ), - ]); } Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, @@ -624,7 +598,7 @@ class _H2oSettingState extends State { if (tag) { AppToast.showSuccessToast(message: TranslationBase.of(context).success); await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l"); - int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? _selectedRemindedTime; + int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? 0; if (_tempRemindTime != _selectedRemindedTime) { await prefs.setInt(H2O_REMINDER, _selectedRemindedTime); _addReminderToCalender(_selectedRemindedTime); diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 583dabbf..fe385ade 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -224,7 +224,7 @@ class _TodayPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).amount, + TranslationBase.of(context).amount_, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index a79c9d9d..b38e3f63 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -3,8 +3,10 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/weather/weather_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; @@ -23,12 +25,11 @@ class _HospitalsPageState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); LocationUtils locationUtils; var weather = '--'; + @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance - .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); getWeather(); super.initState(); } @@ -41,82 +42,92 @@ class _HospitalsPageState extends State { allowAny: true, builder: (_, mode, widget) => AppScaffold( isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).healthWeatherIndicators, isShowAppBar: true, body: mode.weatherIndicatorData.length > 0 ? SingleChildScrollView( child: Column(children: [ - Container( - margin: EdgeInsets.all(8), - width: double.infinity, - height: 150, - decoration: BoxDecoration( - image: DecorationImage( - image: - ExactAssetImage('assets/images/Weather_img.png'), - fit: BoxFit.cover, - ), - borderRadius: BorderRadius.circular(8.0)), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Row( - children: [ - Expanded( - flex: 3, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .healthWeatherIndicators, - color: Colors.white, + AspectRatio( + aspectRatio: 1.8, + child: Container( + width: double.infinity, + height: double.infinity, + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), + child: Padding( + padding: const EdgeInsets.all(30.0), + child: Stack( + alignment: projectViewModel.isArabic ? Alignment.centerLeft : Alignment.centerRight, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Directionality( + textDirection: TextDirection.ltr, + child: Text( + weather, + style: TextStyle( + fontSize: 30, + letterSpacing: -0.83, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + Text( + DateUtil.getMonthDayYearDateFormatted(new DateTime.now()), + style: TextStyle( + fontSize: 12, + letterSpacing: -0.60, fontWeight: FontWeight.w600, + color: Colors.white, ), - AppText( - TranslationBase.of(context) - .healthTipsBasedOnCurrentWeather, + ), + mFlex(1), + Text( + TranslationBase.of(context).healthWeatherIndicators, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, color: Colors.white, - fontSize: 14, ), - ], - )), - Expanded( - flex: 2, - child: InkWell( - onTap: () {}, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/Weather_ico.png', - width: 60, - height: 60, - ), - Directionality( - textDirection: TextDirection.ltr, - child: AppText(weather, - fontSize: 22, - color: Colors.white)) - ], - ), - ], - )), - ) - ], + ), + Text( + TranslationBase.of(context).healthTipsBasedOnCurrentWeather, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.72, + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ], + ), + Image.asset( + "assets/images/Weather_ico.png", + color: Colors.white.withOpacity(0.5), + ), + ], + ), ), ), ), Padding( padding: EdgeInsets.all(15), child: AppText( - projectViewModel.isArabic - ? mode.weatherIndicatorData[0].cityNameN - : mode.weatherIndicatorData[0].cityName, + projectViewModel.isArabic ? mode.weatherIndicatorData[0].cityNameN : mode.weatherIndicatorData[0].cityName, fontSize: 24, fontWeight: FontWeight.bold, )), diff --git a/lib/pages/AlHabibMedicalService/my_web_view.dart b/lib/pages/AlHabibMedicalService/my_web_view.dart index f6646d36..4b03c7dd 100644 --- a/lib/pages/AlHabibMedicalService/my_web_view.dart +++ b/lib/pages/AlHabibMedicalService/my_web_view.dart @@ -22,6 +22,8 @@ class MyWebView extends StatelessWidget { isShowAppBar: true, appBarTitle: title, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: WebView( initialUrl: selectedUrl, javascriptMode: JavascriptMode.unrestricted, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index e069eca6..323567b7 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -104,10 +104,9 @@ class _BookConfirmState extends State { ), ), mHeight(20), - Card( - shape: cardRadius(12), + Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, - elevation: 0, child: Padding( padding: const EdgeInsets.fromLTRB(16, 20, 16, 20), child: Column( @@ -138,9 +137,8 @@ class _BookConfirmState extends State { ), ), mHeight(12), - Card( - shape: cardRadius(12), - elevation: 0, + Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.fromLTRB(16, 20, 16, 20), @@ -194,6 +192,7 @@ class _BookConfirmState extends State { child: RaisedButton( color: CustomColors.green, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 15ccf128..04086ee3 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -143,6 +143,7 @@ class _BookSuccessState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -177,6 +178,7 @@ class _BookSuccessState extends State { child: RaisedButton( color: CustomColors.green, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -197,6 +199,7 @@ class _BookSuccessState extends State { child: RaisedButton( color: new Color(0xffc5272d), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -232,6 +235,7 @@ class _BookSuccessState extends State { child: RaisedButton( color: new Color(0xffc5272d), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -252,6 +256,7 @@ class _BookSuccessState extends State { child: RaisedButton( color: CustomColors.green, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index da7ec5c1..342bff21 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -70,7 +70,7 @@ class _DentalComplaintsState extends State { separatorBuilder: (BuildContext context, int index) { return Padding( padding: const EdgeInsets.only(left: 14, right: 14), - child: mDivider(Colors.grey), + child: mDivider(CustomColors.devider), ); }, ) diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 5c2cb113..87941ed5 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -85,6 +85,7 @@ class _DoctorProfileState extends State with TickerProviderStateM child: RaisedButton( color: CustomColors.accentColor, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: goToBookConfirm, diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 3c89b2f5..d4942ccf 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -14,7 +14,7 @@ class Search extends StatefulWidget { final List clnicIds; Function onBackClick; - Search({this.type = 0, this.clnicIds,this.onBackClick}); + Search({this.type = 0, this.clnicIds, this.onBackClick}); @override _SearchState createState() => _SearchState(); @@ -68,7 +68,10 @@ class _SearchState extends State with TickerProviderStateMixin { Expanded( child: TabBarView( physics: NeverScrollableScrollPhysics(), - children: [SearchByClinic(clnicIds: widget.clnicIds), SearchByDoctor()], + children: [ + SearchByClinic(clnicIds: widget.clnicIds), + SearchByDoctor(), + ], controller: _tabController, ), ) diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index e4b8068c..0a654e22 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -47,7 +47,7 @@ class _SearchResultsState extends State { bodyWidget: ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + padding: EdgeInsets.only(bottom: 10, top: 10, left: 21, right: 21), itemBuilder: (context, _index) { //widget.patientDoctorAppointmentListHospital[index].patientDoctorAppointmentList[_index].speciality = null; return DoctorView( diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index 8066e369..39f1648f 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -62,7 +62,7 @@ class _BookReminderPageState extends State { isShowAppBar: true, showNewAppBarTitle: true, showNewAppBar: true, - backgroundColor: CustomColors.appBackgroudGreyColor, + backgroundColor: CustomColors.appBackgroudGrey2Color, body: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, @@ -111,8 +111,8 @@ class _BookReminderPageState extends State { if (isSuccessShow) Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.all(10), child: Padding( padding: const EdgeInsets.all(16.0), @@ -153,7 +153,7 @@ class _BookReminderPageState extends State { bottomSheet: Container( color: CustomColors.appBackgroudGreyColor, child: Container( - color: CustomColors.appBackgroudGreyColor, + color: CustomColors.white, margin: EdgeInsets.all(14), height: 45.0, child: Row( @@ -167,8 +167,9 @@ class _BookReminderPageState extends State { ), height: 45.0, child: RaisedButton( - color: new Color(0xFF60686b), + color: CustomColors.accentColor, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFEAEAEA), onPressed: () { @@ -187,8 +188,9 @@ class _BookReminderPageState extends State { ), height: 45.0, child: RaisedButton( - color: new Color(0xffc5272d), + color: CustomColors.green, textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: CustomColors.green, onPressed: () async { diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 25f8cb9c..959816af 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -163,8 +163,8 @@ class _DocAvailableAppointmentsState extends State wit } Widget _buildTableCalendarWithBuilders() { - return Card( - shape: cardRadius(12), + return Container( + decoration: cardRadius(12), margin: EdgeInsets.all(16), clipBehavior: Clip.antiAlias, child: Padding( diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index 6e10df41..041a021f 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -17,9 +17,8 @@ class DoctorInformation extends StatelessWidget { children: [ Container( width: double.infinity, - child: Card( - shape: cardRadius(12), - elevation: 0, + child: Container( + decoration: cardRadius(12), child: Padding( padding: EdgeInsets.all(16), child: Column( @@ -88,9 +87,8 @@ class DoctorInformation extends StatelessWidget { mHeight(8), Container( width: double.infinity, - child: Card( - shape: cardRadius(12), - elevation: 0, + child: Container( + decoration: cardRadius(12), child: Padding( padding: EdgeInsets.all(16), child: Column( diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index ab36738e..147cb9f9 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -176,48 +176,9 @@ class _SearchByClinicState extends State { ), ], ), - Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 2), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Age", - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - color: Colors.black, - fontWeight: FontWeight.w600, - ), - ), - TextField( - controller: ageController, - style: TextStyle( - fontSize: 15, - letterSpacing: -0.59, - color: Colors.black, - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.zero, - border: OutlineInputBorder( - borderSide: BorderSide.none, - ), - ), - ), - // Text( - // projectViewModel.isLogin ? projectViewModel.user.age.toString() : "", - // style: TextStyle( - // fontSize: 15, - // letterSpacing: -0.59, - // color: Colors.black, - // ), - // ), - ], - ), - ), + + Container(child: inputWidget("Age", "", ageController),margin: EdgeInsets.only(left: 20, right: 20),), + ], ), Padding( @@ -403,6 +364,89 @@ class _SearchByClinicState extends State { ); } + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + + void openDropdown(GlobalKey key) { GestureDetector detector; void searchForGestureDetector(BuildContext element) { diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index e0e0fa66..dde431e6 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -26,54 +26,70 @@ class _SearchByDoctorState extends State { @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 15.0), - child: Text(TranslationBase.of(context).searchByDocText, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), - ), - Container( - decoration: BoxDecoration(color: Colors.white), - child: TextField( - controller: doctorNameController, - onChanged: (content) { - _onDocTextChanged(content); - }, - decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())), - ), - Expanded( - child: Align( - alignment: FractionalOffset.bottomCenter, - child: _buildCounterButton(), + return Column( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(20.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 15.0), + child: Text( + TranslationBase.of(context).searchByDocText, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.9, + fontWeight: FontWeight.w600, + ), + ), + ), + // Container( + // decoration: BoxDecoration(color: Colors.white), + // child: TextField( + // controller: doctorNameController, + // onChanged: (content) { + // _onDocTextChanged(content); + // }, + // decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())), + // ), + inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController), + + ], ), ), - ], - ), + ), + _buildCounterButton(), + ], ); } Widget _buildCounterButton() { - return new ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: CustomColors.accentColor, - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (_isButtonDisabled == false) { - _searchDoctor(context); - } - }, - child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0)), + return Container( + width: double.infinity, + padding: EdgeInsets.all(16), + color: Colors.white, + child: new ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + disabledTextColor: Colors.white, + elevation: 0, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + if (_isButtonDisabled == false) { + _searchDoctor(context); + } + }, + child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0)), + ), ), ); } @@ -143,4 +159,86 @@ class _SearchByDoctorState extends State { navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) { Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {_onDocTextChanged(value)}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } } diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index 241e20c8..3c56aa24 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -34,7 +34,15 @@ class _DentalComplaintCardState extends State { mainAxisSize: MainAxisSize.max, children: [ Container( - child: Text(widget.listDentalChiefComplain.name, style: TextStyle(fontSize: 16.0, color: Colors.black)), + child: Text( + widget.listDentalChiefComplain.name, + style: TextStyle( + fontSize: 16.0, + color: Colors.black, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), ), ], ), diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index a73759b1..794ece31 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -73,8 +74,8 @@ class DoctorView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - if (doctor.clinicName != null) myRichText(TranslationBase.of(context).clinic + ":", doctor.clinicName, projectViewModel.isArabic), - if (doctor.projectName != null) myRichText(TranslationBase.of(context).branch, doctor.projectName, projectViewModel.isArabic), + if (doctor.clinicName != null) MyRichText(TranslationBase.of(context).clinic + ":", doctor.clinicName, projectViewModel.isArabic), + if (doctor.projectName != null) MyRichText(TranslationBase.of(context).branch, doctor.projectName, projectViewModel.isArabic), if (doctor.speciality != null) Text( getDoctorSpeciality(this.doctor.speciality).trim(), @@ -99,11 +100,12 @@ class DoctorView extends StatelessWidget { filledIcon: Icons.star, emptyIcon: Icons.star_border, ), - if (isShowFlag) Icon( - Icons.arrow_forward, - color: Theme.of(context).primaryColor, - ), - // if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0) + if (isShowFlag) + Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ), + // if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0) ], ), ], diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 2eb5e062..43038658 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -133,57 +133,83 @@ class _ReminderDialogState extends State { letterSpacing: -0.48, ), ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text(TranslationBase.of(context).appoReminder30), - leading: Radio( - value: 0, - groupValue: i, - onChanged: (int value) { - setState(() { - i = value; - }); - }, - ), + Row( + children: [ + Radio( + value: 0, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder30, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text(TranslationBase.of(context).appoReminder60), - leading: Radio( - value: 1, - groupValue: i, - onChanged: (int value) { - setState(() { - i = value; - }); - }, - ), + Row( + children: [ + Radio( + value: 1, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder60, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text(TranslationBase.of(context).appoReminder90), - leading: Radio( - value: 2, - groupValue: i, - onChanged: (int value) { - setState(() { - i = value; - }); - }, - ), + Row( + children: [ + Radio( + value: 2, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text(TranslationBase.of(context).appoReminder90, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ),), + ], ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text(TranslationBase.of(context).appoReminder120), - leading: Radio( - value: 3, - groupValue: i, - onChanged: (int value) { - setState(() { - i = value; - }); - }, - ), + Row( + children: [ + Radio( + value: 3, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text( + TranslationBase.of(context).appoReminder120, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + ], ), mHeight(12), DefaultButton( diff --git a/lib/pages/ChildVaccines/new/child_vaccine_page.dart b/lib/pages/ChildVaccines/new/child_vaccine_page.dart new file mode 100644 index 00000000..2563fa63 --- /dev/null +++ b/lib/pages/ChildVaccines/new/child_vaccine_page.dart @@ -0,0 +1,304 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../add_newchild_page.dart'; +import '../vaccinationtable_page.dart'; + +class ChildVaccinePage extends StatefulWidget { + @override + _ChildPageState createState() => _ChildPageState(); +} + +class _ChildPageState extends State with SingleTickerProviderStateMixin { + DeleteBaby deleteBaby = DeleteBaby(); + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double height = (size.height - kToolbarHeight - 60); + final double itemWidth = size.width / 2; + final double itemHeight = height / 2 + 40; + + var checkedValue = true; + return BaseView( + onModelReady: (model) => model.getNewUserOrders(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).vaccination, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 0, right: 0, bottom: 20), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(12)), + color: Colors.white, + gradient: LinearGradient( + colors: model.babyInformationModelList[index].gender == 1 + ? [ + Color(0xFFFDA4B0), + Color(0xFFFBC8CC), + ] + : [ + Color(0xFF6EA8FF), + Color(0xFF7AB8FD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.all(12), + //double.infinity, + child: Column( + children: [ + Texts(model.babyInformationModelList[index].babyName.trim()), + Row(children: [ + IconButton( + icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model.babyInformationModelList[index].genderDescription), + IconButton( + icon: Icon( + Icons.remove_red_eye, + color: Colors.red, + ), + tooltip: '', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(model.babyInformationModelList[index]), + ), + ); + }, + ) + ]), + Row(children: [ + Texts(TranslationBase.of(context).dob), + ]), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + tooltip: '', + onPressed: () { + setState(() {}); + }, + ), + Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)), + ]), + Row(children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () async { + //===================== + await model.deleteBabyOrders(newChild: deleteBaby); + + deleteBaby.babyID = model.babyInformationModelList[index].babyID; + + await model.deleteBabyOrders(newChild: deleteBaby); + if (model.isDeleted) { + AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + Navigator.pop(context, model.isDeleted); + } else { + //TODO handling error + } + }, + ), + Texts(TranslationBase.of(context).deleteView), + ]), + SizedBox( + height: 12, + ), + ], + ), + ), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mHeight(12); + }, + itemCount: model.babyInformationModelList.length, + ), + ), + // Container( + // height: height * 0.85, + // child: SingleChildScrollView( + // child: Container( + // margin: EdgeInsets.only(left: 8, right: 8, top: 16), + // child: GridView.count( + // crossAxisCount: 2, + // childAspectRatio: (itemWidth / (itemHeight + 0)), + // crossAxisSpacing: 10, + // mainAxisSpacing: 10, + // controller: ScrollController(keepScrollOffset: true), + // shrinkWrap: true, + // padding: const EdgeInsets.all(4.0), + // children: [ + // ...List.generate( + // model.babyInformationModelList.length, + // (index) => InkWell( + // onTap: () { + // Navigator.push( + // context, + // FadePage( + // page: VaccinationTablePage(model.babyInformationModelList[index]), + // ), + // ); + // }, + // child: Container( + // margin: EdgeInsets.only(left: 0, right: 0, bottom: 20), + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // border: Border.all(color: Colors.white, width: 0.5), + // borderRadius: BorderRadius.all(Radius.circular(5)), + // color: Colors.white, + // ), + // padding: EdgeInsets.all(12), + // //double.infinity, + // child: Column( + // children: [ + // Row(children: [ + // Texts(TranslationBase.of(context).childName), + // ]), + // Row(children: [ + // Texts(model.babyInformationModelList[index].babyName.trim()), + // ]), + // Row(children: [ + // IconButton( + // icon: Image.asset(model.babyInformationModelList[index].gender == 1 ? 'assets/images/new-design/male.png' : 'assets/images/new-design/female.png'), + // tooltip: '', + // onPressed: () { + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + // }, + // ), + // Texts(model.babyInformationModelList[index].genderDescription), + // IconButton( + // icon: Icon( + // Icons.remove_red_eye, + // color: Colors.red, + // ), + // tooltip: '', + // onPressed: () { + // Navigator.push( + // context, + // FadePage( + // page: VaccinationTablePage(model.babyInformationModelList[index]), + // ), + // ); + // }, + // ) + // ]), + // Row(children: [ + // Texts(TranslationBase.of(context).dob), + // ]), + // Row(children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + // tooltip: '', + // onPressed: () { + // setState(() {}); + // }, + // ), + // Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)), + // ]), + // Row(children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/garbage.png'), + // tooltip: '', + // onPressed: () async { + // //===================== + // await model.deleteBabyOrders(newChild: deleteBaby); + // + // deleteBaby.babyID = model.babyInformationModelList[index].babyID; + // + // await model.deleteBabyOrders(newChild: deleteBaby); + // if (model.isDeleted) { + // AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + // Navigator.pop(context, model.isDeleted); + // } else { + // //TODO handling error + // } + // }, + // ), + // Texts(TranslationBase.of(context).deleteView), + // ]), + // SizedBox( + // height: 12, + // ), + // ], + // ), + // ), + // ), + // ) + // ], + // ))), + // ), + ], + ), + bottomSheet: Container( + height: height * 0.15, + width: double.infinity, + padding: EdgeInsets.all(16), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: TranslationBase.of(context).addNewChild, + // + onTap: () { + Navigator.push( + context, + FadePage( + page: AddNewChildPage(), + ), + ).then((value) { + if (value) model.getNewUserOrders(); + }); + }, + ), + ), + )); + } +} diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index 280c958b..87516e52 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; @@ -28,102 +29,7 @@ class _HospitalsPageState extends State { shrinkWrap: true, padding: EdgeInsets.zero, separatorBuilder: (context, index) => SizedBox(height: 14), - itemBuilder: (context, index) { - GetHMGLocationsModel _location = widget.findusHospitalModelList[index]; - return Container( - padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - _location.locationName, - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.network( - _location.projectImageURL.toString(), - fit: BoxFit.cover, - ), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - ), - ); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: Image.network( - _location.projectImageURL.toString(), - width: 48, - height: 48, - fit: BoxFit.cover, - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: 12, right: 12), - child: Text( - _location.locationName?.trim().toString() + "\n" + _location.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - ), - ), //model.cOCItemList[index].cOCTitl - IconButton( - icon: Icon( - Icons.location_on, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - setState(() { - MapsLauncher.launchCoordinates(double.parse(_location.latitude), double.parse(_location.longitude), _location.locationName); - }); - }, - ), - IconButton( - icon: Icon( - Icons.phone, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - setState(() { - launch("tel://" + _location.phoneNumber); - }); - }, - ), - ], - ), - ); - }, + itemBuilder: (context, index) => HospitalLocation(widget.findusHospitalModelList[index]), itemCount: widget.findusHospitalModelList.length, ), Container( diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index 8bc8053d..72b2316c 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -1,9 +1,7 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class PharmaciesPage extends StatefulWidget { @@ -28,128 +26,7 @@ class _PharmaciesPageState extends State { shrinkWrap: true, padding: EdgeInsets.zero, separatorBuilder: (context, index) => SizedBox(height: 14), - itemBuilder: (context, index) { - GetHMGLocationsModel _location = widget.findusPharmaciesModelList[index]; - return Container( - padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - _location.locationName, - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: _location.projectImageURL != null - ? Image.network( - _location.projectImageURL, - fit: BoxFit.cover, - ) - : Image.network( - 'https://hmgwebservices.com/Images/Hospitals/15.jpg', - fit: BoxFit.cover, - ), - buttonCancelText: Text(TranslationBase.of(context).cancel), - // buttonCancelText:Text(model.user.projectID) , - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - ), - ); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: Image.network( - _location?.projectImageURL?.toString() ?? 'https://hmgwebservices.com/Images/Hospitals/15.jpg', - width: 48, - height: 48, - fit: BoxFit.cover, - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: 12, right: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _location.locationName?.trim() ?? "", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - SizedBox( - height: 2, - ), - Text( - _location.cityName?.trim().toString() + "\n" + _location.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - SizedBox( - height: 2, - ), - ], - ), - ), - ), - IconButton( - icon: Icon( - Icons.location_on, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - setState(() { - MapsLauncher.launchCoordinates(double.parse(_location.latitude), double.parse(_location.longitude), _location.locationName); - }); - }, - ), - IconButton( - icon: Icon( - Icons.phone, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - setState(() { - launch("tel://" + _location.phoneNumber); - }); - }, - ), - ], - ), - ); - }, + itemBuilder: (context, index) => HospitalLocation(widget.findusPharmaciesModelList[index], showCity: true), itemCount: widget.findusPharmaciesModelList.length, ), Container( diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 834d7a0a..fb73280b 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -146,8 +146,8 @@ class _CovidTimeSlotsState extends State with TickerProviderStat ), ), mHeight(12), - Card( - shape: cardRadius(12), + Container( + decoration: cardRadius(12), child: _buildTableCalendarWithBuilders(projectViewModel), ), mHeight(12), @@ -201,10 +201,9 @@ class _CovidTimeSlotsState extends State with TickerProviderStat ), ), ), - Card( - elevation: 20, + Container( margin: EdgeInsets.zero, - shape: cardRadius(0), + decoration: cardRadius(0), child: Container( width: double.infinity, padding: EdgeInsets.all(12), @@ -362,6 +361,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat Widget getSelectedButton(int index) { return RaisedButton( color: CustomColors.green, //Color of the border + elevation: 0, textColor: Colors.white, onPressed: () { setState(() { diff --git a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart index aa1e3ea5..78ee36f0 100644 --- a/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart +++ b/lib/pages/Covid-DriveThru/covid-dirvethru-questions.dart @@ -62,8 +62,8 @@ class CovidDirveThruQuestionsState extends State { children: [ Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.all(12.0), @@ -222,7 +222,7 @@ class CovidDirveThruQuestionsState extends State { ), Card( margin: EdgeInsets.zero, - elevation: 20, + elevation: 0, child: Container( padding: EdgeInsets.all(12), child: FractionallySizedBox( diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index b033e1f4..0d169ef8 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -177,9 +177,8 @@ class _CovidDrivethruLocationState extends State { onTap: () { getDirections(); }, - child: Card( - shape: cardRadius(1000), - elevation: 4, + child: Container( + decoration: cardRadius(1000), margin: EdgeInsets.all(12), child: Padding( padding: const EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), @@ -222,7 +221,7 @@ class _CovidDrivethruLocationState extends State { ), ), Card( - elevation: 20, + elevation: 0, margin: EdgeInsets.zero, child: Container( width: double.infinity, diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart index 2d7d5363..2b2121d0 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-alert.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -87,9 +87,9 @@ class _CovidPaymentAlertState extends State { mHeight(20), Container( width: double.infinity, - child: Card( + child: Container( margin: EdgeInsets.zero, - shape: cardRadius(12), + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -169,7 +169,7 @@ class _CovidPaymentAlertState extends State { ), Card( margin: EdgeInsets.zero, - elevation: 20, + elevation: 0, child: Container( margin: EdgeInsets.all(12), width: double.infinity, diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index f31aa53e..e567dbe7 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -120,28 +120,54 @@ class _CovidPaymentDetailsState extends State { getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); }); }, - child: ListTile( - title: Text( - projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName, - style: TextStyle( - fontSize: 12.0, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, + child: Row( + children: [ + Radio( + value: widget.proceduresList[index], + groupValue: widget.selectedProcedure, + activeColor: Colors.red[800], + toggleable: true, + onChanged: (value) { + setState(() { + widget.selectedProcedure = value; + print(widget.selectedProcedure.procedureName); + getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); + }); + }, + + ), + Text( + projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), ), - ), - leading: Radio( - value: widget.proceduresList[index], - groupValue: widget.selectedProcedure, - activeColor: Colors.red[800], - toggleable: true, - onChanged: (value) { - setState(() { - widget.selectedProcedure = value; - print(widget.selectedProcedure.procedureName); - getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); - }); - }, - ), + // ListTile( + // title: Text( + // projectViewModel.isArabic ? widget.proceduresList[index].procedureNameN : widget.proceduresList[index].procedureName, + // style: TextStyle( + // fontSize: 12.0, + // letterSpacing: -0.48, + // fontWeight: FontWeight.w600, + // ), + // ), + // leading: Radio( + // value: widget.proceduresList[index], + // groupValue: widget.selectedProcedure, + // activeColor: Colors.red[800], + // toggleable: true, + // onChanged: (value) { + // setState(() { + // widget.selectedProcedure = value; + // print(widget.selectedProcedure.procedureName); + // getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID); + // }); + // }, + // ), + // ), + ], ), ), ) @@ -151,8 +177,8 @@ class _CovidPaymentDetailsState extends State { ), ), - Card( - shape: cardRadius(12), + Container( + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -270,7 +296,7 @@ class _CovidPaymentDetailsState extends State { Container( width: double.infinity, child: Card( - elevation: 20, + elevation: 0, margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.only(top: 12, bottom: 12, left: 12, right: 12), @@ -286,7 +312,7 @@ class _CovidPaymentDetailsState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: CustomColors.darkGreyColor, + color: CustomColors.accentColor, textColor: Colors.white, elevation: 0, disabledTextColor: Colors.white, @@ -295,11 +321,11 @@ class _CovidPaymentDetailsState extends State { cancel(); }, child: Text( - TranslationBase.of(context).cancel, + TranslationBase.of(context).cancel_nocaps, style: TextStyle( fontSize: 16.0, letterSpacing: -0.48, - color: Colors.black, + color: Colors.white, fontWeight: FontWeight.w600, ), ), @@ -318,7 +344,7 @@ class _CovidPaymentDetailsState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: CustomColors.accentColor, + color: CustomColors.green, textColor: Colors.white, elevation: 0, disabledTextColor: Colors.white, diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart index c5bcb23b..84126109 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-summary.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -173,8 +173,8 @@ class _CovidPaymentSummaryState extends State { Widget showDetail(String title, String value) { return Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.all(12.0), diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index ba8d971e..18450954 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -1,7 +1,7 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; @@ -25,18 +25,16 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; class MyFamily extends StatefulWidget { final bool isAppbarVisible; @@ -145,7 +143,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget myFamilyDetails(context) { return Container( - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Column( children: [ Expanded( @@ -162,15 +160,16 @@ class _MyFamily extends State with TickerProviderStateMixin { else return ListView.separated( itemBuilder: (context, index) { - snapshot.data.getAllSharedRecordsByStatusList[index].gender = 2; if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3) - return Card( - margin: EdgeInsets.all(10), - shape: cardRadius(25), - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Color(0xff6EA8FF) : Color(0xffFDA4B0), - elevation: 3, + return Container( + margin: EdgeInsets.all(5), + decoration: cardRadius( + 15, + elevation: 0, + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0xffFDA4B0) : Color(0xff6EA8FF), + ), child: Container( - // height: 130, + // height: 130,0xffFDA4B0 width: MediaQuery.of(context).size.width, padding: EdgeInsets.all(10), child: Row( @@ -181,7 +180,7 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ Texts( snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach, - fontSize: 22, + fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white, ), @@ -211,7 +210,7 @@ class _MyFamily extends State with TickerProviderStateMixin { mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset("assets/images/new-design/switch.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Colors.white : Color(0Xff5A282E)), + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), SizedBox( width: 5, ), @@ -225,9 +224,9 @@ class _MyFamily extends State with TickerProviderStateMixin { // }, // ), Texts(TranslationBase.of(context).switchUser, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Colors.white : Color(0Xff5A282E), + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, fontSize: 12, - fontWeight: FontWeight.bold) + fontWeight: FontWeight.w600) ], ))), SizedBox( @@ -244,14 +243,14 @@ class _MyFamily extends State with TickerProviderStateMixin { mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset("assets/images/new-design/delete.svg", - height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Colors.white : Color(0Xff5A282E)), + height: 22, color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white), SizedBox( width: 5, ), Texts(TranslationBase.of(context).delete, - color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Colors.white : Color(0Xff5A282E), + color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 2 ? Color(0Xff5A282E) : Colors.white, fontSize: 12, - fontWeight: FontWeight.bold), + fontWeight: FontWeight.w600), ], ))), SizedBox(height: 10), @@ -334,7 +333,10 @@ class _MyFamily extends State with TickerProviderStateMixin { Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)), Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)), ])), - Divider(color: Colors.black, height: 1.5, thickness: 1.5), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), Column( children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { return Container( @@ -500,7 +502,10 @@ class _MyFamily extends State with TickerProviderStateMixin { Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)), Expanded(flex: 1, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600)) ])), - Divider(color: Colors.black, height: 1.5, thickness: 1.5), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), Column( children: snapshot.data.getAllSharedRecordsByStatusList.map((result) { return Padding( @@ -517,7 +522,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Expanded( flex: 1, child: Card( - shape: cardRadius(10), + // shape: cardRadius(10), color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), child: Padding( padding: EdgeInsets.all(5), @@ -591,7 +596,10 @@ class _MyFamily extends State with TickerProviderStateMixin { textAlign: TextAlign.center, )), ])), - Divider(color: Colors.black, height: 1.5, thickness: 1.5), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Divider(color: Colors.black, height: 1.5, thickness: 1.5), + ), Column( children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map((result) { return Padding( diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 5a859fca..7b699467 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notificatio import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.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/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -15,25 +16,6 @@ import 'package:provider/provider.dart'; // ignore: must_be_immutable class NotificationsPage extends StatelessWidget { - getDateForm(String date) { - DateTime d = DateUtil.convertStringToDate(date); - String monthName = DateUtil.getMonth(d.month).toString(); - TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); - String minute = timeOfDay.minute < 10 ? timeOfDay.minute.toString().padLeft(2, '0') : timeOfDay.minute.toString(); - - String hour = '${timeOfDay.hourOfPeriod}:$minute'; - if (timeOfDay.period == DayPeriod.am) { - hour = hour + "AM"; - } else { - { - hour = hour + "PM"; - } - } - - //DayPeriod.am - return monthName + ',${d.day},${d.year}, $hour'; - } - int currentIndex = 0; @override @@ -41,7 +23,11 @@ class NotificationsPage extends StatelessWidget { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { - GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: currentIndex, pagingSize: 14, notificationStatusID: 2); + GetNotificationsRequestModel getNotificationsRequestModel = + new GetNotificationsRequestModel( + currentPage: currentIndex, + pagingSize: 14, + notificationStatusID: 2); model.getNotifications(getNotificationsRequestModel, context); }, @@ -53,6 +39,28 @@ class NotificationsPage extends StatelessWidget { baseViewModel: model, body: ListView.separated( itemBuilder: (context, index) { + if (index == model.notifications.length) { + return InkWell( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + currentIndex++; + GetNotificationsRequestModel + getNotificationsRequestModel = + new GetNotificationsRequestModel( + currentPage: currentIndex, + pagingSize: 14, + notificationStatusID: 2); + + await model.getNotifications( + getNotificationsRequestModel, context); + GifLoaderDialogUtils.hideDialog(context); + }, + child: Center( + child: Image.asset('assets/images/notf.png'), + ), + ); + } + return InkWell( onTap: () async { if (!model.notifications[index].isRead) { @@ -69,17 +77,23 @@ class NotificationsPage extends StatelessWidget { width: double.infinity, padding: EdgeInsets.all(8.0), decoration: BoxDecoration( - color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor.withOpacity(0.05), + color: model.notifications[index].isRead + ? Theme.of(context).scaffoldBackgroundColor + : CustomColors.accentColor.withOpacity(0.05), border: projectViewModel.isArabic ? Border( right: BorderSide( - color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + color: model.notifications[index].isRead + ? Theme.of(context).scaffoldBackgroundColor + : CustomColors.accentColor, width: 5.0, ), ) : Border( left: BorderSide( - color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, + color: model.notifications[index].isRead + ? Theme.of(context).scaffoldBackgroundColor + : CustomColors.accentColor, width: 5.0, ), ), @@ -92,16 +106,25 @@ class NotificationsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) + + Texts(DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(model + .notifications[index].createdOn)) + " " + - DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false)), + DateUtil.formatDateToTimeLang( + DateUtil.convertStringToDate(model + .notifications[index].createdOn), + false)), SizedBox( height: 5, ), Row( children: [ - Expanded(child: Texts(model.notifications[index].message)), - if (model.notifications[index].messageType == "image") + Expanded( + child: Texts(model + .notifications[index].message)), + if (model + .notifications[index].messageType == + "image") Icon( FontAwesomeIcons.images, color: CustomColors.grey, @@ -130,7 +153,7 @@ class NotificationsPage extends StatelessWidget { ], ); }, - itemCount: model.notifications.length)), + itemCount: model.notifications.length + 1)), // ListView( // children: model.notifications // .map( diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index cecf8c5d..d05fae2f 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -51,6 +51,9 @@ class _PickupLocationState extends State { void initState() { super.initState(); _getCurrentLocation(); + setState(() { + + }); } _getCurrentLocation() async { @@ -61,6 +64,7 @@ class _PickupLocationState extends State { _longitude = 0; _latitude = 0; }); + } @override @@ -89,8 +93,8 @@ class _PickupLocationState extends State { context, FadePage( page: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, + latitude: _latitude??0, + longitude: _longitude??0, onPick: (value) { setState(() { _result = value; diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index e738a438..0a25ca7a 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -145,10 +145,10 @@ class RRTRequestPickupAddressPageState extends State confirmSelectLocationDialog(myAddresses), diff --git a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart index ea72c75d..4e863bd1 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart @@ -1,9 +1,10 @@ -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -12,11 +13,10 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-main-screen.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:provider/provider.dart'; class RRTPlaceOrderPage extends StatelessWidget { TranslationBase localize; @@ -29,8 +29,11 @@ class RRTPlaceOrderPage extends StatelessWidget { TextEditingController noteController = TextEditingController(text: ''); BuildContext _context; + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); _context = context; localize = TranslationBase.of(context); var lat = selectedAddress.latLong.split(',').first; @@ -171,11 +174,16 @@ class RRTPlaceOrderPage extends StatelessWidget { Map params = {}; var cordinates = selectedAddress.latLong.split(','); var latlng = LatLng(double.parse(cordinates.first), double.parse(cordinates.last)); - params['Latitude'] = latlng.latitude; - params['Longitude'] = latlng.longitude; - params['Notes'] = noteController.text; + params['latitude'] = latlng.latitude; + params['longitude'] = latlng.longitude; + params['additionalDetails'] = noteController.text; + params['nationality'] = projectViewModel.user.nationalityID; + params['paymentAmount'] = servicePrice.totalPrice; + // var response = await viewModel.createOrder(params); - var requestId = await viewModel.createOrder(params); + // var requestId = await viewModel.createOrder(params); + + var requestId = await viewModel.createOrderRC(params); GifLoaderDialogUtils.hideDialog(_context); diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index e8856ddb..5cac41dd 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -46,8 +46,8 @@ class ArrivedButtons { "caller": "askDoc", }, { - "title": TranslationBase.of(AppGlobal.context).appoSurvey, - "subtitle": TranslationBase.of(AppGlobal.context).service, + "title": TranslationBase.of(AppGlobal.context).service, + "subtitle": TranslationBase.of(AppGlobal.context).appoSurvey, "icon": "survey.svg", "caller": "Survey", } diff --git a/lib/pages/MyAppointments/widgets/askDocDialog.dart b/lib/pages/MyAppointments/widgets/askDocDialog.dart index 15af9ae7..1098a389 100644 --- a/lib/pages/MyAppointments/widgets/askDocDialog.dart +++ b/lib/pages/MyAppointments/widgets/askDocDialog.dart @@ -52,6 +52,7 @@ class _AskDocDialogState extends State { borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), color: Colors.blue, + elevation: 0, onPressed: () { if(AskDocDialog.selectedParameterCode != 0) Navigator.pop(context, AskDocDialog.selectedParameterCode); diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart index bc120df8..6a5c685c 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -57,6 +57,7 @@ class _ReminderDialogState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), color: Colors.blue, + elevation: 0, onPressed: () { print(ReminderDialog.selectedDuration); createCalendarEvent(); diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart index ed8c324c..9a315bba 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart @@ -61,7 +61,7 @@ class _ReminderDialogState extends State { child: RaisedButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)), - color: Colors.blue, + color: Colors.blue,elevation: 0, onPressed: () { createOrUpdateEvents(); }, diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 3e7678cc..ccee254b 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -33,11 +33,11 @@ class _PaymentMethodState extends State { child: Container( child: Column( mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 0.0), - alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0), + child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( @@ -52,26 +52,48 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "MADA" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: selectedPaymentMethod == "MADA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), - child: Row( - children: [ - Container( - height: 60.0, - width: 60, - padding: EdgeInsets.all(7.0), - child: Image.asset("assets/images/new/payment/Mada.png"), - ), - mWidth(12), - Text( - "Mada", - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MADA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ) - ], + mWidth(12), + Container( + height: 70.0, + width: 70.0, + padding: EdgeInsets.all(7.0), + child: Image.asset("assets/images/new/payment/Mada.png"), + ), + // mWidth(12), + // Text( + // "Mada", + // style: TextStyle( + // color: Colors.black, + // fontSize: 14, + // fontWeight: FontWeight.bold, + // ), + // ), + mFlex(1), + if (selectedPaymentMethod == "MADA") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), ), ), ), @@ -88,26 +110,49 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "VISA" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: selectedPaymentMethod == "VISA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), - child: Row( - children: [ - Container( - height: 60.0, - padding: EdgeInsets.all(7.0), - width: 60, - child: Image.asset("assets/images/new/payment/visa.png"), - ), - mWidth(12), - Text( - "VISA", - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "VISA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/visa.png"), ), - ) - ], + // mWidth(12), + // Text( + // "VISA", + // style: TextStyle( + // color: Colors.black, + // fontSize: 14, + // fontWeight: FontWeight.bold, + // ), + // ) + // , + mFlex(1), + if (selectedPaymentMethod == "VISA") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), ), ), ), @@ -124,26 +169,48 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "MASTERCARD" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: selectedPaymentMethod == "MASTERCARD" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), - child: Row( - children: [ - Container( - height: 60.0, - padding: EdgeInsets.all(7.0), - width: 60, - child: Image.asset("assets/images/new/payment/Mastercard.png"), - ), - mWidth(12), - Text( - "MasterCard", - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MASTERCARD" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ) - ], + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/Mastercard.png"), + ), + // mWidth(12), + // Text( + // "MasterCard", + // style: TextStyle( + // color: Colors.black, + // fontSize: 14, + // fontWeight: FontWeight.bold, + // ), + // ), + mFlex(1), + if (selectedPaymentMethod == "MASTERCARD") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), ), ), ), @@ -160,26 +227,48 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "Installment" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: selectedPaymentMethod == "Installment" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), - child: Row( - children: [ - Container( - height: 60.0, - padding: EdgeInsets.all(7.0), - width: 60, - child: Image.asset("assets/images/new/payment/installments.png"), - ), - mWidth(12), - Text( - "Installments", - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "Installment" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/installments.png"), ), - ) - ], + // mWidth(12), + // Text( + // "Installments", + // style: TextStyle( + // color: Colors.black, + // fontSize: 14, + // fontWeight: FontWeight.bold, + // ), + // ), + mFlex(1), + if (selectedPaymentMethod == "Installment") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), ), ), ), @@ -197,26 +286,48 @@ class _PaymentMethodState extends State { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: selectedPaymentMethod == "ApplePay" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), + side: selectedPaymentMethod == "ApplePay" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), - child: Row( - children: [ - Container( - height: 60.0, - padding: EdgeInsets.all(7.0), - width: 60, - child: Image.asset("assets/images/new/payment/Apple_Pay.png"), - ), - mWidth(12), - Text( - "Apple Pay", - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "ApplePay" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), + ), + mWidth(12), + Container( + height: 60.0, + padding: EdgeInsets.all(7.0), + width: 60, + child: Image.asset("assets/images/new/payment/Apple_Pay.png"), ), - ) - ], + // mWidth(12), + // Text( + // "Apple Pay", + // style: TextStyle( + // color: Colors.black, + // fontSize: 14, + // fontWeight: FontWeight.bold, + // ), + // ), + mFlex(1), + if (selectedPaymentMethod == "ApplePay") + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), ), ), ), @@ -279,7 +390,7 @@ class _PaymentMethodState extends State { minWidth: MediaQuery.of(context).size.height * 0.1, height: 45.0, child: RaisedButton( - color: CustomColors.accentColor, + color: CustomColors.green, textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index 7c1bf6ed..eedbb874 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -93,8 +93,8 @@ class _PaymentDialogState extends State { () { Navigator.pop(context, null); }, - color: Color(0xffEAEAEA), - textColor: Colors.black, + color: CustomColors.accentColor, + textColor: Colors.white, ), ), mWidth(10.0), @@ -104,6 +104,8 @@ class _PaymentDialogState extends State { () { Navigator.pop(context, widget.patientShareResponse); }, + color: CustomColors.green, + textColor: Colors.white, ), ), ], diff --git a/lib/pages/appUpdatePage/app_update_page.dart b/lib/pages/appUpdatePage/app_update_page.dart index 7bcf2388..1296ac38 100644 --- a/lib/pages/appUpdatePage/app_update_page.dart +++ b/lib/pages/appUpdatePage/app_update_page.dart @@ -73,6 +73,7 @@ class _AppUpdatePageState extends State { child: RaisedButton( color: Colors.red[800], textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 46a545a6..5040b200 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -5,13 +5,12 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -34,7 +33,11 @@ class _StatusFeedbackPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCOC(), + allowAny: true, + onModelReady: (model) { + model.cOCItemList.clear(); + if (projectViewModel.isLogin) model.getCOC(); + }, builder: (_, model, widget) => AppScaffold( baseViewModel: model, isShowDecPage: false, @@ -161,6 +164,7 @@ class _StatusFeedbackPageState extends State { countryCode = value; }); }), + if (model.cOCItemList.length > 0) listData(model.cOCItemList, projectViewModel.isArabic, false), ], ), ), @@ -179,9 +183,7 @@ class _StatusFeedbackPageState extends State { Future.delayed(Duration(seconds: 1), () { AppToast.showErrorToast(message: model.error); }); - } else { - listData(model.cOCItemList, projectViewModel.isArabic, false); - } + } else {} }); }, disabledColor: Colors.grey, @@ -201,8 +203,8 @@ class _StatusFeedbackPageState extends State { physics: isLogin ? null : NeverScrollableScrollPhysics(), itemBuilder: (context, index) => InkWell( onTap: () {}, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.all(10), child: Padding( padding: const EdgeInsets.all(12.0), @@ -217,7 +219,7 @@ class _StatusFeedbackPageState extends State { margin: EdgeInsets.only(top: 5.0), child: Text(cOCItemList[index].formType.toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12))), - myRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), + MyRichText(TranslationBase.of(context).number + ": ", cOCItemList[index].itemID.toString(), isArabic), Text(cOCItemList[index].cOCTitle, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), ], diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index baf38221..7e8385f0 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -1,21 +1,29 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_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/src/widgets/image.dart' as flutterImage; import 'base/base_view.dart'; - dynamic languageID; + class FinalProductsPage extends StatefulWidget { final String id; final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed + AuthenticatedUserObject authenticatedUserObject = + locator(); FinalProductsPage({this.id, this.productType = 1}); @@ -27,6 +35,7 @@ class _FinalProductsPageState extends State { String id; _FinalProductsPageState({this.id}); String categoriseName = "Personal Care"; + String appBarTitle = ""; bool styleOne = true; bool styleTwo = false; Icon styleIcon = Icon( @@ -43,29 +52,35 @@ class _FinalProductsPageState extends State { getLanguageID(); super.initState(); } + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) { if (widget.productType == 1) { model.getFinalProducts(i: id); + appBarTitle = TranslationBase.of(context).products; } else if (widget.productType == 2) { model.getManufacturerProducts(id); } else if (widget.productType == 3) { model.getLastVisitedProducts(); - } else if (widget.productType == 4){ + appBarTitle = TranslationBase.of(context).recentlyViewed; + } else if (widget.productType == 4) { model.getMostViewedProducts(); - } else if (widget.productType == 5){ + appBarTitle = TranslationBase.of(context).mostViewed; + } else if (widget.productType == 5) { model.getNewProducts(); + appBarTitle = TranslationBase.of(context).newProducts; } else { model.getBestSellerProducts(); + appBarTitle = TranslationBase.of(context).bestSellers; } }, allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( - appBarTitle: TranslationBase.of(context).products, + appBarTitle: appBarTitle, isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -84,7 +99,8 @@ class _FinalProductsPageState extends State { Padding( padding: EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).products, + "$appBarTitle " + + TranslationBase.of(context).products, fontWeight: FontWeight.w600, ), ), @@ -136,468 +152,541 @@ class _FinalProductsPageState extends State { ), styleOne == true ? Expanded( - child:model.finalProducts.length > 0 - ? Container( - height: MediaQuery.of(context).size.height * 3.90, - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 1.0, - ), - itemCount: model.finalProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.finalProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - 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: Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - 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.finalProducts[index].rxMessage != null - ? MediaQuery.of( - context) - .size - .width / - 2.8 - : 0, - padding: - EdgeInsets.all(4), - decoration: BoxDecoration( - color: - Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child:model.finalProducts[index].rxMessage != null - ? Texts( languageID == 'ar' ? model.finalProducts[index].rxMessagen - : model.finalProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w600, - ): Texts(""), - ), - ], + child: model.finalProducts.length > 0 + ? Container( + height: MediaQuery.of(context).size.height * + 3.90, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.finalProducts.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: + model.finalProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: Radius.circular( + 110.0), + ), + color: Colors.white, ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, child: Column( crossAxisAlignment: CrossAxisAlignment .start, children: [ - if (model - .finalProducts[ - index] - .discountName != - null) - Container( - width: - double.infinity, - height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), + Stack( + children: [ + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .finalProducts[ + index] + .images + .isNotEmpty + ? model + .finalProducts[ + 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, + ), ), - child: Center( - child: Texts( + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 2.8 + : 0, + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: model + .finalProducts[ + index] + .rxMessage != + null + ? Texts( + languageID == + 'ar' + ? model + .finalProducts[ + index] + .rxMessagen + : model + .finalProducts[index] + .rxMessage, + color: Colors + .white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w600, + ) + : Texts(""), + ), + ], + ), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .finalProducts[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .finalProducts[ + index] + .discountName, + regular: + true, + color: Colors + .white, + fontSize: + 10.4, + ), + ), + ), + Texts( model .finalProducts[ index] - .discountName, + .name, regular: true, - color: - Colors.white, - fontSize: 10.4, + fontSize: 12, + fontWeight: + FontWeight + .w400, ), - ), - ), - Texts( - model - .finalProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w400, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model.finalProducts[index].approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum - .toDouble() / - model - .finalProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), ], ), ), - ], - ), + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.finalProducts[ + index]), + )), + }, + )); + }, + ), + ) + : Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/images/pharmacy/empty_box.png', + width: 100, + height: 100, ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.finalProducts[index]), - )), - }, - )); - }, - ), - ) - : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: Alignment.center, - child: Image.asset( - 'assets/images/pharmacy/empty_box.png', - width: 100, - height: 100, - ), - ), - Text( - TranslationBase.of(context).noResult, - style: TextStyle( - fontSize: 20.0, + Text( + TranslationBase.of(context).noResult, + style: TextStyle( + fontSize: 20.0, // fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ], - ), - ),) + ) : Expanded( child: model.finalProducts.length > 0 - ? Container( - height: MediaQuery.of(context).size.height * 5.0, - child: ListView.builder( - itemCount: model.finalProducts.length, - itemBuilder: - (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), + ? Container( + height: MediaQuery.of(context).size.height * + 5.0, + child: ListView.builder( + itemCount: model.finalProducts.length, + itemBuilder: + (BuildContext context, int index) { + return InkWell( + child: Card( + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .finalProducts[ + index] + .images + .isNotEmpty + ? model + .finalProducts[ + 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, + ), + ), + ], ), - ), - Container( - margin: - EdgeInsets.fromLTRB( - 0, 0, 0, 0), - alignment: - Alignment.center, - child: Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - 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, + Column( + children: [ + Container( + width: model + .finalProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5.3 + : 0, + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .finalProducts[ + index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: + Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w600, + ), + ), + ], ), + ], + ), + Container( + height: 100.0, + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - ], - ), - Column( - children: [ - Container( - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( context) .size - .width / - 3.5 - : 0, - padding: - EdgeInsets.all(4), - decoration: BoxDecoration( - color: - Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular( - 6)), - ), - child: Texts( - model - .finalProducts[ - index] - .rxMessage != - null - ? model + .width * + 0.65, + child: Texts( + model .finalProducts[ index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w600, - ), - ), - ], - ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: - MediaQuery.of(context) - .size - .width * - 0.65, - child: Texts( - model.finalProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, + .name, + regular: true, + fontSize: 13.2, + fontWeight: + FontWeight.w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / + model.finalProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, + + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon(Icons.shopping_cart, + size: 18, + color: Colors.blue,), + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + if(model.finalProducts[index].rxMessage == null){ + await addToCartFunction(1, model.finalProducts[index].id); +// GifLoaderDialogUtils.hideDialog(context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + } + else{ + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + GifLoaderDialogUtils.hideDialog(context); + } + ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model - .finalProducts[ - index] - .approvedRatingSum - .toDouble() / - model - .finalProducts[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), + ):Container(), ], ), ), - ], + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.finalProducts[ + index]), + )), + }, + ); + }), + ) + : Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Align( + alignment: Alignment.center, + child: Image.asset( + 'assets/images/pharmacy/empty_box.png', + width: 100, + height: 100, + ), ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage( - model.finalProducts[index]), - )), - }, - ); - }), - ) - : Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: Alignment.center, - child: Image.asset( - 'assets/images/pharmacy/empty_box.png', - width: 100, - height: 100, - ), - ), - Text( - TranslationBase.of(context).noResult, - style: TextStyle( - fontSize: 20.0, + Text( + TranslationBase.of(context).noResult, + style: TextStyle( + fontSize: 20.0, // fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ], - ), - ), ) ], ), ), )); } + + addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); + } } diff --git a/lib/pages/insurance/insurance_approval_detail_screen.dart b/lib/pages/insurance/insurance_approval_detail_screen.dart index a1be5cf8..fa6d0f5a 100644 --- a/lib/pages/insurance/insurance_approval_detail_screen.dart +++ b/lib/pages/insurance/insurance_approval_detail_screen.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -12,6 +12,7 @@ import 'package:provider/provider.dart'; class InsuranceApprovalDetail extends StatelessWidget { final InsuranceApprovalModel insuranceApprovalModel; + InsuranceApprovalDetail({Key key, this.insuranceApprovalModel}) : super(key: key); @override @@ -71,15 +72,15 @@ class InsuranceApprovalDetail extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - myRichText(TranslationBase.of(context).clinic + ":", insuranceApprovalModel?.clinicName ?? "", projectViewModel.isArabic), - myRichText(TranslationBase.of(context).approvalNo, insuranceApprovalModel?.approvalNo.toString() ?? "", projectViewModel.isArabic), - myRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), - myRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ":", insuranceApprovalModel?.clinicName ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).approvalNo, insuranceApprovalModel?.approvalNo.toString() ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), SizedBox(height: 6), - myRichText(TranslationBase.of(context).receiptOn, - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", projectViewModel.isArabic), - myRichText(TranslationBase.of(context).expiryOn, - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", + projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", + projectViewModel.isArabic), ], ), ), diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 51422bcd..52ce35c8 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -2,12 +2,11 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -47,126 +46,128 @@ class _InsuranceApprovalState extends State { description: TranslationBase.of(context).infoApprovals, infoList: TranslationBase.of(context).infoApprovalPoints, imagesInfo: imagesInfo, - body: model.insuranceApproval.length > 0 ? ListView.separated( - padding: EdgeInsets.all(21), - physics: BouncingScrollPhysics(), - itemBuilder: (_, index) { - Color _patientStatusColor; - String _patientStatusString; + body: model.insuranceApproval.length > 0 + ? ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (_, index) { + Color _patientStatusColor; + String _patientStatusString; - if (model.insuranceApproval[index].isLiveCareAppointment) { - _patientStatusColor = Color(0xff2E303A); - _patientStatusString = TranslationBase.of(context).liveCare.capitalizeFirstofEach; - } else if (!model.insuranceApproval[index].isInOutPatient) { - _patientStatusColor = Color(0xffD02127); - _patientStatusString = TranslationBase.of(context).inPatient.capitalizeFirstofEach; - } else { - _patientStatusString = TranslationBase.of(context).outpatient.capitalizeFirstofEach; - _patientStatusColor = Color(0xffa9a089); - } - return InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceApprovalDetail(insuranceApprovalModel: model.insuranceApproval[index]))); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: _patientStatusColor), - child: Row( - children: [ - SizedBox( - width: 16, - child: RotatedBox( - quarterTurns: 3, - child: Text( - _patientStatusString, - style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), + if (model.insuranceApproval[index].isLiveCareAppointment) { + _patientStatusColor = Color(0xff2E303A); + _patientStatusString = TranslationBase.of(context).liveCare.capitalizeFirstofEach; + } else if (!model.insuranceApproval[index].isInOutPatient) { + _patientStatusColor = Color(0xffD02127); + _patientStatusString = TranslationBase.of(context).inPatient.capitalizeFirstofEach; + } else { + _patientStatusString = TranslationBase.of(context).outpatient.capitalizeFirstofEach; + _patientStatusColor = Color(0xffa9a089); + } + return InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceApprovalDetail(insuranceApprovalModel: model.insuranceApproval[index]))); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.fromLTRB(12, 10, 12, 10), - decoration: BoxDecoration( - border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(10.0), - topRight: Radius.circular(10.0), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: _patientStatusColor), + child: Row( + children: [ + SizedBox( + width: 16, + child: RotatedBox( + quarterTurns: 3, + child: Text( + _patientStatusString, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.insuranceApproval[index].approvalStatusDescption, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: model.insuranceApproval[index].status == 9 ? Color(0xff359846) : Color(0xffD02127), - letterSpacing: -0.4, - height: 18 / 10), - ), - Text( - model.insuranceApproval[index].doctorName, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.64, - ), - ), - SizedBox(height: 6), - Row( - children: [ - LargeAvatar( - name: model.insuranceApproval[index].doctorName, - url: model.insuranceApproval[index].doctorImageURL, - width: 48, - height: 48, + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.fromLTRB(12, 10, 12, 10), + decoration: BoxDecoration( + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(10.0), + topRight: Radius.circular(10.0), ), - SizedBox(width: 12), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - myRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", - projectViewModel.isArabic), - myRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), - ], - ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.insuranceApproval[index].approvalStatusDescption, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: model.insuranceApproval[index].status == 9 ? Color(0xff359846) : Color(0xffD02127), + letterSpacing: -0.4, + height: 18 / 10), ), - Container( - height: 48, - alignment: Alignment.bottomRight, - child: Icon( - Icons.arrow_forward, + Text( + model.insuranceApproval[index].doctorName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, color: Color(0xff2E303A), + letterSpacing: -0.64, ), + ), + SizedBox(height: 6), + Row( + children: [ + LargeAvatar( + name: model.insuranceApproval[index].doctorName, + url: model.insuranceApproval[index].doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", + projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), + ], + ), + ), + Container( + height: 48, + alignment: Alignment.bottomRight, + child: Icon( + Icons.arrow_forward, + color: Color(0xff2E303A), + ), + ) + ], ) ], - ) - ], + ), + ), ), - ), + ], ), - ], - ), - ), - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 12), - itemCount: model.insuranceApproval.length) : getNoDataWidget(context)), + ), + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 12), + itemCount: model.insuranceApproval.length) + : getNoDataWidget(context)), ); } diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 16995546..9e95e0fe 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -69,9 +69,8 @@ class _InsuranceCardState extends State { top: index == 0 ? 10 : 0, bottom: index == model.insurance.length - 1 ? 100 : 0, ), - child: Card( - shape: cardRadius(12), - elevation: 2, + child: Container( + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index 26425335..c6eccae1 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -51,10 +51,9 @@ class InsuranceCardUpdateDetails extends StatelessWidget { width: double.maxFinite, // height: projectViewModel.isArabic ? 320 : 240, // decoration: containerRadius(CustomColors.accentColor, 12), - child: Card( - shape: cardRadius(12), - color: CustomColors.accentColor, - elevation: 4, + child: Container( + decoration: cardRadius(12,color: CustomColors.accentColor), + child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -228,9 +227,9 @@ class InsuranceCardUpdateDetails extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - child: Card( - color: Colors.white, - shape: cardRadius(12), + child: Container( + + decoration: cardRadius(12), child: Container( width: MediaQuery.of(context).size.width, padding: EdgeInsets.all(10.0), diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 58a9e64a..fb3271fd 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -26,8 +26,8 @@ class InsurancePage extends StatelessWidget { children: [ Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: InkWell( @@ -94,8 +94,8 @@ class InsurancePage extends StatelessWidget { }, child: Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Row( diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index c6807ebb..08a7971e 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -8,12 +8,14 @@ import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -53,13 +55,13 @@ class _HomePageFragment2State extends State { hmgServices.clear(); hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); - hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); - hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); - hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergency, TranslationBase.of(context).services2, "assets/images/new/emergency.svg", isLogin)); - hmgServices.add(new HmgServices(6, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); - hmgServices.add(new HmgServices(8, TranslationBase.of(context).reachUs, TranslationBase.of(context).findUs, "assets/images/new/reach_us.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).findUs, TranslationBase.of(context).reachUs, "assets/images/new/reach_us.svg", isLogin)); } @override @@ -235,7 +237,7 @@ class _HomePageFragment2State extends State { ), FlatButton( onPressed: () { - Navigator.push(context, FadePage(page: AllHabibMedicalService())); + Navigator.push(context, FadePage(page: AllHabibMedicalSevicePage2())); }, child: Text( TranslationBase.of(context).viewAllServices, @@ -269,7 +271,7 @@ class _HomePageFragment2State extends State { ), ], ), - mHeight(140), + mHeight(60), ], ), ); @@ -281,6 +283,7 @@ class _HomePageFragment2State extends State { child: InkWell( onTap: () { Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); + }, child: Container( width: double.infinity, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart new file mode 100644 index 00000000..07958a7d --- /dev/null +++ b/lib/pages/landing/home_page.dart @@ -0,0 +1,889 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; +import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; +import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; +import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; +import 'package:diplomaticquarterapp/pages/paymentService/payment_service.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/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +import 'landing_page_pharmcy.dart'; + +class HomePage extends StatefulWidget { + final Function goToMyProfile; + + HomePage({Key key, this.goToMyProfile}); + + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => () async {}, + builder: (_, model, wi) => AppScaffold( + isShowDecPage: false, + isHelp: true, + body: Container( + width: double.infinity, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + height: 210, + decoration: BoxDecoration( + image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover), + ), + child: Stack( + children: [ + Positioned( + top: 15, + left: 5, + right: 5, + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Row( + children: [ + Expanded( + child: Container( + height: 125, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/new-design/covid_bg_transparent.png"), + fit: BoxFit.fill, + ), + color: Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all(Radius.circular(5))), + child: (model.user != null && model.user.outSA == 1) + ? Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.shade500.withOpacity(0.3), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) + : Container( + child: Column( + children: [ + Texts( + TranslationBase.of(context).covidTest, + color: Colors.white, + fontWeight: FontWeight.w700, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, + ), + child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0), + ), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Column( + children: [ + Texts( + TranslationBase.of(context).driveThru, + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.15, + height: 25.0, + child: RaisedButton( + color: Colors.red[800], + elevation: 0, + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: (model.user != null && model.user.outSA == 1) + ? () {} + : () { + navigateToCovidDriveThru(); + }, + child: Center( + child: Center( + child: Center( + child: Center( + child: Texts( + TranslationBase.of(context).bookNow, + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ), + ), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ], + ), + )), + ), + Expanded( + child: InkWell( + onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), + child: Container( + height: 125, + padding: EdgeInsets.all(15), + margin: EdgeInsets.all(5), + decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))), + child: SvgPicture.asset( + projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg', + ), + ), + ), + ), + ], + ), + ), + ) + ], + ), + ), + Container(width: double.infinity, height: projectViewModel.isArabic ? 110 : 80) + ], + ), + Positioned( + top: 155, + left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), + right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03), + child: (!model.isLogin) + ? Container( + width: double.infinity, + height: 125, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(9)), + image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.black87, + fontWeight: FontWeight.w700, + fontSize: 23, + ), + Texts( + TranslationBase.of(context).myMedicalFileSubTitle, + color: Colors.black, + fontSize: 16, + ), + Align( + alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, + child: InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.only(left: 15, right: 15), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(0)), + ), + child: Center( + child: Texts( + TranslationBase.of(context).viewMore, + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 12, + ), + ), + ), + ), + ) + ], + ), + ), + ) + : Container( + width: double.infinity, + height: projectViewModel.isArabic ? 160 : 130, + decoration: BoxDecoration( + color: HexColor('#A59E9E'), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(9)), + image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover), + ), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + Row( + children: [ + if (projectViewModel.user != null && model.isLogin) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + model.user.cRSVerificationStatus == 2 + ? Row( + children: [ + Texts( + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + Container( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), + child: SvgPicture.asset("assets/images/new-design/verification_check.svg"), + ), + ], + ) + : model.user.cRSVerificationStatus == 3 + ? Row( + children: [ + Texts( + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + Container( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0), + child: SvgPicture.asset("assets/images/new-design/pending.svg"), + ), + ], + ) + : Row( + children: [ + Texts( + model.user.firstName + " " + model.user.lastName, + color: Colors.grey[100], + bold: true, + fontSize: 15, + ), + ], + ), + Texts( + '${model.user.patientID}', + color: Colors.white, + fontSize: 14, + ), + SizedBox( + height: 5, + ), + Texts( + '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}', + color: Colors.grey[100], + fontWeight: FontWeight.normal, + fontSize: 14, + ), + ], + ), + ), + InkWell( + onTap: () { + widget.goToMyProfile(); + }, + child: Container( + margin: EdgeInsets.all(2), + width: 90, + height: 30, + decoration: BoxDecoration( + color: HexColor('#D81A2E'), + shape: BoxShape.rectangle, + border: Border.all(color: Colors.transparent, width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(5), + ), + ), + child: Center( + child: Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.white, + fontSize: 12, + textAlign: TextAlign.center, + ), + ), + ), + ) + ], + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + Image.asset( + 'assets/images/height_icon.png', + width: 35, + height: 40, + ), + Texts( + "${model.heightCm} ${TranslationBase.of(context).cm}", + color: Colors.white, + fontSize: 17, + ) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + children: [ + Image.asset( + 'assets/images/weight_icon.png', + width: 25, + height: 40, + ), + Texts('${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 17) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + children: [ + Image.asset( + 'assets/images/blood_icon.png', + width: 35, + height: 40, + ), + Texts('${model.booldType}', color: Colors.white, fontSize: 17) + ], + ), + ), + ], + ) + ], + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15), + child: InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Color(0xffB8382C), + ), + child: Padding( + padding: const EdgeInsets.all(8), + child: Row( + children: [ + Texts( + TranslationBase.of(context).offerAndPackages, + color: Colors.white, + fontSize: 20, + fontWeight: FontWeight.normal, + ), + Spacer(), + Image.asset("assets/images/offer_icon.png"), + ], + ), + ), + ), + ), + ), + if (projectViewModel.havePrivilege(64) || projectViewModel.havePrivilege(65) || projectViewModel.havePrivilege(67)) + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (projectViewModel.havePrivilege(64)) + DashboardItem( + onTap: (model.user != null && model.user.outSA == 1) + ? () {} + : () { + Navigator.push( + context, + FadePage( + page: HomeHealthCarePage(), + ), + ); + }, + child: Center( + child: Padding( + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), + child: (model.user != null && model.user.outSA == 1) + ? Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.shade500.withOpacity(0.3), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) + : Column( + children: [ + Image.asset( + 'assets/images/home_health_care_icon.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).homeHealthCare, + textAlign: TextAlign.center, + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], + )), + ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'home_healthcare_service_bg.png', + opacity: 0.5, + ), + if (projectViewModel.havePrivilege(65)) + DashboardItem( + onTap: () => (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model), + child: Center( + child: Padding( + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), + child: (model.user != null && model.user.outSA == 1) + ? Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.shade500.withOpacity(0.3), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) + : Column( + children: [ + // if (projectViewModel.user != null && model.isLogin && model.user.outSA == 1) + // Image.asset( + // 'assets/images/lock_icon.png', + // width: 50, + // height: 50, + // ), + Image.asset( + 'assets/images/pharmacy_logo.png', + width: 40, + height: 40, + ), + SizedBox( + height: 20, + ), + Texts( + TranslationBase.of(context).onlinePharmacy, + textAlign: TextAlign.center, + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], + ), + ), + ), + height: MediaQuery.of(context).size.width * 0.4, + imageName: 'al-habib_onlne_pharmacy_bg.png', + ), + if (projectViewModel.havePrivilege(67)) + DashboardItem( + onTap: (model.user != null && model.user.outSA == 1) + ? () {} + : () { + Navigator.push( + context, + FadePage( + page: CMCPage(), + ), + ); + }, + child: Center( + child: Padding( + padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0), + child: (model.user != null && model.user.outSA == 1) + ? Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.shade500.withOpacity(0.3), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) + : Column( + children: [ + Image.asset( + 'assets/images/comprehensive_medical_checkup_logo.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).cmcHeading, + textAlign: TextAlign.center, + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: SizeConfig.textMultiplier * 1.55, + ) + ], + )), + ), + height: MediaQuery.of(context).size.width * 0.4, + color: HexColor("#747C80"), + imageName: 'emergency_service_image.png', + ), + ], + ), + ), + SizedBox( + height: 8, + ), + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () => Navigator.push(context, FadePage(page: PaymentService())), + child: Container( + width: MediaQuery.of(context).size.width * 0.29, + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/al-habib_online_payment_service_icon.png', + height: 55, + ), + SizedBox( + height: 5, + ), + Texts( + TranslationBase.of(context).onlinePaymentService, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), + ), + ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + ), + ), + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: EReferralPage())); + }, + child: Container( + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/ereferral_service_icon.png', + width: 50, + height: 55, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).ereferral, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), + ), + ), + width: MediaQuery.of(context).size.width * 0.29, + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + )), + ), + if (projectViewModel.havePrivilege(60)) + Container( + width: MediaQuery.of(context).size.width * 0.29, + child: InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: ErOptions( + isAppbar: true, + ))), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/Dr_Schedule_report.png', + width: 50, + height: 50, + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).emergencyServices, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 1.7, + ) + ], + ), + ), + ), + ), + height: MediaQuery.of(context).size.width * 0.4, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Colors.white, + ), + ), + ], + ), + ), + // ), + SizedBox( + height: 5, + ), + Container( + margin: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + DashboardItem( + child: Container( + width: double.infinity, + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).hMGService, + color: Colors.white, + fontWeight: FontWeight.normal, + ), + Texts( + TranslationBase.of(context).viewAllHabibMedicalService, + color: Colors.white, + fontWeight: FontWeight.normal, + fontSize: 10, + ), + Expanded( + child: Container(), + ), + Texts( + TranslationBase.of(context).viewMore, + color: Colors.white, + //fontWeight: FontWeight.normal, + ) + ], + ), + ), + height: 100, + imageName: 'contact_us_bg.png', + opacity: 0.5, + color: Colors.grey[700], + width: MediaQuery.of(context).size.width * 0.45, + onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService())), + ), + DashboardItem( + onTap: () { + // Navigator.push( + // context, FadePage(page: FeedbackHomePage())); + Navigator.push(context, FadePage(page: ContactUsPage())); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).reachUs, + color: Colors.white, + fontWeight: FontWeight.normal, + ), + Texts( + TranslationBase.of(context).viewAllWaysReachUs, + color: Colors.white, + fontWeight: FontWeight.normal, + fontSize: 10, + ), + Expanded( + child: Container(), + ), + Texts( + TranslationBase.of(context).viewMore, + color: Colors.white, + fontWeight: FontWeight.normal, + ) + ], + ), + ), + height: 100, + imageName: 'contact_us_bg.png', + opacity: 0.5, + color: Colors.grey[700], + width: MediaQuery.of(context).size.width * 0.45, + ), + ], + ), + ), + SizedBox( + height: 120, + ) + ], + ), + ), + ), + ), + ); + } + + getPharmacyToken(DashboardViewModel model) async { + if (!model.isLogin) { + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + + await pharmacyModuleViewModel.verifyCustomer().then((value) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + }); + }); + } + } + + navigateToCovidDriveThru() { + Navigator.push(context, FadePage(page: CovidDrivethruLocation())); + } +} + +class DashboardItem extends StatelessWidget { + const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true}) + : super(key: key); + final bool hasBorder; + final String imageName; + final Widget child; + final Function onTap; + final double width; + final double height; + final Color color; + final double opacity; + final bool hasColorFilter; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Container( + width: width != null ? width : MediaQuery.of(context).size.width * 0.29, + height: height != null + ? height + : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.17 + : MediaQuery.of(context).size.height * 0.35, + decoration: BoxDecoration( + color: !hasBorder + ? color != null + ? color + : HexColor('#050705').withOpacity(opacity) + : Colors.white, + borderRadius: BorderRadius.circular(6.0), + border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), + image: imageName != null + ? DecorationImage( + image: ExactAssetImage('assets/images/$imageName'), + fit: BoxFit.cover, + colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, + ) + : null, + ), + child: Center( + child: child, + ), + ), + ); + } +} diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 5da853fb..6ae272e2 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -2,9 +2,10 @@ import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; @@ -18,6 +19,8 @@ import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.da import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import '../../locator.dart'; + class LandingPagePharmacy extends StatefulWidget { @override _LandingPagePharmacyState createState() => _LandingPagePharmacyState(); @@ -37,127 +40,102 @@ class _LandingPagePharmacyState extends State { void initState() { super.initState(); + locator().manufacturerList = []; + locator().bestSellerProducts = []; + locator().lastVisitedProducts = []; + pageController = PageController(keepPage: true); } @override Widget build(BuildContext context) { - return Scaffold( - appBar: currentTab != 4 && currentTab != 3 - ? AppBar( - backgroundColor: Color(0xff5AB145), - elevation: 0, - title: Container( - height: MediaQuery.of(context).size.height * 0.056, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5.0), - color: Colors.white, - ), - child: InkWell( - child: Padding( - padding: EdgeInsets.all(5.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, - ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], + return WillPopScope( + onWillPop: () async { + return false; + }, + child: Scaffold( + appBar: currentTab != 4 && currentTab != 3 + ? AppBar( + backgroundColor: Color(0xff5AB145), + elevation: 0, + title: Container( + height: MediaQuery.of(context).size.height * 0.056, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + color: Colors.white, + ), + child: InkWell( + child: Padding( + padding: EdgeInsets.all(5.0), + child: Row( + //crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.search, size: 25.0), + SizedBox( + width: 15.0, + ), + Texts( + TranslationBase.of(context).searchProductHere, + fontSize: 13, + ) + ], + ), ), + onTap: () { + Navigator.push( + context, + FadePage(page: SearchProductsPage()), + ); + }, ), - onTap: () { - Navigator.push( - context, - FadePage(page: SearchProductsPage()), + ), + leading: Builder( + builder: (BuildContext context) { + return InkWell( + onTap: () { + setState(() { + currentTab = 0; + pageController.jumpToPage(0); + }); + }, + child: Container( + height: 2.0, + width: 10.0, + child: Image.asset( + 'assets/images/pharmacy_logo.png', + ), + ), ); }, ), - ), - leading: Builder( - builder: (BuildContext context) { - return InkWell( - onTap: () { - setState(() { - currentTab = 0; - pageController.jumpToPage(0); - }); - }, - child: Container( - height: 2.0, - width: 10.0, - child: Image.asset( - 'assets/images/pharmacy_logo.png', + actions: [ + IconButton( + // iconSize: 70, + icon: Image.asset( + 'assets/images/new-design/qr-code.png', ), - ), - ); - }, - ), - actions: [ - IconButton( - // iconSize: 70, - icon: Image.asset( - 'assets/images/new-design/qr-code.png', - ), - onPressed: _scanQrAndGetProduct //do something, - ) - ], - 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(), - controller: pageController, - 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, - index: currentTab, + onPressed: _scanQrAndGetProduct //do something, + ) + ], + centerTitle: true, + ) + : null, + extendBody: false, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [ + PharmacyPage(), + PharmacyCategorisePage(), + PharmacyProfilePage(), + CartOrderPage(changeTab: _changeCurrentTab), + ], + ), + bottomNavigationBar: BottomNavPharmacyBar( + changeIndex: _changeCurrentTab, + index: currentTab, + ), ), ); } @@ -172,7 +150,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/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart index a0665e85..54417ee4 100644 --- a/lib/pages/landing/widgets/logged_slider_view.dart +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -19,16 +19,15 @@ class LoggedSliderView extends StatelessWidget { @override Widget build(BuildContext context) { //'${DateUtil.getMonthDayYearDateFormatted(sliderData.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}', - return Card( - shape: cardRadius(20), - elevation: 0, + return Container( + decoration: cardRadius(20), + margin: EdgeInsets.all(0), - child: Card( - shape: cardRadius(20), + child: Container( + decoration: cardRadius(20,color: sliderData.darkColor), clipBehavior: Clip.antiAlias, margin: EdgeInsets.zero, - color: sliderData.darkColor, - elevation: 0, + // padding: EdgeInsets.zero, child: Stack( children: [ diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index e083448c..2eae79d3 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -1,24 +1,48 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/smart_watch_instructions.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../../locator.dart'; +import '../landing_page.dart'; +import '../landing_page_pharmcy.dart'; class ServicesView extends StatelessWidget { HmgServices hmgServices; int index; + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + PharmacyModuleViewModel pharmacyModuleViewModel = locator(); ServicesView(this.hmgServices, this.index); @@ -46,6 +70,83 @@ class ServicesView extends StatelessWidget { Navigator.push(context, FadePage(page: H2OPage())); } else if (index == 8) { Navigator.push(context, FadePage(page: ContactUsPage())); + } else if (index == 9) { + Navigator.push( + context, + FadePage( + page: MedicalProfilePageNew(), + ), + ); + } else if (index == 10) { + Navigator.push( + context, + FadePage( + page: Search(), + ), + ); + } else if (index == 11) { + getPharmacyToken(context); + } else if (index == 12) { + Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), + ), + ); + } else if (index == 13) { + Navigator.push( + context, + FadePage( + page: MyFamily(), + ), + ); + } else if (index == 14) { + Navigator.push( + context, + FadePage(page: ChildVaccinePage()), + ); + } else if (index == 15) { + Navigator.pop(context); + LandingPage.shared.switchToDoFromHMGServices(); + } else if (index == 16) { + Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ); + } else if (index == 17) { + Navigator.push( + context, + FadePage( + page: (HealthCalculators()), + ), + ); + } else if (index == 18) { + Navigator.push( + context, + FadePage( + page: HealthConverter(), + ), + ); + } else if (index == 19) { + Navigator.push( + context, + FadePage(page: SmartWatchInstructions()), + ); + } else if (index == 20) { + Navigator.push( + context, + FadePage( + page: ParkingPage(), + ), + ); + } else if (index == 21) { + launch("https://hmgwebservices.com/vt_mobile/html/index.html"); + } else if (index == 22) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => MyWebView( + title: "HMG News", + selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + ),),); } }, child: Container( @@ -147,4 +248,23 @@ class ServicesView extends StatelessWidget { ), ); } + + getPharmacyToken(BuildContext context) async { + if (!authProvider.isLogin) { + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if (pharmacyModuleViewModel.error.isNotEmpty) { + await pharmacyModuleViewModel.createUser().then((value) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + }); + } else { + GifLoaderDialogUtils.hideDialog(context); + Navigator.push(context, FadePage(page: LandingPagePharmacy())); + } + }); + } + } } diff --git a/lib/pages/landing/widgets/slider_view.dart b/lib/pages/landing/widgets/slider_view.dart index 09a8f50d..5030d004 100644 --- a/lib/pages/landing/widgets/slider_view.dart +++ b/lib/pages/landing/widgets/slider_view.dart @@ -17,16 +17,14 @@ class SliderView extends StatelessWidget { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - return Card( - shape: cardRadius(20), - elevation: 0, + return Container( + decoration: cardRadius(20), margin: EdgeInsets.all(0), - child: Card( - shape: cardRadius(20), + child: Container( + decoration: cardRadius(20,color: Color(0xFFF2B353E)), clipBehavior: Clip.antiAlias, margin: EdgeInsets.zero, - color: Color(0xFFF2B353E), - elevation: 0, + // padding: EdgeInsets.zero, child: Container( width: double.infinity, @@ -92,8 +90,9 @@ class SliderView extends StatelessWidget { height: MediaQuery.of(context).size.width / 14, width: MediaQuery.of(context).size.width / (projectViewModel.isArabic ? 4 : 6), child: RaisedButton( - shape: cardRadius(8), + shape: cardRadiusNew(8), color: Color(0xFFFBF2E31), + elevation: 0, padding: EdgeInsets.zero, onPressed: () { onLoginClick(); diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index 839fb02c..26d2e829 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -132,6 +132,7 @@ class _LiveCarePendingRequestState extends State { child: RaisedButton( color: Colors.red[800], textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 3e2ba0cf..afb41ea2 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -485,6 +485,7 @@ class _clinic_listState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: startScheduleLiveCare, diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 8fd61e4b..59ad1e3a 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -64,7 +64,10 @@ class _Login extends State { if (BASE_URL.contains("uat.")) { nationalIDorFile.text = "2001273"; mobileNumberController.text = mobileNo = "0555416043"; - } + }/* else { + nationalIDorFile.text = "3376044"; + mobileNumberController.text = mobileNo = "0555416575"; + }*/ } getDeviceToken() async { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 52bfe5a5..f7def7c8 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -14,15 +14,12 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart' as intl; -import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; class Register extends StatefulWidget { @@ -131,73 +128,7 @@ class _Register extends State { Icons.calendar_today, size: 16, ))) - : - - // ? TextFields( - // onChanged: (value) => {dob = value}, - // hintText: 'DD/MM/YYYY', - // suffixIcon: Icons.date_range, - // hintColor: Colors.black, - // ) - // ? Directionality(textDirection: TextDirection.ltr, child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYY", dob)) - - // ? Container( - // padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - // alignment: Alignment.center, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(15), - // color: Colors.white, - // border: Border.all( - // color: Color(0xffefefef), - // width: 1, - // ), - // ), - // child: InkWell( - // onTap: () {}, - // child: Row( - // children: [ - // Expanded( - // child: Column( - // mainAxisSize: MainAxisSize.min, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Text( - // TranslationBase.of(context).dob, - // style: TextStyle( - // fontSize: 11, - // fontWeight: FontWeight.w600, - // color: Color(0xff2B353E), - // letterSpacing: -0.44, - // ), - // ), - // TextField( - // scrollPadding: EdgeInsets.zero, - // keyboardType: TextInputType.number, - // decoration: InputDecoration( - // suffix: Icon(Icons.date_range), - // contentPadding: EdgeInsets.zero, - // border: InputBorder.none, - // focusedBorder: InputBorder.none, - // enabledBorder: InputBorder.none, - // ), - // maxLines: , - // onChanged: (value) => {dob = value}, - // style: TextStyle( - // fontSize: 14, - // height: 21 / 14, - // fontWeight: FontWeight.w400, - // color: Color(0xff2B353E), - // letterSpacing: -0.44, - // ), - // ), - // ], - // ), - // ), - // ], - // ), - // ), - // ) - Container( + : Container( child: InkWell( onTap: () { if (isHijri != null) _selectDate(context); @@ -211,55 +142,10 @@ class _Register extends State { Icons.calendar_today, size: 16, )))))), - - // RaisedButton.icon( - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(15.0), - // ), - - // color: Colors.white, - // onPressed: () => }, - // icon: Icon(Icons.date_range), - // label: Text(selectedDate != null ? "${selectedDate.toLocal()}".split(' ')[0] : TranslationBase.of(context).dob))) ]) ], ), ), - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - // children: [ - // // MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - // // Container( - // // child: TextFields( - // // controller: nationalIDorFile, - // // onChanged: (value) => validateForm(), - // // keyboardType: TextInputType.number, - // // prefixIcon: Icon(Icons.chrome_reader_mode, color: Color(0xFF40ACC9)), - // // padding: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), - // // hintText: TranslationBase.of(context).nationalID, - // // )), - // ], - // ), - // ), - // Column( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // Divider( - // color: Colors.grey, - // height: 2, - // ), - // SizedBox( - // height: 10, - // ), - // Row( - // children: [ - // Expanded( - // child:) - // ], - // ), - // ], - // )) ]), )), bottomSheet: Container( diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 389c9dc9..26b6421c 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -79,8 +80,8 @@ class _WelcomeLogin extends State { () => { Navigator.of(context).push(FadePage(page: Register())), }, - color: Color(0xffEAEAEA), - textColor: Color(0xff000000), + color: CustomColors.accentColor, + textColor: Colors.white, ), ), SizedBox(width: 8), @@ -90,7 +91,7 @@ class _WelcomeLogin extends State { () => { Navigator.of(context).push(FadePage(page: LoginType())), }, - color: Color(0xffD02127), + color: CustomColors.green, ), ), ], diff --git a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart index 87f5b0c4..6af41514 100644 --- a/lib/pages/medical/active_medications/ActiveMedicationsPage.dart +++ b/lib/pages/medical/active_medications/ActiveMedicationsPage.dart @@ -29,9 +29,9 @@ class ActiveMedicationsPage extends StatelessWidget { itemCount: model.activePrescriptionReport.length, itemBuilder: (context, index) => Container( width: double.infinity, - child: Card( + child: Container( margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), - shape: cardRadius(12), + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.only(top: 12, bottom: 20, left: 20, right: 20), child: Column( @@ -52,7 +52,7 @@ class ActiveMedicationsPage extends StatelessWidget { Row( children: [ Container( - child: Card( + child: Container( child: Image.memory( Utils.dataFromBase64String(model.activePrescriptionReport[index].imageString), fit: BoxFit.cover, @@ -61,7 +61,7 @@ class ActiveMedicationsPage extends StatelessWidget { ), margin: EdgeInsets.zero, clipBehavior: Clip.antiAlias, - shape: cardRadius(2000), + decoration: cardRadius(2000), ), clipBehavior: Clip.antiAlias, decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1), diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index e1a0b843..2d79219d 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -31,7 +31,11 @@ class ConfirmPaymentPage extends StatefulWidget { final String selectedPaymentMethod; AuthenticatedUser authenticatedUser; - ConfirmPaymentPage({this.advanceModel, this.patientInfoAndMobileNumber, this.selectedPaymentMethod, this.authenticatedUser}); + ConfirmPaymentPage( + {this.advanceModel, + this.patientInfoAndMobileNumber, + this.selectedPaymentMethod, + this.authenticatedUser}); @override _ConfirmPaymentPageState createState() => _ConfirmPaymentPageState(); @@ -47,12 +51,16 @@ class _ConfirmPaymentPageState extends State { void submit(MyBalanceViewModel model, code) { final activationCode = code; GifLoaderDialogUtils.showMyDialog(AppGlobal.context); - model.checkActivationCodeForAdvancePayment(activationCode: activationCode).then((value) { + model + .checkActivationCodeForAdvancePayment(activationCode: activationCode) + .then((value) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); Navigator.pop(context, true); - AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + AppoitmentAllHistoryResultList appo = + new AppoitmentAllHistoryResultList(); appo.projectID = widget.patientInfoAndMobileNumber.projectID; - openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null); + openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, + double.parse(widget.advanceModel.amount), null); }); } @@ -70,22 +78,6 @@ class _ConfirmPaymentPageState extends State { Navigator.pop(context), }, ).displayDialog(context); - - // showDialog( - // context: context, - // barrierDismissible: false, - // child: ConfirmSMSDialog( - // phoneNumber: patientInfoAndMobileNumber.mobileNumber, - // ), - // ).then((value) { - // print("dialog dismissed"); - // print(value); - // if (value != null && value) { - // AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); - // appo.projectID = patientInfoAndMobileNumber.projectID; - // openPayment(selectedPaymentMethod, authenticatedUser, double.parse(advanceModel.amount), null); - // } - // }); } return BaseView( @@ -120,11 +112,13 @@ class _ConfirmPaymentPageState extends State { Container( height: 100.0, padding: EdgeInsets.all(7.0), - width: MediaQuery.of(context).size.width * 0.45, - child: widget.selectedPaymentMethod == "ApplePay" ? SvgPicture.asset(getImagePath(widget.selectedPaymentMethod)) : Image.asset(getImagePath(widget.selectedPaymentMethod)), + width: MediaQuery.of(context).size.width * 0.30, + child: Image.asset( + getImagePath(widget.selectedPaymentMethod)), ), Text( - '${widget.advanceModel.amount} SAR', + '${widget.advanceModel.amount} ' + + TranslationBase.of(context).sar, style: TextStyle( fontSize: 20, fontWeight: FontWeight.w900, @@ -153,7 +147,8 @@ class _ConfirmPaymentPageState extends State { margin: EdgeInsets.all(3), child: NewTextFields( hintText: TranslationBase.of(context).name, - initialValue: widget.patientInfoAndMobileNumber.firstName, + initialValue: + widget.patientInfoAndMobileNumber.firstName, isEnabled: false, ), ), @@ -173,7 +168,11 @@ class _ConfirmPaymentPageState extends State { ), NewTextFields( hintText: TranslationBase.of(context).depositorName, - initialValue: model.user.firstName + " " + model.user.middleName + " " + model.user.lastName, + initialValue: model.user.firstName + + " " + + model.user.middleName + + " " + + model.user.lastName, isEnabled: false, ), SizedBox( @@ -198,9 +197,14 @@ class _ConfirmPaymentPageState extends State { TranslationBase.of(context).confirm.toUpperCase(), () { GifLoaderDialogUtils.showMyDialog(context); - model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) { + model + .sendActivationCodeForAdvancePayment( + patientID: int.parse(widget.advanceModel.fileNumber), + projectID: widget.advanceModel.hospitalsModel.iD) + .then((value) { GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model); + if (model.state != ViewState.ErrorLocal && + model.state != ViewState.Error) showSMSDialog(model); }); }, ), @@ -213,35 +217,54 @@ class _ConfirmPaymentPageState extends State { String getImagePath(String paymentMethod) { switch (paymentMethod) { case "MADA": - return 'assets/images/new-design/mada.png'; + return 'assets/images/new/payment/Mada.png'; break; case "SADAD": return 'assets/images/new-design/sadad.png'; break; case "VISA": - return 'assets/images/new-design/visa.png'; + return 'assets/images/new/payment/visa.png'; break; case "MASTERCARD": - return 'assets/images/new-design/mastercard.png'; + return 'assets/images/new/payment/Mastercard.png'; break; case "Installment": - return 'assets/images/new-design/installment.png'; + return 'assets/images/new/payment/installments.png'; break; case "ApplePay": - return 'assets/images/new-design/applepay.svg'; + return 'assets/images/new/payment/Apple_Pay.png'; break; } return 'assets/images/new-design/mada.png'; } - openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { - browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart); + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, + double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser( + onExitCallback: onBrowserExit, + appo: appo, + onLoadStartCallback: onBrowserLoadStart); - transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); + transID = Utils.getAdvancePaymentTransID( + widget.advanceModel.hospitalsModel.iD, + int.parse(widget.advanceModel.fileNumber)); - browser.openPaymentBrowser(amount, "Advance Payment", transID, widget.advanceModel.hospitalsModel.iD.toString(), widget.advanceModel.email, paymentMethod, - widget.patientInfoAndMobileNumber.patientType, widget.advanceModel.patientName, widget.advanceModel.fileNumber, authenticatedUser, browser, false, "3", ""); + browser.openPaymentBrowser( + amount, + "Advance Payment", + transID, + widget.advanceModel.hospitalsModel.iD.toString(), + widget.advanceModel.email, + paymentMethod, + widget.patientInfoAndMobileNumber.patientType, + widget.advanceModel.patientName, + widget.advanceModel.fileNumber, + authenticatedUser, + browser, + false, + "3", + ""); } onBrowserLoadStart(String url) { @@ -293,11 +316,23 @@ class _ConfirmPaymentPageState extends State { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service.HIS_createAdvancePayment(appo, widget.advanceModel.hospitalsModel.iD.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], widget.patientInfoAndMobileNumber.patientType, - widget.advanceModel.patientName, widget.advanceModel.fileNumber, AppGlobal.context) + service.HIS_createAdvancePayment( + appo, + widget.advanceModel.hospitalsModel.iD.toString(), + res['Amount'], + res['Fort_id'], + res['PaymentMethod'], + widget.patientInfoAndMobileNumber.patientType, + widget.advanceModel.patientName, + widget.advanceModel.fileNumber, + AppGlobal.context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); - addAdvancedNumberRequest(res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, 0, appo); + addAdvancedNumberRequest( + res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), + paymentReference, + 0, + appo); }).catchError((err) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: err); @@ -305,9 +340,13 @@ class _ConfirmPaymentPageState extends State { }); } - addAdvancedNumberRequest(String advanceNumber, String paymentReference, dynamic appointmentID, AppoitmentAllHistoryResultList appo) { + addAdvancedNumberRequest(String advanceNumber, String paymentReference, + dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); - service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, AppGlobal.context).then((res) { + service + .addAdvancedNumberRequest( + advanceNumber, paymentReference, appointmentID, AppGlobal.context) + .then((res) { print(res); GifLoaderDialogUtils.hideDialog(AppGlobal.context); navigateToHome(AppGlobal.context); diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 63ab557d..8c98ebc8 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -123,15 +124,15 @@ class MyBalancePage extends StatelessWidget { ), bottomSheet: Container( // height: MediaQuery.of(context).size.height * 0.12, - height: 85.0, + height: 70.0, color: Colors.white, width: double.infinity, padding: EdgeInsets.all(12), - child: SecondaryButton( - textColor: Colors.white, - color: CustomColors.accentColor, - label: TranslationBase.of(context).createAdvancedPayment, - onTap: () { + child: DefaultButton( + // textColor: Colors.white, + // color: CustomColors.accentColor, + TranslationBase.of(context).createAdvancedPayment, + () { Navigator.push(context, FadePage(page: AdvancePaymentPage())); }, ), diff --git a/lib/pages/medical/eye/ClassesPage.dart b/lib/pages/medical/eye/ClassesPage.dart index 563a7ce3..bb38d095 100644 --- a/lib/pages/medical/eye/ClassesPage.dart +++ b/lib/pages/medical/eye/ClassesPage.dart @@ -20,9 +20,8 @@ class ClassesPage extends StatelessWidget { margin: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 20), child: Column( children: [ - Card( - shape: cardRadius(12), - elevation: 1, + Container( + decoration: cardRadius(12), child: Container( child: Column( @@ -51,9 +50,8 @@ class ClassesPage extends StatelessWidget { SizedBox( height: 12, ), - Card( - shape: cardRadius(12), - elevation: 1, + Container( + decoration: cardRadius(12), child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index a681b2f0..007a5527 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -28,9 +28,8 @@ class ContactLensPage extends StatelessWidget { margin: EdgeInsets.only(top: 20, left: 20, right: 20, bottom: 20), child: Column( children: [ - Card( - shape: cardRadius(12), - elevation: 1, + Container( + decoration: cardRadius(12), child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -61,9 +60,8 @@ class ContactLensPage extends StatelessWidget { SizedBox( height: 12, ), - Card( - shape: cardRadius(12), - elevation: 1, + Container( + decoration: cardRadius(12), child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/medical/labs/passport_update_page.dart b/lib/pages/medical/labs/passport_update_page.dart index f9a665d1..cca80905 100644 --- a/lib/pages/medical/labs/passport_update_page.dart +++ b/lib/pages/medical/labs/passport_update_page.dart @@ -48,8 +48,8 @@ class _PassportUpdatePageState extends State { children: [ Container( width: double.infinity, - child: Card( - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.all(12.0), diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index dc7ff71f..d128f460 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -40,7 +40,7 @@ class _MedicalProfilePageState extends State { showNewAppBar: true, isHelp: true, showNewAppBarTitle: true, - appBarTitle: TranslationBase.of(context).medicalFile, + appBarTitle: TranslationBase.of(context).medicalFileTitle, onTap: widget.onTap, body: Container( child: SingleChildScrollView( @@ -82,7 +82,7 @@ class _MedicalProfilePageState extends State { ) : Container(), Text( - TranslationBase.of(context).medicalFile, + TranslationBase.of(context).medicalFileTitle, style: TextStyle( color: Colors.black, fontSize: SizeConfig.textMultiplier * 3, diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 9a6a9b03..55a91b9a 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -10,7 +10,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -75,9 +75,9 @@ class _InvoiceDetailState extends State { }, ), Container( - child: Card( - elevation: 3.0, - shape: cardRadius(12), + child: Container( + + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(12.0), @@ -100,9 +100,8 @@ class _InvoiceDetailState extends State { ), Container( width: double.infinity, - child: Card( - elevation: 3.0, - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), @@ -113,13 +112,13 @@ class _InvoiceDetailState extends State { margin: EdgeInsets.only(bottom: 10.0), child: Text(TranslationBase.of(context).cardDetail, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)), ), - myRichText( + MyRichText( TranslationBase.of(context).insuranceCompany + ": ", projectViewModel.isArabic ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].groupNameN : widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].companyName, projectViewModel.isArabic), - myRichText( + MyRichText( TranslationBase.of(context).insuranceID + ": ", widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID != null ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID : "N/A", projectViewModel.isArabic), @@ -130,9 +129,8 @@ class _InvoiceDetailState extends State { ), Container( width: double.infinity, - child: Card( - elevation: 3.0, - shape: cardRadius(12), + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), @@ -157,7 +155,7 @@ class _InvoiceDetailState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider( Color(0xffEFEFEF),), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), @@ -175,7 +173,7 @@ class _InvoiceDetailState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider( Color(0xffEFEFEF),), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), @@ -190,7 +188,7 @@ class _InvoiceDetailState extends State { ], ), ), - mDivider(Colors.grey[600]), + mDivider( Color(0xffEFEFEF),), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index d7dcafa7..6857b6cd 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -12,8 +12,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; + import 'AddWeightPage.dart'; import 'WeightMonthlyPage.dart'; import 'WeightWeeklyPage.dart'; @@ -82,49 +81,64 @@ class _WeightHomePageState extends State with SingleTickerProvid ), ], baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget( - tabController: _tabController, - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - WeightWeeklyPage( - model: model, - ), - WeightMonthlyPage( - model: model, - ), - WeightYearPage( - model: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: FloatingActionButton( - child: Icon( - Icons.add, - color: Colors.white, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], ), - backgroundColor: CustomColors.accentColor, - onPressed: () { - Navigator.push( - context, - FadePage( - page: AddWeightPage( + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + WeightWeeklyPage( model: model, ), - ), - ); - }, + WeightMonthlyPage( + model: model, + ), + WeightYearPage( + model: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: FloatingActionButton( + child: Icon( + Icons.add, + color: Colors.white, ), + backgroundColor: CustomColors.accentColor, + onPressed: () { + Navigator.push( + context, + FadePage( + page: AddWeightPage( + model: model, + ), + ), + ); + }, ), ), ); diff --git a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart index 3cc02dba..ffe5e5a6 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightMonthlyPage.dart @@ -1,16 +1,16 @@ import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class WeightMonthlyPage extends StatelessWidget { final WeightPressureViewModel model; @@ -20,75 +20,71 @@ class WeightMonthlyPage extends StatelessWidget { this.model, }) : super(key: key); List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); groupData(); - return AppScaffold( - isShowDecPage: false, - backgroundColor: CustomColors.appBackgroudGrey2Color, - body: ListView( - children: [ - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: MonthLineChartCurved( - horizontalInterval: 1.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData, - indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, - ), + return ListView( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: MonthLineChartCurved( + horizontalInterval: 1.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData, + indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, ), - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weighMonthTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + // 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weighMonthTimeSeriesData.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Column(children: [ - for (var monthly in monthlyGroup) - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.maxFinite, - padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Texts(monthly[0])), - Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - // 2: FlexColumnWidth(1.8), - }, - children: fullData(context, monthly[1]), - ) - ]) - ]) - ], - ), - ) - ], - ), + ) + ], ), - mHeight(80), - ], - ), + ), + mHeight(80), + ], ); } @@ -108,9 +104,9 @@ class WeightMonthlyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false), - Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), - Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart index 6725874f..b97e118b 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightWeeklyPage.dart @@ -1,5 +1,6 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -7,74 +8,71 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'AddWeightPage.dart'; class WeightWeeklyPage extends StatelessWidget { final WeightPressureViewModel model; - const WeightWeeklyPage({Key key, this.model}) : super(key: key); + WeightWeeklyPage({Key key, this.model}) : super(key: key); + + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - return AppScaffold( - isShowDecPage: false, - backgroundColor: CustomColors.appBackgroudGrey2Color, - body: ListView( - children: [ - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: ShowChart( - title: TranslationBase.of(context).weight, - timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData, - indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, - horizontalInterval: 2, - ), + if (projectViewModel == null) projectViewModel = Provider.of(context); + return ListView( + children: [ + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + title: TranslationBase.of(context).weight, + timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData, + indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, + horizontalInterval: 2, ), - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightWeekTimeSeriesData.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - }, - children: fullData(context, model), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightWeekTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), ), - ], - ), - ) - ], - ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context, model), + ), + ], + ), + ) + ], ), - mHeight(80), - ], - ), + ), + mHeight(80), + ], ); } @@ -95,9 +93,9 @@ class WeightWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false), - Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), - Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 12), Container( diff --git a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart index c0c2142b..b22da46f 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightYeaPage.dart @@ -23,70 +23,66 @@ class WeightYearPage extends StatelessWidget { this.model, }) : super(key: key); List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); groupData(); - return AppScaffold( - isShowDecPage: false, - backgroundColor: CustomColors.appBackgroudGrey2Color, - body: ListView( - children: [ - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: ShowChart( - horizontalInterval: 2.0, - title: TranslationBase.of(context).weight, - timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData, - indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", - )), - - Card( - shape: cardRadius(12), - elevation: 1, + return ListView( + children: [ + Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start,children: [ Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), - ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightYearTimeSeriesData.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Column(children: [ - for (var monthly in monthlyGroup) - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.maxFinite, - padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Texts(monthly[0])), - Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - }, - children: fullData(context, monthly[1]), - ) - ]) - ]), - ], - ), - )], - ), + child: ShowChart( + horizontalInterval: 2.0, + title: TranslationBase.of(context).weight, + timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData, + indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", + )), + + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start,children: [ Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), ), - mHeight(80), - ], - ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightYearTimeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + ], + ), + )], + ), + ), + mHeight(80), + ], ); } @@ -107,9 +103,9 @@ class WeightYearPage extends StatelessWidget { TableRow( children: [ Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.weightDate)} ', - isCapitable: false), - Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false), - Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false), + isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightDate.hour}:${diabtec.weightDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.weightMeasured}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index d0a68588..7501e910 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -45,100 +44,116 @@ class _BloodPressureHomePageState extends State with Sing return BaseView( onModelReady: (model) => model.getBloodPressure(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodPressure, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget( - tabController: _tabController, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).bloodPressure, + showNewAppBar: true, + showNewAppBarTitle: true, + baseViewModel: model, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - BloodPressureWeeklyPage( - model: model, - ), - BloodPressureMonthlyPage( + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + BloodPressureWeeklyPage( + model: model, + ), + BloodPressureMonthlyPage( + model: model, + ), + BloodPressureYearPage( + model: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: Stack(children: [ + Positioned( + bottom: 60, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodPressurePage( model: model, + ))).then((value) { + model.getBloodPressure(); + }); + }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, ), - BloodPressureYearPage( - model: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: Stack(children: [ - Positioned( - bottom: 60, - right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodPressurePage( - model: model, - ))).then((value) { - model.getBloodPressure(); + )), + )) + ]), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); }); }, - child: Container( - width: 50, - height: 50, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), - )), - )) - ]), - bottomSheet: Container( - color: Theme.of(context).scaffoldBackgroundColor, - child: Padding( - padding: const EdgeInsets.all(12.0), - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async { - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).emailSentSuccessfully, - ); - } - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, - ), - ); - }, - // label: TranslationBase.of(context).sendEmail, - // backgroundColor: Colors.red[900], - ), - ), + ), + ); + }, + // label: TranslationBase.of(context).sendEmail, + // backgroundColor: Colors.red[900], ), - )), + ), + ), + ), ); } } diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart index 049636a9..8dd26f41 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureMonthly.dart @@ -1,80 +1,82 @@ import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BloodPressureMonthlyPage extends StatelessWidget { final BloodPressureViewMode model; BloodPressureMonthlyPage({Key key, this.model}) : super(key: key); List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); groupData(); - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: MonthCurvedChartBloodPressure( - horizontalInterval: 20.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataTop, - timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: + MonthCurvedChartBloodPressure( + horizontalInterval: 20.0, + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weighMonthTimeSeriesDataTop.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataTop, + timeSeries2: model.weighMonthTimeSeriesDataLow.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesDataLow, + indexes: model.weighMonthTimeSeriesDataLow.length ~/ 5.5, ), - SizedBox( - height: 12, + ), + SizedBox( + height: 12, + ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Texts(TranslationBase.of(context).details), + // ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weighMonthTimeSeriesDataTop.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], ), - // Padding( - // padding: const EdgeInsets.all(8.0), - // child: Texts(TranslationBase.of(context).details), - // ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weighMonthTimeSeriesDataTop.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Column(children: [ - for (var monthly in monthlyGroup) - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.maxFinite, - padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Texts(monthly[0])), - Table( - columnWidths: { - 0: FlexColumnWidth(1.8), - 2: FlexColumnWidth(1.8), - }, - children: fullData(context, monthly[1]), - ) - ]) - ]), - SizedBox(height: 80) - ], - ), - ) - ], - ), + ) + ], ); } @@ -86,7 +88,7 @@ class BloodPressureMonthlyPage extends StatelessWidget { Utils.tableColumnTitle(TranslationBase.of(context).date), Utils.tableColumnTitle(TranslationBase.of(context).time), Utils.tableColumnTitle(TranslationBase.of(context).arm), - Utils.tableColumnTitle(TranslationBase.of(context).sysdias), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); @@ -95,10 +97,10 @@ class BloodPressureMonthlyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false), - Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false), - Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false), - Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart index 1b1334e9..893fc468 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureYeaPage.dart @@ -1,6 +1,8 @@ import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart'; +import 'package:diplomaticquarterapp/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -9,69 +11,68 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BloodPressureYearPage extends StatelessWidget { final BloodPressureViewMode model; BloodPressureYearPage({Key key, this.model}) : super(key: key); List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); groupData(); - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - color: Colors.white, - child: CurvedChartBloodPressure( - horizontalInterval: 3.0, - // model.weightWeekTimeSeriesDataLow.length==1 ?1 :20.0, - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataTop, - timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + color: Colors.white, + child: LineChartCurvedBloodPressure( + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightYearTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataTop, + timeSeries2: model.weightYearTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), - SizedBox( - height: 12, + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.weightYearTimeSeriesDataTop.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in monthlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.weightYearTimeSeriesDataTop.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Column(children: [ - for (var monthly in monthlyGroup) - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.maxFinite, - padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Texts(monthly[0])), - Table( - columnWidths: { - 0: FlexColumnWidth(1.8), - 2: FlexColumnWidth(1.8), - }, - children: fullData(context, monthly[1]), - ) - ]) - ]), - SizedBox(height: 80) - ], - ), - ) - ], - ), + ) + ], ); } @@ -83,7 +84,7 @@ class BloodPressureYearPage extends StatelessWidget { Utils.tableColumnTitle(TranslationBase.of(context).date), Utils.tableColumnTitle(TranslationBase.of(context).time), Utils.tableColumnTitle(TranslationBase.of(context).arm), - Utils.tableColumnTitle(TranslationBase.of(context).sysdias), + Utils.tableColumnTitle(TranslationBase.of(context).value), ], ), ); @@ -92,10 +93,10 @@ class BloodPressureYearPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false), - Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false), - Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false), - Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.bloodPressureDate.hour}:${diabtec.bloodPressureDate.minute}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredArmDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart index f3bdb057..7686d03f 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/bloodPressureWeeklyPage.dart @@ -1,70 +1,72 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/blood_pressure_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'AddBloodPressurePage.dart'; class BloodPressureWeeklyPage extends StatelessWidget { final BloodPressureViewMode model; - const BloodPressureWeeklyPage({Key key, this.model}) : super(key: key); + BloodPressureWeeklyPage({Key key, this.model}) : super(key: key); + + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 12.0), - padding: EdgeInsets.only(bottom: 12.0), - color: Colors.white, - child: LineChartCurvedBloodPressure( - title: TranslationBase.of(context).bloodPressure, - timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataTop, - timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataLow, - indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, - ), - ), - SizedBox( - height: 12, + if (projectViewModel == null) projectViewModel = Provider.of(context); + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 12.0), + padding: EdgeInsets.only(bottom: 12.0), + color: Colors.white, + child: LineChartCurvedBloodPressure( + title: TranslationBase.of(context).bloodPressure, + timeSeries1: model.weightWeekTimeSeriesDataTop.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataTop, + timeSeries2: model.weightWeekTimeSeriesDataLow.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesDataLow, + indexes: model.weightWeekTimeSeriesDataLow.length ~/ 5.5, ), - // Padding( - // padding: const EdgeInsets.all(8.0), - // child: Texts(TranslationBase.of(context).details), - // ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - model.bloodPressureService.weekDiabtecPatientResult.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Table( - columnWidths: { - 0: FlexColumnWidth(1.8), - 2: FlexColumnWidth(1.8), - }, - children: fullData(context, model), + ), + SizedBox( + height: 12, + ), + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Texts(TranslationBase.of(context).details), + // ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + model.bloodPressureService.weekDiabtecPatientResult.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), ), - SizedBox(height: 80) - ], - ), - ) - ], - ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, model), + ), + SizedBox(height: 80) + ], + ), + ) + ], ); } @@ -86,10 +88,10 @@ class BloodPressureWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)} ', isCapitable: false), - Utils.tableColumnValue(diabtec.bloodPressureDate.hour.toString() + ':' + diabtec.bloodPressureDate.minute.toString(), isCapitable: false), - Utils.tableColumnValue('${diabtec.measuredArmDesc}', isCapitable: false), - Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false), + Utils.tableColumnValue('${DateUtil.getDayMonthYearDateFormatted(diabtec.bloodPressureDate)} ', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.bloodPressureDate.hour.toString() + ':' + diabtec.bloodPressureDate.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.measuredArmDesc}', isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue('${diabtec.systolicePressure}/${diabtec.diastolicPressure}', isCapitable: false, mProjectViewModel: projectViewModel), Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 12), Container( diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart index 72e2e58b..4517e746 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodMonthly.dart @@ -1,6 +1,7 @@ import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -10,6 +11,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BloodMonthlyPage extends StatelessWidget { final List diabtecPatientResult; @@ -19,9 +21,11 @@ class BloodMonthlyPage extends StatelessWidget { BloodMonthlyPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); List monthlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); groupData(); return AppScaffold( body: ListView( @@ -92,10 +96,10 @@ class BloodMonthlyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false), - Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), - Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), - Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart index 4b3b4152..52ef5f1a 100644 --- a/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/BloodYeaPage.dart @@ -1,15 +1,16 @@ import "package:collection/collection.dart"; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BloodYearPage extends StatelessWidget { final List diabtecPatientResult; @@ -18,66 +19,67 @@ class BloodYearPage extends StatelessWidget { BloodYearPage({Key key, this.diabtecPatientResult, this.timeSeriesData, this.bloodSugarViewMode}) : super(key: key); List yearlyGroup = []; + ProjectViewModel projectViewModel; @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); + groupData(); - return AppScaffold( - body: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 12, left: 8, right: 8), - width: double.maxFinite, - color: Colors.white, - child: ShowChart( - title: TranslationBase.of(context).weight, - timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, - indexes: timeSeriesData.length ~/ 5.5, - horizontalInterval: 2, - ), - ), - SizedBox( - height: 12, + return ListView( + children: [ + Container( + margin: EdgeInsets.only(top: 12, left: 8, right: 8), + width: double.maxFinite, + color: Colors.white, + child: ShowChart( + title: TranslationBase.of(context).weight, + timeSeries: timeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 2, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(context).details), + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts(TranslationBase.of(context).details), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + timeSeriesData.isEmpty + ? Container( + child: Center( + child: Texts(TranslationBase.of(context).noDataAvailable), + ), + ) + : Column(children: [ + for (var monthly in yearlyGroup) + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + width: double.maxFinite, + padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), + child: Texts(monthly[0])), + Table( + columnWidths: { + 0: FlexColumnWidth(1.8), + 2: FlexColumnWidth(1.8), + }, + children: fullData(context, monthly[1]), + ) + ]) + ]), + SizedBox(height: 80) + ], ), - Container( - padding: EdgeInsets.all(10), - color: Colors.transparent, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - timeSeriesData.isEmpty - ? Container( - child: Center( - child: Texts(TranslationBase.of(context).noDataAvailable), - ), - ) - : Column(children: [ - for (var monthly in yearlyGroup) - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.maxFinite, - padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), - child: Texts(monthly[0])), - Table( - columnWidths: { - 0: FlexColumnWidth(1.8), - 2: FlexColumnWidth(1.8), - }, - children: fullData(context, monthly[1]), - ) - ]) - ]), - SizedBox(height: 80) - ], - ), - ) - ], - ), + ) + ], ); } @@ -98,10 +100,10 @@ class BloodYearPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false), - Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), - Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), - Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index 13c8392d..eeef1de5 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -1,11 +1,10 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -13,10 +12,10 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; + import 'AddBloodSugarPage.dart'; import 'BloodMonthly.dart'; import 'BloodYeaPage.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'blood_sugar_weekly_page.dart'; class BloodSugarHomePage extends StatefulWidget { @@ -51,98 +50,113 @@ class _BloodSugarHomePageState extends State with SingleTick baseViewModel: model, appBarTitle: TranslationBase.of(context).bloodSugar, // baseViewModel: model, - body: Scaffold( - extendBodyBehindAppBar: true, - appBar: TabBarWidget( - tabController: _tabController, - ), - body: Column( - children: [ - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - BloodSugarWeeklyPage( - timeSeriesData: model.bloodWeekTimeSeriesData, - diabtecPatientResult: model.weekDiabtecPatientResult, - bloodSugarViewMode: model, - ), - BloodMonthlyPage( - timeSeriesData: model.monthTimeSeriesData, - diabtecPatientResult: model.monthDiabtecPatientResult, - bloodSugarViewMode: model, - ), - BloodYearPage( - timeSeriesData: model.yearTimeSeriesData, - diabtecPatientResult: model.yearDiabtecPatientResult, - bloodSugarViewMode: model, - ) - ], - ), - ) - ], - ), - floatingActionButton: Stack( - children: [ - Positioned( - bottom: 60, - right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: AddBloodSugarPage( - bloodSugarViewMode: model, - ))); - }, - child: Container( - width: 50, - height: 50, - decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), - child: Center( - child: Icon( - Icons.add, - color: Colors.white, - ), - )), - ), + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ], - ), - bottomSheet: Container( - color: Theme.of(context).scaffoldBackgroundColor, - child: Padding( - padding: const EdgeInsets.all(12.0), - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: model.user.emailAddress, - onTapSendEmail: () async { - GifLoaderDialogUtils.showMyDialog(context); - model.sendReportByEmail().then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } else { - AppToast.showSuccessToast( - message: TranslationBase.of(context).emailSentSuccessfully, - ); - } - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: model.error); - }); - }, - ), - ); + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + BloodSugarWeeklyPage( + timeSeriesData: model.bloodWeekTimeSeriesData, + diabtecPatientResult: model.weekDiabtecPatientResult, + bloodSugarViewMode: model, + ), + BloodMonthlyPage( + timeSeriesData: model.monthTimeSeriesData, + diabtecPatientResult: model.monthDiabtecPatientResult, + bloodSugarViewMode: model, + ), + BloodYearPage( + timeSeriesData: model.yearTimeSeriesData, + diabtecPatientResult: model.yearDiabtecPatientResult, + bloodSugarViewMode: model, + ) + ], + ), + ) + ], + ), + floatingActionButton: Stack( + children: [ + Positioned( + bottom: 60, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: AddBloodSugarPage( + bloodSugarViewMode: model, + ))); }, + child: Container( + width: 50, + height: 50, + decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + )), ), ), + ], + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: model.user.emailAddress, + onTapSendEmail: () async { + GifLoaderDialogUtils.showMyDialog(context); + model.sendReportByEmail().then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) { + AppToast.showErrorToast(message: model.error); + } else { + AppToast.showSuccessToast( + message: TranslationBase.of(context).emailSentSuccessfully, + ); + } + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: model.error); + }); + }, + ), + ); + }, + ), ), ), ), diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart index d1728610..965cc9ff 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_weekly_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/my_trakers/blood_sugar/DiabtecPatientResult.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -11,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'AddBloodSugarPage.dart'; @@ -18,11 +20,13 @@ class BloodSugarWeeklyPage extends StatelessWidget { final List diabtecPatientResult; final BloodSugarViewMode bloodSugarViewMode; final List timeSeriesData; + ProjectViewModel projectViewModel; BloodSugarWeeklyPage({Key key, this.diabtecPatientResult, this.bloodSugarViewMode, this.timeSeriesData}) : super(key: key); @override Widget build(BuildContext context) { + if (projectViewModel == null) projectViewModel = Provider.of(context); return AppScaffold( body: ListView( children: [ @@ -41,7 +45,7 @@ class BloodSugarWeeklyPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts(TranslationBase.of(AppGlobal.context).details), + child: Texts(TranslationBase.of(context).details), ), Container( padding: EdgeInsets.all(10), @@ -91,10 +95,10 @@ class BloodSugarWeeklyPage extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false), - Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false), - Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false), - Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(diabtec.dateChart), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.dateChart.hour.toString() + ':' + diabtec.dateChart.minute.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.measuredDesc, isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(diabtec.resultValue.toString(), isCapitable: false, mProjectViewModel: projectViewModel), Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 12), Container( diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart index b2721366..bf3d9cb9 100644 --- a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -12,8 +12,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { final int indexes; final double horizontalInterval; - MonthCurvedChartBloodPressure( - {this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); + MonthCurvedChartBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); List xAxixs = List(); List yAxixs = List(); @@ -38,8 +37,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), Text( title, - style: TextStyle( - color: Colors.black, fontSize: 15, letterSpacing: 2), + style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), textAlign: TextAlign.center, ), SizedBox( @@ -47,8 +45,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -67,9 +64,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Theme.of(context).primaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor), ), SizedBox( width: 5, @@ -85,8 +80,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, color: secondaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: secondaryColor), ), SizedBox( width: 5, @@ -122,8 +116,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { touchCallback: (LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, @@ -133,12 +126,17 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ), margin: 22, getTitles: (value) { - return ''; + return timeSeries1[value.toInt()].time; + // return ''; }, ), leftTitles: SideTitles( showTitles: true, - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, + interval: getMaxY() - getMinY() <= 500 + ? 10 + : getMaxY() - getMinY() <= 1000 + ? 30 + : 40, getTextStyles: (value) => const TextStyle( color: Colors.black, @@ -227,7 +225,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { spots: spots, isCurved: true, colors: [Colors.red], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, @@ -240,7 +238,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { spots: spots2, isCurved: true, colors: [Theme.of(context).primaryColor], - barWidth: 5, + barWidth: 1.5, isStrokeCapRound: true, dotData: FlDotData( show: false, diff --git a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart index f4d3aaed..6574780d 100644 --- a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart +++ b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart @@ -90,10 +90,9 @@ class _PrescriptionDeliveryAddressPageState extends State confirmSelectLocationDialog(model.addressesList), @@ -199,9 +198,8 @@ class _PrescriptionDeliveryAddressPageState extends State Card( + (index) => Container( margin: EdgeInsets.all(0.0), - color: Colors.white, - shape: cardRadius(0), - elevation: 0, + decoration: cardRadius(0), child: Row( children: [ ClipRRect( @@ -90,9 +88,9 @@ class PrescriptionOrderOverview extends StatelessWidget { ), ) else - Card( + Container( margin: EdgeInsets.all(12), - shape: cardRadius(12), + decoration: cardRadius(12), clipBehavior: Clip.antiAlias, child: Padding( padding: const EdgeInsets.all(12.0), @@ -101,11 +99,9 @@ class PrescriptionOrderOverview extends StatelessWidget { children: [ ...List.generate( prescriptionReportEnhList.length, - (index) => Card( + (index) => Container( margin: EdgeInsets.all(0.0), - color: Colors.white, - shape: cardRadius(0), - elevation: 0, + decoration: cardRadius(0), child: Row( children: [ Container( @@ -156,10 +152,9 @@ class PrescriptionOrderOverview extends StatelessWidget { ], ), ), - Card( - shape: cardRadius(0), + Container( + decoration: cardRadius(0), margin: EdgeInsets.zero, - elevation: 20, child: Container( width: double.infinity, margin: EdgeInsets.all(12), diff --git a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart index c88283be..b12cc386 100644 --- a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart @@ -1,14 +1,13 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:giffy_dialog/giffy_dialog.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import 'package:url_launcher/url_launcher.dart'; class PharmacyForPrescriptionsPage extends StatelessWidget { final itemID; @@ -28,211 +27,63 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { baseViewModel: model, body: Column( children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, + Padding( + padding: const EdgeInsets.fromLTRB(21, 21, 21, 0), + child: Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, ), ), - ) - ], + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''), + ), + ), + ) + ], + ), ), ), model.pharmacyPrescriptionsList.isNotEmpty == true ? Expanded( child: ListView.builder( scrollDirection: Axis.vertical, + padding: EdgeInsets.all(21), physics: BouncingScrollPhysics(), - itemBuilder: (context, index) => Container( - margin: EdgeInsets.all(12.0), - padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (_) => AssetGiffyDialog( - title: Text( - model.pharmacyPrescriptionsList[index].locationDescription, - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.network( - model.pharmacyPrescriptionsList[index].projectImageURL.toString(), - fit: BoxFit.cover, - ), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - ), - ); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: Image.network( - model.pharmacyPrescriptionsList[index].projectImageURL.toString(), - width: 48, - height: 48, - fit: BoxFit.cover, - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: 12, right: 12), - child: Text( - model.pharmacyPrescriptionsList[index].locationDescription?.trim().toString() + - "\n" + - model.pharmacyPrescriptionsList[index].cityName.trim().toString() + - "\n" + - model.pharmacyPrescriptionsList[index].distanceInKilometers.toString() + - " " + - TranslationBase.of(context).km_ ?? - "", - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - ), - ), //model.cOCItemList[index].cOCTitl - IconButton( - icon: Icon( - Icons.location_on, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - // setState(() { - MapsLauncher.launchCoordinates(double.parse(model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude), - model.pharmacyPrescriptionsList[index].locationDescription); - // }); - }, - ), - IconButton( - icon: Icon( - Icons.phone, - color: Color(0xff2B353E), - ), - constraints: BoxConstraints(), - padding: EdgeInsets.all(8), - tooltip: '', - onPressed: () { - // setState(() { - launch("tel://" + model.pharmacyPrescriptionsList[index].phoneNumber); - // }); - }, - ), - ], - ), - ), - // Container( - // width: double.infinity, - // margin: EdgeInsets.only(top: 10, left: 10, right: 10), - // padding: EdgeInsets.all(8.0), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.all( - // Radius.circular(10.0), - // ), - // border: Border.all(color: Colors.grey[200], width: 0.5), - // ), - // child: Row( - // children: [ - // ClipRRect( - // borderRadius: BorderRadius.all(Radius.circular(5)), - // child: Image.network( - // model.pharmacyPrescriptionsList[index].projectImageURL, - // fit: BoxFit.cover, - // width: 60, - // height: 70, - // ), - // ), - // Expanded( - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts(model.pharmacyPrescriptionsList[index].locationDescription), - // SizedBox( - // height: 5, - // ), - // Texts(model.pharmacyPrescriptionsList[index].cityName), - // ], - // ), - // ), - // ), - // InkWell( - // onTap: () { - // MapsLauncher.launchCoordinates(double.parse(model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude)); - // }, - // child: Icon( - // Icons.pin_drop, - // size: 18, - // color: Colors.red[900], - // ), - // ), - // SizedBox( - // width: 15, - // ), - // InkWell( - // onTap: Feedback.wrapForTap(() { - // launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}"); - // }, context), - // child: Container( - // child: Icon( - // Icons.call, - // size: 18, - // color: Colors.red[900], - // ), - // ), - // ) - // ], - // ), - // ), + itemBuilder: (context, index) { + GetHMGLocationsModel location = GetHMGLocationsModel(); + location.locationName = model.pharmacyPrescriptionsList[index].locationDescription; + location.cityName = model.pharmacyPrescriptionsList[index].cityName; + location.phoneNumber = model.pharmacyPrescriptionsList[index].phoneNumber; + location.latitude = model.pharmacyPrescriptionsList[index].latitude; + location.longitude = model.pharmacyPrescriptionsList[index].longitude; + location.distanceInKilometers = model.pharmacyPrescriptionsList[index].distanceInKilometers; + return HospitalLocation(location, showCity: true); + }, itemCount: model.pharmacyPrescriptionsList.length, ), ) diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 860a362e..ebc3c241 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -209,8 +209,8 @@ class PrescriptionDetailsPage extends StatelessWidget { pageBuilder: (context, animation1, animation2) {}); }, iconData: Icons.notifications_active, - color: Color(0xffEAEAEA), - textColor: Color(0xff2B353E), + color: Color(0xffD02127), + //textColor: Color(0xff2B353E), ), ), ], diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 7fbb5745..6e30a3f7 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -11,14 +11,14 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; + import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; import 'PrescriptionIDeliveryAddressPage.dart'; @@ -84,9 +84,9 @@ class PrescriptionItemsPage extends StatelessWidget { }, child: Container( width: double.infinity, - child: Card( + child: Container( margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), - shape: cardRadius(12), + decoration: cardRadius(12), child: Padding( padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), child: Row( @@ -109,7 +109,7 @@ class PrescriptionItemsPage extends StatelessWidget { Row( children: [ Container( - child: Card( + child: Container( child: Image.network( model.prescriptionReportListINP[index].imageSRCUrl, fit: BoxFit.cover, @@ -118,7 +118,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), margin: EdgeInsets.zero, clipBehavior: Clip.antiAlias, - shape: cardRadius(2000), + decoration: cardRadius(2000), ), clipBehavior: Clip.antiAlias, decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1), @@ -269,7 +269,7 @@ class PrescriptionItemsPage extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Card( + Container( child: Image.network( model.prescriptionReportEnhList[index].imageSRCUrl, fit: BoxFit.cover, @@ -278,15 +278,15 @@ class PrescriptionItemsPage extends StatelessWidget { ), margin: EdgeInsets.zero, clipBehavior: Clip.antiAlias, - shape: cardRadius(2000), + decoration: cardRadius(2000), ), mWidth(12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - myRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), - myRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), + MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), projectViewModel.isArabic), mHeight(9), Text( diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index e84a5063..f2a9490e 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -59,10 +59,9 @@ class RadiologyDetailsPage extends StatelessWidget { buttonTitle: TranslationBase.of(context).sendCopyRad, isNeedToShowButton: projectViewModel.havePrivilege(8), ), - Card( + Container( margin: EdgeInsets.all(24), - shape: cardRadius(12), - elevation: 0, + decoration: cardRadius(12), child: Container( width: double.infinity, child: Padding( diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index f565594e..8d72216a 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -9,8 +9,8 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -27,93 +27,95 @@ class ReportListWidget extends StatelessWidget { @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - return reportList.length > 0 ? ListView.separated( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), - separatorBuilder: (context, index) => SizedBox(height: 14), - itemBuilder: (context, index) { - Reports report = reportList[index]; - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Padding( - padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (report.doctorName != null) - Text( - report.doctorName, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - if (report.doctorName != null) SizedBox(height: 6), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - LargeAvatar( - name: report.doctorName, - url: report.doctorImageURL, - width: 48, - height: 48, + return reportList.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) { + Reports report = reportList[index]; + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - SizedBox(width: 11), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Padding( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (report.doctorName != null) + Text( + report.doctorName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + if (report.doctorName != null) SizedBox(height: 6), + Row( mainAxisSize: MainAxisSize.min, children: [ - if (report.projectName != null) myRichText(TranslationBase.of(context).clinic + ":", report.projectName, projectViewModel.isArabic), - if (report.clinicDescription != null) myRichText(TranslationBase.of(context).hospital + ":", report.clinicDescription, projectViewModel.isArabic), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RatingBar.readOnly( - initialRating: report.actualDoctorRate.toDouble(), - size: 16.0, - filledColor: Color(0XFFD02127), - emptyColor: Color(0XFFD02127), - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - ), - if (reportList[index].status == 2) - IconButton( - icon: Icon(Icons.email), - color: Color(0xff28323A), - constraints: BoxConstraints(), - padding: EdgeInsets.zero, - onPressed: () { - showConfirmMessage(reportList[index]); - }) - ], + LargeAvatar( + name: report.doctorName, + url: report.doctorImageURL, + width: 48, + height: 48, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (report.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", report.projectName, projectViewModel.isArabic), + if (report.clinicDescription != null) MyRichText(TranslationBase.of(context).hospital + ":", report.clinicDescription, projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + RatingBar.readOnly( + initialRating: report.actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + if (reportList[index].status == 2) + IconButton( + icon: Icon(Icons.email), + color: Color(0xff28323A), + constraints: BoxConstraints(), + padding: EdgeInsets.zero, + onPressed: () { + showConfirmMessage(reportList[index]); + }) + ], + ), + ], + ), ), ], ), - ), - ], + ], + ), ), - ], - ), - ), - ); - }, - itemCount: reportList.length, - ) : getNoDataWidget(context) ; + ); + }, + itemCount: reportList.length, + ) + : getNoDataWidget(context); } void showConfirmMessage(Reports report) { diff --git a/lib/pages/medical/reports/reports_page.dart b/lib/pages/medical/reports/reports_page.dart index b5535982..85d35d84 100644 --- a/lib/pages/medical/reports/reports_page.dart +++ b/lib/pages/medical/reports/reports_page.dart @@ -6,9 +6,8 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -100,8 +99,8 @@ class MedicalReports extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - if (_appointmenHistory.projectName != null) myRichText(TranslationBase.of(context).clinic + ":", _appointmenHistory.projectName, projectViewModel.isArabic), - if (_appointmenHistory.clinicName != null) myRichText(TranslationBase.of(context).hospital + ":", _appointmenHistory.clinicName, projectViewModel.isArabic), + if (_appointmenHistory.projectName != null) MyRichText(TranslationBase.of(context).clinic + ":", _appointmenHistory.projectName, projectViewModel.isArabic), + if (_appointmenHistory.clinicName != null) MyRichText(TranslationBase.of(context).hospital + ":", _appointmenHistory.clinicName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -135,4 +134,4 @@ class MedicalReports extends StatelessWidget { ), ); } -} \ No newline at end of file +} diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index 057c6be6..eb8e916e 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -309,6 +309,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -382,6 +383,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -406,6 +408,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -701,6 +704,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -779,6 +783,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { @@ -803,6 +808,7 @@ class _SmartWatchInstructionsState extends State { child: RaisedButton( color: new Color(0xFF60686b), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index 89f5545f..b7da4fa2 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -62,9 +62,9 @@ class VitalSignDetailsScreen extends StatelessWidget { child: ListView( children: [ Container( - child: Card( + child: Container( margin: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 6), - shape: cardRadius(12), + decoration: cardRadius(12), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index e98bcb72..3211755c 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -52,9 +52,8 @@ class _VitalSingChartAndDetialsState extends State { children: [ Container( height: 400, - child: Card( - shape: cardRadius(12), - elevation: 1, + child: Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), child: ShowChart( title: widget.name, @@ -65,8 +64,8 @@ class _VitalSingChartAndDetialsState extends State { // child: SyncFuChart(), ), ), - Card( - shape: cardRadius(12), + Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(12.0), diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart index 1255a43d..424b0c90 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_blood_pressure.dart @@ -40,9 +40,8 @@ class VitalSingChartBloodPressure extends StatelessWidget { return SingleChildScrollView( child: Column( children: [ - Card( - shape: cardRadius(12), - elevation: 1, + Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), child: LineChartCurvedBloodPressure( title: name, @@ -60,8 +59,8 @@ class VitalSingChartBloodPressure extends StatelessWidget { // viewKey1: viewKey1, // viewKey2: viewKey2, // ), - Card( - shape: cardRadius(12), + Container( + decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(12.0), diff --git a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart index 8aeb4edf..f2ff8f6c 100644 --- a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart +++ b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart @@ -25,8 +25,6 @@ class OfferAndPackagesDetailState extends State{ @override Widget build(BuildContext context) { - getLanguageID(); - return BaseView( onModelReady: (model){ viewModel = model; diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 8e8085d7..727cea23 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -380,6 +380,7 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { ), Expanded(child: Container()), RaisedButton( + elevation: 0, child: Texts( TranslationBase.of(context).payNow, fontSize: 15, diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index dcae9d90..1ac20946 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,8 +1,15 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; @@ -14,25 +21,34 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/pages/sub_categories_modalsheet.dart'; import 'base/base_view.dart'; + class ParentCategorisePage extends StatefulWidget { String id; String titleName; + AuthenticatedUserObject authenticatedUserObject = + locator(); + ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { String id; String titleName; + final dynamic productID; - _ParentCategorisePageState({this.id, this.titleName}); + + + _ParentCategorisePageState({this.id, this.titleName, this.productID,}); Map values = {'huusam': false, 'ali': false, 'noor': false}; bool checkedBrands = false; @@ -56,7 +72,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, @@ -107,62 +126,72 @@ class _ParentCategorisePageState extends State { child: InkWell( child: Container( child: Texts( - TranslationBase.of(context).viewCategorise, + TranslationBase.of(context) + .viewCategorise, // 'View All Categories', fontWeight: FontWeight.w300, ), ), onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - // height: MediaQuery.of(context) - // .size - // .height * - // 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: Axis.vertical, - itemCount: model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Container( - child: Padding( - padding: EdgeInsets.all(4.0), - child: InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(projectViewModel.isArabic - ? model.categoriseParent[index].namen - : model.categoriseParent[index].name), - Divider( - thickness: 0.6, - color: Colors.black12, - ) - ], - ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: id, - )), - ); - }, - ), - ), - ); - }), - ), - ); - }, + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + ) + ), ); +// showModalBottomSheet( +// isScrollControlled: true, +// context: context, +// builder: (BuildContext context) { +// return Container( +// // height: MediaQuery.of(context) +// // .size +// // .height * +// // 0.89, +// color: Colors.white, +// child: Center( +// child: ListView.builder( +// scrollDirection: Axis.vertical, +// itemCount: model.categoriseParent.length, +// itemBuilder: (BuildContext context, int index) { +// return Container( +// child: Padding( +// padding: EdgeInsets.all(4.0), +// child: InkWell( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Texts(projectViewModel.isArabic +// ? model.categoriseParent[index].namen +// : model.categoriseParent[index].name), +// Divider( +// thickness: 0.6, +// color: Colors.black12, +// ) +// ], +// ), +// onTap: () { +// Navigator.push( +// context, +// FadePage( +// page: SubCategorisePage( +// title: model.categoriseParent[index].name, +// id: model.categoriseParent[index].id, +// parentId: id, +// )), +// ); +// }, +// ), +// ), +// ); +// }), +// ), +// ); +// }, +// ); }, ), ), @@ -184,22 +213,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( @@ -210,7 +245,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 * @@ -218,8 +256,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, @@ -233,8 +275,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, )), ); @@ -280,16 +324,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( @@ -299,21 +348,29 @@ class _ParentCategorisePageState extends State { width: 10.0, ), Texts( - 'Refine', - fontWeight: FontWeight.w600, + + TranslationBase.of(context).refine, +// 'Refine', + + fontWeight: + FontWeight.w600, + ), SizedBox( width: 250.0, ), InkWell( child: Texts( - 'Close', +// 'Close', + TranslationBase.of(context).closeIt, color: Colors.red, - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop(context); + Navigator.pop( + context); }, ), ], @@ -326,27 +383,39 @@ class _ParentCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts('Categorise'), + + title: Texts( TranslationBase.of( + context) + .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), ) ], ), @@ -355,27 +424,39 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Brands'), + title: Texts( TranslationBase.of( + context) + .brands), 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), ) ], ), @@ -384,43 +465,68 @@ class _ParentCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts('Price'), + title: Texts( TranslationBase.of( + context) + .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, ), ), ], @@ -435,18 +541,31 @@ 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', + + label: TranslationBase.of( + context) + .reset, backgroundColor: Colors.red, + + + ), ), SizedBox( @@ -455,38 +574,68 @@ 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', + + label: TranslationBase.of( + context) + .apply, backgroundColor: Colors.green, + + ), ), ], @@ -553,22 +702,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, @@ -596,106 +751,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, @@ -705,22 +941,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, ) ], ), @@ -735,7 +974,9 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.parentProducts[index]), + page: ProductDetailPage( + model.parentProducts[ + index]), )), }, )); @@ -743,11 +984,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( @@ -757,9 +1001,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, @@ -767,11 +1013,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, @@ -782,23 +1039,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.3 : 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, ), ), ], @@ -811,21 +1090,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, ), ), @@ -833,7 +1128,10 @@ 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, @@ -843,27 +1141,56 @@ 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, ) ], ), ], ), ), + + widget.authenticatedUserObject.isLogin ? + Container( + child: IconButton( + icon: Icon(Icons.shopping_cart, + size: 18, + color: Colors.blue,), + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + if(model.parentProducts[index].rxMessage == null){ + await addToCartFunction(1, model.parentProducts[index].id); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + } + else{ + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + GifLoaderDialogUtils.hideDialog(context); + } + + ), + ): Container(), ], ), ), @@ -871,7 +1198,8 @@ class _ParentCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.parentProducts[index]), + page: ProductDetailPage(model + .parentProducts[index]), )), }, ); @@ -910,10 +1238,18 @@ class _ParentCategorisePageState extends State { ), ), )); + + + } + + addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); } 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; } @@ -921,10 +1257,14 @@ 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; } return false; } + + + } diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index edecff62..aac971a0 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -1,113 +1,58 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/product_tile.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/wishlist_view_model.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; - -AppSharedPreferences sharedPref = AppSharedPreferences(); -var languageID; +import 'package:provider/provider.dart'; class ProductCheckTypeWidget extends StatefulWidget { - final List wishlist; - final bool isTrue; + final WishListViewModel model; - ProductCheckTypeWidget(this.isTrue, this.wishlist); + ProductCheckTypeWidget({this.model}); @override _ProductCheckTypeWidgetState createState() => _ProductCheckTypeWidgetState(); } class _ProductCheckTypeWidgetState extends State { - void initState() { - getLanguageID(); - } @override Widget build(BuildContext context) { - return widget.isTrue - ? ListView.builder( - itemCount: widget.wishlist.length, - itemBuilder: (BuildContext context, int index) { - return Column( - children: [ - Container( - child: widget.isTrue - ? productTile( - productName: languageID == 'ar' - ? widget.wishlist[index].product.namen - : widget.wishlist[index].product.name, - productPrice: widget.wishlist[index].subtotal, - productRate: double.parse( - widget.wishlist[index].subtotalVatRate), - productImage: - widget.wishlist[index].product.images[0].src, - showLine: widget.isTrue, - productID: widget.wishlist[index].product.id, - onDelete: deleteWishListItem, - - ) - : productTile( - productName: languageID == 'ar' - ? widget.wishlist[index].product.namen - : widget.wishlist[index].product.name, - productPrice: widget.wishlist[index].subtotal, - productRate: double.parse( - widget.wishlist[index].subtotalVatRate), - productImage: - widget.wishlist[index].product.images[0].src, - showLine: widget.isTrue, - onDelete: deleteWishListItem, - - ), - ), - Divider(height: 1, color: Colors.grey) - ], - ); - }) - : GridView.count( - crossAxisCount: 2, - children: List.generate( - widget.wishlist.length, - (index) => productTile( - productName: widget.wishlist[index].product.name, - productPrice: widget.wishlist[index].subtotal, - productRate: - double.parse(widget.wishlist[index].subtotalVatRate), - productImage: - widget.wishlist[index].product.images[0].src, - showLine: widget.isTrue, - )), + ProjectViewModel projectViewModel = Provider.of(context); + return ListView.builder( + itemCount: widget.model.wishListList.length, + itemBuilder: (BuildContext context, int index) { + return Column( + children: [ + Container( + child: productTile( + productName: projectViewModel.isArabic + ? widget.model.wishListList[index].product.namen + : widget.model.wishListList[index].product.name, + productPrice: widget.model.wishListList[index].subtotal, + productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + productImage: widget.model.wishListList[index].product.images[0].src, + productID: widget.model.wishListList[index].product.id, + onDelete: deleteWishListItem, + + ), + ), + Divider(height: 1, color: Colors.grey) + ], ); + }); } deleteWishListItem(itemID) async { ProductDetailViewModel x = new ProductDetailViewModel(); GifLoaderDialogUtils.showMyDialog(context); - await x.deletWishlistData(itemID); - setState(() - async{ - await - //getWishlistData(); - Navigator.push(context, - FadePage(page: WishlistPage(false)), - ); - }); + await x.deleteWishlistData(itemID); + await widget.model.getWishlistData(isLocalLoader: true); GifLoaderDialogUtils.hideDialog(context); - print("Delete"); } - getWishlistData() async { - WishListViewModel x = new WishListViewModel(); - await x.getWishlistData(); - } } -getLanguageID() async { - languageID = await sharedPref.getString(APP_LANGUAGE); -} diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index 7e7e33a0..08ba3d14 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -44,8 +44,8 @@ class _MyReviewsPageState extends State { ), Padding( padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', + child: Text(TranslationBase.of(context).noData, +// 'There is no data', style: TextStyle(fontSize: 30), ), ) @@ -121,7 +121,7 @@ reviewDetails(data, rate, myRate) { : data.product.name, style: TextStyle( color: Colors.black54, - fontSize: languageID == 'ar' ? 7 : 13, + fontSize: languageID == 'ar' ? 12 : 13, fontWeight: FontWeight.bold), ), ), @@ -137,7 +137,7 @@ reviewDetails(data, rate, myRate) { : Alignment.topLeft, child: RichText( text: TextSpan( - text: data.product.price.toString() + + text: data.product.quantity.toString() + " " + data.product.currency, style: TextStyle( @@ -187,7 +187,7 @@ reviewDetails(data, rate, myRate) { padding: languageID == 'ar' ? EdgeInsets.only(right: 10) : EdgeInsets.only(left: 10), - child: Text(data.createdOnUtc.toString())), + child: Text(data.createdOnUtc.toString().substring(0 , 11))), ], ), ), diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index 5ae69e84..4ff90706 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -95,7 +95,7 @@ class _ProductBrandsPageState extends State { height: 10, ), Container( - height: 290, + height: 420, width: double.infinity, color: Colors.white, child: ListView.builder( diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 012ab7b0..e69de29b 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -1,2199 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; -import 'package:rating_bar/rating_bar.dart'; - -import 'screens/cart-order-page.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - -int price = 0; -dynamic languageID; -bool isOverQuantity = false; -bool isInWishlit = false; -//int isSelected = 1; -bool isSelected= true; -String itemID; -var customerId; -CompareList compareItems = new CompareList(); -PharmacyProduct specificationData; -//Products recommendedData; - -class ProductDetailPage extends StatefulWidget { - final PharmacyProduct product; -// final Products recommendedProducts; - - - ProductDetailPage(this.product ); - - - @override - __ProductDetailPageState createState() => __ProductDetailPageState(); -} - -class __ProductDetailPageState extends State { - AppSharedPreferences sharedPref = AppSharedPreferences(); - - bool isTrue = true; - bool isDetails = true; - bool isReviews = false; - bool isAvailabilty = false; - dynamic wishlistItems; - //var model; - - // String ProductId="4561"; - // String productId = ""; - getLanguageID() async { - languageID = await sharedPref.getString(APP_LANGUAGE); - } - - checkWishlist() async { - GifLoaderDialogUtils.showMyDialog(context); - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.checkWishlistData(); - -// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); - - for (int i = 0; i < x.wishListItems.length; i++) { - if (itemID == x.wishListItems[i].product.id) { - isInWishlit = true; - break; - } else { - isInWishlit = false; - } - } - GifLoaderDialogUtils.hideDialog(context); - setState(() {}); - } - - - void initState() { - getLanguageID(); - price = 1; - specificationData = widget.product; - userInfo(); - super.initState(); - } - - void userInfo() async { - print(specificationData); - customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - if (customerId != null) { - itemID = widget.product.id; - checkWishlist(); -// getSpecificationData(itemID); - } - print("customerId:$customerId"); - - setState(() {}); -// getSpecificationData(itemID); - } - - Widget build(BuildContext context) { - return customerId != null - ? DetailPageScafold( - appBarTitle: TranslationBase.of(context).productDetails, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, - child: Column( - children: [ - Image.network( - widget.product.images[0].src.trim(), - ), - widget.product.discountDescription != null - ? Container( - width: double.infinity, - height: 50, - color: Colors.yellowAccent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerRight, - child: languageID == "ar" - ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ) - : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 0, - child: Container( - child: Image( - image: AssetImage( - 'assets/images/offer.png'), - ), - ), - ), - ], - ), - ) - : Container(), - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - width: 500, - height: 220, - color: Colors.white, - child: productNameAndPrice(context, widget.product), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - height: 100, - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).specification, - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - Divider(color: Colors.grey), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).noData, -// "there is no data", - ), - ), - ), - ], - ), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - margin: EdgeInsets.only(bottom: 6), -// height: 350, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = true; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = false; - isAvailabilty = true; - }); - }, - child: Text( - TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isAvailabilty - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - isDetails - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Text( - TranslationBase.of(context) - .description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 10, - ), - Divider(height: 1, color: Colors.grey), - SizedBox( - height: 15, - ), - Container( - child: Text( - languageID == "ar" - ? widget.product.fullDescriptionn - : widget.product.fullDescription ?? - "", - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 20, - ), - ]), - ) - -// Container( -// child: Text( -// languageID == 'ar' -// ? widget.product.fullDescriptionn -// : widget.product.fullDescription, -// style: TextStyle( -// fontSize: 16, -// fontFamily: 'WorkSans-Regular'), -// ), -// ), -// SizedBox( -// height: 10, -// ), -// Container( -// child: Text( -// TranslationBase.of(context).howToUse, -// style: TextStyle( -// fontSize: 17, -// color: Colors.grey, -// fontWeight: FontWeight.w600), -// ), -// ), -// SizedBox( -// height: 6, -// ), -// Divider( -// height: 2, -// color: Colors.grey), -// SizedBox( -// height: 10, -// ), -// Container( -// child: Text( -// languageID == 'ar' -// ? widget.product.shortDescriptionn -// : widget.product.shortDescription, -// style: TextStyle( -// fontSize: 16, -// fontFamily: 'WorkSans-Regular'), -// ), -// ), - // ], - // ), - // ) - : isReviews - ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), - ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, - ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noReviewsAvailable,), -// Text('No Reviews Available'), - ), - ) - : isAvailabilty - ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => model - .productLocationService - .length == - 0 - ? Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noLocationAvailable,), -// Text('No location Available'), - ) - : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .productLocationService - .length, - itemBuilder: - (BuildContext context, - int index) { - return Padding( - padding: - EdgeInsets.all(8.0), - child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( -// crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model - .productLocationService[ - index] - .locationDescription + - "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: - 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .location_on), - color: - Colors.red, - onPressed: - () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .phone), - color: - Colors.red, - onPressed: - () {}, - ), - ), - ], - ), - Divider( - height: 1.2, - color: Colors.grey) - ], - ), - ); - }, - ), - ) - : Container(), - ], - ), - ), - Row( - children: [ - customerId != null ? Container( - width: 410, - height: 50, - // margin: EdgeInsets.only(bottom: 5), - color: Colors.white, - child: Texts( - TranslationBase.of(context).recommended, - bold: true, - ), - ) - : Container(), - ], - ), - SingleChildScrollView( - child: Container( - width: 410, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, - children: [ - Container( - color: Colors.white, - height: 210, - margin: EdgeInsets.only(bottom: 75), - padding: EdgeInsets.only(bottom: 5), - // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), - child: BaseView( - - onModelReady: (model) => model.getRecommendedProducts(widget.product.id), - builder: (_, model, wi) => Container( - child: - model.recommendedProductList.length != null - ? Expanded( - child: ListView.builder( - scrollDirection: - Axis.horizontal, - shrinkWrap: true, - physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), - itemCount: model.recommendedProductList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () - async { - GifLoaderDialogUtils.showMyDialog(context); - RecommendedProductModel data = model.recommendedProductList[index]; - var json = data.toJson(); - PharmacyProduct product = new PharmacyProduct.fromJson(json); - await Navigator.pushReplacement( - context, - FadePage( - page: ProductDetailPage(product), - )); - GifLoaderDialogUtils.hideDialog(context); - }, - child: 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: IconButton( - icon: Icon(model.recommendedProductList[index].isinwishlist != true ? Icons.favorite_border : Icons.favorite), - color: model.recommendedProductList[index].isinwishlist != true ? Colors.grey : Colors.red, - onPressed: () async { - - if (customerId != null ) { - if (!isInWishlit && model.recommendedProductList[index].isinwishlist != true) { - GifLoaderDialogUtils.showMyDialog(context); - await addToWishlistFunction(model.recommendedProductList[index].id); -// checkWishlist(); - GifLoaderDialogUtils.hideDialog(context); - setState((){ - model.recommendedProductList[index].isinwishlist= true; - }); - - } else { - GifLoaderDialogUtils.showMyDialog(context); - await deleteFromWishlistFunction(model.recommendedProductList[index].id); - GifLoaderDialogUtils.hideDialog(context); - setState((){ - model.recommendedProductList[index].isinwishlist = false; - }); - } - } else { - return ; - } - setState(() { - // checkWishlist(); - }); - }, - )), - -// child: Align( -// alignment: Alignment.topRight, -// child:itemID.contains(model.recommendedProductList[index]['id']) -// // !isInWishlist -// ? IconButton( -// icon: Icon(Icons.favorite_border), -// color: Colors.grey, -// iconSize: 30, -// onPressed: () { -// setState(() { -// if (customerId != null && isInWishlit ) { -// deleteFromWishlistFunction( -// model.recommendedProductList[index].id); -// } }); -// }, -// ) -// : IconButton( -// icon: Icon(Icons.favorite), -// color: Colors.red, -// iconSize: 30, -// onPressed: () { -// setState(() { -// if (customerId != null && !isInWishlit ) { -// addToWishlistFunction( -// model.recommendedProductList[index].id); -// } }); -// }, -// ) -// ), - ), - - 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: model.recommendedProductList[index].rxMessage != null - ? Texts( - languageID == "ar" - ? model.recommendedProductList[index].rxMessagen - : model.recommendedProductList[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ):Texts (""), - ), - ]), - Container( - margin: EdgeInsets - .symmetric( - horizontal: - 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Text( - languageID == "ar" - ? model.recommendedProductList[index].namen - : model.recommendedProductList[index].name, - style: - TextStyle( - color: - Colors.black, - fontSize: - 13.0, -// fontWeight: FontWeight.bold, - ), - ), - Padding( -// padding: const EdgeInsets.only(top: 15, bottom: 10), - padding: const EdgeInsets.only( - top: - 10, - bottom: - 5), - child: - Texts( - "SAR ${model.recommendedProductList[index].price}", - bold: - true, - fontSize: - 14, - ), - ), - ], - ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Container( - padding: - EdgeInsets.only(right: 10), -// margin: EdgeInsets.only(left: 5), - child: - Align( - alignment: - Alignment.topLeft, - child: - RatingBar.readOnly( - initialRating: model.recommendedProductList[index].approvedRatingSum.toDouble(), -// initialRating: productRate, - size: - 13.0, - filledColor: - Colors.yellow[700], - emptyColor: - Colors.grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons.star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ), - Texts( - "(${model.recommendedProductList[index].notApprovedTotalReviews.toString()})", -// bold: true, - fontSize: - 12, - ), - ]), - ], - ), - ), - ), - ); - }), - ) - : Container( - // color: Colors.white, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).nonRecommended, - color: Colors.black,), - ], - ), - ), - )), - ), - ], - ), - ), - ) - ], - ), - ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), - ) - : AppScaffold( - appBarTitle: TranslationBase.of(context).productDetails, - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - body: SingleChildScrollView( - child: Column( - children: [ - Container( - width: double.infinity, - color: Colors.white, - child: Column( - children: [ - Image.network( - widget.product.images[0].src.trim(), - ), - widget.product.discountDescription != null - ? Container( - width: double.infinity, - height: 50, - color: Colors.yellowAccent, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Container( - alignment: Alignment.centerRight, - child: languageID == 'ar' - ? Text( - widget.product - .discountDescriptionn, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ) - : Text( - widget.product - .discountDescription, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 17), - ), - ), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 0, - child: Container( - child: Image( - image: AssetImage( - 'assets/images/offer.png'), - ), - ), - ), - ], - ), - ) - : Container(), - ], - ), - ), - SizedBox( - height: 4, - ), - Container( - width: 500, - height: 150, - color: Colors.white, - child: productNameAndPrice(context, widget.product), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - height: 120, - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Text( - TranslationBase.of(context).specification, - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - Divider(color: Colors.grey) - ], - ), - ), - SizedBox( - height: 6, - ), - Container( - width: 500, - margin: EdgeInsets.only(bottom: 100), -// height: 350, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = true; - isReviews = false; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).details, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isDetails - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container() - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = true; - isAvailabilty = false; - }); - }, - child: Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isReviews - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - SizedBox( - width: 20, - ), - Column( - children: [ - FlatButton( - onPressed: () { - setState(() { - isDetails = false; - isReviews = false; - isAvailabilty = true; - }); - }, - child: Text( - TranslationBase.of(context).availability, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold), - ), - color: Colors.white, - ), - isAvailabilty - ? Container( - width: 100, - height: 5, - color: Colors.green, - ) - : Container(), - ], - ), - ], - ), - SizedBox( - height: 10, - ), - isDetails - ? Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Text( - TranslationBase.of(context).description, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 6, - ), - Divider(height: 1, color: Colors.grey), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.shortDescriptionn - : widget.product.shortDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - TranslationBase.of(context).howToUse, - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), - ), - ), - SizedBox( - height: 6, - ), - Divider(height: 2, color: Colors.grey), - SizedBox( - height: 10, - ), - Container( - child: Text( - languageID == 'ar' - ? widget.product.fullDescriptionn - : widget.product.fullDescription, - style: TextStyle( - fontSize: 16, - fontFamily: 'WorkSans-Regular'), - ), - ), - ], - ), - ) - : isReviews - ? BaseView( - onModelReady: (model) => - model.getProductReviewsData( - widget.product.id), - builder: (_, model, wi) => model - .productDetailService - .length != - 0 && - model.productDetailService[0] - .reviews.length != - 0 - ? ListView.builder( - physics: ScrollPhysics(), - itemCount: model - .productDetailService[0] - .reviews - .length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[ - index] - .customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors - .grey, - fontWeight: - FontWeight - .w600), - ), - ), - Container( - margin: - EdgeInsets.only( - left: 210), - child: RatingBar - .readOnly( - initialRating: model - .productDetailService[ - 0] - .reviews[ - index] - .rating - .toDouble(), - size: 15.0, - filledColor: - Colors.yellow[ - 700], - emptyColor: Colors - .grey[500], - isHalfAllowed: - true, - halfFilledIcon: - Icons - .star_half, - filledIcon: - Icons.star, - emptyIcon: - Icons.star, - ), - ), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model - .productDetailService[ - 0] - .reviews[index] - .reviewText, - style: TextStyle( - fontSize: 20), - ), - ), - SizedBox( - height: 50, - ), - Divider( - height: 1, - color: Colors.grey), - ], - ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text(TranslationBase.of(context).noReviewsAvailable), -// Text('No Reviews Available'), - ), - ) - : isAvailabilty - ? BaseView( - onModelReady: (model) => - model.getProductLocationData(), - builder: (_, model, wi) => - ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model - .productLocationService.length, - itemBuilder: (BuildContext context, - int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( -// crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(model - .productLocationService[ - index] - .projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - model - .productLocationService[ - index] - .locationDescription + - "\n" + - fixingString(model - .productLocationService[ - 0] - .cityName - .toString()), - style: TextStyle( - fontSize: 12), - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons - .location_on), - color: Colors.red, - onPressed: () {}, - ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: - Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, - ), - ), - ], - ), - Divider( - height: 1.2, - color: Colors.grey) - ], - ), - ); - }, - ), - ) - : Container(), - ], - ), - ), -// ListView(scrollDirection: Axis.vertical, shrinkWrap: true, children: [Text('ENAD')]), - ], - ), - ), - bottomSheet: footerWidget( - widget.product.stockAvailability != 'Out of stock', - widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, - widget.product.stockQuantity, - widget.product), - ); - } -} - -class footerWidget extends StatefulWidget { - final bool isAvailble; - final int maxQuantity; - final int minQuantity; - final int quantityLimit; - final PharmacyProduct item; - - footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item); - - @override - _footerWidgetState createState() => _footerWidgetState(); -} - -class _footerWidgetState extends State { - double quantityUI = 70; - bool showUI = false; - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: quantityUI, - color: Colors.white, - child: Column( - children: [ - showUI - ? Container( - width: double.infinity, - height: 90, - color: Colors.white, - child: Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).quantity, - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), - ), - ), -// ListView( -// scrollDirection: Axis.horizontal, -// children: [ -// itemQuantity(), -// ], -// ), - Container( -// margin: EdgeInsets.symmetric(vertical: 20.0), - height: 50.0, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '1', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 1; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '2', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 2; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '3', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 3; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '4', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 4; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '5', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 5; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '6', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 6; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '7', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 7; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '8', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 8; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '9', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 9; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - InkWell( - child: Container( - alignment: Alignment.center, - width: 50.0, - color: Colors.white, - child: Text( - '10', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - ), - onTap: () { - setState(() { - price = 10; - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - return price; - } - }); - }, - ), - SizedBox( - width: 5, - ), - Container( - width: 50.0, - child: TextField( - decoration: - InputDecoration(labelText: 'quantity #'), - onChanged: (text) { - print(price); - print(widget.quantityLimit); - if (int.tryParse(text) == null) { - text = ''; - } else { - setState(() { - price = int.parse(text); - if (price >= widget.quantityLimit) { - isOverQuantity = true; - } else { - isOverQuantity = false; - } - }); - } - }, - ), - ), - ], - ), - ) - ], - ), - ), - ) - : Container( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70, - height: 50, - child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Text( - price.toString(), - style: TextStyle(fontSize: 20), - ), - ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), - ), - ), - ], - ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 70; - showUI = false; - } else { - quantityUI = 150; - showUI = true; - } - }); - }, - ), - ), - !widget.isAvailble && price > 0 || - price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 190, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - addToCartFunction(price, widget.item.id, context); - }, - child: Container( - alignment: Alignment.center, - width: 190, - height: 46, - color: Colors.green, - child: Text( - TranslationBase.of(context).addToCart, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), - SizedBox( - width: 5, - ), - !widget.isAvailble && price > 0 || - price > widget.quantityLimit || - widget.item.rxMessage != null - ? Container( - width: 120, - height: 46, - color: Colors.grey, - child: Align( - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ) - : InkWell( - onTap: () { - print('buy now'); - addToCartFunction(price, widget.item.id, context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - child: Container( - alignment: Alignment.center, - width: 120, - height: 46, - color: Colors.blue, - child: Text( - TranslationBase.of(context).buyNow, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 15), - ), - ), - ), - ], - ), - ], - ), - ); - } -} - -class productNameAndPrice extends StatefulWidget { - BuildContext context; - PharmacyProduct item; - - productNameAndPrice(this.context, this.item); - - @override - _productNameAndPriceState createState() => _productNameAndPriceState(); -} - -class _productNameAndPriceState extends State { - @override - Widget build(BuildContext context) { - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Text( - widget.item.price.toString() + " " + "SAR", - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30), - ), - SizedBox( - width: 40, - ), - Text( - languageID == 'ar'? - widget.item.stockAvailabilityn : widget.item.stockAvailability , - style: widget.item.stockAvailability == 'Out of stock' - ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle( - fontWeight: FontWeight.bold, color: Colors.green), - ), - SizedBox(width: 20), - widget.item.stockAvailability == 'Out of stock' && - customerId != null - ? InkWell( - onTap: () => - notifyMeWhenAvailable(context, widget.item.id), - child: Row(children: [ - Text( - TranslationBase.of(context).notifyMe, - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, - ), - ), - SizedBox(width: 4), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ) - ]), - ) - : Container( - margin: languageID == 'ar' - ? EdgeInsets.only(right: 25) - : EdgeInsets.only(left: 25), - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey, - borderRadius: BorderRadius.circular(30), - ), - child: IconButton( - icon: Icon(!isInWishlit - ? Icons.favorite_border - : Icons.favorite), - color: !isInWishlit ? Colors.white : Colors.red, - onPressed: () async { - if (customerId != null) { - if (!isInWishlit) { - GifLoaderDialogUtils.showMyDialog(context); - await addToWishlistFunction(widget.item.id); - GifLoaderDialogUtils.hideDialog(context); - } else { - await deleteFromWishlistFunction(widget.item.id); - } - } else { - return; - } - setState(() {}); - }, - )), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: - languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, - child: Text( - languageID == 'ar' - ? widget.item.fullDescriptionn - : widget.item.fullDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), - ), - ), - ), - ), - Row( - children: [ - Expanded( - flex: 2, - child: Container( - margin: EdgeInsets.only(right: 150), - child: Align( - alignment: Alignment.bottomLeft, - child: RatingBar.readOnly( - initialRating: 3, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ), - ), - Expanded( - flex: 1, - child: Container( - child: widget.item.rxMessage != null - ? Text( - languageID == 'ar' - ? widget.item.rxMessagen.toString() - : widget.item.rxMessage.toString(), - style: TextStyle(color: Colors.red, fontSize: 10), - ) - : Container()), - ), - widget.item.rxMessage != null - ? Icon( - FontAwesomeIcons.questionCircle, - color: Colors.red, - size: 15.0, - ) - : Container(), - ], - ), - ], - ); - } -} - -slideDetail() { - return Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 15.0), - decoration: const BoxDecoration( - border: Border( - top: BorderSide(width: 0.5, color: Colors.grey), - left: BorderSide(width: 0.5, color: Colors.grey), - right: BorderSide(width: 0.5, color: Colors.grey), - bottom: BorderSide(width: 0.5, color: Colors.grey), - ), - color: Colors.white, - ), - child: const Text('1', - textAlign: TextAlign.center, - style: TextStyle(color: Color(0xFF000000))), - ), - ) - ], - ); -} - -fixingString(txt) { - String stringTxt; - String newTxt; - stringTxt = txt.toString(); - newTxt = stringTxt.split('.')[1]; - - return newTxt; -} - -//getLanguageID() async { -// languageID = await sharedPref.getString(APP_LANGUAGE); -//} - -getSpecificationData(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - specificationData = await x.productSpecificationData(itemID); -} - -addToCartFunction(quantity, itemID, BuildContext context) async { - GifLoaderDialogUtils.showMyDialog(context); - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.addToCartData(quantity, itemID).then((value) { - GifLoaderDialogUtils.hideDialog(context); - }); -} - -notifyMeWhenAvailable(context, itemId) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.notifyMe(customerId, itemId); -} - -addToWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlit = true; - await x.addToWishlistData(itemID); - -} - -deleteFromWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlit = false; - await x.deletWishlistData(itemID); -} - -checkWishlist() async { - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.checkWishlistData(); - -// isInWishlit = x.wishListItems.map((e) => e.id.toString()).toList().contains(itemID); - - for (int i = 0; i < x.wishListItems.length; i++) { - if (itemID == x.wishListItems[i].product.id) { - isInWishlit = true; - break; - } else { - isInWishlit = false; - } - } -} - -class sttingModalBottomSheet extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Container(); - } -} - -settingModalBottomSheet(context) { - showModalBottomSheet( - context: context, - builder: (BuildContext bc) { - return Container( - child: new Wrap( - children: [ - new ListTile( - leading: Icon(Icons.shopping_cart), - title: Text(TranslationBase.of(context) - .addToCart,), - onTap: () => { - if (price > 0) - {addToCartFunction(price, itemID, context)} - else - { - AppToast.showErrorToast( - message: "you should add quantity") - } - }), - ListTile( - leading: Icon(Icons.favorite_border), - title: Text(TranslationBase.of(context) - .addToWishlist,), - onTap: () => {addToWishlistFunction(itemID)}, - ), - ListTile( - leading: Icon(Icons.compare), - title: Text(TranslationBase.of(context) - .compare,), - onTap: () => { - Provider.of(context, listen: false) - .addItem(specificationData), - }, - ), - ], - ), - ); - }); -} diff --git a/lib/pages/pharmacies/screens/address-select-page.dart b/lib/pages/pharmacies/screens/address-select-page.dart index 3b78e3c1..9378fb3b 100644 --- a/lib/pages/pharmacies/screens/address-select-page.dart +++ b/lib/pages/pharmacies/screens/address-select-page.dart @@ -22,6 +22,7 @@ class AddressSelectPageTest extends StatelessWidget { "Set address", style: new TextStyle(color: Colors.white, fontSize: 14), ), + elevation: 0, color: Colors.blueAccent, disabledColor: Colors.blueAccent, ), diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index 6c760fcd..13dec0c3 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -4,222 +4,265 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse. import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-preview.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.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:http/http.dart'; import 'package:provider/provider.dart'; -class CartOrderPage extends StatelessWidget { +import 'cart-page/cart-order-preview.dart'; + +class CartOrderPage extends StatefulWidget { + + + const CartOrderPage({ Key key}) + : super(key: key); + + + @override + _CartOrderPageState createState() => _CartOrderPageState(); +} + +class _CartOrderPageState extends State { + bool isLoading = true; + + @override + void initState() { + super.initState(); + getData(); + + } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); + OrderPreviewViewModel model = Provider.of(context); 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}'); - }); - }, - builder: (_, model, wi) => ChangeNotifierProvider.value( - value: model.cartResponse, - child: appScaffold = AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - baseViewModel: model, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? Container( - height: height * 0.85, - width: double.infinity, - child: Consumer( - builder: (ctx, cart, _) => Container( - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), + return NetworkBaseView( + // baseViewModel: model, + isLoading: isLoading, + isLocalLoader: true, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isPharmacy: true, + showHomeAppBarIcon: false, + isShowDecPage: true, + baseViewModel: model, + backgroundColor: Colors.white, + body: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? Container( + height: height * 0.85, + width: double.infinity, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureIconButton( + TranslationBase.of(context).deleteAllItems, + Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade700, + ), + onTap: () => {model.deleteShoppingCart()}, + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - 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}'); - } - if (model.state == - ViewState.ErrorLocal) {Utils.showErrorToast(model.error);} - }); - }, - () { - model.deleteProduct(cart.shoppingCarts[index]).then((value){ - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater('${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(cart.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Image.asset( - "assets/images/pharmacy_module/payment_image.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ) + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model.cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderItem( + model.cartResponse + .shoppingCarts[index], () { + print(model.cartResponse + .shoppingCarts[index].quantity); + model + .changeProductQuantity(model + .cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != ViewState.Error) { + appScaffold.appBar.badgeUpdater( + '${value.quantityCount ?? 0}'); + } + if (model.state == + ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + }); + }, () { + model + .deleteProduct(model.cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != ViewState.Error) { + appScaffold.appBar.badgeUpdater( + '${value.quantityCount ?? 0}'); + } + }); + })) ], ), ), - ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).subtotal, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Image.asset( + "assets/images/pharmacy_module/payment_image.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ), + SizedBox( + height: 120, + ) + ], ), ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), + ), + ) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text(TranslationBase.of(context).noData, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).noData, // 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), + style: TextStyle(fontSize: 30), + ), + ) + ], ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), + ), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height), ), ), ); } + + void getData() async { + await Provider.of(context, listen: false) + .getShoppingCart(); + setState(() { + isLoading = false; + }); + } } class OrderBottomWidget extends StatefulWidget { @@ -238,46 +281,41 @@ class _OrderBottomWidgetState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - - return Container( - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), - child: Consumer( - builder: (ctx, cart, _) => !(cart.shoppingCarts == null || - cart.shoppingCarts.length == 0) - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, + OrderPreviewViewModel cart = Provider.of(context); + return !(cart.cartResponse.shoppingCarts == null || + cart.cartResponse.shoppingCarts.length == 0) + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + height: widget.height * 0.070, + color: Color(0xffe6ffe0), + padding: EdgeInsets.symmetric(horizontal: 4), + child: Row( children: [ - const Divider( - color: Color(0xFFD6D6D6), - height: 1, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: widget.height * 0.070, - color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - isAgree = !isAgree; - }); - }, - child: Container( - width: 25.0, - height: widget.height * 0.070, - decoration: new BoxDecoration( - color: !isAgree - ? Color(0xffeeeeee) - : Colors.green, - shape: BoxShape.circle, - ), - child: !isAgree - ? null - : Padding( + InkWell( + onTap: () { + setState(() { + isAgree = !isAgree; + }); + }, + child: Container( + width: 25.0, + height: widget.height * 0.070, + decoration: new BoxDecoration( + color: !isAgree ? Color(0xffeeeeee) : Colors.green, + shape: BoxShape.circle, + ), + child: !isAgree + ? null + : Padding( padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, @@ -285,108 +323,133 @@ class _OrderBottomWidgetState extends State { size: 25, ), ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - margin: const EdgeInsets.symmetric(vertical: 4), - child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, - fontSize: 13, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ), - InkWell( - onTap: () => { - Navigator.push(context, - FadePage(page: PharmacyTermsConditions())) - }, - child: Container( - child: Icon( - Icons.info, - size: 25, - color: Color(0xff005aff), - ), - ), - ), - ], ), ), - Container( - height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + TranslationBase.of(context) + .pharmacyServiceTermsCondition, + fontSize: 13, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ), + InkWell( + onTap: () => { + Navigator.push( + context, FadePage(page: PharmacyTermsConditions())) + }, + child: Container( + child: Icon( + Icons.info, + size: 25, + color: Color(0xff005aff), + ), + ), + ), + ], + ), + ), + Container( + height: widget.height * 0.065, + margin: EdgeInsets.symmetric(vertical: 2), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, + Container( + margin: EdgeInsets.symmetric( + horizontal: 0, vertical: 0), + child: Row( children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), - child: Row( - children: [ - Texts( - "${TranslationBase.of(context).sar} ${(cart.subtotal).toStringAsFixed(2)}", - fontSize: - projectProvider.isArabic ? 12 : 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 4), - child: Texts( - "${TranslationBase.of(context).inclusiveVat}", - fontSize: 8, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), Texts( - "${cart.quantityCount} ${TranslationBase.of(context).items}", - fontSize: 10, - color: Colors.grey, + "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}", + fontSize: projectProvider.isArabic ? 12 : 14, fontWeight: FontWeight.bold, ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ), ], ), ), - RaisedButton( - onPressed: isAgree - ? () => { - Navigator.push( - context, - FadePage( - page: OrderPreviewPage( - widget.addresses))) - } - : null, - child: new Text( - "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: isAgree - ? Colors.white - : Colors.grey.shade300, - fontSize: 14), - ), - color: Color(0xff005aff), - disabledColor: Color(0xff005aff), + Texts( + "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, ), ], ), ), + RaisedButton( + onPressed: isAgree +// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 + ? () => { + if(cart.isCartItemsOutOfStock()){ + // Toast msg + AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) + }else { + Navigator.push( + context, + FadePage( + page: + OrderPreviewPage(widget.addresses))) + } + } + : null, + child: new Text( + "${TranslationBase.of(context).checkOut}", + style: new TextStyle( + color: + isAgree ? Colors.white : Colors.grey.shade300, + fontSize: 14), + ), + color: Color(0xff005aff), + elevation: 0, + disabledColor: Color(0xff005aff), + ) +// RaisedButton( +// onPressed: isAgree +//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 +// ? () => { +// Navigator.push( +// context, +// FadePage( +// page: +// OrderPreviewPage(widget.addresses))) +// } +// : null, +// child: new Text( +// "${TranslationBase.of(context).checkOut}", +// style: new TextStyle( +// color: +// isAgree ? Colors.white : Colors.grey.shade300, +// fontSize: 14), +// ), +// color: Color(0xff005aff), +// disabledColor: Color(0xff005aff), +// ) ], - ) - : Container(), - )); + ), + ), + ], + ) + : Container(); } } diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart index dcf2ae64..e69de29b 100644 --- a/lib/pages/pharmacies/screens/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-order-preview.dart @@ -1,947 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; - -class OrderPreviewPage extends StatelessWidget { - final List addresses; - - OrderPreviewPage(this.addresses); - - MyInAppBrowser browser; - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context); - final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - - return BaseView( - onModelReady: (model) => model.getShoppingCart(), - builder: (_, model, wi) => ChangeNotifierProvider.value( - value: model.paymentCheckoutData, - child: AppScaffold( - appBarTitle: "${TranslationBase.of(context).checkOut}", - isShowAppBar: true, - isPharmacy: true, - isShowDecPage: false, - backgroundColor: Colors.white, - baseViewModel: model, - body: Container( - height: height * 0.90, - child: SingleChildScrollView( - child: Container( - color: Color(0xFFF1F1F1), - child: Column( - children: [ - SelectAddressWidget(model, addresses), - SizedBox( - height: 10, - ), - SelectPaymentOptionWidget(model), - SizedBox( - height: 10, - ), - Consumer( - builder: (ctx, paymentData, _) => - paymentData.lacumInformation != null - ? Container( - child: Column( - children: [ - LakumWidget(model), - SizedBox( - height: 10, - ), - ], - ), - ) - : Container()), - Container( - color: Colors.white, - width: double.infinity, - padding: EdgeInsets.all(8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .reviewOrder, - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => - ProductOrderPreviewItem( - model.cartResponse - .shoppingCarts[index]), - ), - ], - ), - ), - Container( - width: double.infinity, - padding: EdgeInsets.all(8), - child: model.cartResponse.subtotal != null - ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase - .of(context) - .orderSummary, - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase - .of(context) - .subtotal}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase - .of(context) - .sar} ${(model.cartResponse.subtotal) - .toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase - .of(context) - .shipping}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase - .of(context) - .sar} ${(model - .totalAdditionalShippingCharge) - .toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase - .of(context) - .vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase - .of(context) - .sar} ${(model.cartResponse - .subtotalVatAmount).toStringAsFixed( - 2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase - .of(context) - .total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase - .of(context) - .sar} ${(model.cartResponse.subtotal) - .toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - SizedBox( - height: 10, - ), - ], - ) - : Container(), - ) - ], - ), - ), - ), - ), - bottomSheet: Container( - height: model.cartResponse.shoppingCarts != null - ? height * 0.10 - : 0, - color: Colors.white, - child: PaymentBottomWidget(model), - ), - ), - )); - } -} - -class SelectAddressWidget extends StatefulWidget { - final OrderPreviewViewModel model; - final List addresses; - - SelectAddressWidget(this.model, this.addresses); - - @override - _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); -} - -class _SelectAddressWidgetState extends State { - Addresses address; - - _navigateToAddressPage() { - Navigator.push(context, FadePage(page: PharmacyAddressesPage())) - .then((result) { - if (result != null) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); - } - - /* setState(() { - if (result != null) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); - } - })*/ - }); - } - - @override - void initState() { - if (widget.model.paymentCheckoutData.address != null) { - address = widget.model.paymentCheckoutData.address; - } - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (ctx, paymentData, _) => - Container( - color: Colors.white, - child: address == null - ? InkWell( - onTap: () => {_navigateToAddressPage()}, - child: Container( - margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/ic_shipping_address.png", - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - Expanded( - child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), - child: Texts( - TranslationBase - .of(context) - .selectAddress, - fontSize: 14, - fontWeight: FontWeight.bold, - color: Color(0xff0000ff), - ), - ), - ), - Icon( - Icons.arrow_forward, - size: 20, - color: Colors.grey.shade400, - ), - ], - ), - ), - ) - : Container( - child: Container( - margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/ic_shipping_mark.png", - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric( - vertical: 0, horizontal: 6), - child: Texts( - TranslationBase - .of(context) - .shippingAddress, - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - ), - InkWell( - onTap: () => {_navigateToAddressPage()}, - child: Texts( - TranslationBase - .of(context) - .changeAddress, - fontSize: 12, - fontWeight: FontWeight.normal, - color: Color(0xff0000ff), - ), - ), - ], - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Texts( - "${address.firstName} ${address.lastName}", - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Texts( - "${address.address1} ${address.address2} ${address - .address2},, ${address.city}, ${address - .country} ${address.zipPostalCode}", - fontSize: 12, - fontWeight: FontWeight.normal, - color: Colors.grey.shade500, - ), - ), - Row( - children: [ - Container( - margin: const EdgeInsets.only(right: 8), - child: Icon( - Icons.phone, - size: 20, - color: Colors.black, - ), - ), - Texts( - "${address.phoneNumber}", - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ], - ), - Container( - margin: EdgeInsets.symmetric(vertical: 8), - child: SizedBox( - height: 2, - width: double.infinity, - child: Container( - color: Color(0xffefefef), - ), - ), - ), - Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/ic_shipping_truck.png", - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - Container( - padding: EdgeInsets.symmetric( - vertical: 0, horizontal: 6), - child: Texts( - "${TranslationBase - .of(context) - .shipBy}", - fontSize: 12, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - Container( - child: Image.asset( - paymentData.shippingOption - .shippingRateComputationMethodSystemName == - "Shipping.FixedOrByWeight" - ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" - : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", - fit: BoxFit.contain, - ), - margin: EdgeInsets.symmetric(horizontal: 8), - ), - ], - ), - ], - ), - ), - ), // ic_shipping_mark.png - ), - ); - } -} - -class SelectPaymentOptionWidget extends StatefulWidget { - final OrderPreviewViewModel model; - - SelectPaymentOptionWidget(this.model); - - @override - _SelectPaymentOptionWidgetState createState() => - _SelectPaymentOptionWidgetState(); -} - -class _SelectPaymentOptionWidgetState extends State { - PaymentOption paymentOption; - - _navigateToPaymentOption() { - Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) - .then((result) => - { - setState(() { - if (result != null) { - paymentOption = result; - widget.model.paymentCheckoutData.paymentOption = - paymentOption; - widget.model.paymentCheckoutData.updateData(); - } - }) - }); - } - - @override - void initState() { - if (widget.model.paymentCheckoutData.paymentOption != null) { - paymentOption = widget.model.paymentCheckoutData.paymentOption; - } - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Container( - color: Colors.white, - child: paymentOption == null - ? InkWell( - onTap: () => {_navigateToPaymentOption()}, - child: Container( - margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/ic_payment_option.png", - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - Expanded( - child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), - child: Texts( - TranslationBase - .of(context) - .selectPaymentOption, - fontSize: 14, - fontWeight: FontWeight.bold, - color: Color(0xff0000ff), - ), - ), - ), - Icon( - Icons.arrow_forward, - size: 20, - color: Colors.grey.shade400, - ), - ], - ), - ), - ) - : Container( - margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/ic_payment_option.png", - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 8), - padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0), - decoration: new BoxDecoration( - color: Colors.grey.shade100, - shape: BoxShape.rectangle, - ), - child: Image.asset( - widget.model.getPaymentOptionImage(paymentOption), - width: 30.0, - height: 30.0, - fit: BoxFit.scaleDown, - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), - child: Texts( - widget.model.getPaymentOptionName(paymentOption), - fontSize: 14, - fontWeight: FontWeight.bold, - color: Colors.black, - ), - ), - ), - InkWell( - onTap: () => {_navigateToPaymentOption()}, - child: Texts( - TranslationBase - .of(context) - .changeMethod, - fontSize: 12, - fontWeight: FontWeight.normal, - color: Color(0xff0000ff), - ), - ), - ], - ), - ), - ); - } -} - -class LakumWidget extends StatefulWidget { - final OrderPreviewViewModel model; - - LakumWidget(this.model); - - @override - _LakumWidgetState createState() => _LakumWidgetState(); -} - -class _LakumWidgetState extends State { - TextEditingController _pointsController = new TextEditingController(); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); - - return Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/lakum_checkout.png", - width: 30.0, - fit: BoxFit.scaleDown, - ), - Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "${TranslationBase - .of(context) - .lakumPoints}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), - Texts( - "${widget.model.paymentCheckoutData.lacumInformation - .lakumInquiryInformationObjVersion.pointsBalanceAmount}", - fontSize: 12, - fontWeight: FontWeight.normal, - ), - ], - ), - ), - Expanded( - child: Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Texts( - "${TranslationBase - .of(context) - .riyal}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), - Container( - margin: projectProvider.isArabic - ? EdgeInsets.only(right: 4) - : EdgeInsets.only(left: 4), - width: 60, - height: 50, - child: TextField( - decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.2), - gapPadding: 0, - borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topRight: Radius.circular(8), - bottomRight: Radius.circular(8)) - : BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), - ), - disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.4), - gapPadding: 0, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), - ), - ), - controller: _pointsController, - keyboardType: TextInputType.number, - style: TextStyle( - fontSize: 14, - color: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount > - 0 - ? Colors.black - : Colors.grey, - ), - enabled: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount == - 0 - ? false - : true, - onChanged: (val) { - var value = int.tryParse(val); - if (value != null && - value <= - widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount) { - widget.model.paymentCheckoutData.usedLakumPoints = - value; - } else { - widget.model.paymentCheckoutData.usedLakumPoints = 0; - } - _pointsController.text = - "${widget.model.paymentCheckoutData.usedLakumPoints}"; - }, - ), - ), - Container( - height: 50, - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), - decoration: new BoxDecoration( - color: Color(0xff3666E0), - shape: BoxShape.rectangle, - borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topLeft: Radius.circular(6), - bottomLeft: Radius.circular(6)) - : BorderRadius.only( - topRight: Radius.circular(6), - bottomRight: Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: Color(0xff3666E0), - width: 0.8, - )), - ), - child: Texts( - "${TranslationBase - .of(context) - .use}", - fontSize: 12, - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - ), - ], - ), - ); - } -} - -class PaymentBottomWidget extends StatelessWidget { - final OrderPreviewViewModel model; - - BuildContext context; - MyInAppBrowser browser; - - PaymentBottomWidget(this.model); - - @override - Widget build(BuildContext context) { - final scaffold = Scaffold.of(context); - this.context = context; - - return Container( - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), - child: Consumer( - builder: (ctx, paymentData, _) => - paymentData.cartDataVisible - ? Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - margin: - EdgeInsets.symmetric(horizontal: 0, vertical: 4), - child: Row( - children: [ - Texts( - "${TranslationBase - .of(context) - .sar} ${(model.cartResponse.subtotal) - .toStringAsFixed(2)}", - fontSize: 14, - fontWeight: FontWeight.bold, - color: Color(0xff929295), - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), - child: Texts( - "${TranslationBase - .of(context) - .inclusiveVat}", - fontSize: 8, - color: Color(0xff929295), - fontWeight: FontWeight.w600, - ), - ), - ], - ), - ), - Texts( - "${model.cartResponse.quantityCount} ${TranslationBase - .of(context) - .items}", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], - ), - Container( - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide( - color: Color(0xff929295), - width: 1, - ), - ), - onPressed: (paymentData.address != null && - paymentData.paymentOption != null) - ? () async { - await model.makeOrder(); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast( - message: "Order has been placed successfully!!"); - openPayment(model.orderListModel[0], model.user); - } else { - AppToast.showErrorToast(message: model.error); - } - Navigator.pop(context); - Navigator.pop(context); - } - : null, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 16), - child: new Text( - "${TranslationBase - .of(context) - .proceedPay}", - style: new TextStyle( - color: (paymentData.address != null && - paymentData.paymentOption != null) - ? Colors.white - : Colors.grey.shade400, - fontWeight: FontWeight.bold, - fontSize: 12), - ), - ), - color: (paymentData.address != null && - paymentData.paymentOption != null) - ? Colors.green - : Color(0xff929295), - disabledColor: (paymentData.address != null && - paymentData.paymentOption != null) - ? Colors.green - : Color(0xff929295), - ), - ), - ], - ), - ) - : Container(), - ), - ); - } - - openPayment(OrderDetailModel order, - AuthenticatedUser authenticatedUser,) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); - - browser.openPharmacyPaymentBrowser( - order, - order.orderTotal, - 'ePharmacy Order', - order.id, - order.billingAddress.email, - order.customValuesXml, - "${authenticatedUser.firstName} ${authenticatedUser - .middleName} ${authenticatedUser.lastName}", - authenticatedUser.patientID, - authenticatedUser, - browser); - } - - onBrowserLoadStart(String url) { - print("onBrowserLoadStart"); - print(url); - - MyInAppBrowser.successURLS.forEach((element) { - if (url.contains(element)) { - if (browser.isOpened()) browser.close(); - MyInAppBrowser.isPaymentDone = true; - return; - } - }); - - MyInAppBrowser.errorURLS.forEach((element) { - if (url.contains(element)) { - if (browser.isOpened()) browser.close(); - MyInAppBrowser.isPaymentDone = false; - return; - } - }); - } - - onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { - print("onBrowserExit Called!!!!"); - if (isPaymentMade) { - AppToast.showSuccessToast( - message: "شكراً\nPayment status for your order is Paid"); - Navigator.pop(context); - Navigator.pop(context); - } else { - AppToast.showErrorToast( - message: - "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); - } - } -} diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart new file mode 100644 index 00000000..44eb3e09 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -0,0 +1,421 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.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:provider/provider.dart'; + +class CartOrderPage extends StatefulWidget { + final Function(int) changeTab; + + const CartOrderPage({Key key, this.changeTab}) : super(key: key); + + @override + _CartOrderPageState createState() => _CartOrderPageState(); +} + +class _CartOrderPageState extends State { + bool isLoading = true; + + @override + void initState() { + super.initState(); + getData(); + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + OrderPreviewViewModel model = Provider.of(context); + + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + AppScaffold appScaffold; + return NetworkBaseView( + // baseViewModel: model, + isLoading: isLoading, + isLocalLoader: true, + child: AppScaffold( + appBarTitle: TranslationBase.of(context).shoppingCart, + isShowAppBar: true, + isPharmacy: true, + showHomeAppBarIcon: false, + isShowDecPage: true, + baseViewModel: model, + backButtonTab: + widget.changeTab != null ? () => widget.changeTab(0) : null, + backgroundColor: Colors.white, + body: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? Container( + height: height * 0.85, + width: double.infinity, + child: SingleChildScrollView( + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureIconButton( + TranslationBase.of(context).deleteAllItems, + Icon( + Icons.delete_outline_sharp, + color: Colors.grey.shade700, + ), + onTap: () => {model.deleteShoppingCart()}, + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + child: Column( + children: [ + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model.cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderItem( + model.cartResponse + .shoppingCarts[index], () { + print(model.cartResponse + .shoppingCarts[index].quantity); + model + .changeProductQuantity(model + .cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != ViewState.Error) { + appScaffold.appBar.badgeUpdater( + '${value.quantityCount ?? 0}'); + } + if (model.state == + ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + }); + }, () { + model + .deleteProduct(model.cartResponse + .shoppingCarts[index]) + .then((value) { + if (model.state != ViewState.Error) { + appScaffold.appBar.badgeUpdater( + '${value.quantityCount ?? 0}'); + } + }); + })) + ], + ), + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).subtotal, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Image.asset( + "assets/images/pharmacy_module/payment_image.png", + width: mediaQuery.size.width - 20, + height: 30.0, + fit: BoxFit.scaleDown, + ), + SizedBox( + height: 120, + ) + ], + ), + ), + ), + ) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context).noData, +// 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + bottomSheet: Container( + height: !(model.cartResponse.shoppingCarts == null || + model.cartResponse.shoppingCarts.length == 0) + ? height * 0.15 + : 0, + color: Colors.white, + child: OrderBottomWidget(model.addresses, height), + ), + ), + ); + } + + void getData() async { + await Provider.of(context, listen: false) + .getShoppingCart(); + setState(() { + isLoading = false; + }); + } +} + +class OrderBottomWidget extends StatefulWidget { + final List addresses; + final double height; + + OrderBottomWidget(this.addresses, this.height); + + @override + _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); +} + +class _OrderBottomWidgetState extends State { + bool isAgree = false; + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + OrderPreviewViewModel cart = Provider.of(context); + return !(cart.cartResponse.shoppingCarts == null || + cart.cartResponse.shoppingCarts.length == 0) + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider( + color: Color(0xFFD6D6D6), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Container( + height: widget.height * 0.070, + color: Color(0xffe6ffe0), + padding: EdgeInsets.symmetric(horizontal: 4), + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + isAgree = !isAgree; + }); + }, + child: Container( + width: 25.0, + height: widget.height * 0.070, + decoration: new BoxDecoration( + 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, + ), + ), + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Texts( + TranslationBase.of(context) + .pharmacyServiceTermsCondition, + fontSize: 13, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ), + InkWell( + onTap: () => { + Navigator.push( + context, FadePage(page: PharmacyTermsConditions())) + }, + child: Container( + child: Icon( + Icons.info, + size: 25, + color: Color(0xff005aff), + ), + ), + ), + ], + ), + ), + Container( + height: widget.height * 0.065, + margin: EdgeInsets.symmetric(vertical: 2), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.symmetric( + horizontal: 0, vertical: 0), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: projectProvider.isArabic ? 12 : 14, + fontWeight: FontWeight.bold, + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Texts( + "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + RaisedButton( + onPressed: isAgree + ? () => { + Navigator.push( + context, + FadePage( + page: + OrderPreviewPage(widget.addresses))) + } + : null, + child: new Text( + "${TranslationBase.of(context).checkOut}", + style: new TextStyle( + color: + isAgree ? Colors.white : Colors.grey.shade300, + fontSize: 14), + ), + elevation: 0, + color: Color(0xff005aff), + disabledColor: Color(0xff005aff), + ), + ], + ), + ), + ], + ) + : Container(); + } +} diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart new file mode 100644 index 00000000..25c02dd0 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -0,0 +1,238 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'lakum_widget.dart'; + +class OrderPreviewPage extends StatefulWidget { + final List addresses; + + OrderPreviewPage(this.addresses); + + @override + _OrderPreviewPageState createState() => _OrderPreviewPageState(); +} + +class _OrderPreviewPageState extends State { + MyInAppBrowser browser; + bool isLoading = true; + + @override + void initState() { + super.initState(); + getData(); + } + + void getData() async { + if (isLoading) + await Provider.of(context, listen: false) + .getShoppingCart(); + setState(() { + isLoading = false; + }); + } + + @override + Widget build(BuildContext context) { + final mediaQuery = MediaQuery.of(context); + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + OrderPreviewViewModel model = Provider.of(context); + return AppScaffold( + appBarTitle: "${TranslationBase.of(context).checkOut}", + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + isLoading: isLoading, + isLocalLoader: true, + backgroundColor: Colors.white, + // baseViewModel: model, + body: Container( + color: Color(0xFFF1F1F1), + height: height * 0.90, + child: SingleChildScrollView( + child: Container( + color: Color(0xFFF1F1F1), + child: Column( + children: [ + SelectAddressWidget(model, widget.addresses), + SizedBox( + height: 10, + ), + SelectPaymentOptionWidget(model), + SizedBox( + height: 10, + ), + model.paymentCheckoutData.lacumInformation != null + ? Container( + child: Column( + children: [ + LakumWidget(model), + SizedBox( + height: 10, + ), + ], + ), + ) + : Container(), + Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).reviewOrder, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ...List.generate( + model.cartResponse.shoppingCarts != null + ? model.cartResponse.shoppingCarts.length + : 0, + (index) => ProductOrderPreviewItem( + model.cartResponse.shoppingCarts[index]), + ), + ], + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(8), + child: model.cartResponse.subtotal != null + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).orderSummary, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).subtotal}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).shipping}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.totalAdditionalShippingCharge).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).vat}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w500, + ), + ], + ), + const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), + SizedBox( + height: 10, + ), + ], + ) + : Container(), + ), + SizedBox( + height: model.cartResponse.shoppingCarts != null + ? height * 0.10 + : 0, + ) + ], + ), + ), + ), + ), + bottomSheet: Container( + height: model.cartResponse.shoppingCarts != null ? height * 0.10 : 0, + color: Colors.white, + child: PaymentBottomWidget(model), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart new file mode 100644 index 00000000..cdd26ddc --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -0,0 +1,187 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart'; + +class LakumWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + LakumWidget(this.model); + + @override + _LakumWidgetState createState() => _LakumWidgetState(); +} + +class _LakumWidgetState extends State { + TextEditingController _pointsController = new TextEditingController(); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + + return Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/lakum_checkout.png", + width: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).lakumPoints}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Texts( + "${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", + fontSize: 12, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + "${TranslationBase.of(context).riyal}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Container( + margin: projectProvider.isArabic + ? EdgeInsets.only(right: 4) + : EdgeInsets.only(left: 4), + width: 60, + height: 50, + child: TextField( + decoration: InputDecoration( + border: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black, width: 0.2), + gapPadding: 0, + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topRight: Radius.circular(8), + bottomRight: Radius.circular(8)) + : BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), + ), + disabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.black, width: 0.4), + gapPadding: 0, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + bottomLeft: Radius.circular(8)), + ), + ), + controller: _pointsController, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: 14, + color: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount > + 0 + ? Colors.black + : Colors.grey, + ), + enabled: widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount == + 0 + ? false + : true, + onChanged: (val) { + var value = int.tryParse(val); + if (value != null && + value <= + widget + .model + .paymentCheckoutData + .lacumInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount) { + widget.model.paymentCheckoutData.usedLakumPoints = + value; + } else { + widget.model.paymentCheckoutData.usedLakumPoints = 0; + } + _pointsController.text = + "${widget.model.paymentCheckoutData.usedLakumPoints}"; + }, + ), + ), + Container( + height: 50, + padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + decoration: new BoxDecoration( + color: Color(0xff3666E0), + shape: BoxShape.rectangle, + borderRadius: projectProvider.isArabic + ? BorderRadius.only( + topLeft: Radius.circular(6), + bottomLeft: Radius.circular(6)) + : BorderRadius.only( + topRight: Radius.circular(6), + bottomRight: Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: Color(0xff3666E0), + width: 0.8, + )), + ), + child: Texts( + "${TranslationBase.of(context).use}", + fontSize: 12, + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart new file mode 100644 index 00000000..44ebd882 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -0,0 +1,196 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class PaymentBottomWidget extends StatelessWidget { + final OrderPreviewViewModel model; + + BuildContext context; + MyInAppBrowser browser; + + PaymentBottomWidget(this.model); + + @override + Widget build(BuildContext context) { + final scaffold = Scaffold.of(context); + this.context = context; + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); + return Container( + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0), + child: orderPreviewViewModel.paymentCheckoutData.cartDataVisible + ? Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: + EdgeInsets.symmetric(horizontal: 0, vertical: 4), + child: Row( + children: [ + Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ), + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 4), + child: Texts( + "${TranslationBase.of(context).inclusiveVat}", + fontSize: 8, + color: Color(0xff929295), + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Texts( + "${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}", + fontSize: 10, + color: Colors.grey, + fontWeight: FontWeight.bold, + ), + ], + ), + Container( + child: RaisedButton( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + side: BorderSide( + color: Color(0xff929295), + width: 1, + ), + ), + onPressed: (orderPreviewViewModel + .paymentCheckoutData.address != + null && + orderPreviewViewModel + .paymentCheckoutData.paymentOption != + null) + ? () async { + await model.makeOrder(); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast( + message: + "Order has been placed successfully!!"); + openPayment( + model.orderListModel[0], model.user); + } else { + AppToast.showErrorToast(message: model.error); + } + Navigator.pop(context); + Navigator.pop(context); + } + : null, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), + child: new Text( + "${TranslationBase.of(context).proceedPay}", + style: new TextStyle( + color: (orderPreviewViewModel + .paymentCheckoutData.address != + null && + orderPreviewViewModel.paymentCheckoutData + .paymentOption != + null) + ? Colors.white + : Colors.grey.shade400, + fontWeight: FontWeight.bold, + fontSize: 12), + ), + ), + color: + (orderPreviewViewModel.paymentCheckoutData.address != + null && + orderPreviewViewModel + .paymentCheckoutData.paymentOption != + null) + ? Colors.green + : Color(0xff929295), + disabledColor: + (orderPreviewViewModel.paymentCheckoutData.address != + null && + orderPreviewViewModel + .paymentCheckoutData.paymentOption != + null) + ? Colors.green + : Color(0xff929295), + ), + ), + ], + ), + ) + : Container(), + ); + } + + openPayment( + OrderDetailModel order, + AuthenticatedUser authenticatedUser, + ) { + browser = new MyInAppBrowser( + onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); + + browser.openPharmacyPaymentBrowser( + order, + order.orderTotal, + 'ePharmacy Order', + order.id, + order.billingAddress.email, + order.customValuesXml, + "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", + authenticatedUser.patientID, + authenticatedUser, + browser); + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + if (isPaymentMade) { + AppToast.showSuccessToast( + message: "شكراً\nPayment status for your order is Paid"); + Navigator.pop(context); + Navigator.pop(context); + } else { + AppToast.showErrorToast( + message: + "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + } + } +} diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart new file mode 100644 index 00000000..bf958a36 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -0,0 +1,226 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart'; + +class SelectAddressWidget extends StatefulWidget { + final OrderPreviewViewModel model; + final List addresses; + + SelectAddressWidget(this.model, this.addresses); + + @override + _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); +} + +class _SelectAddressWidgetState extends State { + Addresses address; + + _navigateToAddressPage() { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())) + .then((result) { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + + /* setState(() { + if (result != null) { + address = result; + widget.model.paymentCheckoutData.address = address; + widget.model.getInformationsByAddress(); + } + })*/ + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.address != null) { + address = widget.model.paymentCheckoutData.address; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + OrderPreviewViewModel model = Provider.of(context); + return Container( + color: Colors.white, + child: address == null + ? InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_address.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_mark.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric( + vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).shippingAddress, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToAddressPage()}, + child: Texts( + TranslationBase.of(context).changeAddress, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Texts( + "${address.firstName} ${address.lastName}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Texts( + "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + fontSize: 12, + fontWeight: FontWeight.normal, + color: Colors.grey.shade500, + ), + ), + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 8), + child: Icon( + Icons.phone, + size: 20, + color: Colors.black, + ), + ), + Texts( + "${address.phoneNumber}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(vertical: 8), + child: SizedBox( + height: 2, + width: double.infinity, + child: Container( + color: Color(0xffefefef), + ), + ), + ), + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_shipping_truck.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + "${TranslationBase.of(context).shipBy}", + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + Container( + child: Image.asset( + model.paymentCheckoutData.shippingOption == null + ? "" + : model.paymentCheckoutData.shippingOption + .shippingRateComputationMethodSystemName == + "Shipping.FixedOrByWeight" + ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, + ), + margin: EdgeInsets.symmetric(horizontal: 8), + ), + ], + ), + ], + ), + ), + ), // ic_shipping_mark.png + ); + } +} diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart new file mode 100644 index 00000000..9234bb38 --- /dev/null +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.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:provider/provider.dart'; + +class SelectPaymentOptionWidget extends StatefulWidget { + final OrderPreviewViewModel model; + + SelectPaymentOptionWidget(this.model); + + @override + _SelectPaymentOptionWidgetState createState() => + _SelectPaymentOptionWidgetState(); +} + +class _SelectPaymentOptionWidgetState extends State { + PaymentOption paymentOption; + + _navigateToPaymentOption() { + Navigator.push(context, FadePage(page: PaymentMethodSelectPage())) + .then((result) => { + setState(() { + if (result != null) { + paymentOption = result; + widget.model.paymentCheckoutData.paymentOption = + paymentOption; + } + }) + }); + } + + @override + void initState() { + if (widget.model.paymentCheckoutData.paymentOption != null) { + paymentOption = widget.model.paymentCheckoutData.paymentOption; + } + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: paymentOption == null + ? InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Expanded( + child: Container( + padding: + EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + TranslationBase.of(context).selectPaymentOption, + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff0000ff), + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 20, + color: Colors.grey.shade400, + ), + ], + ), + ), + ) + : Container( + margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/ic_payment_option.png", + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + padding: EdgeInsets.symmetric(horizontal: 4, vertical: 0), + decoration: new BoxDecoration( + color: Colors.grey.shade100, + shape: BoxShape.rectangle, + ), + child: Image.asset( + widget.model.getPaymentOptionImage(paymentOption), + width: 30.0, + height: 30.0, + fit: BoxFit.scaleDown, + ), + ), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), + child: Texts( + widget.model.getPaymentOptionName(paymentOption), + fontSize: 14, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ), + InkWell( + onTap: () => {_navigateToPaymentOption()}, + child: Texts( + TranslationBase.of(context).changeMethod, + fontSize: 12, + fontWeight: FontWeight.normal, + color: Color(0xff0000ff), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index e8ca6caa..454b391c 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -1,30 +1,15 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.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/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; -import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/BannerPager.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.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/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/BannerPager.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/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:rating_bar/rating_bar.dart'; - -import '../../final_products_page.dart'; -import 'lacum-activitaion-vida-page.dart'; +import 'package:provider/provider.dart'; bool isInWishlist = false; int price = 0; @@ -36,913 +21,49 @@ 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(), - allowAny: true, - builder: (_, model, wi) => AppScaffold( - title: "", - isShowAppBar: false, - isShowDecPage: false, - baseViewModel: model, - backgroundColor: Colors.white, - body: Container( - width: double.infinity, - child: SingleChildScrollView( - child: Column( - 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: 60, - child: ListView.builder( - itemBuilder: (ctx, i) => - ManufacturerItem(model.manufacturerList[i]), - scrollDirection: Axis.horizontal, - itemCount: model.manufacturerList.length, - ), - ), - Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).recentlyViewed, - bold: true, - ), - BorderedButton( - TranslationBase.of(context).viewAll, - hasBorder: true, - vPadding: 6, - hPadding: 4, - borderColor: Colors.green, - textColor: Colors.green, - handler: () { - Navigator.push( - context, - FadePage( - page: FinalProductsPage( - id: "", - productType: 3, - ), - ), - ); - }, - ), - ], - ), - ), - Container( - height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 4 + 20 - : 0, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.lastVisitedProducts[i]), - scrollDirection: Axis.horizontal, - itemCount: model.lastVisitedProducts.length, - ), - ), - Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).bestSellers, - bold: true, - ), - BorderedButton( - TranslationBase.of(context).viewAll, - hasBorder: true, - borderColor: Colors.green, - textColor: Colors.green, - vPadding: 6, - hPadding: 4, - handler: () => { - Navigator.push( - context, - FadePage( - page: FinalProductsPage( - id: "", - productType: 4, - ), - ), - ), - }, - ), - ], - ), - ), - Container( - height: MediaQuery.of(context).size.height / 4 + 20, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.bestSellerProduct[i]), - scrollDirection: Axis.horizontal, - itemCount: model.bestSellerProduct.length, - ), - ), - ], - ), - ), - ), - ), - ); - } - - addToWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlist = true; - await x.addToWishlistData(itemID); - } - - deleteFromWishlistFunction(itemID) async { - ProductDetailViewModel x = new ProductDetailViewModel(); - isInWishlist = false; - await x.addToWishlistData(itemID); - } - - checkWishlist() async { - ProductDetailViewModel x = new ProductDetailViewModel(); - await x.checkWishlistData(); - for (int i = 0; i < x.wishListItems.length; i++) { - // itemID = x.wishListItems[i].id; - print("-------------wishlist---------------"); - print(itemID); -// print(product.id); - print(x.wishListItems[i].productId); - if (itemID == x.wishListItems[i].productId) { - isInWishlist = true; -// print('in wishlist'); - break; - } else { - isInWishlist = false; -// print('not in wishlist'); - } - } - } - - Future userInfo(id, product) async { - customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - if (customerId != null) { - itemID = id; - product = product; - checkWishlist(); - } - print("customerId:$customerId"); - return customerId; - } -} - -class GridViewButtons extends StatelessWidget { - final PharmacyModuleViewModel model; - - GridViewButtons(this.model); - @override Widget build(BuildContext context) { - final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; - return Container( - child: SizedBox( - height: gridHeight, - child: GridView.count( - childAspectRatio: 2.2, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - controller: new ScrollController(keepScrollOffset: false), - shrinkWrap: true, - padding: const EdgeInsets.all(4.0), - crossAxisCount: 2, - children: [ - DashboardItem( - imageName: 'pharmacy_module/bg_1.png', - hasColorFilter: false, - opacity: 0.8, - child: GridViewCard( - TranslationBase.of(context).offersAndPromotions, - 'assets/images/pharmacy_module/offer_icon.png', () { - Navigator.push(context, FadePage(page: OffersCategorisePage())); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_2.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).medicationRefill, - 'assets/images/pharmacy_module/medication_icon.png', () { - model.checkUserIsActivated().then((isActivated) { - if (isActivated) { - Navigator.push(context, FadePage(page: LakumMainPage())); - } else { - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())); - } - }); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_3.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).myPrescriptions, - 'assets/images/pharmacy_module/prescription_icon.png', () { - Navigator.push( - context, FadePage(page: PharmacyAddressesPage())); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_4.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard( - TranslationBase.of(context).searchAndScanMedication, - 'assets/images/pharmacy_module/search_scan_icon.png', - () {}), - ), - ], - ), - ), - ); - } -} -class DashboardItem extends StatelessWidget { - const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true}) - : super(key: key); - final bool hasBorder; - final String imageName; - final Widget child; - final Function onTap; - final double width; - final double height; - final Color color; - final double opacity; - final bool hasColorFilter; - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - child: Container( - width: width != null ? width : MediaQuery.of(context).size.width * 0.29, - height: height != null - ? height - : MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.17 - : MediaQuery.of(context).size.height * 0.35, - decoration: BoxDecoration( - color: !hasBorder - ? color != null - ? color - : HexColor('#050705').withOpacity(opacity) - : Colors.white, - borderRadius: BorderRadius.circular(6.0), - border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent), - image: imageName != null - ? DecorationImage( - image: ExactAssetImage('assets/images/$imageName'), - fit: BoxFit.cover, - colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null, - ) - : null, - ), - child: Center( - child: child, - ), - ), - ); - } -} - - -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, + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); + return WillPopScope( + onWillPop: () async { + return false; + }, + child: BaseView( + onModelReady: (model) async { + await model.getSavedLanguage(); + await model.getBannerList(); + if (model.isLogin) await orderPreviewViewModel.getShoppingCart(); + }, + allowAny: true, + builder: (_, model, wi) => AppScaffold( + title: "", + isShowAppBar: false, + isShowDecPage: false, + baseViewModel: model, + backgroundColor: Colors.white, + body: Container( + width: double.infinity, + child: SingleChildScrollView( 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()), - ], - ), + //crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BannerPager(model), + GridViewButtons(model), + PrescriptionsWidget(), + ShopByBrandWidget(), + RecentlyViewedWidget(), + BestSellerWidget(), ], ), ), - 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/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart new file mode 100644 index 00000000..9e717de6 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -0,0 +1,90 @@ +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/material.dart'; + +class AvailabilityInfo extends StatelessWidget { + final ProductDetailViewModel previousModel; + + const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + @override + Widget build(BuildContext context) { + return previousModel.productLocationService.length == 0 + ? Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) + : ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: previousModel.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(previousModel + .productLocationService[index].projectImageUrl), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 4, + child: Text( + previousModel.productLocationService[index] + .locationDescription + + "\n" + + convertCityName( + previousModel.productLocationService[0].cityName + .toString(), + ), + style: TextStyle(fontSize: 12), + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () {}, + ), + ), + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () {}, + ), + ), + ], + ), + Divider(height: 1.2, color: Colors.grey) + ], + ), + ); + }, + ); + } + + convertCityName(txt) { + String stringTxt; + String newTxt; + stringTxt = txt.toString(); + newTxt = stringTxt.split('.')[1]; + + return newTxt; + } +} diff --git a/lib/pages/pharmacies/screens/product-details/details_info.dart b/lib/pages/pharmacies/screens/product-details/details_info.dart new file mode 100644 index 00000000..bc5e7f80 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/details_info.dart @@ -0,0 +1,56 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DetailsInfo extends StatelessWidget { + + final PharmacyProduct product; + + const DetailsInfo({Key key, this.product}) : super(key: key); + + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + child: Texts( + TranslationBase.of(context) + .description, + fontSize: 17, + color: Colors.grey, + ), + ), + SizedBox( + height: 10, + ), + Divider(height: 1, color: Colors.grey), + SizedBox( + height: 15, + ), + Container( + child: Texts( + projectViewModel.isArabic + ? product.fullDescriptionn + : product + .fullDescription ?? + "", + fontSize: 16, + ), + ), + SizedBox( + height: 20, + ), + ]), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/discount_description.dart b/lib/pages/pharmacies/screens/product-details/discount_description.dart new file mode 100644 index 00000000..1dde8175 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/discount_description.dart @@ -0,0 +1,47 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:flutter/material.dart'; + +class DiscountDescription extends StatelessWidget { + final PharmacyProduct product; + + const DiscountDescription({Key key, this.product}) : super(key: key); + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + height: 50, + color: Colors.yellowAccent, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: Text( + product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), + ), + ), + ), + SizedBox( + width: 10, + ), + Expanded( + flex: 0, + child: Container( + child: Image( + image: AssetImage( + 'assets/images/offer.png'), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart new file mode 100644 index 00000000..3a3eba23 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -0,0 +1,258 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../../../locator.dart'; +import '../../../../../routes.dart'; +import '../../cart-page/cart-order-page.dart'; +import '../product-detail.dart'; + +class FooterWidget extends StatefulWidget { + final bool isAvailable; + final int maxQuantity; + final int minQuantity; + final int quantityLimit; + final PharmacyProduct item; + final Function addToCartFunction; + final ProductDetailViewModel model; + + int quantity; + bool isOverQuantity; + + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item, + {this.quantity, + this.isOverQuantity = false, + this.addToCartFunction, + this.model}); + + @override + _FooterWidgetState createState() => _FooterWidgetState(); +} + +class _FooterWidgetState extends State { + double quantityUI = 80; + bool showUI = false; + AuthenticatedUserObject authenticatedUserObject = + locator(); + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), + ), + border: Border.all(color: HexColor('#707070'), width: 0), + ), + width: double.infinity, + height: quantityUI, + child: Column( + children: [ + showUI + ? Container( + width: double.infinity, + height: 100, + color: Colors.white, + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Quantity", + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), + ), + ), + InkWell( + child: Icon(Icons.close, color: Colors.black), + onTap: () { + setState(() { + quantityUI = 80; + showUI = false; + }); + }, + ) + ], + mainAxisAlignment: MainAxisAlignment.spaceBetween, + ), + Container( + height: 50.0, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + SizedBox( + width: 5, + ), + for (int i = 1; i <= 10; i++) + QuantityBox( + label: i, + onTapFunc: onChangeValue, + isSelected: widget.quantity == i), + Container( + width: 100, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey[300]), + color: Colors.white, + ), + child: TextField( + decoration: InputDecoration( + labelText: ' Quantity # '), + onChanged: (text) { + if (int.tryParse(text) == null) { + text = ''; + } else { + setState(() { + widget.quantity = int.parse(text); + if (widget.quantity >= + widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + } + }); + } + }, + ), + ), + ], + ), + ) + ], + ), + ), + ) + : Container( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 70, + height: 50, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + widget.quantity.toString(), + style: TextStyle(fontSize: 20), + ), + ), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), + ), + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 80; + showUI = false; + } else { + quantityUI = 160; + showUI = true; + } + }); + }, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.45, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: !widget.isAvailable && widget.quantity == 0 || + widget.quantity > widget.quantityLimit || + widget.item.rxMessage != null, + disableColor: Color(0xFF4CAF50), + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else + await widget.addToCartFunction( + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); + }, + fontWeight: FontWeight.w600, + borderColor: Color(0xFF4CAF50), + borderRadius: 3, + color: Color(0xFF4CAF50), + ), + ), + SizedBox( + width: 5, + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: !widget.isAvailable && widget.quantity > 0 || + widget.quantity > widget.quantityLimit || + widget.item.rxMessage != null, + onTap: () async { + await widget.addToCartFunction( + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + ); + }, + fontWeight: FontWeight.w600, + borderColor: Colors.grey[800], + borderRadius: 3, + disableColor: Colors.grey[700], + color: !widget.isAvailable && widget.quantity > 0 || + widget.quantity > widget.quantityLimit || + widget.item.rxMessage != null + ? Colors.grey + : Colors.grey[800], + ), + ), + ], + ), + ], + ), + ); + } + + onChangeValue(int i) { + setState(() { + widget.quantity = i; + if (widget.quantity >= widget.quantityLimit) { + widget.isOverQuantity = true; + } else { + widget.isOverQuantity = false; + return widget.quantity; + } + }); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart b/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart new file mode 100644 index 00000000..35e69e0c --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/footor/quantity_box.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; + +class QuantityBox extends StatelessWidget { + final int label; + final bool isSelected; + final Function(int) onTapFunc; + + QuantityBox({ + Key key, + this.label, + this.onTapFunc, this.isSelected = false, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + InkWell( + child: Container( + decoration: BoxDecoration( + border: Border.all(color:isSelected?Colors.green: Colors.grey[300]), + color: Colors.white, + ), + alignment: Alignment.center, + width: 50.0, + + child: Text( + '$label', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + ), + ), + onTap:(){ + onTapFunc(label); + } + ), + SizedBox( + width: 5, + ) + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart new file mode 100644 index 00000000..83a76a19 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -0,0 +1,365 @@ +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/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +import 'availability_info.dart'; +import 'details_info.dart'; +import 'discount_description.dart'; +import 'footor/footer-widget.dart'; +import 'shared/product_details_app_bar.dart'; + +String itemID; +PharmacyProduct specificationData; + +class ProductDetailPage extends StatefulWidget { + final PharmacyProduct product; + + ProductDetailPage(this.product); + + @override + __ProductDetailPageState createState() => __ProductDetailPageState(); +} + +class __ProductDetailPageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + + bool isTrue = true; + bool isDetails = true; + bool isReviews = false; + bool isAvailability = false; + String customerId; + bool isSelected = true; + bool isOverQuantity = false; + bool isInWishList = false; + int quantity = 0; + + checkWishlist() async { + GifLoaderDialogUtils.showMyDialog(context); + ProductDetailViewModel model = new ProductDetailViewModel(); + await model.checkWishlistData(); + + for (int i = 0; i < model.wishListItems.length; i++) { + if (itemID == model.wishListItems[i].product.id) { + isInWishList = true; + break; + } else { + isInWishList = false; + } + } + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + } + + void initState() { + quantity = 1; + specificationData = widget.product; + + userInfo(); + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + void userInfo() async { + print(specificationData); + customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + if (customerId != null) { + itemID = widget.product.id; + checkWishlist(); + } + setState(() {}); + } + + Widget build(BuildContext context) { + return BaseView( + allowAny: true, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).productDetails, + isShowAppBar: true, + isPharmacy: true, + isShowDecPage: false, + customAppBar: ProductAppBar( + product: widget.product, + quantity: quantity, + model: model, + addToWishlistFunction: () async { + await addToWishlistFunction(itemID: itemID, model: model); + }, + deleteFromWishlistFunction: () async { + await deleteFromWishlistFunction(itemID: itemID, model: model); + }, + isInWishList:isInWishList, + addToCartFunction:addToCartFunction , + ), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + color: Colors.white, + child: Column( + children: [ + if (widget.product.images.isNotEmpty) + Container( + height: MediaQuery.of(context).size.height * .40, + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), + ), + if (widget.product.discountDescription != null) + DiscountDescription(product: widget.product) + ], + ), + ), + SizedBox( + height: 4, + ), + Container( + color: Colors.white, + child: ProductNameAndPrice( + context, + widget.product, + customerId: customerId, + addToWishlistFunction: (item) { + addToWishlistFunction(itemID: item, model: model); + setState(() {}); + }, + deleteFromWishlistFunction: (item) { + deleteFromWishlistFunction( + itemID: item, model: model); + setState(() {}); + }, + notifyMeWhenAvailable: (context, itemId) { + notifyMeWhenAvailable( + itemId: itemId, + customerId: customerId, + model: model); + }, + isInWishList: isInWishList, + ), + ), + SizedBox( + height: 6, + ), + Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric( + vertical: 15, horizontal: 10), + child: Texts( + TranslationBase.of(context).specification, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + width: double.infinity, + ), + // Divider(color: Colors.grey), + ], + ), + ), + SizedBox( + height: 6, + ), + Container( + // width: 500, + margin: EdgeInsets.only(bottom: 6), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + children: [ + FlatButton( + onPressed: () { + setState(() { + isDetails = true; + isReviews = false; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isDetails + ? Colors.green + : Colors.transparent, + ) + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () async { + if (widget.product.approvedTotalReviews > + 0) { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getProductReviewsData( + widget.product.id); + GifLoaderDialogUtils.hideDialog( + context); + } else { + model.clearReview(); + } + setState(() { + isDetails = false; + isReviews = true; + isAvailability = false; + }); + }, + child: Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isReviews + ? Colors.green + : Colors.transparent, + ), + ], + ), + SizedBox( + width: 20, + ), + Column( + children: [ + FlatButton( + onPressed: () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getProductLocationData(); + GifLoaderDialogUtils.hideDialog(context); + + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + }, + child: Text( + TranslationBase.of(context).availability, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), + ), + color: Colors.white, + ), + CustomDivider( + color: isAvailability + ? Colors.green + : Colors.transparent, + ), + ], + ), + ], + ), + SizedBox( + height: 10, + ), + isDetails + ? DetailsInfo( + product: widget.product, + ) + : isReviews + ? ReviewsInfo( + product: widget.product, + previousModel: model, + ) + : isAvailability + ? AvailabilityInfo( + previousModel: model, + ) + : Container(), + ], + ), + ), + SizedBox( + height: 10, + ), + RecommendedProducts(product: widget.product,productDetailViewModel: model, + addToWishlistFunction: (itemID) async { + await addToWishlistFunction(itemID: itemID, model: model); + }, deleteFromWishlistFunction: (itemID) async { + await deleteFromWishlistFunction(itemID: itemID, model: model); + },) + ], + ), + ), + bottomSheet: FooterWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product, + quantity: quantity, + isOverQuantity: isOverQuantity, + addToCartFunction: addToCartFunction, + model: model, + ), + )); + } + + addToWishlistFunction({itemID, ProductDetailViewModel model}) async { + isInWishList = true; + await model.addToWishlistData(itemID); + setState(() {}); + } + + deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async { + isInWishList = false; + await model.deleteWishlistData(itemID); + setState(() {}); + } + addToCartFunction( + {quantity, + itemID, + ProductDetailViewModel model}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.addToCartData(quantity, itemID); + GifLoaderDialogUtils.hideDialog(context); + } +} + + + +notifyMeWhenAvailable( + {itemId, customerId, ProductDetailViewModel model}) async { + await model.notifyMe(customerId, itemId); +} diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart new file mode 100644 index 00000000..6d8ea11d --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -0,0 +1,203 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + +import '../../../../locator.dart'; +import 'shared/icon_with_bg.dart'; + +class ProductNameAndPrice extends StatefulWidget { + BuildContext context; + PharmacyProduct item; + final customerId; + final bool isInWishList; + final Function notifyMeWhenAvailable; + final Function addToWishlistFunction; + final Function deleteFromWishlistFunction; + + AuthenticatedUserObject authenticatedUserObject = + locator(); + + ProductNameAndPrice(this.context, this.item, + {this.customerId, + this.isInWishList, + this.notifyMeWhenAvailable, + this.addToWishlistFunction, + this.deleteFromWishlistFunction}); + + @override + _ProductNameAndPriceState createState() => _ProductNameAndPriceState(); +} + +class _ProductNameAndPriceState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + FractionallySizedBox( + widthFactor: 0.95, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(widget.item.price.toString() + " " + "SR", + fontWeight: FontWeight.bold, fontSize: 20), + Texts( + projectViewModel.isArabic + ? widget.item.stockAvailabilityn + : widget.item.stockAvailability, + fontWeight: FontWeight.bold, + fontSize: 15, + color: widget.item.stockAvailability == 'Out of stock' + ? Colors.red + : Colors.green, + ), + // SizedBox(width: 20), + if (widget.authenticatedUserObject.isLogin) + widget.item.stockAvailability == 'Out of stock' && + widget.customerId != null + ? InkWell( + onTap: () => widget.notifyMeWhenAvailable( + context, widget.item.id), + child: Row(children: [ + Texts( + TranslationBase.of(context).notifyMe, + decoration: TextDecoration.underline, + color: Colors.blue, + ), + SizedBox(width: 4), + Icon( + FontAwesomeIcons.bell, + color: Colors.blue, + size: 15.0, + ) + ]), + ) + : IconWithBg( + icon: !widget.isInWishList + ? Icons.favorite_border + : Icons.favorite, + color: !widget.isInWishList + ? Colors.white + : Colors.red[800], + onPress: () async { + { + if (widget.customerId != null) { + if (!widget.isInWishList) { + + await widget + .addToWishlistFunction(widget.item.id); + + } else { + await widget + .deleteFromWishlistFunction(widget.item.id); + } + } else { + return; + } + setState(() {}); + } + }, + ) + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: projectViewModel.isArabic + ? Alignment.topRight + : Alignment.topLeft, + child: Text( + projectViewModel.isArabic + ? widget.item.namen + : widget.item.name, + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), + ), + ), + ), + FractionallySizedBox( + widthFactor: 0.95, + child: Row( + children: [ + Container( + child: Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + RatingBar.readOnly( + initialRating: double.parse( + widget.item.approvedRatingSum.toString()), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[400], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + SizedBox( + width: 10, + ), + Texts( + "${widget.item.approvedRatingSum}", + fontWeight: FontWeight.bold, + fontSize: 12, + ), + SizedBox( + width: 30, + ), + Texts( + "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", + fontSize: 12, + ), + SizedBox( + width: 70, + ), + if (widget.item.rxMessage != null) + Row( + children: [ + Text( + projectViewModel.isArabic + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle(color: Colors.red, fontSize: 10), + ), + SizedBox( + width: 5, + ), + Icon( + FontAwesomeIcons.questionCircle, + color: Colors.red, + size: 15.0, + ) + ], + ) + ], + ), + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + ], + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/recommended_products.dart b/lib/pages/pharmacies/screens/product-details/recommended_products.dart new file mode 100644 index 00000000..6e0fbba9 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/recommended_products.dart @@ -0,0 +1,346 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.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/locator.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.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:provider/provider.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class RecommendedProducts extends StatefulWidget { + final PharmacyProduct product; + final String customerId; + final ProductDetailViewModel productDetailViewModel; + final bool isOverQuantity; + final bool isInWishList; + final Function addToWishlistFunction; + final Function deleteFromWishlistFunction; + + AuthenticatedUserObject authenticatedUserObject = + locator(); + + RecommendedProducts( + {Key key, + this.product, + this.productDetailViewModel, + this.customerId, + this.isOverQuantity = false, + this.isInWishList = false, + this.addToWishlistFunction, + this.deleteFromWishlistFunction}) + : super(key: key); + + @override + _RecommendedProductsState createState() => _RecommendedProductsState(); +} + +class _RecommendedProductsState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return SingleChildScrollView( + child: Container( + width: 410, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 9), + width: 410, + color: Colors.white, + child: Texts( + TranslationBase.of(context).recommended, + fontWeight: FontWeight.bold, fontSize: 16 + ), + ), + Container( + color: Colors.white, + height: 210, + margin: EdgeInsets.only(bottom: 75), + padding: EdgeInsets.only(bottom: 5), + // margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4), + child: BaseView( + onModelReady: (model) => + model.getRecommendedProducts(widget.product.id), + builder: (_, model, wi) => NetworkBaseView( + isLocalLoader: true, + baseViewModel: model, + child: Container( + child: model.state== ViewState.BusyLocal?Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ):model.recommendedProductList.length != null + ? ListView.builder( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + itemCount: model.recommendedProductList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + RecommendedProductModel data = + model.recommendedProductList[index]; + var json = data.toJson(); + PharmacyProduct product = + new PharmacyProduct.fromJson(json); + await Navigator.pushReplacement( + context, + FadePage( + page: ProductDetailPage(product), + ), + ); + GifLoaderDialogUtils.hideDialog(context); + }, + child: 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: IconButton( + icon: Icon(model.recommendedProductList[index].isinwishlist != true + ? Icons.favorite_border : Icons.favorite), + color: model.recommendedProductList[index].isinwishlist != true + ? Colors.grey : Colors.red, + onPressed: () async { + if (widget.authenticatedUserObject.isLogin + ) { + if (!widget.isInWishList && model.recommendedProductList[index].isinwishlist != true) { + GifLoaderDialogUtils.showMyDialog(context); + await widget.addToWishlistFunction(model.recommendedProductList[index].id, + ); + GifLoaderDialogUtils.hideDialog(context); + setState(() { + model.recommendedProductList[index].isinwishlist = true;}); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await widget.deleteFromWishlistFunction(model.recommendedProductList[index].id, + ); + GifLoaderDialogUtils.hideDialog(context); + setState(() { + model.recommendedProductList[index].isinwishlist = false; + }); + } + } else { + return; + } + setState(() { + // checkWishlist(); + }); + }, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 10, 16), + alignment: Alignment.center, + child: (model + .recommendedProductList[ + index] + .images != + null && + model + .recommendedProductList[ + index] + .images + .length > + 0) + ? Image.network( + model + .recommendedProductList[ + index] + .images[0] + .src + .toString(), + 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: model + .recommendedProductList[ + index] + .rxMessage != + null + ? Texts( + projectViewModel.isArabic + ? model + .recommendedProductList[ + index] + .rxMessagen + : model + .recommendedProductList[ + index] + .rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ) + : Texts(""), + ), + ]), + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + projectViewModel.isArabic + ? 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), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model + .recommendedProductList[ + index] + .approvedRatingSum + .toDouble(), + 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].notApprovedTotalReviews.toString()})", +// bold: true, + fontSize: 12, + ), + ]), + ], + ), + ), + ), + ); + }) + : Container( + // color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Texts( + TranslationBase.of(context).nonRecommended, + color: Colors.black, + ), + ], + ), + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart new file mode 100644 index 00000000..64336d85 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -0,0 +1,90 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:rating_bar/rating_bar.dart'; + +class ReviewsInfo extends StatelessWidget { + final PharmacyProduct product; + final ProductDetailViewModel previousModel; + + const ReviewsInfo({Key key, this.product, this.previousModel}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return previousModel.productDetailService.length != 0 && + previousModel.productDetailService[0].reviews.length != 0 + ? ListView.builder( + physics: ScrollPhysics(), + itemCount: previousModel.productDetailService[0].reviews.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Row( + children: [ + Container( + child: Text( + previousModel.productDetailService[0] + .reviews[index].customerId + .toString(), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), + ), + Container( + margin: EdgeInsets.only(left: 210), + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Container( + child: Text( + previousModel + .productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), + ), + ), + SizedBox( + height: 50, + ), + Divider(height: 1, color: Colors.grey), + ], + ), + ); + }, + ) + : Container( + padding: EdgeInsets.all(15), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noReviewsAvailable, + ), +// Text('No Reviews Available'), + ); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/shared/custom-divider.dart b/lib/pages/pharmacies/screens/product-details/shared/custom-divider.dart new file mode 100644 index 00000000..268e79d0 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/shared/custom-divider.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; + +class CustomDivider extends StatelessWidget { + const CustomDivider({ + Key key, + this.color, + }) : super(key: key); + + final Color color; + + @override + Widget build(BuildContext context) { + return Container( + width: 120, + height: 2, + color: color, + ); + } +} \ No newline at end of file diff --git a/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart b/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart new file mode 100644 index 00000000..f2406614 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +class IconWithBg extends StatelessWidget { + final IconData icon; + final Color color; + final Function onPress; + + const IconWithBg({Key key, this.icon, this.color, this.onPress}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(30), + ), + child: Center( + child: IconButton( + icon: Icon(icon, size: 20,), + color: color, + onPressed: () async { + onPress(); + }, + ), + )); + } +} diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart new file mode 100644 index 00000000..b9612925 --- /dev/null +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -0,0 +1,183 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; + +import '../../../../../locator.dart'; +import '../../../compare-list.dart'; +import '../../cart-page/cart-order-page.dart'; +import 'icon_with_bg.dart'; + +class ProductAppBar extends StatelessWidget with PreferredSizeWidget { + final PharmacyProduct product; + + final ProductDetailViewModel model; + final Function addToWishlistFunction; + final Function deleteFromWishlistFunction; + final int quantity; + final bool isInWishList; + final Function addToCartFunction; + + + ProductAppBar( + {Key key, + this.product, + this.model, + this.addToWishlistFunction, + this.quantity, + this.deleteFromWishlistFunction, + this.isInWishList, this.addToCartFunction}) + : super(key: key); + + AuthenticatedUserObject authenticatedUserObject = + locator(); + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: FractionallySizedBox( + widthFactor: 0.95, + child: Column( + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + IconWithBg( + icon: Icons.arrow_back, + color: Colors.grey, + onPress: () { + Navigator.pop(context); + }, + ), + ], + ), + if (authenticatedUserObject.isLogin) + Row( + children: [ + Stack( + children: [ + IconWithBg( + icon: Icons.shopping_cart, + color: Colors.grey[800], + onPress: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CartOrderPage()), + ); + }), + + if(Provider.of(context, listen: false).cartResponse.quantityCount !=0) + Positioned( + top:0, right: -1.0, + child: Container( + decoration: BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(15), + + ), + padding: EdgeInsets.only(left: 5, right: 4.5), + height: 18, + child: Center(child: Texts(Provider.of(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)), + ), + ) + ], + ), + SizedBox( + width: 10, + ), + IconWithBg( + icon: FontAwesomeIcons.ellipsisV, + color: Colors.grey, + onPress: () { + settingModalBottomSheet(context); + }, + ), + ], + ) + ], + ), + ], + ), + ), + ); + } + + @override + Size get preferredSize => Size(double.maxFinite, 50); + + settingModalBottomSheet(context) { + showModalBottomSheet( + context: context, + builder: (BuildContext bc) { + return Container( + child: new Wrap( + children: [ + if (product.stockAvailability != 'Out of stock') + new ListTile( + leading: Icon(Icons.shopping_cart), + title: Text( + TranslationBase.of(context).addToCart, + ), + onTap: () async { + if (quantity > 0) { + { + await addToCartFunction( + quantity: quantity, + itemID: itemID, + model: model); + + Navigator.of(context).pop(); + } + } else { + AppToast.showErrorToast( + message: "you should add quantity"); + } + }), + ListTile( + leading: Icon( + !isInWishList ? Icons.favorite_border : Icons.favorite, + color: !isInWishList ? Colors.white : Colors.red[800], + ), + title: Text( + isInWishList + ? TranslationBase.of(context).removeFromWishlist + : TranslationBase.of(context).addToWishlist, + ), + onTap: () async { + if (isInWishList) + await deleteFromWishlistFunction(); + else + await addToWishlistFunction(); + Navigator.of(context).pop(); + }), + ListTile( + leading: Icon(Icons.compare), + title: Text( + TranslationBase.of(context).compare, + ), + onTap: () { + Provider.of(context, listen: false) + .addItem(specificationData); + Navigator.of(context).pop(); + }, + ), + ], + ), + ); + }); + } +} diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index d7a82cc6..cb7c59fd 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -45,6 +45,7 @@ class _ProductOrderItemState extends State { ), title: Container( child: Row( +// widget.item.product.stock_quantity===0 crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ @@ -166,10 +167,22 @@ class _ProductOrderItemState extends State { "$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}", fontSize: 12, fontWeight: FontWeight.bold, - ) + ), + widget.item.product.stockQuantity == 0 ? + Texts( + projectProvider.isArabic + ? widget.item.product.stockAvailabilityn + : widget.item.product.stockAvailability, + fontWeight: FontWeight.normal, + fontSize: 13, + color:Colors.red, + + ): Texts(""), ], ), - ) + ), + + ], ), ) diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 5e296716..92ad8d1a 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -12,8 +14,9 @@ import 'package:provider/provider.dart'; class ProductTileItem extends StatelessWidget { final AppSharedPreferences sharedPref = AppSharedPreferences(); final PharmacyProduct item; + final double itemHeight; - ProductTileItem(this.item); + ProductTileItem(this.item, this.itemHeight); void productOnClick(BuildContext ctx) { _saveLastVisitProducts(); @@ -23,6 +26,7 @@ class ProductTileItem extends StatelessWidget { void _saveLastVisitProducts() async { String lastVisited = ""; bool isIdExist = false; + List items = []; if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { lastVisited = @@ -31,8 +35,27 @@ class ProductTileItem extends StatelessWidget { if (id == item.id) { isIdExist = true; } + items.add(id); }); } + + if(items.length >= 15){ + items.removeAt(0); + // lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), ''); + } + + lastVisited = ""; + for(int i = items.length - 1; i >= 0; i--){ + if (lastVisited == "") { + // it means there is no lastVisited yet + lastVisited = "${items[i]}"; + } else { + // there is lastVisited id's and this product id is not found + lastVisited += ",${items[i]}"; + } + } + + if (!isIdExist) { if (lastVisited == "") { // it means there is no lastVisited yet @@ -41,8 +64,8 @@ class ProductTileItem extends StatelessWidget { // there is lastVisited id's and this product id is not found lastVisited += ",${item.id}"; } - sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited); } + sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, lastVisited); } @override @@ -51,75 +74,83 @@ 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: itemHeight / 2, + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, ), - 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,), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 6.0), + child: Texts( + projectProvider.isArabic ? item.namen : item.name, + regular: true, + fontSize: 12, + fontWeight: FontWeight.w400, ), - Container( + ), + Expanded( + child: Container( margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, 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}", - bold: true, + fontWeight: FontWeight.w600, fontSize: 14, ), ), @@ -129,24 +160,19 @@ class ProductTileItem extends StatelessWidget { child: StarRating( totalAverage: item.approvedTotalReviews > 0 ? (item.approvedRatingSum.toDouble() / - item.approvedTotalReviews.toDouble()) - .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 86% rename from lib/pages/pharmacies/widgets/BannerPager.dart rename to lib/pages/pharmacies/widgets/home/BannerPager.dart index 756d0758..6f1155dd 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, - fit: BoxFit.cover, - ), + : CachedNetworkImage( + imageUrl: item, + fit: BoxFit.fitWidth, + 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..2814bc1c --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart @@ -0,0 +1,56 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +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, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: MediaQuery.of(context).size.height / 3 + 20, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.bestSellerProduct[i], MediaQuery.of(context).size.height / 4 + 20), + scrollDirection: Axis.horizontal, + itemCount: model.bestSellerProduct.length, + ), + ) else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], + ), + ), + )); + } +} 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..8bdaf1f5 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/GridViewCard.dart @@ -0,0 +1,84 @@ +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: Column( + children: [ + Texts( + text, + color: Colors.white, + bold: true, + fontSize: SizeConfig.textMultiplier * 1.3, + ), + ], + ), + ), + ), + Row( + children: [ + BorderedButton( + TranslationBase.of(context).viewAll, + handler: handler, + tPadding: 0, + textColor: Color(0xFF5ab145), + 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..3e7cf5fe --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -0,0 +1,59 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +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: model.lastVisitedProducts.isNotEmpty ? Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).recentlyViewed, + FinalProductsPage( + id: "", + productType: 3, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 3 + 20 + : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => + ProductTileItem(model.lastVisitedProducts[i], MediaQuery.of(context).size.height / 4 + 20), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, + ), + ) + else + Container( + height: 80, + child: Center( + child:CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], + ), + ) : Container(), + )); + } +} diff --git a/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart b/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart new file mode 100644 index 00000000..7fcdbfe8 --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/ShopByBrandWidget.dart @@ -0,0 +1,53 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +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()), + if (model.state != ViewState.BusyLocal) + Container( + height: 150, + child: ListView.builder( + itemBuilder: (ctx, i) => + ManufacturerItem(model.manufacturerList[i]), + scrollDirection: Axis.horizontal, + itemCount: model.manufacturerList.length, + ), + ) + else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], + ), + ), + )); + } +} diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart new file mode 100644 index 00000000..05c57f2e --- /dev/null +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -0,0 +1,46 @@ +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(16, 10, 16, 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + title, + bold: true, + fontSize: 16, + ), + BorderedButton( + TranslationBase.of(context).viewAll, + hasBorder: true, + borderColor: Colors.green, + textColor: Colors.green, + fontWeight: FontWeight.bold, + vPadding: 6, + hPadding: 14, + handler: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + navigationWidget)); + }, + ), + ], + ), + ); + } +} diff --git a/lib/pages/pharmacies/widgets/manufacturerItem.dart b/lib/pages/pharmacies/widgets/manufacturerItem.dart index 574c37c5..c5b6bf23 100644 --- a/lib/pages/pharmacies/widgets/manufacturerItem.dart +++ b/lib/pages/pharmacies/widgets/manufacturerItem.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -23,28 +24,33 @@ class ManufacturerItem extends StatelessWidget { ), ); }, - child: Card( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Container( + width: 100, margin: EdgeInsets.symmetric( - horizontal: 8, + horizontal: 12, vertical: 4, ), - child: Container( - decoration: BoxDecoration( - border: Border( - right: BorderSide(color: Colors.grey.shade300, width: 1), - bottom: BorderSide(color: Colors.grey.shade300, width: 1), - left: BorderSide(color: Colors.grey.shade300, width: 1), - top: BorderSide(color: Colors.grey.shade300, width: 1)), - ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8), - child: Image.network( - item.image.src, - fit: BoxFit.cover, - ), - ), + decoration: BoxDecoration( + borderRadius:BorderRadius.circular(12) , + border: Border( + right: BorderSide(color: Colors.grey.shade300, width: 1), + bottom: BorderSide(color: Colors.grey.shade300, width: 1), + left: BorderSide(color: Colors.grey.shade300, width: 1), + top: BorderSide(color: Colors.grey.shade300, width: 1)), ), + child: item.image == null + ? Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10), + alignment: Alignment.topCenter, + child: AppText(item.name, fontWeight: FontWeight.w500,fontSize: 14,), + ) + : Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: Image.network( + item.image.src, + fit: BoxFit.cover, + ), + ), ), ); } diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index b75f709b..3d1c8114 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -5,68 +5,61 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -class WishlistPage extends StatefulWidget { - bool showBar; - WishlistPage(this.showBar); - @override - _WishlistPageState createState() => _WishlistPageState(); -} - -class _WishlistPageState extends State { - bool isTrue = true; +class WishlistPage extends StatelessWidget { + const WishlistPage({Key key}) : super(key: key); + @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getWishlistData(), builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).wishlist, - isShowAppBar: widget.showBar, + isShowAppBar: true, isShowDecPage: false, isPharmacy: true, baseViewModel: model, body: model.wishListList.length == 0 ? Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), ), - ) + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), + ), + ) : Container( - child: Column( - children: [ - Expanded( - flex: 20, - child: Container( - width: double.infinity, - height: - MediaQuery.of(context).size.height * 0.85, //250, - child: - ProductCheckTypeWidget(isTrue, model.wishListList), - ), - ), - ], + child: Column( + children: [ + Expanded( + flex: 20, + child: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.85, //250, + child: ProductCheckTypeWidget(model: model,), ), ), + ], + ), + ), ), ); } } + diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 9afd2554..6cc0961e 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -242,9 +242,10 @@ class _OrderPageState extends State color: Colors.blue[700], borderRadius: BorderRadius.circular(30.0)), - child: deliveredOrderList[index] - .orderStatusId == - 30 + child: deliveredOrderList[index].orderStatusId == 30 || + deliveredOrderList[index].orderStatusId == 997 || + deliveredOrderList[index].orderStatusId == 994 +// deliveredOrderList[index].orderStatusId == 30 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) @@ -507,9 +508,11 @@ class _OrderPageState extends State color: Colors.green, borderRadius: BorderRadius.circular(30.0)), - child: processingOrderList[index] - .orderStatusId == - 20 + child: processingOrderList[index].orderStatusId == 20 || + processingOrderList[index].orderStatusId == 995 || + processingOrderList[index].orderStatusId == 998 || + processingOrderList[index].orderStatusId == 999 +// processingOrderList[index].orderStatusId == 20 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), TranslationBase.of(context) diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 999356e9..0a0a131d 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -121,17 +121,40 @@ class _OrderDetailsPageState extends State { ), color: getStatusBackgroundColor(), borderRadius: BorderRadius.circular(30.0)), - child: Text( + child: model.orderListModel[0].orderStatusId == 30 || + model.orderListModel[0].orderStatusId == 997 || + model.orderListModel[0].orderStatusId == 994 +// deliveredOrderList[index].orderStatusId == 30 + ? Text( +// deliveredOrderList[0].orderStatus.toString().substring(12), + TranslationBase.of(context).deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( languageID == "ar" - ? model.orderListModel[0].orderStatusn - : model.orderListModel[0].orderStatus, -// TranslationBase.of(context).delivered, + ? model.orderListModel[0].orderStatusn.toString() + : model.orderListModel[0].orderStatus.toString(), style: TextStyle( color: Colors.white, fontSize: 13.0, fontWeight: FontWeight.bold, ), - ), + ) +// Text( +// languageID == "ar" +// ? model.orderListModel[0].orderStatusn +// : model.orderListModel[0].orderStatus, +//// TranslationBase.of(context).delivered, +// style: TextStyle( +// color: Colors.white, +// fontSize: 13.0, +// fontWeight: FontWeight.bold, +// ), +// ), ), ], ), diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 54a54322..514ea1a5 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -33,8 +33,14 @@ class _AddAddressPageState extends State { } else { _getCurrentLocation(); } + + setState(() { + }); } + + + _getCurrentLocation() async { await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; @@ -42,9 +48,12 @@ class _AddAddressPageState extends State { }).catchError((e) { _longitude = 0; _latitude = 0; + + }); } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); @@ -59,8 +68,8 @@ class _AddAddressPageState extends State { body: Container( height: height * 1, child: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, + latitude: _latitude??0, + longitude: _longitude??0, isWithAppBar: false, buttonColor: Color(0xFF5AB145), buttonLabel: TranslationBase.of(context).save, diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 906abd9e..b763e960 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -78,6 +78,8 @@ class _PharmacyAddressesState extends State { }, ), ), + SizedBox(height: height * 0.10,) + ], ), ), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 918e9668..a82a74eb 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 @@ -235,9 +235,7 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - WishlistPage(true))); + FadePage(page: WishlistPage())); }, child: Column( children: [ 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/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 8eafe6cb..94ee801a 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -1,26 +1,20 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_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/landing_page.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class RateAppointmentClinic extends StatefulWidget { @@ -28,8 +22,7 @@ class RateAppointmentClinic extends StatefulWidget { final String doctorNote; final int doctorRate; - RateAppointmentClinic( - {this.appointmentDetails, this.doctorRate, this.doctorNote}); + RateAppointmentClinic({this.appointmentDetails, this.doctorRate, this.doctorNote}); @override _RateAppointmentClinicState createState() => _RateAppointmentClinicState(); @@ -56,27 +49,17 @@ class _RateAppointmentClinicState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 25, - ), Text( TranslationBase.of(context).lastAppointment, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.64, - height: 23 / 16), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), SizedBox( height: 25, ), - Card( - elevation: 0, - shape: cardRadius(10), + Container( + decoration: cardRadius(10), child: Padding( - padding: const EdgeInsets.only( - left: 12, right: 12, top: 12, bottom: 12), + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -88,21 +71,11 @@ class _RateAppointmentClinicState extends State { children: [ Text( model.appointmentDetails.projectName, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.64, - height: 25 / 16), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), Text( model.appointmentDetails.startTime.toString().substring(0, 5), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.64, - height: 25 / 16), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ], ), @@ -111,11 +84,7 @@ class _RateAppointmentClinicState extends State { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - url: - 'https://hmgwebservices.com/Images/Hospitals/' + - model.appointmentDetails.projectID - .toString() + - '.jpg', + url: 'https://hmgwebservices.com/Images/Hospitals/' + model.appointmentDetails.projectID.toString() + '.jpg', width: 48, height: 48, ), @@ -125,16 +94,8 @@ class _RateAppointmentClinicState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - myRichText( - TranslationBase.of(context).clinic + ":", - model.appointmentDetails.projectName, - projectViewModel.isArabic), - myRichText( - TranslationBase.of(context).date + ":", - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDate(model - .appointmentDetails - .appointmentDate)), + MyRichText(TranslationBase.of(context).clinic + ":", model.appointmentDetails.projectName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).date + ":", DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.appointmentDetails.appointmentDate)), projectViewModel.isArabic), ], ), @@ -150,9 +111,8 @@ class _RateAppointmentClinicState extends State { ), Container( width: double.infinity, - child: Card( - elevation: 0, - shape: cardRadius(10), + child: Container( + decoration: cardRadius(10), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -160,12 +120,7 @@ class _RateAppointmentClinicState extends State { children: [ Text( TranslationBase.of(context).rateClinic, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.64, - height: 23 / 16), + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), ), SizedBox( height: 12, @@ -179,21 +134,13 @@ class _RateAppointmentClinicState extends State { duration: Duration(milliseconds: 300), switchInCurve: Curves.elasticOut, switchOutCurve: Curves.elasticIn, - transitionBuilder: (Widget child, - Animation animation) { - return ScaleTransition( - child: child, scale: animation); + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(child: child, scale: animation); }, child: rating == (index + 1) ? Container( - margin: EdgeInsets.only( - left: 3.0, right: 3.0), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(100), - border: Border.all( - width: 3, - color: CustomColors.green)), + margin: EdgeInsets.only(left: 3.0, right: 3.0), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)), key: ValueKey(rating), child: IconButton( onPressed: () { @@ -202,10 +149,7 @@ class _RateAppointmentClinicState extends State { }); }, iconSize: 35, - icon: SvgPicture.asset( - 'assets/images/new/appointment-rating/' + - (index + 1).toString() + - '.svg'), + icon: SvgPicture.asset('assets/images/new/appointment-rating/' + (index + 1).toString() + '.svg'), ), ) : Container( @@ -217,10 +161,7 @@ class _RateAppointmentClinicState extends State { }); }, iconSize: 35, - icon: SvgPicture.asset( - 'assets/images/new/appointment-rating/' + - (index + 1).toString() + - '.svg'), + icon: SvgPicture.asset('assets/images/new/appointment-rating/' + (index + 1).toString() + '.svg'), ), ), ), @@ -257,8 +198,8 @@ class _RateAppointmentClinicState extends State { ), ); }, - color: Color(0xffEAEAEA), - textColor: Color(0xff2B353E), + color: CustomColors.accentColor, + textColor: Colors.white, ), ), SizedBox(width: 10), @@ -270,25 +211,18 @@ class _RateAppointmentClinicState extends State { : () { model .sendAppointmentRate( - rating, - widget.appointmentDetails.appointmentNo, - widget.appointmentDetails.projectID, - widget.appointmentDetails.doctorID, - widget.appointmentDetails.clinicID, - note) + rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note) .then( (value) => { model .sendDoctorRate( widget.doctorRate, - widget - .appointmentDetails.appointmentNo, + widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note, - widget.appointmentDetails - .appointmentDate, + widget.appointmentDetails.appointmentDate, widget.appointmentDetails.doctorName, widget.appointmentDetails.projectName, widget.appointmentDetails.clinicName) diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index aaf9aa06..55e3fc31 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.da import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_clinic.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -38,9 +39,6 @@ class _RateAppointmentDoctorState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 25, //5598 - ), Text( TranslationBase.of(context).lastVisit, style: TextStyle( @@ -65,9 +63,8 @@ class _RateAppointmentDoctorState extends State { ), Container( width: double.infinity, - child: Card( - elevation: 0, - shape: cardRadius(10), + child: Container( + decoration: cardRadius(10), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -127,9 +124,8 @@ class _RateAppointmentDoctorState extends State { SizedBox( height: 12, ), - Card( - elevation: 0, - shape: cardRadius(10), + Container( + decoration: cardRadius(10), child: Padding( padding: EdgeInsets.all(8.0), child: TextField( @@ -169,8 +165,8 @@ class _RateAppointmentDoctorState extends State { ), ); }, - color: Color(0xffEAEAEA), - textColor: Color(0xff2B353E), + color: CustomColors.accentColor, + textColor: Colors.white, ), ), SizedBox(width: 10), diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 6e8b0c73..0aac68a0 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index adbebfca..f61650e5 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -6,7 +6,6 @@ import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; @@ -46,23 +45,14 @@ class _GeneralSettings extends State with TickerProviderStateMi child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).alert, + TranslationBase.of(context).modes, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.64, ), ), - Text( - TranslationBase.of(context).modesBelow, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - ), Row( children: [ Checkbox( @@ -75,7 +65,7 @@ class _GeneralSettings extends State with TickerProviderStateMi activeColor: CustomColors.accentColor, ), Text( - TranslationBase.of(context).prefferedMode, + TranslationBase.of(context).vibration, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -113,14 +103,6 @@ class _GeneralSettings extends State with TickerProviderStateMi letterSpacing: -0.64, ), ), - Text( - TranslationBase.of(context).prefferedMode, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - ), Column( children: [ Row( @@ -219,14 +201,6 @@ class _GeneralSettings extends State with TickerProviderStateMi letterSpacing: -0.64, ), ), - Text( - TranslationBase.of(context).permissionsBellow, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - ), Row( children: [ Checkbox( diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index f55227d8..7f1f6a93 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -51,10 +51,9 @@ class _ProfileSettings extends State with TickerProviderStateMi child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Card( - shape: cardRadius(8), + Container( + decoration: cardRadius(8), margin: EdgeInsets.zero, - elevation: 3, child: Padding( padding: const EdgeInsets.all(12.0), child: Row( @@ -227,7 +226,7 @@ class _ProfileSettings extends State with TickerProviderStateMi width: double.infinity, child: Card( margin: EdgeInsets.zero, - elevation: 20, + elevation: 0, child: Padding( padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 16), child: DefaultButton( diff --git a/lib/pages/sub_categories_modalsheet.dart b/lib/pages/sub_categories_modalsheet.dart new file mode 100644 index 00000000..d6499c8e --- /dev/null +++ b/lib/pages/sub_categories_modalsheet.dart @@ -0,0 +1,109 @@ + +import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'base/base_view.dart'; +import 'package:provider/provider.dart'; + + + + +class SubCategoriseModalsheet extends StatefulWidget { + String id; + String titleName; + + SubCategoriseModalsheet({this.id, this.titleName}); + @override + _SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName); + +} + +class _SubCategoriseModalsheetState extends State { + String id; + String titleName; +// List categoriesList = []; + _SubCategoriseModalsheetState({this.id, this.titleName}); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getCategoriseParent(i: id), + builder: (_, model, wi) => AppScaffold( + // appBarTitle: titleName, + appBarTitle: TranslationBase.of(context).categorise, + isBottomBar: false, + isShowAppBar: true, + isPharmacy: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: Container( + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.categoriseParent.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Padding( + padding: EdgeInsets.all(4.0), + child: InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(projectViewModel.isArabic + ? model.categoriseParent[index].namen + : model.categoriseParent[index].name), + SizedBox( + height: 10, + ), + Divider( + thickness: 0.6, + color: Colors.black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), + ), + ); + }), + ), + ), + + ), + ); + } +// getCatName() { +// +// if (widget.id == '1' ) +// return Texts("text1"); +// else if (widget.id == '2' ) +// return Texts("text2"); +// else if (widget.id == '3') +// return Texts("text3"); +// else if (widget.id == '4' ) +// return Texts("text4"); +// } + + +} \ No newline at end of file diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 45617072..3fb1574f 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1,6 +1,11 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; @@ -20,10 +25,14 @@ class SubCategorisePage extends StatefulWidget { String title; String parentId; + AuthenticatedUserObject authenticatedUserObject = + locator(); + SubCategorisePage({this.id, this.parentId, this.title}); @override - _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); + _SubCategorisePageState createState() => + _SubCategorisePageState(id: id, title: title, parentId: parentId); } class _SubCategorisePageState extends State { @@ -51,7 +60,9 @@ class _SubCategorisePageState extends State { TextEditingController maxField = TextEditingController(); return BaseView( onModelReady: (model) => model.getSubCategorise(i: id), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + PharmacyAppScaffold( appBarTitle: title, isBottomBar: false, isShowAppBar: true, @@ -83,7 +94,8 @@ class _SubCategorisePageState extends State { ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' : parentId == '9' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : parentId == '10' + : parentId == + '10' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' : '', fit: BoxFit.fill, @@ -95,12 +107,14 @@ class _SubCategorisePageState extends State { children: [ InkWell( child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Padding( padding: EdgeInsets.all(10.0), child: Container( - child: Texts(TranslationBase.of(context).viewCategorise), + child: Texts(TranslationBase.of(context) + .viewCategorise), ), ), Icon(Icons.arrow_forward) @@ -112,21 +126,30 @@ class _SubCategorisePageState extends State { context: context, builder: (BuildContext context) { return Container( - height: MediaQuery.of(context).size.height * 0.89, + height: + MediaQuery.of(context).size.height * + 0.89, color: Colors.white, child: Center( child: ListView.builder( scrollDirection: Axis.vertical, - itemCount: model.subCategorise.length, - itemBuilder: (BuildContext context, int index) { + itemCount: + model.subCategorise.length, + itemBuilder: (BuildContext context, + int index) { return Container( child: Padding( padding: EdgeInsets.all(8.0), child: InkWell( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - Texts(model.subCategorise[index].name), + Texts(model + .subCategorise[ + index] + .name), Divider( thickness: 0.6, color: Colors.black12, @@ -137,8 +160,12 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: FinalProductsPage( - id: model.subCategorise[index].id, + page: + FinalProductsPage( + id: model + .subCategorise[ + index] + .id, ), ), ); @@ -171,19 +198,23 @@ class _SubCategorisePageState extends State { itemCount: model.subCategorise.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( @@ -194,8 +225,14 @@ class _SubCategorisePageState extends State { ), ), Container( - width: MediaQuery.of(context).size.width * 0.17, - height: MediaQuery.of(context).size.height * 0.10, + width: MediaQuery.of(context) + .size + .width * + 0.17, + height: MediaQuery.of(context) + .size + .height * + 0.10, child: Center( child: Texts( model.subCategorise[index].name, @@ -256,16 +293,21 @@ class _SubCategorisePageState 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( @@ -275,23 +317,30 @@ class _SubCategorisePageState extends State { width: 10.0, ), Texts( - TranslationBase.of(context).refine, + TranslationBase.of( + context) + .refine, // 'Refine', - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, ), SizedBox( width: 250.0, ), InkWell( child: Texts( - TranslationBase.of(context).closeIt, + TranslationBase.of( + context) + .closeIt, // 'Close', color: Colors.red, - fontWeight: FontWeight.w600, + fontWeight: + FontWeight.w600, fontSize: 15.0, ), onTap: () { - Navigator.pop(context); + Navigator.pop( + context); }, ), ], @@ -304,27 +353,39 @@ class _SubCategorisePageState extends State { Column( children: [ ExpansionTile( - title: Texts(TranslationBase.of(context).categorise), + title: Texts( + TranslationBase.of( + context) + .categorise), children: [ ProcedureListWidget( model: model, - masterList: model.subCategorise, - removeHistory: (item) { + masterList: model + .subCategorise, + 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), ) ], ), @@ -333,27 +394,40 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts(TranslationBase.of(context).brands), + title: Texts( + TranslationBase.of( + context) + .brands), 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), ) ], ), @@ -362,43 +436,69 @@ class _SubCategorisePageState extends State { color: Colors.black12, ), ExpansionTile( - title: Texts(TranslationBase.of(context).price), + title: Texts( + TranslationBase.of( + context) + .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, ), ), ], @@ -413,20 +513,31 @@ class _SubCategorisePageState 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: [ Expanded( child: Container( width: 100, child: Button( - label: TranslationBase.of(context).reset, + label: TranslationBase.of( + context) + .reset, // 'Reset', - backgroundColor: Colors.red, + backgroundColor: + Colors + .red, ), ), ), @@ -436,37 +547,66 @@ class _SubCategorisePageState 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.getFilteredSubProducts( - min: minField.text.toString(), - max: maxField.text.toString(), - categoryId: categoriesId, - brandId: brandIds); - GifLoaderDialogUtils.hideDialog(context); - Navigator.pop(context); + min: minField + .text + .toString(), + max: maxField + .text + .toString(), + categoryId: + categoriesId, + brandId: + brandIds); + GifLoaderDialogUtils + .hideDialog( + context); + Navigator.pop( + context); }, - label: TranslationBase.of(context).apply, + label: TranslationBase.of( + context) + .apply, // 'Apply', - backgroundColor: Colors.green, + backgroundColor: + Colors + .green, ), ), ], @@ -533,22 +673,28 @@ class _SubCategorisePageState extends State { model.subProducts.isNotEmpty ? styleOne == true ? Container( - height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15, + height: model.subProducts.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.subProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, child: InkWell( child: Card( - color: model.subProducts[index].discountName != null + color: model.subProducts[index] + .discountName != + null ? Color(0xffFFFF00) : Colors.white, elevation: 0, @@ -576,67 +722,118 @@ class _SubCategorisePageState 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: [ 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.subProducts[index].images.isNotEmpty - ? model.subProducts[index].images[0].thumb + model + .subProducts[ + index] + .images + .isNotEmpty + ? model + .subProducts[ + 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.subProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .subProducts[ + 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.subProducts[index].rxMessage != null - ? model.subProducts[index].rxMessage + model + .subProducts[ + index] + .rxMessage != + null + ? model + .subProducts[ + 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: [ Texts( - model.subProducts[index].name, + model + .subProducts[ + index] + .name, regular: true, fontSize: 12, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), child: Texts( "SAR ${model.subProducts[index].price}", bold: true, @@ -646,21 +843,25 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.subProducts[index].approvedRatingSum > 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model.subProducts[index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum.toDouble() / + model.subProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight + .w400, ) ], ), @@ -675,7 +876,9 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.subProducts[index]), + page: ProductDetailPage( + model.subProducts[ + index]), )), }, )); @@ -683,11 +886,14 @@ class _SubCategorisePageState extends State { ), ) : Container( - height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122, + height: model.subProducts.length * + MediaQuery.of(context).size.height * + 0.122, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemCount: model.subProducts.length, - itemBuilder: (BuildContext context, int index) { + itemBuilder: + (BuildContext context, int index) { return InkWell( child: Card( child: Row( @@ -697,9 +903,11 @@ class _SubCategorisePageState 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, @@ -707,11 +915,22 @@ class _SubCategorisePageState 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.subProducts[index].images.isNotEmpty - ? model.subProducts[index].images[0].thumb + model + .subProducts[ + index] + .images + .isNotEmpty + ? model + .subProducts[ + 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, @@ -722,23 +941,45 @@ class _SubCategorisePageState extends State { Column( children: [ Container( - width: model.subProducts[index].rxMessage != null - ? MediaQuery.of(context).size.width / 5 + width: model + .subProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5.3 : 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.subProducts[index].rxMessage != null - ? model.subProducts[index].rxMessage + model + .subProducts[ + index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage : "", color: Colors.white, regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ), ), ], @@ -752,19 +993,31 @@ class _SubCategorisePageState 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( - model.subProducts[index].name, + model + .subProducts[ + index] + .name, regular: true, fontSize: 13.2, - fontWeight: FontWeight.w500, + fontWeight: + FontWeight.w500, maxLines: 5, ), ), @@ -772,7 +1025,11 @@ class _SubCategorisePageState 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.subProducts[index].price}", bold: true, @@ -782,26 +1039,55 @@ class _SubCategorisePageState extends State { Row( children: [ StarRating( - totalAverage: - model.subProducts[index].approvedRatingSum > 0 - ? (model.subProducts[index].approvedRatingSum - .toDouble() / - model.subProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model.subProducts[index].approvedRatingSum + .toDouble() / + model + .subProducts[index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, forceStars: true), Texts( "(${model.subProducts[index].approvedTotalReviews})", regular: true, fontSize: 10, - fontWeight: FontWeight.w400, + fontWeight: + FontWeight.w400, ) ], ), ], ), ), + widget.authenticatedUserObject.isLogin? + Container( + child: IconButton( + icon: Icon(Icons.shopping_cart, + size: 18, + color: Colors.blue,), + onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); + if(model.subProducts[index].rxMessage == null){ + await addToCartFunction(1, model.subProducts[index].id); +// GifLoaderDialogUtils.hideDialog(context); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + );} + else{ + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + GifLoaderDialogUtils.hideDialog(context); + } + + ), + ):Container(), ], ), ), @@ -809,7 +1095,8 @@ class _SubCategorisePageState extends State { Navigator.push( context, FadePage( - page: ProductDetailPage(model.subProducts[index]), + page: ProductDetailPage( + model.subProducts[index]), )), }, ); @@ -851,7 +1138,8 @@ class _SubCategorisePageState 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; } @@ -859,10 +1147,15 @@ class _SubCategorisePageState 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; } return false; } + addToCartFunction(quantity, itemID) async { + ProductDetailViewModel x = new ProductDetailViewModel(); + await x.addToCartData(quantity, itemID); + } } diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index f15ee9fb..1030c709 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -35,46 +35,50 @@ class _MyVaccinesState extends State { appBarTitle: TranslationBase.of(context).myVaccines, description: TranslationBase.of(context).infoVaccines, imagesInfo: [ - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png') + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png'), ], body: Container( margin: EdgeInsets.only(top: 20.0), child: Column( children: [ AppExpandableNotifier( - isExpand: true, - title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate).year.toString() : "", - bodyWidget: Container( - child: ListView.separated( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, - padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), - separatorBuilder: (context, index) => SizedBox(height: 14), - itemBuilder: (BuildContext context, int index) { - return DoctorCard( - onTap: null, - isInOutPatient: true, - isShowInOutPatient: false, - name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName, - billNo: "", - vaccineName: model.vaccineList[index].vaccineName, - profileUrl: model.vaccineList[index].doctorImageURL, - subName: model.vaccineList[index].projectName, - isLiveCareAppointment: false, - date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate), - isSortByClinic: true, - ); - }), - )), + isExpand: true, + title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate).year.toString() : "", + bodyWidget: Container( + child: ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (BuildContext context, int index) { + return DoctorCard( + onTap: null, + isInOutPatient: true, + isShowInOutPatient: false, + name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName, + billNo: "", + vaccineName: model.vaccineList[index].vaccineName, + profileUrl: model.vaccineList[index].doctorImageURL, + subName: model.vaccineList[index].projectName, + isLiveCareAppointment: false, + date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate), + isSortByClinic: true, + ); + }, + ), + ), + ), // SpaceBetweenTexts(space: 165.0), ], ), ), bottomSheet: Container( - color: Colors.white, - padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: Row(mainAxisSize: MainAxisSize.min, children: [ + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ Expanded( child: DefaultButton( TranslationBase.of(context).availability, @@ -87,21 +91,24 @@ class _MyVaccinesState extends State { ), SizedBox(width: 8), Expanded( - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, - onTapSendEmail: () { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ); - }, - )) - ])), + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); + }, + ), + ); + }, + ), + ), + ], + ), + ), ), ); } diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 181a4101..31a06fea 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/models/pharmacy/locationModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/productDetailModel.dart'; import 'package:diplomaticquarterapp/models/pharmacy/specification.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class ProductDetailService extends BaseService { @@ -87,6 +88,9 @@ class ProductDetailService extends BaseService { "language_id": 1 } }; + + + await baseAppClient.pharmacyPost(GET_SHOPPING_CART, isExternal: false, onSuccess: (dynamic response, int statusCode) { _addToCartModel.clear(); @@ -97,7 +101,7 @@ class ProductDetailService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - AppToast.showErrorToast(message: 'something went wrong please try again'); + AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); }, body: request); } @@ -108,7 +112,7 @@ class ProductDetailService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - AppToast.showErrorToast(message: 'something went wrong please try again'); + AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); }); } @@ -125,12 +129,13 @@ class ProductDetailService extends BaseService { _wishListProducts.clear(); response['shopping_carts'].forEach((item) { _wishListProducts.add(Wishlist.fromJson(item)); - AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); }); + AppToast.showSuccessToast(message: 'You have added a product to the Wishlist'); + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - AppToast.showErrorToast(message: 'something went wrong please try again'); + AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); }, body: request); } @@ -148,7 +153,8 @@ class ProductDetailService extends BaseService { super.error = error; }); } - Future delteItemFromWishlist(itemID) async { + + Future deleteItemFromWishlist(itemID) async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); hasError = false; await baseAppClient.getPharmacy(DELETE_WISHLIST+customerId+"+&product_id="+itemID+"&cart_type=Wishlist", @@ -157,9 +163,11 @@ class ProductDetailService extends BaseService { response['shopping_carts'].forEach((item) { _wishListProducts.add(Wishlist.fromJson(item)); }); + AppToast.showSuccessToast(message: 'You have removed a product from the Wishlist'); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; + AppToast.showErrorToast(message: error??Utils.generateContactAdminMessage()); }); } diff --git a/lib/services/pharmacy_services/review_service.dart b/lib/services/pharmacy_services/review_service.dart index b60ad412..329d52af 100644 --- a/lib/services/pharmacy_services/review_service.dart +++ b/lib/services/pharmacy_services/review_service.dart @@ -28,6 +28,8 @@ class ReviewService extends BaseService { _reviewList.clear(); response['reviews'].forEach((item) { _reviewList.add(Review.fromJson(item)); + print (response); + print (item['reviewText']); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index 78f17401..ce55a40b 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -51,9 +51,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/theme/colors.dart b/lib/theme/colors.dart index 463b0e70..6640b442 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -5,12 +5,14 @@ class CustomColors { static const Color purple = Color(0xFF6002EE); static const Color deepPurple = Color(0xFF3900B1); static const Color grey = Color(0xFF848484); + static const Color textColor = Color(0xFF575757); static const Color grey2 = Color(0xFFA5A5A5); static const Color darkGrey = Color(0xFF222222); static const Color black = Color(0xFF141414); static const Color white = Color(0xFFFFFFFF); static const Color accentColor = Color(0xFFD02127); static const Color lightGreyColor = Color(0xFFE2E2E2); + static const Color devider = Color(0xFFE5E5E5); static const Color darkGreyColor = Color(0xFFC9C9C9); static const Color pharmacyGreyColor = Color(0xFFDBDBDB); static const Color backgroudGreyColor = Color(0xFFEFEFEF); @@ -18,4 +20,7 @@ class CustomColors { static const Color appBackgroudGrey2Color = Color(0xFFF8F8F8); static const Color green = Color(0xFF359846); static const Color orange = Color(0xFFCC9B14); + + static const Color femaleColor = Color(0xFF359846); + static const Color maleColor = Color(0xFFCC9B14); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index aed37b8d..e1a14689 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -127,6 +127,8 @@ class TranslationBase { String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; + String get waitingTime => localizedValues['waitingTime'][locale.languageCode]; + String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; String get todoList => localizedValues['todoList'][locale.languageCode]; @@ -615,6 +617,8 @@ class TranslationBase { String get locationa => localizedValues['locationa'][locale.languageCode]; + String get callNow => localizedValues['call_now'][locale.languageCode]; + String get ambulancerequest => localizedValues['ambulancerequest'][locale.languageCode]; String get requestA => localizedValues['requestA'][locale.languageCode]; @@ -825,6 +829,10 @@ class TranslationBase { String get selectCity => localizedValues['selectCity'][locale.languageCode]; + String get city => localizedValues['city'][locale.languageCode]; + + String get distance => localizedValues['distance'][locale.languageCode]; + String get myAccount => localizedValues['MyAccount'][locale.languageCode]; String get otherAccount => localizedValues['OtherAccount'][locale.languageCode]; @@ -1752,6 +1760,8 @@ class TranslationBase { String get referralNumber => localizedValues['referralNumber'][locale.languageCode]; + String get needPrescription => localizedValues['needPrescription'][locale.languageCode]; + String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; String get requestID => localizedValues['requestID'][locale.languageCode]; String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode]; @@ -1789,9 +1799,8 @@ class TranslationBase { String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; String get addToCart => localizedValues['addToCart'][locale.languageCode]; - String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode]; - + String get removeFromWishlist => localizedValues['removeFromWishlist'][locale.languageCode]; String get buyNow => localizedValues['buyNow'][locale.languageCode]; String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode]; @@ -2408,6 +2417,68 @@ class TranslationBase { String get locked => localizedValues["locked"][locale.languageCode]; String get personalInfo => localizedValues['personalInfo'][locale.languageCode]; + + String get onlinePayment => localizedValues["onlinePayment"][locale.languageCode]; + + String get onlinePaymentSubtitle => localizedValues["onlinePaymentSubtitle"][locale.languageCode]; + + String get cmcTitle => localizedValues["cmcTitle"][locale.languageCode]; + + String get cmcSubtitle => localizedValues["cmcSubtitle"][locale.languageCode]; + + String get emergencyTitle => localizedValues["emergencyTitle"][locale.languageCode]; + + String get emergencySubtitle => localizedValues["emergencySubtitle"][locale.languageCode]; + + String get ereferralTitle => localizedValues["ereferralTitle"][locale.languageCode]; + + String get ereferralSubtitle => localizedValues["ereferralSubtitle"][locale.languageCode]; + + String get medicalFileTitle => localizedValues["medicalFileTitle"][locale.languageCode]; + + String get My_File_Details => localizedValues["My_File_Details"][locale.languageCode]; + + String get Ecommerce => localizedValues["Ecommerce"][locale.languageCode]; + + String get Family_Files => localizedValues["Family_Files"][locale.languageCode]; + + String get My_Child => localizedValues["My_Child"][locale.languageCode]; + + String get Vaccines => localizedValues["Vaccines"][locale.languageCode]; + + String get Todo => localizedValues["Todo"][locale.languageCode]; + + String get list => localizedValues["List"][locale.languageCode]; + + String get Blood => localizedValues["Blood"][locale.languageCode]; + + String get Donation => localizedValues["Donation"][locale.languageCode]; + + String get Health => localizedValues["Health"][locale.languageCode]; + + String get Calculator => localizedValues["Calculator"][locale.languageCode]; + + String get Converter => localizedValues["Converter"][locale.languageCode]; + + String get Smart => localizedValues["Smart"][locale.languageCode]; + + String get Watches => localizedValues["Watches"][locale.languageCode]; + + String get Parking => localizedValues["Parking"][locale.languageCode]; + + String get Details => localizedValues["Details"][locale.languageCode]; + + String get Virtual => localizedValues["Virtual"][locale.languageCode]; + + String get News => localizedValues["News"][locale.languageCode]; + + String get Latest => localizedValues["Latest"][locale.languageCode]; + + String get Tour => localizedValues["Tour"][locale.languageCode]; + String get mostViewed => localizedValues["mostViewed"][locale.languageCode]; + String get newProducts => localizedValues["newProducts"][locale.languageCode]; + + String get paymentSelected => localizedValues["paymentSelected"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 2c796768..d23b91b2 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -146,7 +146,7 @@ class Utils { } String loginIDPattern(loginType) { - var length = loginType == 1 ? 10 : 6; + var length = loginType == 1 ? 10 : 4; return "([0-9]{" + length.toString() + "})"; } @@ -336,9 +336,9 @@ class Utils { medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: MyInvoices())) : null, child: MedicalProfileItem( - title: TranslationBase.of(context).myInvoice, + title: TranslationBase.of(context).invoicesList, imagePath: 'invoice_list.svg', - subTitle: TranslationBase.of(context).invoicesList, + subTitle: TranslationBase.of(context).myInvoice, isEnable: projectViewModel.havePrivilege(14), ), )); @@ -464,9 +464,9 @@ class Utils { medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(30) ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) : null, child: MedicalProfileItem( - title: TranslationBase.of(context).smartWatches, + title: TranslationBase.of(context).smartWatchesSubtitle, imagePath: 'smart_watch.svg', - subTitle: TranslationBase.of(context).smartWatchesSubtitle, + subTitle: TranslationBase.of(context).smartWatches, isEnable: projectViewModel.havePrivilege(30), ), )); @@ -474,7 +474,7 @@ class Utils { medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(28) ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) : null, child: MedicalProfileItem( - title: TranslationBase.of(context).askYour, imagePath: 'ask_doctor.svg', subTitle: TranslationBase.of(context).askYourSubtitle, isEnable: projectViewModel.havePrivilege(28)), + title: TranslationBase.of(context).askYourSubtitle, imagePath: 'ask_doctor.svg', subTitle: TranslationBase.of(context).askYour, isEnable: projectViewModel.havePrivilege(28)), )); if (projectViewModel.havePrivilege(32) || true) { diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index e9d70a1f..70bd7df0 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -51,7 +51,7 @@ Widget getNoDataWidget(BuildContext context) { SvgPicture.asset('assets/images/new/not_found.svg', width: 110.0, height: 110.0), Container( margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xFFBABABA)))), + child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), ], ), ), @@ -131,7 +131,7 @@ Widget circularAviator( double elevation = 4, }) { return Card( - shape: cardRadius(2000), + shape: cardRadiusNew(2000), color: Colors.transparent, elevation: elevation, child: Container( @@ -219,13 +219,13 @@ RoundedRectangleBorder buttonShape() { ); } -Decoration containerRadiusWithGradient(double radius) { +Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2}) { return BoxDecoration( borderRadius: BorderRadius.circular(radius), gradient: LinearGradient( colors: [ - Color(0xFFF71787E), - Color(0xFFF2B353E), + color1?? Color(0xFFF71787E), + color2?? Color(0xFFF2B353E), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -405,10 +405,28 @@ Decoration containerColorRadiusLeftBorder(Color background, double radius, doubl ); } -ShapeBorder cardRadius(double radius) { +BoxDecoration cardRadius(double radius,{Color color,double elevation}) { + return BoxDecoration( + shape: BoxShape.rectangle, + color: color??Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(radius), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius:elevation?? 27, + offset: Offset(-2, 3), + ), + ], + ); +} + +ShapeBorder cardRadiusNew(double radius) { return RoundedRectangleBorder( - side: BorderSide(color: Colors.transparent, width: 1), - borderRadius: BorderRadius.circular(radius), + side: BorderSide(color: Colors.transparent, width: 0), + borderRadius: BorderRadius.all(Radius.circular(radius)), ); } @@ -547,3 +565,17 @@ FontStyle getFontStyle(String fontStyle) { return FontStyle.normal; } } + +bool timeCalculator(int startHour, int startMint, int endHour, int endMint) { + DateTime now = DateTime.now(); + DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour); + DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint); + print(startDate.toString()); + print(endDate.toString()); + print(now); + print("------------"); + if (startDate.isBefore(now) && endDate.isAfter(now)) + return true; + else + return false; +} diff --git a/lib/widgets/buttons/GestureIconButton.dart b/lib/widgets/buttons/GestureIconButton.dart index 841d7ea6..0f035b71 100644 --- a/lib/widgets/buttons/GestureIconButton.dart +++ b/lib/widgets/buttons/GestureIconButton.dart @@ -3,12 +3,12 @@ import 'package:flutter/material.dart'; class GestureIconButton extends StatefulWidget { GestureIconButton( - this.label, - this.icon, { - Key key, - this.onTap, - this.backgroundColor, - }) : super(key: key); + this.label, + this.icon, { + Key key, + this.onTap, + this.backgroundColor, + }) : super(key: key); final String label; final Widget icon; @@ -25,45 +25,48 @@ class _GestureIconButtonState extends State { @override Widget build(BuildContext context) { return GestureDetector( - onLongPressStart: (_) => - setState(() => _buttonLongPress = !_buttonLongPress), - onLongPressEnd: (_) => - setState(() => _buttonLongPress = !_buttonLongPress), - child: Wrap( - children: [ - Container( - decoration: BoxDecoration( - border: Border.all( - color: widget.backgroundColor != null - ? widget.backgroundColor - : Colors.grey[200], + onTap: (){ + setState(() { + _buttonLongPress = !_buttonLongPress; + }); + widget.onTap(); + + }, + // onLongPressStart: (_) => + // setState(() => _buttonLongPress = !_buttonLongPress), + // onLongPressEnd: (_) => + // setState(() => _buttonLongPress = !_buttonLongPress), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: widget.backgroundColor != null + ? widget.backgroundColor + : Colors.grey[200], + ), + color: widget.backgroundColor != null + ? widget.backgroundColor + : Colors.grey.shade200, + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: widget.icon, ), - color: widget.backgroundColor != null - ? widget.backgroundColor - : Colors.grey.shade200, - borderRadius: BorderRadius.all(Radius.circular(8))), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Expanded( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: const EdgeInsets.only(right: 8.0), - child: widget.icon, - ), - Texts( - widget.label, - color: _buttonLongPress ? Colors.white : Colors.black, - ), - ], - ), + Texts( + widget.label, + fontWeight: FontWeight.bold, + fontSize: 13.6, + color: _buttonLongPress ? Colors.white : Colors.black, ), - ), + ], ), ), - ], + ), ), ); } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 3f6b849b..dadabc71 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -27,7 +27,10 @@ class SecondaryButton extends StatefulWidget { this.small = false, this.disabled = false, this.borderColor, - this.noBorderRadius = false}) + this.noBorderRadius = false, + this.borderRadius, + this.disableColor, + this.fontWeight}) : super(key: key); final String label; @@ -41,6 +44,10 @@ class SecondaryButton extends StatefulWidget { final bool iconOnly; final bool disabled; final bool noBorderRadius; + final double borderRadius; + final Color disableColor; + final FontWeight fontWeight; + @override _SecondaryButtonState createState() => _SecondaryButtonState(); @@ -167,7 +174,8 @@ class _SecondaryButtonState extends State child: ClipRRect( borderRadius: widget.noBorderRadius ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(10.0)), + : BorderRadius.all( + Radius.circular(widget.borderRadius ?? 10.0), ), child: Stack( children: [ Positioned( @@ -178,7 +186,7 @@ class _SecondaryButtonState extends State height: 100, decoration: BoxDecoration( color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor), ), ), @@ -241,6 +249,9 @@ class _SecondaryButtonState extends State color: widget.textColor, fontSize: widget.small ? 12.0 : 14.0, fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic + ? 'Cairo' + : 'WorkSans' ), ), ) diff --git a/lib/widgets/card/rounded_container.dart b/lib/widgets/card/rounded_container.dart index a6cb36e2..b0d0fb8d 100644 --- a/lib/widgets/card/rounded_container.dart +++ b/lib/widgets/card/rounded_container.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; // OWNER : Ibrahim albitar @@ -70,18 +71,19 @@ class _RoundedContainerState extends State { ), ]) : null, - child: Card( + child: Container( margin: EdgeInsets.all(0), - shape: RoundedRectangleBorder( - borderRadius: widget.customCornerRaduis - ? BorderRadius.only( - topLeft: Radius.circular(widget.topLeft), - topRight: Radius.circular(widget.topRight), - bottomRight: Radius.circular(widget.bottomRight), - bottomLeft: Radius.circular(widget.bottomLeft)) - : BorderRadius.circular(widget.raduis), - ), - color: widget.backgroundColor, + // shape: RoundedRectangleBorder( + // borderRadius: widget.customCornerRaduis + // ? BorderRadius.only( + // topLeft: Radius.circular(widget.topLeft), + // topRight: Radius.circular(widget.topRight), + // bottomRight: Radius.circular(widget.bottomRight), + // bottomLeft: Radius.circular(widget.bottomLeft)) + // : BorderRadius.circular(widget.raduis), + // ), + decoration: cardRadius(widget.raduis,color: widget.backgroundColor,elevation: 3), + child: widget.child, )); } diff --git a/lib/widgets/charts/app_time_series_chart.dart b/lib/widgets/charts/app_time_series_chart.dart index 24d632bc..f897cb27 100644 --- a/lib/widgets/charts/app_time_series_chart.dart +++ b/lib/widgets/charts/app_time_series_chart.dart @@ -70,7 +70,7 @@ class TimeSeriesSales2 { TimeSeriesSales2(this.time, this.sales); } class TimeSeriesSales3 { - final int time; + final dynamic time; final double sales; TimeSeriesSales3(this.time, this.sales); diff --git a/lib/widgets/charts/show_chart.dart b/lib/widgets/charts/show_chart.dart index b23d90f5..86c83f5b 100644 --- a/lib/widgets/charts/show_chart.dart +++ b/lib/widgets/charts/show_chart.dart @@ -137,7 +137,7 @@ class ShowChart extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 10, ), - interval: null, + interval: _fetchLeftTileInterval(), margin: 12, ), ), @@ -177,6 +177,11 @@ class ShowChart extends StatelessWidget { minY -= increasingY.abs(); } + double _fetchLeftTileInterval() { + final interval = ((lastY - intialY) / 5).toDouble(); + return interval < 1.0 ? 1.0 : interval; + } + double getMaxY() { maxY = 0; timeSeries.forEach((element) { diff --git a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart index b1991f9f..8f5a0df9 100644 --- a/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart +++ b/lib/widgets/data_display/medical/LabResult/FlowChartPage.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -71,9 +72,9 @@ class FlowChartPage extends StatelessWidget { ) : Center( child: Container( - padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.42), + padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.32), child: Center( - child: Texts('No Data'), + child: getNoDataWidget(context), ), ), ), diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 5ce5ceba..4c7656f6 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -70,6 +70,7 @@ class LabResultWidget extends StatelessWidget { child: RaisedButton( color: new Color(0xFFc5272d), textColor: Colors.white, + elevation: 0, disabledTextColor: Colors.white, disabledColor: Colors.red[300], onPressed: () { diff --git a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart index 7b8a0c47..04ed184b 100644 --- a/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart +++ b/lib/widgets/data_display/medical/LabResult/Lab_Result_details_wideget.dart @@ -46,7 +46,7 @@ class _VitalSignDetailsWidgetState extends State { tableRow.add( TableRow( children: [ - Utils.tableColumnValue(DateUtil.formatDateToDate(DateUtil.convertStringToDate(labOrderResultList[i].verifiedOnDateTime), false), isLast: i == (labOrderResultList.length - 1)), + Utils.tableColumnValue(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(labOrderResultList[i].verifiedOnDateTime)), isLast: i == (labOrderResultList.length - 1)), Utils.tableColumnValue(labOrderResultList[i].resultValue, isLast: i == (labOrderResultList.length - 1)), ], ), diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 47c74182..7f67a253 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -11,6 +11,8 @@ import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; +import '../../my_rich_text.dart'; + class DoctorCard extends StatelessWidget { final String name; final String subName; @@ -164,12 +166,12 @@ class DoctorCard extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - myRichText(isSortByClinic ? TranslationBase.of(context).branch : TranslationBase.of(context).clinic + ":", subName, projectViewModel.isArabic), + MyRichText(isSortByClinic ? TranslationBase.of(context).branch : TranslationBase.of(context).clinic + ":", subName, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (rating == null && billNo != "") myRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic), - if (vaccineName != "") myRichText("", vaccineName ?? "", projectViewModel.isArabic), + if (rating == null && billNo != "") MyRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic), + if (vaccineName != "") MyRichText("", vaccineName ?? "", projectViewModel.isArabic), if (rating != null) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -216,10 +218,12 @@ class DoctorCard extends StatelessWidget { color: Theme.of(context).primaryColor, ), ) - : onTap != null ? Icon( - Icons.arrow_forward, - color: Theme.of(context).primaryColor, - ) : SizedBox(), + : onTap != null + ? Icon( + Icons.arrow_forward, + color: Theme.of(context).primaryColor, + ) + : SizedBox(), ), ), ], @@ -234,19 +238,3 @@ class DoctorCard extends StatelessWidget { ); } } - -// todo 'sikander' move this widget to separate file -Widget myRichText(String title, String value, bool isArabic) { - return RichText( - maxLines: 1, - text: TextSpan( - text: title, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), - children: [ - TextSpan( - text: " $value", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), - ) - ]), - ); -} diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index c32fa65c..a7d180c5 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -241,7 +241,8 @@ class _TimeLineViewState extends State { height: MediaQuery.of(context).size.width / 14, width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6), child: RaisedButton( - shape: cardRadius(8), + shape: cardRadiusNew(8), + elevation: 0, color: Color(0xFFFBF2E31), padding: EdgeInsets.zero, onPressed: () { diff --git a/lib/widgets/dialogs/ConfirmWithMessageDialog.dart b/lib/widgets/dialogs/ConfirmWithMessageDialog.dart index fca0dd19..1d423458 100644 --- a/lib/widgets/dialogs/ConfirmWithMessageDialog.dart +++ b/lib/widgets/dialogs/ConfirmWithMessageDialog.dart @@ -61,8 +61,8 @@ class ConfirmWithMessageDialog extends StatelessWidget { child: DefaultButton( TranslationBase.of(context).cancel_nocaps, () => Navigator.pop(context), - textColor: Color(0xff2B353E), - color: Color(0xffEAEAEA), + textColor: Colors.white, + color: CustomColors.accentColor, ), ), SizedBox(width: 10), @@ -73,6 +73,8 @@ class ConfirmWithMessageDialog extends StatelessWidget { Navigator.pop(context); onTap(); }, + textColor: Colors.white, + color: CustomColors.green, ), ), ], diff --git a/lib/widgets/dialogs/confirm_send_email_dialog.dart b/lib/widgets/dialogs/confirm_send_email_dialog.dart index 1e1baa28..e3952225 100644 --- a/lib/widgets/dialogs/confirm_send_email_dialog.dart +++ b/lib/widgets/dialogs/confirm_send_email_dialog.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/pages/settings/settings.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -101,8 +102,8 @@ class _ConfirmSendEmailDialogState extends State { () { Navigator.pop(context); }, - textColor: Color(0xff2B353E), - color: Color(0xffEAEAEA), + textColor: Colors.white, + color: CustomColors.accentColor, ), ), SizedBox(width: 10), @@ -113,6 +114,7 @@ class _ConfirmSendEmailDialogState extends State { Navigator.pop(context); widget.onTapSendEmail(); }, + color: Color(0xff359846), ), ), ], diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 0b96d8fe..6209f52d 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -19,6 +19,7 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; @@ -35,7 +36,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; + import '../../config/size_config.dart'; import '../../locator.dart'; import 'drawer_item_widget.dart'; @@ -46,10 +47,10 @@ class AppDrawer extends StatefulWidget { } class _AppDrawerState extends State { + @override void initState() { super.initState(); - checkUserData(); } diff --git a/lib/widgets/errors/app_embedded_error.dart b/lib/widgets/errors/app_embedded_error.dart index a4c956ca..b8bcc0cc 100644 --- a/lib/widgets/errors/app_embedded_error.dart +++ b/lib/widgets/errors/app_embedded_error.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; @@ -13,12 +14,13 @@ class AppEmbeddedError extends StatelessWidget { @override Widget build(BuildContext context) { - return Center( - child: Texts( - error, - color: Theme.of(context).errorColor, - textAlign: TextAlign.center, - ), - ); + // return Center( + // child: Texts( + // error, + // color: Theme.of(context).errorColor, + // textAlign: TextAlign.center, + // ), + // ); + return Center(child: getNoDataWidget(context),); } } diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart new file mode 100644 index 00000000..dd70d06f --- /dev/null +++ b/lib/widgets/hospital_location.dart @@ -0,0 +1,108 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import 'my_rich_text.dart'; + +class HospitalLocation extends StatelessWidget { + final GetHMGLocationsModel location; + final bool showCity; + + HospitalLocation(this.location, {Key key, this.showCity = false}) : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + location.locationName.trim(), + style: TextStyle(fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600, color: Color(0xff2E303A)), + ), + SizedBox(height: 10), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(30), + child: Image.network( + location?.projectImageURL?.toString() ?? 'https://hmgwebservices.com/Images/Hospitals/15.jpg', + width: 48, + height: 48, + fit: BoxFit.cover, + ), + ), + SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (showCity) MyRichText(TranslationBase.of(context).city + ":", location.cityName?.trim().toString(), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).distance + ":", location.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", projectViewModel.isArabic), + ], + ), + ) + ], + ), + ], + ), + ), + Column( + children: [ + contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { + MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); + }), + SizedBox(height: 10), + contactButton(Icons.call, TranslationBase.of(context).callNow, () { + launch("tel://" + location.phoneNumber); + }), + ], + ), + ], + ), + ); + } + + Widget contactButton(IconData _iconData, String title, VoidCallback callback) { + return SizedBox( + height: 32, + child: FlatButton.icon( + color: Color(0xffF5F5F5), + shape: StadiumBorder(side: BorderSide(color: Color(0xffF0F0F0), width: 1)), + onPressed: callback, + icon: Icon( + _iconData, + size: 12, + color: Color(0xff2E303A), + ), + label: Text( + title, + style: TextStyle(fontSize: 12, letterSpacing: -0.48, fontWeight: FontWeight.w600, color: Color(0xff2E303A)), + ), + ), + ); + } +} diff --git a/lib/widgets/mobile-no/mobile_no.dart b/lib/widgets/mobile-no/mobile_no.dart index a63ed0be..f4cd18fe 100644 --- a/lib/widgets/mobile-no/mobile_no.dart +++ b/lib/widgets/mobile-no/mobile_no.dart @@ -229,46 +229,49 @@ class _MobileNo extends State { ), ], ), - Container( - padding: EdgeInsets.all(5), - decoration: BoxDecoration(color: Colors.white, border: Border.all(color: Colors.grey), borderRadius: BorderRadius.circular(10)), - child: Row(children: [ - Expanded( - flex: 1, - child: Icon( - Icons.phone, - color: secondaryColor, + Directionality( + textDirection: TextDirection.ltr, + child: Container( + padding: EdgeInsets.all(5), + decoration: BoxDecoration(color: Colors.white, border: Border.all(color: Colors.grey), borderRadius: BorderRadius.circular(10)), + child: Row(children: [ + Expanded( + flex: 1, + child: Icon( + Icons.phone, + color: secondaryColor, + ), ), - ), - Expanded( - flex: 1, - child: Text( - countryCode, - overflow: TextOverflow.clip, + Expanded( + flex: 1, + child: Text( + countryCode, + overflow: TextOverflow.clip, + ), ), - ), - Expanded( - flex: 4, - child: Container( - margin: widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft), - child: TextField( - controller: widget.controller, - keyboardType: TextInputType.number, - maxLength: 10, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp("[0-9]")), - ], - // maxLengthEnforced: true, - // onChanged: (value) { - // widget.controller.text = countryCode; - // }, - onChanged: (value) => widget.onNumberChange(value), + Expanded( + flex: 4, + child: Container( + margin: widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only(top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft), + child: TextField( + controller: widget.controller, + keyboardType: TextInputType.number, + maxLength: 10, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp("[0-9]")), + ], + // maxLengthEnforced: true, + // onChanged: (value) { + // widget.controller.text = countryCode; + // }, + onChanged: (value) => widget.onNumberChange(value), - decoration: InputDecoration(counterText: "", border: InputBorder.none, hintText: '5xxxxxxxx'), + decoration: InputDecoration(counterText: "", border: InputBorder.none, hintText: '5xxxxxxxx'), + ), ), - ), - ) - ]), + ) + ]), + ), ) ]), ); diff --git a/lib/widgets/my_rich_text.dart b/lib/widgets/my_rich_text.dart new file mode 100644 index 00000000..92100f48 --- /dev/null +++ b/lib/widgets/my_rich_text.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; + +class MyRichText extends StatelessWidget { + final String title; + final String value; + final bool isArabic; + MyRichText(this.title,this.value,this.isArabic,{Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return RichText( + maxLines: 1, + text: TextSpan( + text: title, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), + children: [ + TextSpan( + text: " $value", + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ) + ]), + ); + } +} diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index d2ff291e..59444b31 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -7,8 +7,8 @@ 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/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; @@ -68,8 +68,8 @@ class DoctorHeader extends StatelessWidget { _speciality, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), - headerModel.invoiceNo.isNotEmpty ? myRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo, projectViewModel.isArabic) : Container(), - myRichText(TranslationBase.of(context).branch, headerModel.projectName, projectViewModel.isArabic), + headerModel.invoiceNo.isNotEmpty ? MyRichText(TranslationBase.of(context).invoiceNo + ":", headerModel.invoiceNo, projectViewModel.isArabic) : Container(), + MyRichText(TranslationBase.of(context).branch, headerModel.projectName, projectViewModel.isArabic), ], ), ), diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index f2d30c01..80ebc6e7 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -128,6 +128,7 @@ class _NfcLayoutState extends State { _stream?.cancel(); Navigator.pop(context); }, + elevation: 0, child: Text("CANCEL"), ), ), @@ -188,7 +189,7 @@ class _NfcLayoutState extends State { // Navigator.pop(context); // }, onPressed: null, - +elevation: 0, child: Text("DONE"), ), ), 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_pharmacy_widget.dart b/lib/widgets/others/app_scaffold_pharmacy_widget.dart index 7f49f441..0d44ec26 100644 --- a/lib/widgets/others/app_scaffold_pharmacy_widget.dart +++ b/lib/widgets/others/app_scaffold_pharmacy_widget.dart @@ -61,7 +61,7 @@ class PharmacyAppScaffold extends StatelessWidget { ), title: Text(authenticatedUserObject.isLogin ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle), + : appBarTitle.toUpperCase()), leading: Builder( builder: (BuildContext context) { return ArrowBack(); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index a0f95c1d..735eb9af 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; @@ -51,6 +52,8 @@ class AppScaffold extends StatelessWidget { final List appBarIcons; final List imagesInfo; final bool isHelp; + final bool isLocalLoader; + final Function backButtonTab; final String icon; final bool showDropDown; final int dropdownIndexValue; @@ -61,41 +64,45 @@ class AppScaffold extends StatelessWidget { AuthenticatedUserObject authenticatedUserObject = locator(); AppBarWidget appBar; - - AppScaffold({ - @required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.showNewAppBar = false, - this.showNewAppBarTitle = false, - this.hasAppBarParam, - this.bottomSheet, - this.bottomNavigationBar, - this.baseViewModel, - this.floatingActionButton, - this.isPharmacy = false, - this.showPharmacyCart = true, - this.isOfferPackages = false, - this.showOfferPackagesCart = false, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.backgroundColor, - this.preferredSize = 0.0, - this.appBarIcons, - this.infoList, - this.isHelp = false, - this.icon, - this.showHomeAppBarIcon = true, - this.imagesInfo, - this.showDropDown = false, - this.dropDownList, - this.dropdownIndexValue, - this.dropDownIndexChange, - this.onTap, - }); + final Widget customAppBar; + + AppScaffold( + {@required this.body, + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.showNewAppBar = false, + this.showNewAppBarTitle = false, + this.hasAppBarParam, + this.bottomSheet, + this.bottomNavigationBar, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.showPharmacyCart = true, + this.isOfferPackages = false, + this.showOfferPackagesCart = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.appBarIcons, + this.infoList, + this.isHelp = false, + this.icon, + this.showHomeAppBarIcon = true, + this.imagesInfo, + this.showDropDown = false, + this.dropDownList, + this.dropdownIndexValue, + this.dropDownIndexChange, + this.onTap, + appBar, + this.customAppBar, + this.isLocalLoader = false, + this.backButtonTab}); AppScaffold setOnAppBarCartClick(VoidCallback onClick) { _onCartClick = onClick; @@ -108,7 +115,7 @@ class AppScaffold extends StatelessWidget { bool isUserNotLogin = (!Provider.of(context, listen: false).isLogin && isShowDecPage); return Scaffold( - backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + backgroundColor: backgroundColor ?? CustomColors.appBackgroudGrey2Color, appBar: isUserNotLogin ? null : (showNewAppBar @@ -123,16 +130,19 @@ class AppScaffold extends StatelessWidget { onTap: onTap, ) : (isShowAppBar - ? appBar = AppBarWidget( - appBarTitle: appBarTitle, - appBarIcons: appBarIcons, - showHomeAppBarIcon: showHomeAppBarIcon, - isPharmacy: isPharmacy, - showPharmacyCart: showPharmacyCart, - isOfferPackages: isOfferPackages, - showOfferPackagesCart: showOfferPackagesCart, - isShowDecPage: isShowDecPage, - ) + ? customAppBar != null + ? customAppBar + : appBar = AppBarWidget( + appBarTitle: appBarTitle, + appBarIcons: appBarIcons, + showHomeAppBarIcon: showHomeAppBarIcon, + isPharmacy: isPharmacy, + showPharmacyCart: showPharmacyCart, + isOfferPackages: isOfferPackages, + showOfferPackagesCart: showOfferPackagesCart, + isShowDecPage: isShowDecPage, + backButtonTab: backButtonTab, + ) : null)), bottomSheet: bottomSheet, body: SafeArea( @@ -242,7 +252,17 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { ], ), actions: [ - if (appBarIcons != null) ...appBarIcons, + if (appBarIcons != null) ...appBarIcons else + IconButton( + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute(builder: (context) => LandingPage()), + (Route route) => false, + ); + }, + icon: Icon(Icons.home), + ), ], ); } @@ -263,6 +283,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget { final bool showOfferPackagesCart; final bool isShowDecPage; + final Function backButtonTab; Function(String) badgeUpdater; AppBarWidget( @@ -273,6 +294,7 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget { this.showPharmacyCart = true, this.isOfferPackages = false, this.showOfferPackagesCart = false, + this.backButtonTab, this.isShowDecPage = true}); @override @@ -285,8 +307,6 @@ class AppBarWidget extends StatefulWidget with PreferredSizeWidget { String _badgeText = "0"; class AppBarWidgetState extends State { - String badgeText = "0"; - @override Widget build(BuildContext context) { widget.badgeUpdater = badgeUpdateBlock; @@ -301,6 +321,8 @@ class AppBarWidgetState extends State { Widget buildAppBar(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); + return AppBar( elevation: 0, backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, @@ -311,7 +333,9 @@ class AppBarWidgetState extends State { style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { - return ArrowBack(); + return ArrowBack( + onTap: widget.backButtonTab, + ); }, ), centerTitle: true, @@ -329,7 +353,7 @@ class AppBarWidgetState extends State { icon: Badge( position: BadgePosition.topStart(top: -15, start: -10), badgeContent: Text( - _badgeText, + orderPreviewViewModel.cartResponse.quantityCount.toString() /*_badgeText*/, style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), ), child: Icon(Icons.shopping_cart)), diff --git a/lib/widgets/others/app_scafold_detail_page.dart b/lib/widgets/others/app_scafold_detail_page.dart index ba729965..e69de29b 100644 --- a/lib/widgets/others/app_scafold_detail_page.dart +++ b/lib/widgets/others/app_scafold_detail_page.dart @@ -1,229 +0,0 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; -import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; - -import '../../locator.dart'; -import '../progress_indicator/app_loader_widget.dart'; -import 'network_base_view.dart'; -import 'not_auh_page.dart'; - -class DetailPageScafold extends StatefulWidget { - final String appBarTitle; - final Widget body; - final Widget bottomSheet; - final bool isLoading; - final bool isShowAppBar; - final bool hasAppBarParam; - final BaseViewModel baseViewModel; - final bool isBottomBar; - final Widget floatingActionButton; - final bool isPharmacy; - final String title; - final String description; - final String image; - final bool isShowDecPage; - final List infoList; - final Color backgroundColor; - final double preferredSize; - final List appBarIcons; - final PreferredSizeWidget appBarWidget; - - DetailPageScafold( - {@required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.hasAppBarParam, - this.bottomSheet, - this.baseViewModel, - this.floatingActionButton, - this.isPharmacy = false, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.backgroundColor, - this.preferredSize = 0.0, - this.appBarIcons, - this.appBarWidget, - this.image, - this.infoList}); - - @override - _DetailPageScafoldState createState() => _DetailPageScafoldState(); -} - -class _DetailPageScafoldState extends State { - AuthenticatedUserObject authenticatedUserObject = - locator(); - - @override - Widget build(BuildContext context) { - AppGlobal.context = context; - PreferredSizeWidget appBar; - - if (this.widget.appBarWidget == null) { - PreferredSizeWidget appBarWidget = AppBarWidget( - widget.appBarTitle, - widget.appBarIcons, - widget.isShowAppBar, - isPharmacy: widget.isPharmacy, - isShowDecPage: widget.isShowDecPage, - image: widget.image, - ); - appBar = widget.preferredSize == 0 - ? appBarWidget - : PreferredSize( - child: appBarWidget, - preferredSize: Size.fromHeight(widget.preferredSize)); - } else { - appBar = this.widget.appBarWidget; - } - - return Scaffold( - backgroundColor: - widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, - appBar: appBar, - body: (!Provider.of(context, listen: false).isLogin && - widget.isShowDecPage) - ? NotAutPage( - title: widget.appBarTitle, - description: widget.description, - infoList: widget.infoList, - ) - : widget.baseViewModel != null - ? NetworkBaseView( - child: buildBodyWidget(), - baseViewModel: widget.baseViewModel, - ) - : buildBodyWidget(), - bottomSheet: widget.bottomSheet, - //floatingActionButton: floatingActionButton ?? floatingActionButton, - // bottomNavigationBar: - // this.isBottomBar == true ? BottomBarSearch() : SizedBox() - // floatingActionButton: FloatingSearchButton(), - ); - } - - buildAppLoaderWidget(bool isLoading) { - return isLoading ? AppLoaderWidget() : Container(); - } - - buildBodyWidget() { - // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); - return Stack(children: [ - widget.body, /*FloatingSearchButton()*/ - ]); - } -} - -class AppBarWidget extends StatelessWidget with PreferredSizeWidget { - final AuthenticatedUserObject authenticatedUserObject = - locator(); - - final String appBarTitle; - final List appBarIcons; - final bool isShowAppBar; - final bool isPharmacy; - final bool isShowDecPage; - final String image; - - AppBarWidget(this.appBarTitle, this.appBarIcons, this.isShowAppBar, - {this.isPharmacy = true, this.isShowDecPage = true, this.image}); - - @override - Widget build(BuildContext context) { - return buildAppBar(context); - } - - Widget buildAppBar(BuildContext context) { - return isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: Colors.white, -// isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Texts( - authenticatedUserObject.isLogin || !isShowDecPage - ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle, - color: Colors.white, - bold: true, - ), - leading: Builder( - builder: (BuildContext context) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () => Navigator.pop(context), - child: Icon(Icons.arrow_back_ios, color: Colors.grey), - ); - }, - ), - centerTitle: true, - actions: [ - isPharmacy - ? IconButton( - icon: Icon(Icons.shopping_cart), - color: Colors.grey, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CartOrderPage()), - ); -// Navigator.of(context) -// .popUntil(ModalRoute.withName('/')); - }) - : Container(), - image != null - ? InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: InsuranceUpdate(), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - image, - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, - color: Colors.grey, - ), - ), - ) - : IconButton( - icon: Icon(FontAwesomeIcons.ellipsisV), - color: Colors.grey, - onPressed: () { - settingModalBottomSheet(context); - }, - ), - if (appBarIcons != null) ...appBarIcons - ], - ) - : Container( - height: 0, - width: 0, - ); - } - - @override - Size get preferredSize => Size(double.maxFinite, 60); -} diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 7cdeb4a4..8a9274be 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -1000,6 +1000,7 @@ class _MyStatefulBuilderState extends State { ? Center( child: RaisedButton( child: AppText('Retry'), + elevation: 0, onPressed: () { RoboSearch.closeAlertDialog(context); event.setValue({'startPopUp': 'true'}); diff --git a/lib/widgets/others/network_base_view.dart b/lib/widgets/others/network_base_view.dart index 13c4ff16..7eacbd35 100644 --- a/lib/widgets/others/network_base_view.dart +++ b/lib/widgets/others/network_base_view.dart @@ -8,19 +8,21 @@ import 'package:flutter/material.dart'; class NetworkBaseView extends StatefulWidget { final BaseViewModel baseViewModel; final Widget child; + final bool isLocalLoader; + final bool isLoading; - NetworkBaseView({Key key, this.baseViewModel, this.child}); + NetworkBaseView({Key key, this.baseViewModel, this.child, this.isLocalLoader = false, this.isLoading}); @override _NetworkBaseViewState createState() => _NetworkBaseViewState(); } -class _NetworkBaseViewState extends State{ - +class _NetworkBaseViewState extends State { @override void initState() { super.initState(); } + @override void dispose() { super.dispose(); @@ -29,7 +31,18 @@ class _NetworkBaseViewState extends State{ @override Widget build(BuildContext context) { return Container( - child: buildBaseViewWidget(), + child: (widget.baseViewModel != null) + ? buildBaseViewWidget() + : Center( + child: widget.isLoading + ? CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ) + : widget.child, + ), ); } @@ -41,19 +54,30 @@ class _NetworkBaseViewState extends State{ return widget.child; break; case ViewState.Busy: - return Container( - height: MediaQuery.of(context).size.height, - - child: Stack( - children: [ - Container( - color: Colors.grey.withOpacity(0.6), + if (widget.isLocalLoader) + return Container( + height: 100, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), ), - Container(child: GifLoaderContainer(), margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.height * 0.09)) - ], - ), - ); + ), + ); + else + return Container( + height: MediaQuery.of(context).size.height, + child: Stack( + children: [ + Container( + color: Colors.grey.withOpacity(0.6), + ), + Container(child: GifLoaderContainer(), margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.09)) + ], + ), + ); break; case ViewState.Error: return Center( @@ -64,8 +88,4 @@ class _NetworkBaseViewState extends State{ break; } } - } - - - diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart index bccd288e..d1490d74 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_bar.dart @@ -1,4 +1,5 @@ - +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'; import 'package:flutter/material.dart'; @@ -17,8 +18,6 @@ class BottomNavPharmacyBar extends StatefulWidget { } class _BottomNavPharmacyBarState extends State { - int _index = 0; - _changeIndex(int index) { widget.changeIndex(index); } @@ -43,63 +42,36 @@ 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.heart, - activeIcon: EvaIcons.heart, + icon: EvaIcons.home, + activeIcon: EvaIcons.home, changeIndex: _changeIndex, index: widget.index, - currentIndex: 2, - title: TranslationBase.of(context).wishList), - + 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.shoppingCart, - activeIcon: EvaIcons.shoppingCart, + 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_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart index 77ce71be..f26c4917 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -59,16 +59,16 @@ class BottomNavHomeItem extends StatelessWidget { Container( child: Image.asset( 'assets/images/habib-logo.png', - height: 35.0, ), + height: 22.0, ), SizedBox( - height: 11, + height: 9, ), Texts( title, - textAlign: TextAlign.center, - color: currentIndex == index ? secondaryColor : Colors.grey, + textAlign: TextAlign.start, + color: currentIndex == index ? Colors.grey : Colors.grey, fontSize: 11, ), // Added TextAlign Property diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 47ff1b23..ff0cac32 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -1,6 +1,15 @@ import 'package:diplomaticquarterapp/Constants.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.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'; + +import '../../locator.dart'; class BottomNavPharmacyItem extends StatelessWidget { final String title; @@ -10,6 +19,7 @@ class BottomNavPharmacyItem extends StatelessWidget { final int index; final int currentIndex; final Function onTap; + final bool isHome; final IconData activeIcon; BottomNavPharmacyItem( @@ -19,54 +29,103 @@ class BottomNavPharmacyItem extends StatelessWidget { this.currentIndex, this.activeIcon, this.title, - this.onTap}); + this.onTap, + this.isHome = false}); @override Widget build(BuildContext context) { + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); + return Expanded( child: SizedBox( // height: 72.0, - child: Material( - type: MaterialType.transparency, - child: InkWell( - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - onTap: () => changeIndex(currentIndex), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - height: 15, - ), - currentIndex == index - ? Divider( - color: Color(0xff5AB145), - thickness: 3.5, - ) - : Divider( - thickness: 0, - ), - Container( - child: Icon(currentIndex == index ? activeIcon : icon, - color: - currentIndex == index ? secondaryColor : Colors.grey, - size: 22.0), - ), - SizedBox( - height: 11, - ), + child: Stack( + clipBehavior: Clip.none, + children: [ + Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + 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, + children: [ + SizedBox( + height: 15, + ), + currentIndex == index + ? Divider( + color: Color(0xff5AB145), + thickness: 3.5, + ) + : Divider( + thickness: 0, + ), + Container( + child: Icon(currentIndex == index ? activeIcon : icon, + color: isHome + ? Color(0xff5AB145) + : currentIndex == index + ? Colors.grey + : Colors.grey, + size: 22.0), + ), + SizedBox( + height: 11, + ), - // Added TextAlign Property - Texts( - title, - textAlign: TextAlign.center, - color: currentIndex == index ? secondaryColor : Colors.grey, - fontSize: 11, + // Added TextAlign Property + Texts( + title, + textAlign: TextAlign.center, + color: currentIndex == index ? Colors.grey : Colors.grey, + fontWeight: currentIndex == index + ? FontWeight.bold + : FontWeight.w400, + fontSize: currentIndex == index ? 13 : 11, + ), + ], ), - ], + ), ), - ), + if (currentIndex == 3 && + Provider.of(context, listen: false) + .cartResponse + .quantityCount != + 0) + Positioned( + top: 11.5, + right: -4.5, + child: Container( + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.only(left: 7, right: 6.5), + height: 18, + child: Center( + child: Texts( + orderPreviewViewModel.cartResponse.quantityCount.toString(), + style: "caption", + medium: true, + color: Colors.white, + )), + ), + ) + ], ), ), ); diff --git a/lib/widgets/pharmacy/my_account_items.dart b/lib/widgets/pharmacy/my_account_items.dart new file mode 100644 index 00000000..bb514e57 --- /dev/null +++ b/lib/widgets/pharmacy/my_account_items.dart @@ -0,0 +1,50 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AccountItem extends StatelessWidget { + final String title; + final String itemIcon; + final bool isTerms; + + const AccountItem({this.title, this.itemIcon, this.isTerms = false}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + isTerms == false + ? Container( + height: 35.0, + width: 35.0, + child: SvgPicture.asset( + '$itemIcon', + width: 35, + height: 35, + ), + ) + : Container( + height: 35.0, + width: 35.0, + child: Image.asset( + '$itemIcon', + width: 35, + height: 35, + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + width: 20, + ), + Texts( + title, + fontSize: 15.0, + ), + ], + ) + ], + ); + } +} diff --git a/lib/widgets/pharmacy/my_account_services.dart b/lib/widgets/pharmacy/my_account_services.dart new file mode 100644 index 00000000..e3b9948d --- /dev/null +++ b/lib/widgets/pharmacy/my_account_services.dart @@ -0,0 +1,52 @@ +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AccountServices extends StatelessWidget { + final String title; + final String serviceImage; + final Function onTap; + + const AccountServices({this.title, this.onTap, this.serviceImage}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: InkWell( + onTap: onTap, + // () { + // if (customerId == null) { + // AppToast.showErrorToast( + // message: "Customer not found"); + // return; + // } + // Navigator.push( + // context, + // FadePage( + // page: OrderPage( + // customerID: customerId))); + // }, + child: Column( + children: [ +// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), + SvgPicture.asset( + '$serviceImage', + width: 55, + height: 55, + ), + SizedBox( + height: 7, + ), + Texts( + title, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 595c8620..405a417c 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; diff --git a/lib/widgets/text/app_texts_widget.dart b/lib/widgets/text/app_texts_widget.dart index 4f2e68d1..a143236f 100644 --- a/lib/widgets/text/app_texts_widget.dart +++ b/lib/widgets/text/app_texts_widget.dart @@ -72,7 +72,6 @@ class _AppTextState extends State { // : 'WorkSans' // : widget.fontFamily, decoration: widget.underline == true ? TextDecoration.underline : TextDecoration.none - // backgroundColor:widget.backGroundcolor ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 90de021b..15c10362 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 1.0.4+5 +version: 4.3.5+1 environment: sdk: ">=2.9.0 <3.0.0" @@ -32,7 +32,7 @@ dependencies: #chart - fl_chart: ^0.12.1 + fl_chart: ^0.12.3 # Permissions permission_handler: ^5.0.0+hotfix.3 @@ -187,6 +187,8 @@ dependencies: speech_to_text: path: speech_to_text + in_app_update: ^1.1.15 + badges: ^1.1.4 # open_settings: ^2.0.1 # Dep by Zohaib