diff --git a/agconnect-services_DQ.json b/agconnect-services_DQ.json new file mode 100644 index 00000000..563c412f --- /dev/null +++ b/agconnect-services_DQ.json @@ -0,0 +1,14 @@ +{ + "client":{ + "appType":"1", + "cp_id":"2640966000002322881", + "product_id":"736430079244816576", + "client_id":"563737844552565952", + "client_secret":"9C9A2C272576B8AE6E886C78AF944E8354B91F0AF3381129BB8369FB35E41C47", + "project_id":"736430079244816576", + "app_id":"103856487", + "api_key":"CgB6e3x90XxBrOCMun809w+DOzcFEettcBDUF3fqaLry1ViqTeJqoPwpfaOq/uGw//x0oYwucu9aWazs+Rdj0GUF", + "package_name":"com.cloud.diplomaticquarterapp" + }, + "configuration_version":"1.0" +} \ No newline at end of file diff --git a/agconnect-services_HMG.json b/agconnect-services_HMG.json new file mode 100644 index 00000000..cfdaf83b --- /dev/null +++ b/agconnect-services_HMG.json @@ -0,0 +1,14 @@ +{ + "client":{ + "appType":"1", + "cp_id":"2640966000002322881", + "product_id":"736430079244816567", + "client_id":"563735388191982656", + "client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF", + "project_id":"736430079244816567", + "app_id":"102857389", + "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", + "package_name":"com.ejada.hmg" + }, + "configuration_version":"1.0" +} \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json index f86832ad..a4655794 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,39 +1,37 @@ { "project_info": { - "project_number": "815750722565", - "firebase_url": "https://api-project-815750722565.firebaseio.com", - "project_id": "api-project-815750722565", - "storage_bucket": "api-project-815750722565.appspot.com" + "project_number": "864393916058", + "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com", + "project_id": "diplomaticquarter-d2385", + "storage_bucket": "diplomaticquarter-d2385.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063", + "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923", "android_client_info": { "package_name": "com.cloud.diplomaticquarterapp" } }, "oauth_client": [ { - "client_id": "815750722565-3a0gc7neins0eoahdrimrfksk0sqice8.apps.googleusercontent.com", + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { - "current_key": "AIzaSyDUfg6AKM1-00WyzpvLImUBC46wFrq9-qw" + "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM" } ], "services": { - "analytics_service": { - "status": 1 - }, "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 2 + "other_platform_oauth_client": [ + { + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_type": 3 + } + ] } } } diff --git a/ios/Podfile b/ios/Podfile index 5579d926..d68afba2 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project - platform :ios, '11.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1df50aa4..fdb971fd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,25 +1,461 @@ PODS: + - android_intent (0.0.1): + - Flutter + - barcode_scan_fix (0.0.1): + - Flutter + - MTBBarcodeScanner + - connectivity (0.0.1): + - Flutter + - Reachability + - connectivity_for_web (0.1.0): + - Flutter + - connectivity_macos (0.0.1): + - Flutter + - device_calendar (0.0.1): + - Flutter + - device_info (0.0.1): + - Flutter + - Firebase/CoreOnly (6.33.0): + - FirebaseCore (= 6.10.3) + - Firebase/Messaging (6.33.0): + - Firebase/CoreOnly + - FirebaseMessaging (~> 4.7.0) + - firebase_core (0.5.3): + - Firebase/CoreOnly (~> 6.33.0) + - Flutter + - firebase_core_web (0.1.0): + - Flutter + - firebase_messaging (7.0.3): + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Messaging (~> 6.33.0) + - firebase_core + - Flutter + - FirebaseCore (6.10.3): + - FirebaseCoreDiagnostics (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - FirebaseCoreDiagnostics (1.7.0): + - GoogleDataTransport (~> 7.4) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) + - nanopb (~> 1.30906.0) + - FirebaseInstallations (1.7.0): + - FirebaseCore (~> 6.10) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - PromisesObjC (~> 1.2) + - FirebaseInstanceID (4.8.0): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - FirebaseMessaging (4.7.1): + - FirebaseCore (~> 6.10) + - FirebaseInstanceID (~> 4.7) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Reachability (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - Protobuf (>= 3.9.2, ~> 3.9) - Flutter (1.0.0) + - flutter_email_sender (0.0.1): + - Flutter + - flutter_flexible_toast (0.0.1): + - Flutter + - flutter_inappwebview (0.0.1): + - Flutter + - flutter_local_notifications (0.0.1): + - Flutter + - flutter_plugin_android_lifecycle (0.0.1): + - Flutter + - flutter_tts (0.0.1): + - Flutter + - geolocator (6.1.9): + - Flutter + - google_maps_flutter (0.0.1): + - Flutter + - GoogleMaps (< 3.10) + - GoogleDataTransport (7.5.1): + - nanopb (~> 1.30906.0) + - GoogleMaps (3.9.0): + - GoogleMaps/Maps (= 3.9.0) + - GoogleMaps/Base (3.9.0) + - GoogleMaps/Maps (3.9.0): + - GoogleMaps/Base + - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (6.7.2): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment + - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (6.7.2)" + - GoogleUtilities/Reachability (6.7.2): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/Logger + - hexcolor (0.0.1): + - Flutter + - image_cropper (0.0.3): + - Flutter + - TOCropViewController (~> 2.5.4) + - image_picker (0.0.1): + - Flutter + - just_audio (0.0.1): + - Flutter + - local_auth (0.0.1): + - Flutter + - location (0.0.1): + - Flutter + - manage_calendar_events (0.0.1): + - Flutter + - map_launcher (0.0.1): + - Flutter + - maps_launcher (0.0.1): + - Flutter + - MTBBarcodeScanner (5.0.11) + - nanopb (1.30906.0): + - nanopb/decode (= 1.30906.0) + - nanopb/encode (= 1.30906.0) + - nanopb/decode (1.30906.0) + - nanopb/encode (1.30906.0) + - native_device_orientation (0.0.1): + - Flutter + - native_progress_hud (0.0.1): + - Flutter - NVActivityIndicatorView (5.1.1): - NVActivityIndicatorView/Base (= 5.1.1) - NVActivityIndicatorView/Base (5.1.1) + - path_provider (0.0.1): + - Flutter + - path_provider_linux (0.0.1): + - Flutter + - path_provider_macos (0.0.1): + - Flutter + - path_provider_windows (0.0.1): + - Flutter + - "permission_handler (5.0.1+1)": + - Flutter + - PromisesObjC (1.2.11) + - Protobuf (3.13.0) + - Reachability (3.2) + - screen (0.0.1): + - Flutter + - shared_preferences (0.0.1): + - Flutter + - shared_preferences_linux (0.0.1): + - Flutter + - shared_preferences_macos (0.0.1): + - Flutter + - shared_preferences_web (0.0.1): + - Flutter + - shared_preferences_windows (0.0.1): + - Flutter + - speech_to_text (0.0.1): + - Flutter + - Try + - TOCropViewController (2.5.5) + - Try (2.1.1) + - "twilio_programmable_video (0.5.0+4)": + - Flutter + - TwilioVideo (~> 3.4) + - TwilioVideo (3.8.0) + - url_launcher (0.0.1): + - Flutter + - url_launcher_linux (0.0.1): + - Flutter + - url_launcher_macos (0.0.1): + - Flutter + - url_launcher_web (0.0.1): + - Flutter + - url_launcher_windows (0.0.1): + - Flutter + - vibration (1.7.3): + - Flutter + - vibration_web (1.6.2): + - Flutter + - video_player (0.0.1): + - Flutter + - video_player_web (0.0.1): + - Flutter + - wakelock (0.0.1): + - Flutter + - webview_flutter (0.0.1): + - Flutter + - wifi (0.0.1): + - Flutter DEPENDENCIES: + - android_intent (from `.symlinks/plugins/android_intent/ios`) + - barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`) + - connectivity (from `.symlinks/plugins/connectivity/ios`) + - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) + - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) + - device_calendar (from `.symlinks/plugins/device_calendar/ios`) + - device_info (from `.symlinks/plugins/device_info/ios`) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) + - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) - Flutter (from `Flutter`) + - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) + - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) + - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) + - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) + - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) + - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) + - geolocator (from `.symlinks/plugins/geolocator/ios`) + - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) + - hexcolor (from `.symlinks/plugins/hexcolor/ios`) + - image_cropper (from `.symlinks/plugins/image_cropper/ios`) + - image_picker (from `.symlinks/plugins/image_picker/ios`) + - just_audio (from `.symlinks/plugins/just_audio/ios`) + - local_auth (from `.symlinks/plugins/local_auth/ios`) + - location (from `.symlinks/plugins/location/ios`) + - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) + - map_launcher (from `.symlinks/plugins/map_launcher/ios`) + - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) + - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) + - native_progress_hud (from `.symlinks/plugins/native_progress_hud/ios`) - NVActivityIndicatorView + - path_provider (from `.symlinks/plugins/path_provider/ios`) + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) + - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) + - permission_handler (from `.symlinks/plugins/permission_handler/ios`) + - screen (from `.symlinks/plugins/screen/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) + - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) + - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) + - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) + - twilio_programmable_video (from `.symlinks/plugins/twilio_programmable_video/ios`) + - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) + - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) + - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) + - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) + - vibration (from `.symlinks/plugins/vibration/ios`) + - vibration_web (from `.symlinks/plugins/vibration_web/ios`) + - video_player (from `.symlinks/plugins/video_player/ios`) + - video_player_web (from `.symlinks/plugins/video_player_web/ios`) + - wakelock (from `.symlinks/plugins/wakelock/ios`) + - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) + - wifi (from `.symlinks/plugins/wifi/ios`) SPEC REPOS: trunk: + - Firebase + - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseInstallations + - FirebaseInstanceID + - FirebaseMessaging + - GoogleDataTransport + - GoogleMaps + - GoogleUtilities + - MTBBarcodeScanner + - nanopb - NVActivityIndicatorView + - PromisesObjC + - Protobuf + - Reachability + - TOCropViewController + - Try + - TwilioVideo EXTERNAL SOURCES: + android_intent: + :path: ".symlinks/plugins/android_intent/ios" + barcode_scan_fix: + :path: ".symlinks/plugins/barcode_scan_fix/ios" + connectivity: + :path: ".symlinks/plugins/connectivity/ios" + connectivity_for_web: + :path: ".symlinks/plugins/connectivity_for_web/ios" + connectivity_macos: + :path: ".symlinks/plugins/connectivity_macos/ios" + device_calendar: + :path: ".symlinks/plugins/device_calendar/ios" + device_info: + :path: ".symlinks/plugins/device_info/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_core_web: + :path: ".symlinks/plugins/firebase_core_web/ios" + firebase_messaging: + :path: ".symlinks/plugins/firebase_messaging/ios" Flutter: :path: Flutter + flutter_email_sender: + :path: ".symlinks/plugins/flutter_email_sender/ios" + flutter_flexible_toast: + :path: ".symlinks/plugins/flutter_flexible_toast/ios" + flutter_inappwebview: + :path: ".symlinks/plugins/flutter_inappwebview/ios" + flutter_local_notifications: + :path: ".symlinks/plugins/flutter_local_notifications/ios" + flutter_plugin_android_lifecycle: + :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" + flutter_tts: + :path: ".symlinks/plugins/flutter_tts/ios" + geolocator: + :path: ".symlinks/plugins/geolocator/ios" + google_maps_flutter: + :path: ".symlinks/plugins/google_maps_flutter/ios" + hexcolor: + :path: ".symlinks/plugins/hexcolor/ios" + image_cropper: + :path: ".symlinks/plugins/image_cropper/ios" + image_picker: + :path: ".symlinks/plugins/image_picker/ios" + just_audio: + :path: ".symlinks/plugins/just_audio/ios" + local_auth: + :path: ".symlinks/plugins/local_auth/ios" + location: + :path: ".symlinks/plugins/location/ios" + manage_calendar_events: + :path: ".symlinks/plugins/manage_calendar_events/ios" + map_launcher: + :path: ".symlinks/plugins/map_launcher/ios" + maps_launcher: + :path: ".symlinks/plugins/maps_launcher/ios" + native_device_orientation: + :path: ".symlinks/plugins/native_device_orientation/ios" + native_progress_hud: + :path: ".symlinks/plugins/native_progress_hud/ios" + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + path_provider_macos: + :path: ".symlinks/plugins/path_provider_macos/ios" + path_provider_windows: + :path: ".symlinks/plugins/path_provider_windows/ios" + permission_handler: + :path: ".symlinks/plugins/permission_handler/ios" + screen: + :path: ".symlinks/plugins/screen/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" + shared_preferences_macos: + :path: ".symlinks/plugins/shared_preferences_macos/ios" + shared_preferences_web: + :path: ".symlinks/plugins/shared_preferences_web/ios" + shared_preferences_windows: + :path: ".symlinks/plugins/shared_preferences_windows/ios" + speech_to_text: + :path: ".symlinks/plugins/speech_to_text/ios" + twilio_programmable_video: + :path: ".symlinks/plugins/twilio_programmable_video/ios" + url_launcher: + :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_linux: + :path: ".symlinks/plugins/url_launcher_linux/ios" + url_launcher_macos: + :path: ".symlinks/plugins/url_launcher_macos/ios" + url_launcher_web: + :path: ".symlinks/plugins/url_launcher_web/ios" + url_launcher_windows: + :path: ".symlinks/plugins/url_launcher_windows/ios" + vibration: + :path: ".symlinks/plugins/vibration/ios" + vibration_web: + :path: ".symlinks/plugins/vibration_web/ios" + video_player: + :path: ".symlinks/plugins/video_player/ios" + video_player_web: + :path: ".symlinks/plugins/video_player_web/ios" + wakelock: + :path: ".symlinks/plugins/wakelock/ios" + webview_flutter: + :path: ".symlinks/plugins/webview_flutter/ios" + wifi: + :path: ".symlinks/plugins/wifi/ios" SPEC CHECKSUMS: + android_intent: 367df2f1277a74e4a90e14a8ab3df3112d087052 + barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1 + connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 + connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b + connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 + device_calendar: 23b28a5f1ab3bf77e34542fb1167e1b8b29a98f5 + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 + Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 + firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 + firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 + firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 + FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd + FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 + FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 + FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + flutter_email_sender: f787522d0e82f50e5766c1213dbffff22fdcf009 + flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 + flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 + flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 + flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d + geolocator: 057a0c63a43e9c5296d8ad845a3ac8e6df23d899 + google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 + GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 + GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac + GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 + hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 + image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 + image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa + local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 + manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 + map_launcher: e325db1261d029ff33e08e03baccffe09593ffea + maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc + native_device_orientation: e24d00be281de72996640885d80e706142707660 + native_progress_hud: f95f5529742b36a3c7fdecfa88dc018319e39bf9 NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 + path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 + PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f + Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 + Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 + screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 + shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 + shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 + shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae + speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe + TOCropViewController: da59f531f8ac8a94ef6d6c0fc34009350f9e8bfe + Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 + twilio_programmable_video: 6a41593640f3d86af60b22541fd457b22deaae7f + TwilioVideo: c13a51ceca375e91620eb7578d2573c90cf53b46 + url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 + url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 + url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c + url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 + vibration: b5a33e764c3f609a975b9dca73dce20fdde627dc + vibration_web: 0ba303d92469ba34d71c612a228b315908d7fcd9 + video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e + video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 + wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 + webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 + wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: d94bd40f28772938199c67fcced06ffe96096c14 +PODFILE CHECKSUM: 5a17be3f8af73a757fa4439c77cf6ab2db29a6e7 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0 diff --git a/lib/config/config.dart b/lib/config/config.dart index b45b625d..f896d304 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -514,7 +514,7 @@ const GET_TOP_BRANDS = "topmanufacturer?page=1&limit=8"; const GET_PRODUCT_DETAIL = "products/"; const GET_LOCATION = "Services/Patients.svc/REST/GetPharmcyListBySKU"; const GET_SPECIFICATION = "productspecification/"; -const GET_BRAND_ITEMS = "products?ManufacturerId="; +const GET_BRAND_ITEMS = "products"; // External API const ADD_ADDRESS_INFO = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 23d92fee..2042d265 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -854,6 +854,7 @@ const Map localizedValues = { "checkBeneficiary": {"en": "CHECK BENEFICIARY", "ar": "تحقق من المستفيد"}, "beneficiaryName": {"en": "Beneficiary Name", "ar": "اسم المستفيد"}, "accountActivation": {"en": "Account Activation", "ar": "تفعيل الحساب"}, + "lakumTransfer": {"en": "Lakum Transfer", "ar": "تفعيل الحساب"}, "acceptLbl": {"en": "Accept", "ar": "موافقة"}, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, @@ -1926,5 +1927,33 @@ const Map localizedValues = { "try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'}, "app-update": {"en": "UPDATE THE APP", "ar": "تحديث التطبيق"}, - // "visit": {"en" : "Visit", "ar": "الزيارة"}, + "covid-alert": {"en": "Alert", "ar": "تنبيه"}, + "enterIdentificationNumber": { + "en": "Enter Identification Number", + "ar": "أدخل رقم التعريف" + }, + "accountActivationDesc": { + "en": + "This service allows you to activate your LAKUM account after registering through the Vida system.", + "ar": + "تتيح لك هذه الخدمة تفعيل حساب LAKUM الخاص بك بعد التسجيل من خلال نظام Vida." + }, + "pointsToTransfer": { + "en": "Point's to Transfer :", + "ar": "النقاط المراد تحويلها:" + }, + "enterBeneficiaryAccountNo": { + "en": "Enter Beneficiary Account No.", + "ar": "أدخل رقم حساب المستفيد" + }, + "confirm-prescription": { + "en": "Are you sure !! you want to send this request", + "ar": "تاكيد ارسال الطلب؟" + }, + "you-already-have-order": { + "en": "You already have this order! do you want to view it?", + "ar": "لديك هذا الطلب بالفعل! هل تريد مشاهدته؟" + }, + "order-overview": {"en": "Order Overview", "ar": "ملخص الطلب"}, + "shipping-address": {"en": "Delivery Address", "ar": "عنوان التوصيل"}, }; diff --git a/lib/core/model/pharmacies/BillingAddress.dart b/lib/core/model/pharmacies/BillingAddress.dart index 765ac54d..418b28a7 100644 --- a/lib/core/model/pharmacies/BillingAddress.dart +++ b/lib/core/model/pharmacies/BillingAddress.dart @@ -1,3 +1,5 @@ +import 'package:google_maps_flutter/google_maps_flutter.dart'; + class BillingAddress { String id; String firstName; @@ -81,4 +83,19 @@ class BillingAddress { data['lat_long'] = this.latLong; return data; } + + LatLng getLocation(){ + if(latLong.contains(',')){ + var parts = latLong.trim().split(','); + if(parts.length == 2){ + var lat = double.tryParse(parts.first); + var lng = double.tryParse(parts.last); + if(lat != null || lng != null) { + var location = LatLng(lat, lng); + return location; + } + } + } + return null; + } } diff --git a/lib/core/model/pharmacies/Customer.dart b/lib/core/model/pharmacies/Customer.dart index e3defbbe..0462c0c2 100644 --- a/lib/core/model/pharmacies/Customer.dart +++ b/lib/core/model/pharmacies/Customer.dart @@ -32,6 +32,7 @@ class Customer { String lastLoginDateUtc; String lastActivityDateUtc; int registeredInStoreId; + List roleIds; Customer( {this.billingAddress, @@ -63,7 +64,8 @@ class Customer { this.createdOnUtc, this.lastLoginDateUtc, this.lastActivityDateUtc, - this.registeredInStoreId}); + this.registeredInStoreId, + this.roleIds}); Customer.fromJson(Map json) { billingAddress = json['billing_address'] != null @@ -105,6 +107,7 @@ class Customer { lastLoginDateUtc = json['last_login_date_utc']; lastActivityDateUtc = json['last_activity_date_utc']; registeredInStoreId = json['registered_in_store_id']; + roleIds = json['role_ids'].cast(); } Map toJson() { @@ -145,6 +148,7 @@ class Customer { data['last_login_date_utc'] = this.lastLoginDateUtc; data['last_activity_date_utc'] = this.lastActivityDateUtc; data['registered_in_store_id'] = this.registeredInStoreId; + data['role_ids'] = this.roleIds; return data; } } diff --git a/lib/core/model/pharmacies/ShoppingCart.dart b/lib/core/model/pharmacies/ShoppingCart.dart index f965203a..4bd460aa 100644 --- a/lib/core/model/pharmacies/ShoppingCart.dart +++ b/lib/core/model/pharmacies/ShoppingCart.dart @@ -7,22 +7,33 @@ class ShoppingCart { // List productAttributes; double customerEnteredPrice; int quantity; - String discountAmountInclTax; - String subtotal; - String subtotalWithVat; - String subtotalVatAmount; - String subtotalVatRate; - String currency; - String currencyn; - String rentalStartDateUtc; - String rentalEndDateUtc; - String createdOnUtc; - String updatedOnUtc; - String shoppingCartType; + dynamic discountAmountInclTax; + dynamic subtotal; + dynamic subtotalWithVat; + dynamic subtotalVatAmount; + dynamic subtotalVatRate; + dynamic currency; + dynamic currencyn; + dynamic rentalStartDateUtc; + dynamic rentalEndDateUtc; + dynamic createdOnUtc; + dynamic updatedOnUtc; + dynamic shoppingCartType; int productId; PharmacyProduct product; int customerId; Customer customer; + double unitPriceInclTax; + double unitPriceExclTax; + double priceInclTax; + double priceExclTax; + dynamic discountAmountExclTax; + double originalProductCost; + String attributeDescription; + int downloadCount; + bool isDownloadActivated; + int licenseDownloadId; + double itemWeight; ShoppingCart( {this.languageId, @@ -45,7 +56,19 @@ class ShoppingCart { this.productId, this.product, this.customerId, - this.customer}); + this.customer, + this.unitPriceInclTax, + this.unitPriceExclTax, + this.priceInclTax, + this.priceExclTax, + this.discountAmountExclTax, + this.originalProductCost, + this.attributeDescription, + this.downloadCount, + this.isDownloadActivated, + this.licenseDownloadId, + this.itemWeight, + }); ShoppingCart.fromJson(Map json) { languageId = json['language_id']; @@ -78,6 +101,18 @@ class ShoppingCart { customer = json['customer'] != null ? new Customer.fromJson(json['customer']) : null; + + unitPriceInclTax = json['unit_price_incl_tax']; + unitPriceExclTax = json['unit_price_excl_tax']; + priceInclTax = json['price_incl_tax']; + priceExclTax = json['price_excl_tax']; + discountAmountExclTax = json['discount_amount_excl_tax']; + originalProductCost = json['original_product_cost']; + attributeDescription = json['attribute_description']; + downloadCount = json['download_count']; + isDownloadActivated = json['isDownload_activated']; + licenseDownloadId = json['license_download_id']; + itemWeight = json['item_weight']; } Map toJson() { @@ -110,6 +145,18 @@ class ShoppingCart { if (this.customer != null) { data['customer'] = this.customer.toJson(); } + data['unit_price_incl_tax'] = this.unitPriceInclTax; + data['unit_price_excl_tax'] = this.unitPriceExclTax; + data['price_incl_tax'] = this.priceInclTax; + data['price_excl_tax'] = this.priceExclTax; + data['discount_amount_excl_tax'] = this.discountAmountExclTax; + data['original_product_cost'] = this.originalProductCost; + data['attribute_description'] = this.attributeDescription; + data['download_count'] = this.downloadCount; + data['isDownload_activated'] = this.isDownloadActivated; + data['license_download_id'] = this.licenseDownloadId; + data['item_weight'] = this.itemWeight; + return data; } } diff --git a/lib/core/model/pharmacies/order_detail.dart b/lib/core/model/pharmacies/order_detail.dart new file mode 100644 index 00000000..cd53af92 --- /dev/null +++ b/lib/core/model/pharmacies/order_detail.dart @@ -0,0 +1,297 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; + +class OrderDetailModel { + String id; + int storeId; + String orderGuid; + bool pickUpInStore; + String paymentMethodSystemName; + String paymentName; + String paymentNamen; + String customerCurrencyCode; + dynamic currencyRate; + dynamic customerTaxDisplayTypeId; + dynamic vatNumber; + double orderSubtotalInclTax; + double orderSubtotalExclTax; + dynamic orderSubTotalDiscountInclTax; + dynamic orderSubTotalDiscountExclTax; + double orderShippingInclTax; + dynamic orderShippingExclTax; + dynamic paymentMethodAdditionalFeeInclTax; + dynamic paymentMethodAdditionalFeeExclTax; + String taxRates; + double orderTax; + dynamic orderDiscount; + dynamic productCount; + dynamic orderTotal; + dynamic refundedAmount; + dynamic rewardPointsWereAdded; + dynamic rxAttachments; + String checkoutAttributeDescription; + int customerLanguageId; + int affiliateId; + String customerIp; + dynamic authorizationTransactionId; + dynamic authorizationTransactionCode; + dynamic authorizationTransactionResult; + dynamic captureTransactionId; + dynamic captureTransactionResult; + dynamic subscriptionTransactionId; + dynamic paidDateUtc; + String shippingMethod; + String shippingRateComputationMethodSystemName; + String customValuesXml; + bool deleted; + String createdOnUtc; + Customer customer; + int customerId; + BillingAddress billingAddress; + BillingAddress shippingAddress; + List orderItems; + int orderStatusId; + String orderStatus; + String orderStatusn; + int paymentStatusId; + String paymentStatus; + String paymentStatusn; + String shippingStatus; + String shippingStatusn; + String customerTaxDisplayType; + bool canCancel; + bool canRefund; + dynamic lakumAmount; + String preferDeliveryDate; + String preferDeliveryTime; + String preferDeliveryTimen; + + OrderDetailModel( + {this.id, + this.storeId, + this.orderGuid, + this.pickUpInStore, + this.paymentMethodSystemName, + this.paymentName, + this.paymentNamen, + this.customerCurrencyCode, + this.currencyRate, + this.customerTaxDisplayTypeId, + this.vatNumber, + this.orderSubtotalInclTax, + this.orderSubtotalExclTax, + this.orderSubTotalDiscountInclTax, + this.orderSubTotalDiscountExclTax, + this.orderShippingInclTax, + this.orderShippingExclTax, + this.paymentMethodAdditionalFeeInclTax, + this.paymentMethodAdditionalFeeExclTax, + this.taxRates, + this.orderTax, + this.orderDiscount, + this.productCount, + this.orderTotal, + this.refundedAmount, + this.rewardPointsWereAdded, + this.rxAttachments, + this.checkoutAttributeDescription, + this.customerLanguageId, + this.affiliateId, + this.customerIp, + this.authorizationTransactionId, + this.authorizationTransactionCode, + this.authorizationTransactionResult, + this.captureTransactionId, + this.captureTransactionResult, + this.subscriptionTransactionId, + this.paidDateUtc, + this.shippingMethod, + this.shippingRateComputationMethodSystemName, + this.customValuesXml, + this.deleted, + this.createdOnUtc, + this.customer, + this.customerId, + this.billingAddress, + this.shippingAddress, + this.orderItems, + this.orderStatusId, + this.orderStatus, + this.orderStatusn, + this.paymentStatusId, + this.paymentStatus, + this.paymentStatusn, + this.shippingStatus, + this.shippingStatusn, + this.customerTaxDisplayType, + this.canCancel, + this.canRefund, + this.lakumAmount, + this.preferDeliveryDate, + this.preferDeliveryTime, + this.preferDeliveryTimen}); + + OrderDetailModel.fromJson(Map json) { + id = json['id']; + storeId = json['store_id']; + orderGuid = json['order_guid']; + pickUpInStore = json['pick_up_in_store']; + paymentMethodSystemName = json['payment_method_system_name']; + paymentName = json['payment_name']; + paymentNamen = json['payment_namen']; + customerCurrencyCode = json['customer_currency_code']; + currencyRate = json['currency_rate']; + customerTaxDisplayTypeId = json['customer_tax_display_type_id']; + vatNumber = json['vat_number']; + orderSubtotalInclTax = json['order_subtotal_incl_tax']; + orderSubtotalExclTax = json['order_subtotal_excl_tax']; + orderSubTotalDiscountInclTax = json['order_sub_total_discount_incl_tax']; + orderSubTotalDiscountExclTax = json['order_sub_total_discount_excl_tax']; + orderShippingInclTax = json['order_shipping_incl_tax']; + orderShippingExclTax = json['order_shipping_excl_tax']; + paymentMethodAdditionalFeeInclTax = + json['payment_method_additional_fee_incl_tax']; + paymentMethodAdditionalFeeExclTax = + json['payment_method_additional_fee_excl_tax']; + taxRates = json['tax_rates']; + orderTax = json['order_tax']; + orderDiscount = json['order_discount']; + productCount = json['product_count']; + orderTotal = json['order_total']; + refundedAmount = json['refunded_amount']; + rewardPointsWereAdded = json['reward_points_were_added']; + rxAttachments = json['rx_attachments']; + checkoutAttributeDescription = json['checkout_attribute_description']; + customerLanguageId = json['customer_language_id']; + affiliateId = json['affiliate_id']; + customerIp = json['customer_ip']; + authorizationTransactionId = json['authorization_transaction_id']; + authorizationTransactionCode = json['authorization_transaction_code']; + authorizationTransactionResult = json['authorization_transaction_result']; + captureTransactionId = json['capture_transaction_id']; + captureTransactionResult = json['capture_transaction_result']; + subscriptionTransactionId = json['subscription_transaction_id']; + paidDateUtc = json['paid_date_utc']; + shippingMethod = json['shipping_method']; + shippingRateComputationMethodSystemName = + json['shipping_rate_computation_method_system_name']; + customValuesXml = json['custom_values_xml']; + deleted = json['deleted']; + createdOnUtc = json['created_on_utc']; + customer = json['customer'] != null + ? new Customer.fromJson(json['customer']) + : null; + customerId = json['customer_id']; + billingAddress = json['billing_address'] != null + ? new BillingAddress.fromJson(json['billing_address']) + : null; + shippingAddress = json['shipping_address'] != null + ? new BillingAddress.fromJson(json['shipping_address']) + : null; + if (json['order_items'] != null) { + orderItems = new List(); + json['order_items'].forEach((v) { + orderItems.add(new ShoppingCart.fromJson(v)); + }); + } + orderStatusId = json['order_status_id']; + orderStatus = json['order_status']; + orderStatusn = json['order_statusn']; + paymentStatusId = json['payment_status_id']; + paymentStatus = json['payment_status']; + paymentStatusn = json['payment_statusn']; + shippingStatus = json['shipping_status']; + shippingStatusn = json['shipping_statusn']; + customerTaxDisplayType = json['customer_tax_display_type']; + canCancel = json['can_cancel']; + canRefund = json['can_refund']; + lakumAmount = json['lakum_amount']; + preferDeliveryDate = json['prefer_delivery_date']; + preferDeliveryTime = json['prefer_delivery_time']; + preferDeliveryTimen = json['prefer_delivery_timen']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['store_id'] = this.storeId; + data['order_guid'] = this.orderGuid; + data['pick_up_in_store'] = this.pickUpInStore; + data['payment_method_system_name'] = this.paymentMethodSystemName; + data['payment_name'] = this.paymentName; + data['payment_namen'] = this.paymentNamen; + data['customer_currency_code'] = this.customerCurrencyCode; + data['currency_rate'] = this.currencyRate; + data['customer_tax_display_type_id'] = this.customerTaxDisplayTypeId; + data['vat_number'] = this.vatNumber; + data['order_subtotal_incl_tax'] = this.orderSubtotalInclTax; + data['order_subtotal_excl_tax'] = this.orderSubtotalExclTax; + data['order_sub_total_discount_incl_tax'] = + this.orderSubTotalDiscountInclTax; + data['order_sub_total_discount_excl_tax'] = + this.orderSubTotalDiscountExclTax; + data['order_shipping_incl_tax'] = this.orderShippingInclTax; + data['order_shipping_excl_tax'] = this.orderShippingExclTax; + data['payment_method_additional_fee_incl_tax'] = + this.paymentMethodAdditionalFeeInclTax; + data['payment_method_additional_fee_excl_tax'] = + this.paymentMethodAdditionalFeeExclTax; + data['tax_rates'] = this.taxRates; + data['order_tax'] = this.orderTax; + data['order_discount'] = this.orderDiscount; + data['product_count'] = this.productCount; + data['order_total'] = this.orderTotal; + data['refunded_amount'] = this.refundedAmount; + data['reward_points_were_added'] = this.rewardPointsWereAdded; + data['rx_attachments'] = this.rxAttachments; + data['checkout_attribute_description'] = this.checkoutAttributeDescription; + data['customer_language_id'] = this.customerLanguageId; + data['affiliate_id'] = this.affiliateId; + data['customer_ip'] = this.customerIp; + data['authorization_transaction_id'] = this.authorizationTransactionId; + data['authorization_transaction_code'] = this.authorizationTransactionCode; + data['authorization_transaction_result'] = + this.authorizationTransactionResult; + data['capture_transaction_id'] = this.captureTransactionId; + data['capture_transaction_result'] = this.captureTransactionResult; + data['subscription_transaction_id'] = this.subscriptionTransactionId; + data['paid_date_utc'] = this.paidDateUtc; + data['shipping_method'] = this.shippingMethod; + data['shipping_rate_computation_method_system_name'] = + this.shippingRateComputationMethodSystemName; + data['custom_values_xml'] = this.customValuesXml; + data['deleted'] = this.deleted; + data['created_on_utc'] = this.createdOnUtc; + if (this.customer != null) { + data['customer'] = this.customer.toJson(); + } + data['customer_id'] = this.customerId; + if (this.billingAddress != null) { + data['billing_address'] = this.billingAddress.toJson(); + } + if (this.shippingAddress != null) { + data['shipping_address'] = this.shippingAddress.toJson(); + } + if (this.orderItems != null) { + data['order_items'] = this.orderItems.map((v) => v.toJson()).toList(); + } + data['order_status_id'] = this.orderStatusId; + data['order_status'] = this.orderStatus; + data['order_statusn'] = this.orderStatusn; + data['payment_status_id'] = this.paymentStatusId; + data['payment_status'] = this.paymentStatus; + data['payment_statusn'] = this.paymentStatusn; + data['shipping_status'] = this.shippingStatus; + data['shipping_statusn'] = this.shippingStatusn; + data['customer_tax_display_type'] = this.customerTaxDisplayType; + data['can_cancel'] = this.canCancel; + data['can_refund'] = this.canRefund; + data['lakum_amount'] = this.lakumAmount; + data['prefer_delivery_date'] = this.preferDeliveryDate; + data['prefer_delivery_time'] = this.preferDeliveryTime; + data['prefer_delivery_timen'] = this.preferDeliveryTimen; + return data; + } + +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart index 8872aaf8..42fc824d 100644 --- a/lib/core/model/pharmacies/order_model.dart +++ b/lib/core/model/pharmacies/order_model.dart @@ -9,6 +9,71 @@ List orderModelFromJson(String str) => List.from(json.de String orderModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); class OrderModel { + + String id; + dynamic storeId; + String orderGuid; + bool pickUpInStore; + PaymentMethodSystemName paymentMethodSystemName; + PaymentName paymentName; + PaymentName paymentNamen; + CustomerCurrencyCode customerCurrencyCode; + dynamic currencyRate; + dynamic customerTaxDisplayTypeId; + dynamic vatNumber; + double orderSubtotalInclTax; + double orderSubtotalExclTax; + dynamic orderSubTotalDiscountInclTax; + dynamic orderSubTotalDiscountExclTax; + double orderShippingInclTax; + dynamic orderShippingExclTax; + dynamic paymentMethodAdditionalFeeInclTax; + dynamic paymentMethodAdditionalFeeExclTax; + String taxRates; + double orderTax; + dynamic orderDiscount; + dynamic productCount; + double orderTotal; + dynamic refundedAmount; + dynamic rewardPointsWereAdded; + String rxAttachments; + CheckoutAttributeDescription checkoutAttributeDescription; + dynamic customerLanguageId; + dynamic affiliateId; + CustomerIp customerIp; + String authorizationTransactionId; + dynamic authorizationTransactionCode; + dynamic authorizationTransactionResult; + dynamic captureTransactionId; + dynamic captureTransactionResult; + dynamic subscriptionTransactionId; + DateTime paidDateUtc; + ShippingMethod shippingMethod; + ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName; + String customValuesXml; + bool deleted; + DateTime createdOnUtc; + OrderModelCustomer customer; + dynamic customerId; + IngAddress billingAddress; + IngAddress shippingAddress; + List orderItems; + dynamic orderStatusId; + OrderStatus orderStatus; + OrderStatusn orderStatusn; + dynamic paymentStatusId; + PaymentStatus paymentStatus; + PaymentStatusn paymentStatusn; + ShippingStatus shippingStatus; + ShippingStatusn shippingStatusn; + CustomerTaxDisplayType customerTaxDisplayType; + bool canCancel; + bool canRefund; + dynamic lakumAmount; + DateTime preferDeliveryDate; + PreferDeliveryTime preferDeliveryTime; + PreferDeliveryTimen preferDeliveryTimen; + OrderModel({ this.id, this.storeId, @@ -75,70 +140,6 @@ class OrderModel { this.preferDeliveryTimen, }); - String id; - dynamic storeId; - String orderGuid; - bool pickUpInStore; - PaymentMethodSystemName paymentMethodSystemName; - PaymentName paymentName; - PaymentName paymentNamen; - CustomerCurrencyCode customerCurrencyCode; - dynamic currencyRate; - dynamic customerTaxDisplayTypeId; - dynamic vatNumber; - double orderSubtotalInclTax; - double orderSubtotalExclTax; - dynamic orderSubTotalDiscountInclTax; - dynamic orderSubTotalDiscountExclTax; - double orderShippingInclTax; - dynamic orderShippingExclTax; - dynamic paymentMethodAdditionalFeeInclTax; - dynamic paymentMethodAdditionalFeeExclTax; - String taxRates; - double orderTax; - dynamic orderDiscount; - dynamic productCount; - double orderTotal; - dynamic refundedAmount; - dynamic rewardPointsWereAdded; - String rxAttachments; - CheckoutAttributeDescription checkoutAttributeDescription; - dynamic customerLanguageId; - dynamic affiliateId; - CustomerIp customerIp; - String authorizationTransactionId; - dynamic authorizationTransactionCode; - dynamic authorizationTransactionResult; - dynamic captureTransactionId; - dynamic captureTransactionResult; - dynamic subscriptionTransactionId; - DateTime paidDateUtc; - ShippingMethod shippingMethod; - ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName; - String customValuesXml; - bool deleted; - DateTime createdOnUtc; - OrderModelCustomer customer; - dynamic customerId; - IngAddress billingAddress; - IngAddress shippingAddress; - List orderItems; - dynamic orderStatusId; - OrderStatus orderStatus; - OrderStatusn orderStatusn; - dynamic paymentStatusId; - PaymentStatus paymentStatus; - PaymentStatusn paymentStatusn; - ShippingStatus shippingStatus; - ShippingStatusn shippingStatusn; - CustomerTaxDisplayType customerTaxDisplayType; - bool canCancel; - bool canRefund; - dynamic lakumAmount; - DateTime preferDeliveryDate; - PreferDeliveryTime preferDeliveryTime; - PreferDeliveryTimen preferDeliveryTimen; - factory OrderModel.fromJson(Map json) => OrderModel( id: json["id"], storeId: json["store_id"], @@ -1469,7 +1470,4 @@ class EnumValues { } return reverseMap; } -} - - - +} \ No newline at end of file diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index 12d7eab3..34fa4bbb 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -25,7 +25,7 @@ class CustomerAddressesService extends BaseService { var date = f.format(DateTime.now().toUtc()) + " GMT"; addNewAddressRequestModel.customer.addresses[0].createdOnUtc = date; hasError = false; - await baseAppClient.post(ADD_ADDRESS_INFO, + await baseAppClient.post(BASE_PHARMACY_URL+ADD_ADDRESS_INFO, onSuccess: (dynamic response, int statusCode) { addressesList.clear(); response["customers"][0]["addresses"].forEach((data) { @@ -43,7 +43,7 @@ class CustomerAddressesService extends BaseService { 'fields':'addresses' }; hasError = false; - await baseAppClient.getPharmacy("$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", + await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES${customerInfo.customerId}", onSuccess: (dynamic response, int statusCode) { addressesList.clear(); response["customers"][0]["addresses"].forEach((data) { @@ -63,7 +63,7 @@ class CustomerAddressesService extends BaseService { }; hasError = false; - await baseAppClient.getPharmacy(GET_CUSTOMER_INFO, + await baseAppClient.getPharmacy(BASE_PHARMACY_URL+GET_CUSTOMER_INFO, onSuccess: (dynamic response, int statusCode) { customerInfo= CustomerInfo.fromJson(response); }, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart new file mode 100644 index 00000000..c36efe89 --- /dev/null +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -0,0 +1,30 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PrescriptionDeliveryService extends BaseService { + Future insertDeliveryOrder( + {int lineItemNo, + double latitude, + double longitude, + int appointmentNo, + int createdBy, + int dischargeID}) async { + hasError = false; + Map body = Map(); + body['LineItemNo'] = lineItemNo; + body['Latitude'] = latitude; + body['Longitude'] = longitude; + body['AppointmentNo'] = appointmentNo; + body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID; + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, + onSuccess: (dynamic response, int statusCode) { + var asd=""; + }, + onFailure: (String error, int statusCode) { + hasError = true; + print(error); + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a953b562..ee93de95 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -5,9 +5,10 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -163,20 +164,24 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { - if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] == null && + parsed['ErrorEndUserMessage'] == null) { + if (parsed['ErrorSearchMsg'] == null) { + onFailure("Server Error found with no available message", + statusCode); + } else { + onFailure(parsed['ErrorSearchMsg'], statusCode); + } } else { - onFailure(parsed['ErrorSearchMsg'], statusCode); + onFailure( + parsed['message'] ?? + parsed['ErrorEndUserMessage'] ?? + parsed['ErrorMessage'], + statusCode); } - } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); } } else if (!parsed['IsAuthenticated']) { await logout(); @@ -208,9 +213,7 @@ class BaseAppClient { Future navigateToAppUpdate(context, String text) async { Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => AppUpdatePage(appUpdateText: text))); + context, FadePage(page: AppUpdatePage(appUpdateText: text))); } get(String endPoint, @@ -259,6 +262,9 @@ class BaseAppClient { bool isAllowAny = false, bool isExternal = false, Map queryParams}) async { + var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); + var user = await sharedPref.getObject(USER_PROFILE); + String url; if (isExternal) { url = endPoint; @@ -271,17 +277,17 @@ class BaseAppClient { } print("URL : $url"); - var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); - var user = await sharedPref.getObject(USER_PROFILE); if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', - 'Authorization': token, - 'Mobilenumber': user['MobileNumber'].toString(), + 'Authorization': token ?? '', + 'Mobilenumber': user != null + ? getPhoneNumberWithoutZero(user['MobileNumber'].toString()) + : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', - 'Username': user['PatientID'].toString(), + 'Username': user != null ? user['PatientID'].toString() : "", }); final int statusCode = response.statusCode; print("statusCode :$statusCode"); @@ -297,6 +303,14 @@ class BaseAppClient { } } + getPhoneNumberWithoutZero(String number) { + String newNumber = number; + if (number.startsWith('0')) { + newNumber = number.substring(1); + } + return newNumber; + } + simpleGet(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index 3be9fe1a..7fe5ca54 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.d import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; class PharmacyModuleService extends BaseService { final AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -22,12 +23,12 @@ class PharmacyModuleService extends BaseService { Map queryParams = {'FileNumber': data['PatientID'].toString()}; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode)async { if (response['UserName'] != null) { sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); print(response); } else { - createUser(); + await createUser(); } }, onFailure: (String error, int statusCode) { hasError = true; @@ -70,7 +71,7 @@ class PharmacyModuleService extends BaseService { await getUser(); Map queryParams = { 'Filenumber':user.patientID.toString(), - 'MobileNumber':user.mobileNumber, + 'MobileNumber':Utils.getPhoneNumberWithoutZero(user.mobileNumber), }; hasError = false; try { diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 0082cc49..479fd25f 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -1,4 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; @@ -21,20 +23,20 @@ class PharmacyCategoriseService extends BaseService { List get parentCategoriseList => _parentCategoriseList; //service three - List _parentProductsList = List(); - List get parentProductsList => _parentProductsList; + List _parentProductsList = List(); + List get parentProductsList => _parentProductsList; //service four List _subCategoriseList = List(); List get subCategoriseList => _subCategoriseList; //service five - List _subProductsList = List(); - List get subProductsList => _subProductsList; + List _subProductsList = List(); + List get subProductsList => _subProductsList; //service six - List _finalProducts = List(); - List get finalProducts => _finalProducts; + List _finalProducts = List(); + List get finalProducts => _finalProducts; //service 7 @@ -43,12 +45,14 @@ class PharmacyCategoriseService extends BaseService { // service 8 - List _searchList = List(); - List get searchList => _searchList; + List _searchList = List(); + List get searchList => _searchList; List _scanList = List(); List get scanList => _scanList; + List manufacturerProducts = List(); + clearSearchList() { _searchList.clear(); } @@ -98,7 +102,7 @@ class PharmacyCategoriseService extends BaseService { endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { - _searchList.add(SearchProductsModel.fromJson(item)); + _searchList.add(PharmacyProduct.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -154,7 +158,7 @@ class PharmacyCategoriseService extends BaseService { endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { - _parentProductsList.add(ParentProductsModel.fromJson(item)); + _parentProductsList.add(PharmacyProduct.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -194,7 +198,7 @@ class PharmacyCategoriseService extends BaseService { endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { - _subProductsList.add(SubProductsModel.fromJson(item)); + _subProductsList.add(PharmacyProduct.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -213,7 +217,7 @@ class PharmacyCategoriseService extends BaseService { endPoint, onSuccess: (dynamic response, int statusCode) { response['products'].forEach((item) { - _finalProducts.add(FinalProductsModel.fromJson(item)); + _finalProducts.add(PharmacyProduct.fromJson(item)); }); }, onFailure: (String error, int statusCode) { @@ -222,4 +226,69 @@ class PharmacyCategoriseService extends BaseService { }, ); } + + Future getManufacturerProducts(String id) async { + hasError = false; + Map queryParams = {'ManufacturerId': id}; + + _finalProducts.clear(); + await baseAppClient.getPharmacy( + GET_BRAND_ITEMS, + onSuccess: (dynamic response, int statusCode) { + response['products'].forEach((item) { + _finalProducts.add(PharmacyProduct.fromJson(item)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + queryParams: queryParams, + ); + } + + Future getLastVisitedProducts() async { + String lastVisited = ""; + 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) { + _finalProducts.clear(); + response['products'].forEach((item) { + _finalProducts.add(PharmacyProduct.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); + } catch (error) { + throw error; + } + } + } + + Future getBestSellerProducts() async { + 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', + }; + try { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, + onSuccess: (dynamic response, int statusCode) { + _finalProducts.clear(); + response['products'].forEach((item) { + _finalProducts.add(PharmacyProduct.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, queryParams: queryParams); + } catch (error) { + throw error; + } + } } diff --git a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart index f2c81956..65fffe33 100644 --- a/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/cmc_view_model.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/cmc_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; @@ -34,6 +35,8 @@ class CMCViewModel extends BaseViewModel { List get checkupItems => _cMCService.checkupItemsList; + PharmacyModuleService _pharmacyModuleService = locator(); + bool get isOrderUpdated => _cMCService.isOrderUpdated; Future getCMCAllServices() async { @@ -115,8 +118,7 @@ class CMCViewModel extends BaseViewModel { Future getCustomerAddresses() async { setState(ViewState.Busy); - await _customerAddressesService.getCustomerAddresses( - ); + await _customerAddressesService.getCustomerAddresses(); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); @@ -127,8 +129,9 @@ class CMCViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _customerAddressesService.getCustomerInfo( - ); + await _pharmacyModuleService.generatePharmacyToken().then((value) async{ + await _customerAddressesService.getCustomerInfo(); + }); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); 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 20a19b23..5bab0df5 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealth import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/home_health_care_service.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:intl/intl.dart'; @@ -36,6 +37,9 @@ class HomeHealthCareViewModel extends BaseViewModel { List get hhcAllOrderDetail => _homeHealthCareService.hhcAllOrderDetail; + PharmacyModuleService _pharmacyModuleService = locator(); + + bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated; GetHHCAllPresOrdersResponseModel pendingOrder; @@ -117,8 +121,9 @@ class HomeHealthCareViewModel extends BaseViewModel { Future getCustomerInfo() async { setState(ViewState.Busy); - await _customerAddressesService.getCustomerInfo( - ); + await _pharmacyModuleService.generatePharmacyToken().then((value) async{ + await _customerAddressesService.getCustomerInfo(); + }); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/PrescriptionDeliveryViewModel.dart deleted file mode 100644 index e9731bae..00000000 --- a/lib/core/viewModels/PrescriptionDeliveryViewModel.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; -import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; - -import '../../locator.dart'; - -class PrescriptionDeliveryViewModel extends BaseViewModel{ - - CustomerAddressesService _customerAddressesService = locator(); - - List get addressesList => _customerAddressesService.addressesList; - - Future getCustomerAddresses() async { - setState(ViewState.Busy); - await _customerAddressesService.getCustomerAddresses( - ); - if (_customerAddressesService.hasError) { - error = _customerAddressesService.error; - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Idle); - } - } - - -} \ No newline at end of file diff --git a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart new file mode 100644 index 00000000..455b5934 --- /dev/null +++ b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart @@ -0,0 +1,68 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/service/PrescriptionDeliveryService.dart'; +import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../../locator.dart'; + +class PrescriptionDeliveryViewModel extends BaseViewModel { + CustomerAddressesService _customerAddressesService = + locator(); + PharmacyModuleService _pharmacyModuleService = + locator(); + PrescriptionDeliveryService _prescriptionDeliveryService = + locator(); + + List get addressesList => + _customerAddressesService.addressesList; + + Future getCustomerInfo() async { + setState(ViewState.Busy); + await _pharmacyModuleService.generatePharmacyToken().then((value) async { + await _customerAddressesService.getCustomerInfo(); + }); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + await getCustomerAddresses(); + } + } + + Future insertDeliveryOrder( + {int lineItemNo, + double latitude, + double longitude, + int appointmentNo, + int createdBy, + int dischargeID}) async { + + setState(ViewState.BusyLocal); + await _prescriptionDeliveryService.insertDeliveryOrder( + lineItemNo: lineItemNo, + latitude: latitude, + longitude: longitude, + appointmentNo: appointmentNo, + createdBy: createdBy, + dischargeID: dischargeID + ); + if (_prescriptionDeliveryService.hasError) { + error = _prescriptionDeliveryService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getCustomerAddresses() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerAddresses(); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index 06295188..7272969b 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -185,7 +185,7 @@ class OrderPreviewViewModel extends BaseViewModel { await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); if (_orderService.hasError) { error = _orderService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); } diff --git a/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart index f8f5ea05..f2ed5913 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-registration-viewModel.dart @@ -19,11 +19,13 @@ class LacumRegistrationViewModel extends LacumViewModel { error = _lacumService.error; setState(ViewState.Error); } else { - if(_lacumService.lacumInformation.yahalaAccountNo != 0){ - error = "The account has already been activated"; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); + if(_lacumService.lacumInformation != null){ + if(_lacumService.lacumInformation.yahalaAccountNo == 0){ + error = _lacumService.lacumInformation.errorEndUserMessage; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } } } } diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart index ba8d70d9..1ee1a41c 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -19,6 +19,9 @@ class LacumViewModel extends BaseViewModel { LacumAccountInformation get lacumGroupInformation => _lacumService.lacumGroupInformation; + String get successMsg => + _lacumService.successMsg; + Future getLacumData() async { await getLacumAccountData(); getLacumGroupData(); @@ -70,16 +73,14 @@ class LacumViewModel extends BaseViewModel { } } - Future createLakumAccount(String name, String phone) async { - setState(ViewState.Busy); + Future createLakumAccount(String name, String phone) async { + setState(ViewState.BusyLocal); await _lacumService.createLakumAccount(name, phone, lacumInformation.yahalaAccountNo, lacumInformation.identificationNo, null); if (_lacumService.hasError) { error = _lacumService.error; - setState(ViewState.Error); - return 404; + setState(ViewState.ErrorLocal); } else { setState(ViewState.Idle); - return 200; } } diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index f434db54..62bf00f4 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -1,18 +1,17 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; +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/pages/pharmacy/order/Order.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:flutter/material.dart'; import '../../../locator.dart'; import '../base_view_model.dart'; @@ -21,10 +20,10 @@ class OrderModelViewModel extends BaseViewModel { List get orders => _orderService.orderList; OrderDetailsService _orderDetailsService = locator(); - List get orderListModel => _orderDetailsService.orderList; + List get orderListModel => _orderDetailsService.orderList; CancelOrderService _cancelOrderService = locator(); - List get cancelOrder => _cancelOrderService.cancelOrderList; + List get cancelOrder => _cancelOrderService.cancelOrderList; OrderPreviewService _orderServices = locator(); @@ -98,7 +97,7 @@ class OrderModelViewModel extends BaseViewModel { return res; } - Future makeReview(Product product, double rating, String reviewText) async { + Future makeReview(PharmacyProduct product, double rating, String reviewText) async { setState(ViewState.Busy); await _orderDetailsService.makeReview(product, rating, reviewText); if (_orderDetailsService.hasError) { diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index e3a6255e..339afa95 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -11,17 +11,14 @@ import '../../../locator.dart'; class ProductDetailViewModel extends BaseViewModel{ ProductDetailService _productDetailService = locator(); - ProductDetailService _productLocationService = locator(); - ProductDetailService _productWishlistService = locator(); - ProductDetailService _productSpecification = locator(); List get productDetailService => _productDetailService.productDetailList; - List get productLocationService => _productLocationService.productLocationList; + List get productLocationService => _productDetailService.productLocationList; - List get wishListItems => _productWishlistService.wishListProducts; + List get wishListItems => _productDetailService.wishListProducts; - List get productSpecification => _productSpecification.productSpecification; + List get productSpecification => _productDetailService.productSpecification; bool hasError = false; @@ -42,9 +39,9 @@ class ProductDetailViewModel extends BaseViewModel{ print('ENAD in model view'); hasError = false; setState(ViewState.Busy); - await _productLocationService.getProductAvailabiltyDetail(); - if (_productLocationService.hasError) { - error = _productLocationService.error; + await _productDetailService.getProductAvailabiltyDetail(); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -53,9 +50,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future notifyMe(customerId, itemID) async { hasError = false; setState(ViewState.Busy); - await _productLocationService.notifyMe(customerId, itemID); - if (_productLocationService.hasError) { - error = _productLocationService.error; + await _productDetailService.notifyMe(customerId, itemID); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -64,9 +61,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToCartData(quantity, itemID) async { hasError = false; setState(ViewState.Busy); - await _productLocationService.addToCart(quantity, itemID); - if (_productLocationService.hasError) { - error = _productLocationService.error; + await _productDetailService.addToCart(quantity, itemID); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -75,9 +72,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future addToWishlistData(itemID) async { hasError = false; setState(ViewState.Busy); - await _productLocationService.addToWishlist(itemID); - if (_productLocationService.hasError) { - error = _productLocationService.error; + await _productDetailService.addToWishlist(itemID); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -86,9 +83,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future checkWishlistData() async { hasError = false; setState(ViewState.Busy); - await _productWishlistService.getWishlistItems(); - if (_productWishlistService.hasError) { - error = _productWishlistService.error; + await _productDetailService.getWishlistItems(); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -98,9 +95,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future deletWishlistData(itemID) async { hasError = false; setState(ViewState.Busy); - await _productWishlistService.delteItemFromWishlist(itemID); - if (_productWishlistService.hasError) { - error = _productWishlistService.error; + await _productDetailService.delteItemFromWishlist(itemID); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); @@ -110,9 +107,9 @@ class ProductDetailViewModel extends BaseViewModel{ Future productSpecificationData(itemID) async { hasError = false; setState(ViewState.Busy); - await _productWishlistService.productSpecificationData(itemID); - if (_productWishlistService.hasError) { - error = _productWishlistService.error; + await _productDetailService.productSpecificationData(itemID); + if (_productDetailService.hasError) { + error = _productDetailService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index d26d860d..c98eedd7 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/brands_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; @@ -16,22 +17,29 @@ import 'base_view_model.dart'; class PharmacyCategoriseViewModel extends BaseViewModel { bool hasError = false; - PharmacyCategoriseService _pharmacyCategoriseService = locator(); + PharmacyCategoriseService _pharmacyCategoriseService = + locator(); - List get categorise => _pharmacyCategoriseService.categoriseList; + List get categorise => + _pharmacyCategoriseService.categoriseList; - List get categoriseParent => _pharmacyCategoriseService.parentCategoriseList; + List get categoriseParent => + _pharmacyCategoriseService.parentCategoriseList; - List get parentProducts => _pharmacyCategoriseService.parentProductsList; + List get parentProducts => + _pharmacyCategoriseService.parentProductsList; - List get subCategorise => _pharmacyCategoriseService.subCategoriseList; + List get subCategorise => + _pharmacyCategoriseService.subCategoriseList; - List get subProducts => _pharmacyCategoriseService.subProductsList; + List get subProducts => + _pharmacyCategoriseService.subProductsList; - List get finalProducts => _pharmacyCategoriseService.finalProducts; + List get finalProducts => + _pharmacyCategoriseService.finalProducts; List get brandsList => _pharmacyCategoriseService.brandsList; - List get searchList => _pharmacyCategoriseService.searchList; + List get searchList => _pharmacyCategoriseService.searchList; List get scanList => _pharmacyCategoriseService.scanList; @@ -147,4 +155,37 @@ class PharmacyCategoriseViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getManufacturerProducts(String id) async { + setState(ViewState.Busy); + await _pharmacyCategoriseService.getManufacturerProducts(id); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getLastVisitedProducts() async { + setState(ViewState.Busy); + await _pharmacyCategoriseService.getLastVisitedProducts(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getBestSellerProducts() async { + setState(ViewState.Busy); + await _pharmacyCategoriseService.getBestSellerProducts(); + if (_pharmacyCategoriseService.hasError) { + error = _pharmacyCategoriseService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/locator.dart b/lib/locator.dart index 0aafccf7..21bc111a 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -25,6 +25,7 @@ import 'core/service/AlHabibMedicalService/e_referral_service.dart'; import 'core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'core/service/AlHabibMedicalService/home_health_care_service.dart'; import 'core/service/AuthenticatedUserObject.dart'; +import 'core/service/PrescriptionDeliveryService.dart'; import 'core/service/appointment_rate_service.dart'; import 'core/service/blood/blood_details_servies.dart'; import 'core/service/blood/blood_donation_service.dart'; @@ -73,7 +74,7 @@ import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/offers_service.dart'; import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; -import 'core/viewModels/PrescriptionDeliveryViewModel.dart'; +import 'core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'core/viewModels/TermsConditionsViewModel.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; @@ -221,6 +222,7 @@ void setupLocator() { locator.registerLazySingleton(() => WeatherService()); locator.registerLazySingleton(() => TermsConditionsService()); locator.registerLazySingleton(() => BariatricsService()); + locator.registerLazySingleton(() => PrescriptionDeliveryService()); /// View Model locator.registerFactory(() => HospitalViewModel()); 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 cc8ea8dd..d9d4c56a 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 @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -111,8 +112,8 @@ class _NewCMCStepTowPageState onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (BuildContext context) => + FadePage( + page: CMCLocationPage( latitude: latitude, longitude: longitude, diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart index a007317e..5e9bd04d 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_three_page.dart @@ -42,6 +42,7 @@ class _NewHomeHealthCareStepThreePageState @override void initState() { + if (widget.patientERInsertPresOrderRequestModel.latitude != null) { markers.clear(); markers.add( 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 9f301328..e9ddd2d1 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 @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -112,8 +113,8 @@ class _NewHomeHealthCareStepTowPageState onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (BuildContext context) => + FadePage( + page: LocationPage( latitude: latitude, longitude: longitude, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart index 2dbf2035..8b9a5409 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'package:flutter/services.dart'; import 'dart:math'; @@ -508,8 +509,8 @@ class _BMICalculatorState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => ResultPage( + FadePage( + page: ResultPage( finalResult: bmiResult, textResult: textResult, msg: msg, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart index 8ac6b06c..a541b3ce 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/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 'package:percent_indicator/percent_indicator.dart'; @@ -114,8 +115,8 @@ class ResultPage extends StatelessWidget { handler: (){ Navigator.push( context, - MaterialPageRoute( - builder: (context) => BariatricsPage(1, 1, finalResult)), + FadePage( + page: BariatricsPage(1, 1, finalResult)), ); }, ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index b393600f..9e3d049f 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'dart:math'; @@ -701,8 +702,8 @@ class _BmrCalculatorState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => BmrResultPage( + FadePage( + page: BmrResultPage( bmrResult: bmrResult, calories: calories, )), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index 51b4cad6..3bda439f 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'dart:math'; @@ -1001,8 +1002,8 @@ class _BodyFatState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => FatResult( + FadePage( + page: FatResult( bodyFat: bodyFat, fat: fat, textResult: textResult, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart index d4e9c427..a7f60f68 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'calorie_result_page.dart'; @@ -678,8 +679,8 @@ class _CalorieCalculatorState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => CalorieResultPage( + FadePage( + page: CalorieResultPage( calorie: calories, )), ); diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index 50152328..78a737bb 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -1,10 +1,10 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.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 'dart:math'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; import 'package:flutter/services.dart'; import 'carbs_result_page.dart'; @@ -207,8 +207,7 @@ class _CarbsState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => CalorieCalculator()), + FadePage(page: CalorieCalculator()), ); } }); @@ -340,8 +339,8 @@ class _CarbsState extends State { calculate(); Navigator.push( context, - MaterialPageRoute( - builder: (context) => CarbsResult( + FadePage( + page: CarbsResult( cCal: cCal, pCal: pCal, fCal: fCal, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index c69f0564..d19c6017 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:intl/intl.dart'; @@ -121,8 +122,8 @@ class _DeliveryDueState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => DeliveryDueResult( + FadePage( + page: DeliveryDueResult( conceivedDate: conceivedDate, dateFrom: dateFrom, dateTo: dateTo, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 2aff7836..4e0b1391 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'dart:math'; @@ -532,8 +533,8 @@ class _IdealBodyState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => IdealBodyResult( + FadePage( + page: IdealBodyResult( idealBodyWeight: idealWeight, minRange: minRange, mixRange: maxRange, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart index 9c5dc0d3..508e8590 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.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 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:intl/intl.dart'; @@ -329,8 +330,8 @@ class _OvulationPeriodState extends State { { Navigator.push( context, - MaterialPageRoute( - builder: (context) => OvulationResult( + FadePage( + page: OvulationResult( conceivedDate: conceivedDate, dateFrom: dateFrom, dateTo: dateTo, diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index 6d1e98ea..76ad2e1d 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -6,21 +6,16 @@ import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dar //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; -import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; -import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; -import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -30,14 +25,11 @@ import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; -//import '../../../core/model/my_balance/AdvanceModel.dart'; -import 'confirm_payment_page.dart'; import 'dialogs/SelectBeneficiaryDialog.dart'; import 'dialogs/SelectBloodDialog.dart'; import 'dialogs/SelectGenderDialog.dart'; import 'dialogs/SelectPatientFamilyDialog.dart'; import 'dialogs/SelectPatientInfoDialog.dart'; -import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } enum Gender { Male, Female, NON } @@ -63,7 +55,8 @@ class _BloodDonationPageState extends State { AuthenticatedUser authenticatedUser; GetAllSharedRecordsByStatusList selectedPatientFamily; AdvanceModel advanceModel = AdvanceModel(); - List_BloodGroupDetailsModel bloodDetails = List_BloodGroupDetailsModel(bloodGroup: "A-"); + List_BloodGroupDetailsModel bloodDetails = + List_BloodGroupDetailsModel(bloodGroup: "A-"); AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; var checkedValue = false; @@ -180,9 +173,8 @@ class _BloodDonationPageState extends State { ), InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute( - builder: (BuildContext context) => - UserAgreementPage())); + Navigator.of(context) + .push(FadePage(page: UserAgreementPage())); }, child: Container( child: Texts( @@ -267,7 +259,6 @@ class _BloodDonationPageState extends State { ), ], ), - SizedBox( height: MediaQuery.of(context).size.height * 0.15, ) @@ -291,8 +282,9 @@ class _BloodDonationPageState extends State { ), label: TranslationBase.of(context).save, onTap: () async { - if(_selectedHospital == null){ - AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + if (_selectedHospital == null) { + AppToast.showErrorToast( + message: TranslationBase.of(context).selectCity); return; } bloodDetails.city = projectProvider.isArabic @@ -536,7 +528,8 @@ class _BloodDonationPageState extends State { return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } - String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { + String getHospitalName( + ProjectViewModel projectProvider, BuildContext context) { if (_selectedHospital != null) return projectProvider.isArabic ? _selectedHospital.descriptionN diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index ae968764..966dc4d4 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -628,8 +629,8 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, - MaterialPageRoute( - builder: (context) => BookSuccess( + FadePage( + page: BookSuccess( docObject: docObject, patientShareResponse: patientShareResponse, appoDateFormatted: widget.appoDateFormatted, diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index bd6c242c..26a5b0fe 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -12,6 +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/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; @@ -592,7 +593,7 @@ class _BookSuccessState extends State { appo.appointmentNo = widget.patientShareResponse.appointmentNo; Navigator.push( - context, MaterialPageRoute(builder: (context) => PaymentMethod())) + context, FadePage(page: PaymentMethod())) .then((value) { print(value); if (value != null) { @@ -920,11 +921,11 @@ class _BookSuccessState extends State { Future navigateToQR(context, String appoQR) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => QRCode( - patientShareResponse: widget.patientShareResponse, - appoQR: appoQR, - ))); + FadePage( + page: QRCode( + patientShareResponse: widget.patientShareResponse, + appoQR: appoQR, + ))); } _getNormalText(text) { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 392eb24c..2a349cf2 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:rating_bar/rating_bar.dart'; @@ -153,7 +154,8 @@ class _DoctorProfileState extends State alignment: Alignment.center, child: Text( "(" + - widget.docProfileList.noOfPatientsRate.toString() + + widget.docProfileList.noOfPatientsRate + .toString() + " " + TranslationBase.of(context).reviews + ")", @@ -279,7 +281,8 @@ class _DoctorProfileState extends State color: Theme.of(context).primaryColor, margin: EdgeInsets.only(bottom: 5.0), padding: EdgeInsets.all(10.0), - child: Text(TranslationBase.of(context).doctorRating, + child: Text( + TranslationBase.of(context).doctorRating, style: TextStyle( fontSize: 22.0, color: Colors.white))), Container( @@ -297,8 +300,11 @@ class _DoctorProfileState extends State margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, child: RatingBar.readOnly( - initialRating: - this.widget.doctor.actualDoctorRate.toDouble(), + initialRating: this + .widget + .doctor + .actualDoctorRate + .toDouble(), size: 35.0, filledColor: Colors.yellow[700], emptyColor: Colors.grey[500], @@ -311,7 +317,11 @@ class _DoctorProfileState extends State Container( margin: EdgeInsets.only(top: 10.0), child: Text( - this.widget.doctor.noOfPatientsRate.toString() + + this + .widget + .doctor + .noOfPatientsRate + .toString() + " " + TranslationBase.of(context).reviews, style: TextStyle( @@ -327,7 +337,8 @@ class _DoctorProfileState extends State child: Text( TranslationBase.of(context).excellent, style: TextStyle( - fontSize: 13.0, color: Colors.black))), + fontSize: 13.0, + color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( @@ -349,9 +360,11 @@ class _DoctorProfileState extends State width: 100.0, margin: EdgeInsets.only( top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).v_good, + child: Text( + TranslationBase.of(context).v_good, style: TextStyle( - fontSize: 13.0, color: Colors.black))), + fontSize: 13.0, + color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( @@ -373,9 +386,11 @@ class _DoctorProfileState extends State width: 100.0, margin: EdgeInsets.only( top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).good, + child: Text( + TranslationBase.of(context).good, style: TextStyle( - fontSize: 13.0, color: Colors.black))), + fontSize: 13.0, + color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( @@ -397,9 +412,11 @@ class _DoctorProfileState extends State width: 100.0, margin: EdgeInsets.only( top: 10.0, left: 15.0, right: 15.0), - child: Text(TranslationBase.of(context).average, + child: Text( + TranslationBase.of(context).average, style: TextStyle( - fontSize: 13.0, color: Colors.black))), + fontSize: 13.0, + color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( @@ -422,9 +439,11 @@ class _DoctorProfileState extends State margin: EdgeInsets.only( top: 10.0, left: 15.0, right: 15.0), child: Text( - TranslationBase.of(context).below_average, + TranslationBase.of(context) + .below_average, style: TextStyle( - fontSize: 13.0, color: Colors.black))), + fontSize: 13.0, + color: Colors.black))), Container( margin: EdgeInsets.only(top: 10.0), child: SizedBox( @@ -440,7 +459,8 @@ class _DoctorProfileState extends State ), ), Container( - margin: EdgeInsets.only(top: 40.0), child: Divider()), + margin: EdgeInsets.only(top: 40.0), + child: Divider()), Container( margin: EdgeInsets.only(top: 0.0), child: Align( @@ -462,7 +482,8 @@ class _DoctorProfileState extends State onPressed: () { Navigator.of(context).pop(); }, - child: Text(TranslationBase.of(context).cancel, + child: Text( + TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), ), ), @@ -485,7 +506,8 @@ class _DoctorProfileState extends State } double getRatingWidth(int patientNumber) { - var width = (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; + var width = + (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; return width; } @@ -528,8 +550,8 @@ class _DoctorProfileState extends State Future navigateToBookConfirm(context) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => BookConfirm( + FadePage( + page: BookConfirm( doctor: widget.doctor, isLiveCareAppointment: widget.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 94308c1c..6dee1076 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,21 +1,18 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; -import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; -import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; import 'components/SearchByClinic.dart'; class Search extends StatefulWidget { final int type; final List clnicIds; + Search({this.type = 0, this.clnicIds}); + @override _SearchState createState() => _SearchState(); } @@ -43,9 +40,12 @@ class _SearchState extends State with TickerProviderStateMixin { children: [ TabBar( tabs: [ - Tab(text: TranslationBase.of(context).clinicName), Tab( - text: TranslationBase.of(context).doctorName, + child: Text(TranslationBase.of(context).clinicName, + style: TextStyle(color: Colors.black))), + Tab( + child: Text(TranslationBase.of(context).doctorName, + style: TextStyle(color: Colors.black)), ) ], controller: _tabController, diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 7caf1977..cd8bb789 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -16,6 +16,7 @@ import '../../../uitl/date_uitl.dart'; class DocAvailableAppointments extends StatefulWidget { DoctorList doctor; static bool areSlotsAvailable = false; + static bool areAppointmentsAvailable = false; static DateTime selectedAppoDateTime; static String selectedDate; static String selectedTime; @@ -137,7 +138,7 @@ class _DocAvailableAppointmentsState extends State shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0), side: BorderSide( - color: Colors.blue[400], //Color of the border + color: Color(0xff76cfb7), //Color of the border style: BorderStyle.solid, //Style of the border width: 1.5, //width of the border ), @@ -209,8 +210,8 @@ class _DocAvailableAppointmentsState extends State color: _calendarController.isSelected(date) ? Colors.green[400] : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], + ? Colors.transparent + : Color(0xff76cfb7), ), width: 40.0, height: 40.0, @@ -321,7 +322,7 @@ class _DocAvailableAppointmentsState extends State Widget getSelectedButton(int index) { return RaisedButton( - color: Colors.blue[400], + color: Color(0xff76cfb7), //Color of the border textColor: Colors.white, onPressed: () { setState(() { @@ -345,17 +346,22 @@ class _DocAvailableAppointmentsState extends State GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { + DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['FreeTimeSlots']; print("res['FreeTimeSlots']"); print(res['FreeTimeSlots'].length); _getJSONSlots().then((value) => { setState(() => {_events.clear(), _events = value}) }); - } else {} + } else { + DocAvailableAppointments.areAppointmentsAvailable = false; + } } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); }); } @@ -370,18 +376,22 @@ class _DocAvailableAppointmentsState extends State GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['PatientER_DoctorFreeSlots'].length != 0) { + DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['PatientER_DoctorFreeSlots']; print("res['PatientER_DoctorFreeSlots']"); print(res['PatientER_DoctorFreeSlots'].length); _getJSONSlots().then((value) => { setState(() => {_events.clear(), _events = value}) }); - } else {} + } else { + DocAvailableAppointments.areAppointmentsAvailable = false; + } } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); }); } @@ -399,10 +409,10 @@ class _DocAvailableAppointmentsState extends State decoration: BoxDecoration( shape: BoxShape.circle, color: _calendarController.isSelected(date) - ? Colors.green[400] + ? Color(0xffB8382C) : _calendarController.isToday(date) ? Colors.brown[300] - : Colors.blue[400], + : Color(0xff76cfb7), ), width: 40.0, height: 40.0, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 7e4e8fa9..733bbe10 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -12,6 +12,7 @@ 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/card/rounded_container.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; class SearchByClinic extends StatefulWidget { @@ -295,8 +296,8 @@ class _SearchByClinicState extends State { BuildContext context, SearchInfo searchInfo) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => DentalComplaints(searchInfo: searchInfo), + FadePage( + page: DentalComplaints(searchInfo: searchInfo), ), ); } @@ -309,8 +310,8 @@ class _SearchByClinicState extends State { isProjectLoaded = false; Navigator.push( context, - MaterialPageRoute( - builder: (context) => SearchResults( + FadePage( + page: SearchResults( isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 5e4ea91c..a1ecb7a0 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis 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/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import '../SearchResults.dart'; @@ -160,8 +161,8 @@ class _SearchByDoctorState extends State { patientDoctorAppointmentListHospital) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => SearchResults( + FadePage( + page: SearchResults( isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: diff --git a/lib/pages/BookAppointment/widgets/CardCommon.dart b/lib/pages/BookAppointment/widgets/CardCommon.dart index b03e9b24..ce26200d 100644 --- a/lib/pages/BookAppointment/widgets/CardCommon.dart +++ b/lib/pages/BookAppointment/widgets/CardCommon.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import '../../../Constants.dart'; @@ -8,6 +9,7 @@ class CardCommon extends StatelessWidget { final text; final subText; final type; + const CardCommon( {@required this.image, @required this.text, @@ -58,9 +60,9 @@ class CardCommon extends StatelessWidget { Future navigateToSearch(context, type) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => Search( - type: type, - ))); + FadePage( + page: Search( + type: type, + ))); } } diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart index 57377d75..02d40b3f 100644 --- a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; // ignore: must_be_immutable @@ -128,8 +129,8 @@ class _DentalComplaintCardState extends State { patientDoctorAppointmentListHospital) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => SearchResults( + FadePage( + page: SearchResults( doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 2788145f..bb6fccab 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -4,16 +4,15 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; import '../DoctorProfile.dart'; class DoctorView extends StatelessWidget { - final DoctorList doctor; - bool isLiveCareAppointment; - - + final DoctorList doctor; + bool isLiveCareAppointment; DoctorView({@required this.doctor, @required this.isLiveCareAppointment}); @@ -52,48 +51,53 @@ class DoctorView extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if(doctor.doctorTitle!=null) - Text(this.doctor.doctorTitle + " " + this.doctor.name, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0), - child: Text(this.doctor.clinicName != null ? this.doctor.clinicName : "", + if (doctor.doctorTitle != null) + Text(this.doctor.doctorTitle + " " + this.doctor.name, style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], + fontSize: 14.0, + color: Colors.grey[700], letterSpacing: 1.0)), - ), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(this.doctor.projectName, + child: Text( + this.doctor.clinicName != null + ? this.doctor.clinicName + : "", style: TextStyle( fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), - if(doctor.speciality!=null) Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(this.doctor.speciality).trim(), + margin: EdgeInsets.only(top: 3.0), + child: Text(this.doctor.projectName, style: TextStyle( fontSize: 12.0, color: Colors.grey[600], letterSpacing: 1.0)), ), - this.doctor.nearestFreeSlot != null ? Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDate(this.doctor.nearestFreeSlot), - style: TextStyle( - fontSize: 14.0, - fontWeight: FontWeight.bold, - color: Colors.green[600], - letterSpacing: 1.0)), - ) : Container(), + if (doctor.speciality != null) + Container( + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text( + getDoctorSpeciality(this.doctor.speciality) + .trim(), + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[600], + letterSpacing: 1.0)), + ), + this.doctor.nearestFreeSlot != null + ? Container( + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text(getDate(this.doctor.nearestFreeSlot), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.green[600], + letterSpacing: 1.0)), + ) + : Container(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -175,7 +179,7 @@ class DoctorView extends StatelessWidget { } String getMinute(DateTime dateObj) { - if(dateObj.minute == 0) { + if (dateObj.minute == 0) { return dateObj.minute.toString() + "0"; } else { return dateObj.minute.toString(); @@ -186,12 +190,12 @@ class DoctorView extends StatelessWidget { {isAppo}) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => DoctorProfile( - doctor: docObject, - isLiveCareAppointment: isLiveCareAppointment, - docProfileList: docProfile, - isOpenAppt: isAppo, - ))); + FadePage( + page: DoctorProfile( + doctor: docObject, + isLiveCareAppointment: isLiveCareAppointment, + docProfileList: docProfile, + isOpenAppt: isAppo, + ))); } } diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart index ae33cc03..fad0b0c2 100644 --- a/lib/pages/ChildVaccines/child_page.dart +++ b/lib/pages/ChildVaccines/child_page.dart @@ -1,10 +1,10 @@ -import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; 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/ChildVaccines/add_newchild_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.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/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -12,9 +12,6 @@ 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:diplomaticquarterapp/uitl/date_uitl.dart'; - -import 'dialogs/delete_child.dart'; class ChildPage extends StatefulWidget { @override @@ -60,7 +57,8 @@ class _ChildPageState extends State Navigator.push( context, FadePage( - page: VaccinationTablePage(model.babyInformationModelList[index]), + page: VaccinationTablePage(model + .babyInformationModelList[index]), ), ); }, @@ -119,7 +117,9 @@ class _ChildPageState extends State Navigator.push( context, FadePage( - page: VaccinationTablePage(model.babyInformationModelList[index]), + page: VaccinationTablePage(model + .babyInformationModelList[ + index]), ), ); }, @@ -159,9 +159,9 @@ class _ChildPageState extends State newChild: deleteBaby); if (model.isDeleted) { AppToast.showSuccessToast( - message: - TranslationBase.of(context) - .recordDeleted); + message: TranslationBase.of( + context) + .recordDeleted); Navigator.pop( context, model.isDeleted); } else { @@ -183,34 +183,34 @@ class _ChildPageState extends State ], ))), ), - 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, + 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(); + }); + }, + ), ), - label: TranslationBase.of(context).addNewChild, - // - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddNewChildPage(), - ), - ).then((value) { - if (value) model.getNewUserOrders(); - }); - }, - ), - ), )); } } diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 1e6911e2..04a7178f 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; @@ -13,9 +14,11 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.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:flutter_svg/flutter_svg.dart'; import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; import 'package:table_calendar/table_calendar.dart'; class CovidTimeSlots extends StatefulWidget { @@ -28,6 +31,8 @@ class CovidTimeSlots extends StatefulWidget { int selectedClinicID; int selectedDoctorID; + var language; + PatientShareResponse patientShareResponse; CovidTimeSlots({@required this.projectID}); @@ -89,10 +94,10 @@ class _CovidTimeSlotsState extends State super.dispose(); } - void _onDaySelected(DateTime day, List events) { + void _onDaySelected(DateTime day, List events, ProjectViewModel projectViewModel) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); setState(() { - this.selectedDate = DateUtil.getMonthDayYearDateFormatted(day); + this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en"); openTimeSlotsPickerForDate(day, docFreeSlots); CovidTimeSlots.selectedDate = formatter.format(day); print(CovidTimeSlots.selectedDate); @@ -111,6 +116,7 @@ class _CovidTimeSlotsState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, @@ -170,11 +176,12 @@ class _CovidTimeSlotsState extends State borderRadius: BorderRadius.circular(10.0), color: Colors.white), margin: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 5.0), - padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0), + padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0), width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height * 0.65, + // height: MediaQuery.of(context).size.height * 0.65, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ Container( margin: EdgeInsets.all(10.0), @@ -219,7 +226,7 @@ class _CovidTimeSlotsState extends State }, ), ), - _buildTableCalendarWithBuilders(), + _buildTableCalendarWithBuilders(projectViewModel), ], ), ), @@ -253,7 +260,7 @@ class _CovidTimeSlotsState extends State onPressed: () { bookCovidTestAppointment(); }, - child: Text("BOOK", style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)), ), ), ), @@ -264,9 +271,9 @@ class _CovidTimeSlotsState extends State ); } - Widget _buildTableCalendarWithBuilders() { + Widget _buildTableCalendarWithBuilders(ProjectViewModel projectViewModel) { return TableCalendar( - locale: 'en_US', + locale: projectViewModel.isArabic ? 'ar_SA' : 'en_US', calendarController: _calendarController, events: _events, initialCalendarFormat: CalendarFormat.month, @@ -351,6 +358,7 @@ class _CovidTimeSlotsState extends State _onDaySelected( date, event, + projectViewModel ); _animationController.forward(from: 0.0); }, @@ -488,7 +496,6 @@ class _CovidTimeSlotsState extends State CovidTimeSlots.selectedDate, context) .then((res) { - print(res); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); getPatientShare(context, res['AppointmentNo'], docObject.clinicID, @@ -525,8 +532,8 @@ class _CovidTimeSlotsState extends State cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { - GifLoaderDialogUtils.showMyDialog(context); ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { @@ -560,10 +567,12 @@ class _CovidTimeSlotsState extends State navigateToPaymentAlert() { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CovidPaymentAlert( - patientShareResponse: widget.patientShareResponse))); + context, + FadePage( + page: CovidPaymentAlert( + patientShareResponse: widget.patientShareResponse), + ), + ); } getCovidFreeSlots(BuildContext context, int projectID) { diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart index c82fd0f1..a8cb5048 100644 --- a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.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/uitl/utils.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:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -285,8 +286,8 @@ class _CovidDrivethruLocationState extends State { }); Navigator.push( context, - MaterialPageRoute( - builder: (context) => CovidPaymentDetails( + FadePage( + page: CovidPaymentDetails( covidPaymentInfoResponse: covidPaymentInfoResponse, projectID: int.parse(projectID), ))); diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart index ac5f45fc..ca6640c0 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-alert.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -1,7 +1,13 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-summary.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:flutter_svg/flutter_svg.dart'; @@ -15,10 +21,13 @@ class CovidPaymentAlert extends StatefulWidget { } class _CovidPaymentAlertState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser; + @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "COVID-19 TEST", + appBarTitle: TranslationBase.of(context).covidTest, isShowAppBar: true, body: SingleChildScrollView( child: Column( @@ -43,7 +52,7 @@ class _CovidPaymentAlertState extends State { children: [ Container( margin: EdgeInsets.only(left: 30.0, right: 20.0), - child: Text("Alert", + child: Text(TranslationBase.of(context).covidAlert, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, @@ -54,7 +63,8 @@ class _CovidPaymentAlertState extends State { margin: EdgeInsets.only( left: 30.0, right: 20.0, top: 5.0), child: Text( - "Pay With-in 15 mins to confirm the appointment", + TranslationBase.of(context).covidAlertHeader, + // "Pay With-in 15 mins to confirm the appointment", overflow: TextOverflow.clip, style: TextStyle( color: Colors.white, fontSize: 20.0)), @@ -72,7 +82,7 @@ class _CovidPaymentAlertState extends State { children: [ Container( alignment: Alignment.center, - child: Text("Pay With-in 15 mins", + child: Text(TranslationBase.of(context).covidAlertMins, overflow: TextOverflow.clip, style: TextStyle( color: new Color(0xFFc5272d), @@ -83,7 +93,7 @@ class _CovidPaymentAlertState extends State { alignment: Alignment.center, margin: EdgeInsets.only(top: 15.0), child: Text( - "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​.", + TranslationBase.of(context).covidAlertInfo, textAlign: TextAlign.center, style: TextStyle( color: Colors.grey[700], @@ -115,7 +125,7 @@ class _CovidPaymentAlertState extends State { Container( margin: EdgeInsets.only( top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), - child: Text("COVID-19 TEST", + child: Text(TranslationBase.of(context).covidTest, style: TextStyle( fontSize: 18.0, color: Colors.black, @@ -137,10 +147,12 @@ class _CovidPaymentAlertState extends State { child: Text( widget.patientShareResponse.projectName != null - ? widget.patientShareResponse.projectName + ? widget + .patientShareResponse.projectName : "NULL", style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + fontSize: 18.0, + color: Colors.grey[700])), ), ], ), @@ -159,14 +171,16 @@ class _CovidPaymentAlertState extends State { )), Container( child: Text( - widget.patientShareResponse.appointmentDate != + widget.patientShareResponse + .appointmentDate != null ? getDate(widget.patientShareResponse .appointmentDate) .split(" ")[0] : "NULL", style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + fontSize: 18.0, + color: Colors.grey[700])), ), ], ), @@ -185,14 +199,16 @@ class _CovidPaymentAlertState extends State { )), Container( child: Text( - widget.patientShareResponse.appointmentDate != + widget.patientShareResponse + .appointmentDate != null ? getDate(widget.patientShareResponse .appointmentDate) .split(" ")[1] : "NULL", style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + fontSize: 18.0, + color: Colors.grey[700])), ), ], ), @@ -216,7 +232,8 @@ class _CovidPaymentAlertState extends State { .patientShareResponse.doctorNameObj : "NULL", style: TextStyle( - fontSize: 18.0, color: Colors.grey[700])), + fontSize: 18.0, + color: Colors.grey[700])), ), ], ), @@ -251,9 +268,9 @@ class _CovidPaymentAlertState extends State { disabledTextColor: Colors.white, disabledColor: Colors.grey[500], onPressed: () { -// bookCovidTestAppointment(); + startPaymentProcess(); }, - child: Text("NEXT", style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), ), ), ), @@ -264,6 +281,37 @@ class _CovidPaymentAlertState extends State { ); } + startPaymentProcess() { + navigateToPaymentMethod(context, widget.patientShareResponse); + } + + Future navigateToPaymentMethod( + context, PatientShareResponse patientShareResponse) async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + + Navigator.push( + context, FadePage(page: PaymentMethod())) + .then((value) { + print(value); + if (value != null) { + Navigator.push( + context, + FadePage( + page: CovidPaymentSummary( + patientShareResponse: widget.patientShareResponse, + selectedPaymentMethod: value.toString()), + ), + ); + } + }); + } + String getDate(String appoDate) { var appoDateFormatted = ""; diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart index 07914c9e..e6c87d0a 100644 --- a/lib/pages/Covid-DriveThru/covid-payment-details.dart +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.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/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -17,7 +18,7 @@ class CovidPaymentDetails extends StatefulWidget { _CovidPaymentDetailsState createState() => _CovidPaymentDetailsState(); } -class _CovidPaymentDetailsState extends State { +class _CovidPaymentDetailsState extends State { bool isAgree = false; @override @@ -197,7 +198,8 @@ class _CovidPaymentDetailsState extends State { onPressed: () { cancel(); }, - child: Text(TranslationBase.of(context).cancel, style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).cancel, + style: TextStyle(fontSize: 18.0)), ), ), ), @@ -218,7 +220,8 @@ class _CovidPaymentDetailsState extends State { disabledTextColor: Colors.white, disabledColor: Colors.grey[500], onPressed: isAgree ? next : null, - child: Text(TranslationBase.of(context).next, style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).next, + style: TextStyle(fontSize: 18.0)), ), ), ), @@ -232,10 +235,10 @@ class _CovidPaymentDetailsState extends State { void next() { Navigator.push( context, - MaterialPageRoute( - builder: (context) => CovidTimeSlots( - projectID: widget.projectID, - ))); + FadePage( + page: CovidTimeSlots( + projectID: widget.projectID, + ))); } cancel() { diff --git a/lib/pages/Covid-DriveThru/covid-payment-summary.dart b/lib/pages/Covid-DriveThru/covid-payment-summary.dart new file mode 100644 index 00000000..e71285b5 --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-payment-summary.dart @@ -0,0 +1,333 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/secondary_button.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 CovidPaymentSummary extends StatefulWidget { + PatientShareResponse patientShareResponse; + + final String selectedPaymentMethod; + MyInAppBrowser browser; + AuthenticatedUser authenticatedUser; + AppSharedPreferences sharedPref = AppSharedPreferences(); + String transID = ""; + + CovidPaymentSummary( + {@required this.patientShareResponse, this.selectedPaymentMethod}); + + @override + _CovidPaymentSummaryState createState() => _CovidPaymentSummaryState(); +} + +class _CovidPaymentSummaryState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).covidTest, + isShowAppBar: true, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).confirmThePayment, + textAlign: TextAlign.center, + fontWeight: FontWeight.w500, + fontSize: 24, + ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 100.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: + Image.asset(getImagePath(widget.selectedPaymentMethod)), + ), + Texts( + '${widget.patientShareResponse.patientShareWithTax} ' + + TranslationBase.of(context).sar, + fontSize: 26, + bold: true, + ) + ], + ), + SizedBox( + height: 12, + ), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: TranslationBase.of(context).fileNumber, + initialValue: + projectViewModel.user.patientID.toString(), + isEnabled: false, + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: TranslationBase.of(context).name, + initialValue: projectViewModel.user.firstName, + isEnabled: false, + ), + ), + ), + ], + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).mobileNumber, + initialValue: projectViewModel.user.mobileNumber, + isEnabled: false, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).depositorName, + initialValue: projectViewModel.user.firstName + + " " + + projectViewModel.user.middleName + + " " + + projectViewModel.user.lastName, + isEnabled: false, + ), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: Theme.of(context).primaryColor, + label: TranslationBase.of(context).confirm.toUpperCase(), + onTap: () { + startPaymentProcess(projectViewModel.user); + }, + ), + ), + ); + } + + startPaymentProcess(AuthenticatedUser authenticatedUser) { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + appo.projectID = widget.patientShareResponse.projectID; + appo.clinicID = widget.patientShareResponse.clinicID; + appo.appointmentNo = widget.patientShareResponse.appointmentNo; + + openPayment( + widget.selectedPaymentMethod, + authenticatedUser, + double.parse( + widget.patientShareResponse.patientShareWithTax.toString()), + widget.patientShareResponse, + appo); + } + + openPayment( + String paymentMethod, + AuthenticatedUser authenticatedUser, + double amount, + PatientShareResponse patientShareResponse, + AppoitmentAllHistoryResultList appo) async { + if (paymentMethod == "ApplePay") { + // await widget.chromeBrowser.open( + // url: "https://applepay-datatrans-sample.herokuapp.com/", + // options: ChromeSafariBrowserClassOptions( + // android: AndroidChromeCustomTabsOptions( + // addDefaultShareMenuItem: false), + // ios: IOSSafariOptions(barCollapsingEnabled: true))); + } else { + widget.browser = new MyInAppBrowser( + onExitCallback: onBrowserExit, + appo: appo, + onLoadStartCallback: onBrowserLoadStart); + + widget.browser.openPaymentBrowser( + amount, + "Appointment check in", + Utils.getAppointmentTransID( + appo.projectID, appo.clinicID, appo.appointmentNo), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser.patientType, + authenticatedUser.firstName, + authenticatedUser.patientID, + authenticatedUser, + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); + } + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (widget.browser.isOpened()) widget.browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (widget.browser.isOpened()) widget.browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + if (isPaymentMade) checkPaymentStatus(appo); + } + + checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service + .checkPaymentStatus( + Utils.getAppointmentTransID( + appo.projectID, appo.clinicID, appo.appointmentNo), + context) + .then((res) { + print("Printing Payment Status Reponse!!!!"); + print(res); + String paymentInfo = res['Response_Message']; + if (paymentInfo == 'Success') { + createAdvancePayment(res, appo); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: res['Response_Message']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + String paymentReference = res['Fort_id'].toString(); + service + .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], + res['Fort_id'], res['PaymentMethod'], context) + .then((res) { + print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); + addAdvancedNumberRequest( + res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), + paymentReference, + appo.appointmentNo.toString()); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + addAdvancedNumberRequest( + String advanceNumber, String paymentReference, String appointmentID) { + DoctorsListService service = new DoctorsListService(); + service + .addAdvancedNumberRequest( + advanceNumber, paymentReference, appointmentID, context) + .then((res) { + print(res); + getAppoQR(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + getAppoQR(context) { + DoctorsListService service = new DoctorsListService(); + service + .generateAppointmentQR(widget.patientShareResponse, context) + .then((res) { + print(res); + GifLoaderDialogUtils.hideDialog(context); + navigateToQR(context, res['AppointmentQR']); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + Future navigateToQR(context, String appoQR) async { + Navigator.push( + context, + FadePage( + page: QRCode( + patientShareResponse: widget.patientShareResponse, + appoQR: appoQR, + ))); + } + + String getImagePath(String paymentMethod) { + switch (paymentMethod) { + case "MADA": + return 'assets/images/new-design/mada.png'; + break; + case "SADAD": + return 'assets/images/new-design/sadad.png'; + break; + case "VISA": + return 'assets/images/new-design/visa.png'; + break; + case "MASTERCARD": + return 'assets/images/new-design/mastercard.png'; + break; + case "Installment": + return 'assets/images/new-design/installment.png'; + break; + } + + return 'assets/images/new-design/mada.png'; + } +} diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 53aad843..9745609d 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -7,6 +7,7 @@ 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/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -57,15 +58,14 @@ class NotificationsPage extends StatelessWidget { .map( (notification) => InkWell( onTap: () async { - if(!notification.isRead) + if (!notification.isRead) model.markAsRead(notification.id); Navigator.push( context, - MaterialPageRoute( - builder: (BuildContext context) => - NotificationsDetailsPage( - notification: notification, - ))); + FadePage( + page: NotificationsDetailsPage( + notification: notification, + ))); }, child: Container( width: double.infinity, @@ -122,8 +122,7 @@ class NotificationsPage extends StatelessWidget { ..add( InkWell( onTap: () async { - GifLoaderDialogUtils.showMyDialog( - context); + GifLoaderDialogUtils.showMyDialog(context); currentIndex++; GetNotificationsRequestModel getNotificationsRequestModel = @@ -132,10 +131,9 @@ class NotificationsPage extends StatelessWidget { pagingSize: 14, notificationStatusID: 2); - await model.getNotifications(getNotificationsRequestModel,context); - GifLoaderDialogUtils.hideDialog( - context); - + await model.getNotifications( + getNotificationsRequestModel, context); + GifLoaderDialogUtils.hideDialog(context); }, child: Center( child: Image.asset('assets/images/notf.png'), diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index 1ea0f7f5..831eb013 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -14,11 +14,13 @@ 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/pickupLocation/PickupLocationFromMap.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:geolocator/geolocator.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; + import '../AvailableAppointmentsPage.dart'; enum HaveAppointment { YES, NO } @@ -87,17 +89,16 @@ class _PickupLocationState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, - onPick: (value) { - setState(() { - _result = value; - }); - }, - ), - ), + FadePage( + page: PickupLocationFromMap( + latitude: _latitude, + longitude: _longitude, + onPick: (value) { + setState(() { + _result = value; + }); + }, + )), ); }, child: Container( @@ -111,7 +112,8 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), + Expanded( + child: Texts(getSelectFromMapName(context))), Icon( FontAwesomeIcons.mapMarkerAlt, size: 24, @@ -327,8 +329,8 @@ class _PickupLocationState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => PickupLocationFromMap( + FadePage( + page: PickupLocationFromMap( latitude: _latitude, longitude: _longitude, onPick: (value) { @@ -351,7 +353,8 @@ class _PickupLocationState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(child: Texts(getSelectFromMapName(context))), + Expanded( + child: Texts(getSelectFromMapName(context))), Icon( FontAwesomeIcons.mapMarkerAlt, size: 24, @@ -366,7 +369,6 @@ class _PickupLocationState extends State { SizedBox( height: 45, ), - ], ), ), @@ -409,18 +411,16 @@ class _PickupLocationState extends State { widget.patientER.pickupLocationLattitude; widget.patientER.longitude = widget.patientER.pickupLocationLongitude; - widget.patientER.dropoffLocationName = - _selectedHospital.name; + widget.patientER.dropoffLocationName = _selectedHospital.name; widget.patientER.createdBy = widget.amRequestViewModel.user.patientID; widget.patientER.isOutPatient = widget.amRequestViewModel.user.outSA; - widget.patientER.patientIdentificationID = widget - .amRequestViewModel.user.patientIdentificationNo; + widget.patientER.patientIdentificationID = + widget.amRequestViewModel.user.patientIdentificationNo; widget.patientER.pickupDateTime = DateUtil.convertDateToStringLocation(DateTime.now()); - widget.patientER.pickupLocationName = - _result.formattedAddress; + widget.patientER.pickupLocationName = _result.formattedAddress; widget.patientER.projectID = widget.amRequestViewModel.user.projectID; widget.patientER.requesterFileNo = @@ -498,8 +498,8 @@ class _PickupLocationState extends State { GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, - MaterialPageRoute( - builder: (context) => AvailableAppointmentsPage( + FadePage( + page: AvailableAppointmentsPage( appointmentsAllHistoryList: widget.amRequestViewModel.appoitmentAllHistoryResultList, ), diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 17b6d57b..9848b394 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -10,6 +10,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/others/app_scaffold_widget.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'; @@ -236,9 +237,10 @@ class _AppointmentDetailsState extends State Future navigateToBookConfirm(context) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => BookConfirm( + FadePage( + page: BookConfirm( doctor: getDoctorObject(), + isLiveCareAppointment: widget.appo.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime))); } diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index a49149b5..5ed0fef4 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -82,9 +82,17 @@ class _MyAppointmentsState extends State child: Column(children: [ TabBar( tabs: [ - Tab(text: TranslationBase.of(context).booked), - Tab(text: TranslationBase.of(context).confirmed), - Tab(text: TranslationBase.of(context).arrived), + Tab( + child: Text(TranslationBase.of(context).booked, + style: TextStyle(color: Colors.black))), + Tab( + child: Text(TranslationBase.of(context).confirmed, + style: TextStyle(color: Colors.black)), + ), + Tab( + child: Text(TranslationBase.of(context).arrived, + style: TextStyle(color: Colors.black)), + ) ], controller: _tabController, ), @@ -103,7 +111,7 @@ class _MyAppointmentsState extends State leading: Radio( value: FilterType.Clinic, groupValue: filterType, - activeColor: Theme.of(context).primaryColor, + activeColor: Color(0xffB8382C), onChanged: (FilterType value) { setFilterType(value); }, @@ -120,7 +128,7 @@ class _MyAppointmentsState extends State leading: Radio( value: FilterType.Hospital, groupValue: filterType, - activeColor: Theme.of(context).primaryColor, + activeColor: Color(0xffB8382C), onChanged: (FilterType value) => setFilterType(value), ), ), diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 60035ee1..51eefe1a 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -110,7 +110,7 @@ class _AppointmentActionsState extends State { child: Text(e.title, overflow: TextOverflow.clip, style: TextStyle( - color: new Color(0xFF40ACC9), + color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)), ), @@ -498,8 +498,8 @@ class _AppointmentActionsState extends State { dynamic listPres) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => PrescriptionReportPage( + FadePage( + page: PrescriptionReportPage( prescriptionReportEnhList: prescriptionReportEnhList, listPres: listPres, appo: widget.appo))); @@ -508,8 +508,8 @@ class _AppointmentActionsState extends State { Future navigateToLabResults(PatientLabOrders patientLabOrders) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => + FadePage( + page: LaboratoryResultPage(patientLabOrders: patientLabOrders))) .then((value) {}); } @@ -517,8 +517,8 @@ class _AppointmentActionsState extends State { Future navigateToRadiologyDetails(FinalRadiology finalRadiology) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => + FadePage( + page: RadiologyDetailsPage(finalRadiology: finalRadiology))) .then((value) {}); } diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index 0d3ac2e5..51e18ff4 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/countdown_timer_controller.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; @@ -57,14 +58,14 @@ class _ApointmentCardState extends State { children: [ Container( width: projectViewModel.isArabic ? 27 : 20, - height: projectViewModel.isArabic ? 165 : 140, + height: projectViewModel.isArabic ? 165 : 140, decoration: BoxDecoration( //Colors.red[900] Color(0xff404545) color: widget.appo.isLiveCareAppointment ? Color(0xff404545) : !widget.appo.isInOutPatient - ? Colors.red[900] - : Theme.of(context).primaryColor, + ? Colors.red[900] + : Theme.of(context).primaryColor, borderRadius: BorderRadius.only( topLeft: projectViewModel.isArabic ? Radius.circular(0) @@ -85,21 +86,21 @@ class _ApointmentCardState extends State { child: Center( child: Text( widget.appo.isLiveCareAppointment - ? TranslationBase.of(context) - .liveCare - .toUpperCase() + ? TranslationBase.of(context).liveCare.toUpperCase() : !widget.appo.isInOutPatient - ? TranslationBase.of(context) - .inPatient - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), + ? TranslationBase.of(context) + .inPatient + .toUpperCase() + : TranslationBase.of(context) + .outpatient + .toUpperCase(), style: TextStyle(color: Colors.white), ), )), ), - SizedBox(width: 8,), + SizedBox( + width: 8, + ), ClipRRect( borderRadius: BorderRadius.circular(100.0), child: Image.network(widget.appo.doctorImageURL, @@ -166,7 +167,7 @@ class _ApointmentCardState extends State { ), Container( transform: - Matrix4.translationValues(15.0, -40.0, 0.0), + Matrix4.translationValues(15.0, -40.0, 0.0), child: projectViewModel.isArabic ? Image.asset( "assets/images/new-design/arrow_menu_black-ar.png", @@ -179,17 +180,18 @@ class _ApointmentCardState extends State { ), ], ), - (widget.appo.patientStatusType == AppointmentType.BOOKED || + (widget.appo.patientStatusType == + AppointmentType.BOOKED || widget.appo.patientStatusType == AppointmentType.CONFIRMED) ? Container( child: CountdownTimer( controller: new CountdownTimerController( - endTime: - DateTime.now().millisecondsSinceEpoch + - (widget.appo.remaniningHoursTocanPay * - 1000) * - 60), + endTime: DateTime.now() + .millisecondsSinceEpoch + + (widget.appo.remaniningHoursTocanPay * + 1000) * + 60), widgetBuilder: (_, CurrentRemainingTime time) { return time != null ? Text( @@ -235,10 +237,7 @@ class _ApointmentCardState extends State { } Future navigateToAppointmentDetails(context, appo) async { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AppointmentDetails(appo: appo))) + Navigator.push(context, FadePage(page: AppointmentDetails(appo: appo))) .then((value) { widget.onReloadAppointmentHistory(); }); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 622f88c8..79bcd94b 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -21,6 +21,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.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:flutter_countdown_timer/countdown_timer_controller.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; @@ -367,7 +368,7 @@ class _ToDoState extends State { height: 30.0, margin: projectViewModel.isArabic ? EdgeInsets.fromLTRB(160.0, 0.0, 30.0, 0.0) - : EdgeInsets.fromLTRB(30.0, 0.0, 160.0, 0.0), + : EdgeInsets.fromLTRB(20.0, 0.0, 160.0, 0.0), transform: Matrix4.translationValues(0.0, -8.0, 0.0), child: Row( mainAxisAlignment: MainAxisAlignment.start, @@ -392,7 +393,7 @@ class _ToDoState extends State { style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, - fontSize: 12.0)), + fontSize: 11.0)), ) : Container( child: Text( @@ -401,7 +402,7 @@ class _ToDoState extends State { style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, - fontSize: 12.0)), + fontSize: 11.0)), ) ], ), @@ -600,8 +601,8 @@ class _ToDoState extends State { Future navigateToAppointmentDetails(context, appo) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => AppointmentDetails(appo: appo))) + FadePage( + page: AppointmentDetails(appo: appo))) .then((value) { getPatientAppointmentHistory(); }); @@ -702,8 +703,8 @@ class _ToDoState extends State { context, String appoQR, PatientShareResponse patientShareResponse) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => QRCode( + FadePage( + page: QRCode( patientShareResponse: patientShareResponse, appoQR: appoQR, ))).then((value) { @@ -907,7 +908,7 @@ class _ToDoState extends State { } Navigator.push( - context, MaterialPageRoute(builder: (context) => PaymentMethod())) + context, FadePage(page: PaymentMethod())) .then((value) { print(value); getPatientAppointmentHistory(); diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index 3a0734dc..9a22eada 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -27,7 +27,7 @@ class _PaymentMethodState extends State { Container( margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 0.0), alignment: Alignment.center, - child: Text("Select Payment Method", + child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle( fontSize: 26.0, fontWeight: FontWeight.bold)), ), diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 3fefe616..6610ed33 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dar import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -351,6 +352,6 @@ class _TodoListCardState extends State { Future navigateToAppointmentDetails(context) async { Navigator.push( - context, MaterialPageRoute(builder: (context) => AppointmentDetails())); + context, FadePage(page: AppointmentDetails())); } } diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 03adee97..4820689a 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -1,15 +1,21 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/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 'base/base_view.dart'; class FinalProductsPage extends StatefulWidget { - String id; - FinalProductsPage({this.id}); + final String id; + final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed + + FinalProductsPage({this.id, this.productType = 1}); + @override _FinalProductsPageState createState() => _FinalProductsPageState(id: id); } @@ -28,11 +34,22 @@ class _FinalProductsPageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getFinalProducts(i: id), + onModelReady: (model) { + if (widget.productType == 1) { + model.getFinalProducts(i: id); + } else if (widget.productType == 2) { + model.getManufacturerProducts(id); + } else if (widget.productType == 3) { + model.getLastVisitedProducts(); + } else { + model.getBestSellerProducts(); + } + }, + allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Products', + appBarTitle: "Products", isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -117,193 +134,220 @@ class _FinalProductsPageState extends State { itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, - 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, + 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, + ), ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, ), - 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 + 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] - .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)), + .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: Texts( - model.finalProducts[index] + Container( + width: model + .finalProducts[ + index] .rxMessage != null - ? model - .finalProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w600, + ? 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: Texts( + model + .finalProducts[ + index] + .rxMessage != + null + ? model + .finalProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w600, + ), ), - ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, + ], ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (model + 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 != - 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, - ), + .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, ), ), - 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, + 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]), + )), + }, )); }, ), @@ -316,158 +360,186 @@ class _FinalProductsPageState extends State { itemCount: model.finalProducts.length, itemBuilder: (BuildContext context, int index) { - return 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, + 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 / + 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 + .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( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ + SizedBox( + height: 4.0, + ), Container( - width: model - .finalProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) + 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)), - ), + .width * + 0.65, child: Texts( model.finalProducts[index] - .rxMessage != - null - ? model - .finalProducts[ - index] - .rxMessage - : "", - color: Colors.white, + .name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight.w600, + FontWeight.w500, + maxLines: 5, ), ), - ], - ), - ], - ), - 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( - height: 35.0, - width: 250.0, - child: Texts( - model.finalProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 2, + SizedBox( + height: 8.0, ), - ), - SizedBox( - height: 8.0, - ), - 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]), + )), + }, ); }), ), diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index d8463653..452c315c 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_index_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'; @@ -11,7 +10,6 @@ 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/paymentService/payment_service.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -322,13 +320,27 @@ class _HomePageState extends State { SizedBox( height: 8, ), - Texts( - model.user.firstName + - " " + - model.user.lastName, - color: Colors.grey[100], - bold: true, - fontSize: 15, + 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"), + ), + ], ), Texts( '${model.user.patientID}', @@ -787,9 +799,13 @@ class _HomePageState extends State { ); } + // openBrowser() { + // InAppBrowser browser = new InAppBrowser(); + // browser.openUrl(url: "https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=ca9dd276-0a20-4924-a768-fafa9a855ef1&&CustomerId=1367368"); + // } + navigateToCovidDriveThru() { - Navigator.push(context, - MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); + Navigator.push(context, FadePage(page: CovidDrivethruLocation())); } } diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 3a46f45c..3dab7c83 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -1,28 +1,22 @@ -import 'dart:convert'; - -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; 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/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/parent_categorise_page.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/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_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/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; class LandingPagePharmacy extends StatefulWidget { @override @@ -49,78 +43,73 @@ class _LandingPagePharmacyState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: - - // currentTab == 0 || currentTab == 1 || currentTab == 2 - // ? - - 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(8.0), - child: Row( - //crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.search, size: 25.0), - SizedBox( - width: 15.0, + appBar: currentTab != 4 + ? 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(8.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, + ) + ], + ), ), - Texts( - TranslationBase.of(context).searchProductHere, - fontSize: 13, - ) - ], - ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => 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', + onTap: () { + Navigator.push( + context, + FadePage(page: SearchProductsPage()), + ); + }, ), ), - ); - }, - ), - actions: [ - IconButton( - // iconSize: 70, - icon: Image.asset( - 'assets/images/new-design/qr-code.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', + ), + ), + ); + }, ), - onPressed: _scanQrAndGetProduct //do something, - ) - ], - centerTitle: true, - ), - // : currentTab == 4 - // ? null:null, + 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, @@ -155,7 +144,6 @@ class _LandingPagePharmacyState extends State { physics: NeverScrollableScrollPhysics(), controller: pageController, children: [ - // TODO mosa_comeback PharmacyPage(), PharmacyCategorisePage(), // OffersCategorisePage(), @@ -180,8 +168,9 @@ class _LandingPagePharmacyState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", - onSuccess: (dynamic response, int statusCode) { + await BaseAppClient() + .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", + onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 5cfdacc6..103066d5 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -22,6 +22,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -256,9 +257,7 @@ class _clinic_listState extends State { }); } - Navigator.push( - context, MaterialPageRoute(builder: (context) => PaymentMethod())) - .then((value) { + Navigator.push(context, FadePage(page: PaymentMethod())).then((value) { print(value); if (value != null) { openPayment(value, authUser, @@ -669,8 +668,8 @@ class _clinic_listState extends State { patientDoctorAppointmentListHospital) async { Navigator.push( context, - MaterialPageRoute( - builder: (context) => SearchResults( + FadePage( + page: SearchResults( doctorsList: docList, isLiveCareAppointment: true, patientDoctorAppointmentListHospital: diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index 69a66d9e..f8af8eac 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -1,10 +1,14 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/pages/login/forgot-password.dart'; +import 'package:diplomaticquarterapp/pages/login/login.dart'; +import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.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'; @@ -50,8 +54,8 @@ class LoginType extends StatelessWidget { child: InkWell( onTap: () => { LoginType.loginType = 1, - Navigator.of(context) - .pushNamed(LOGIN_PAGE) + Navigator.of(context) + .push(FadePage(page: Login())), }, child: RoundedContainer( borderColor: Colors.grey, @@ -90,8 +94,8 @@ class LoginType extends StatelessWidget { child: InkWell( onTap: () => { LoginType.loginType = 2, - Navigator.of(context) - .pushNamed(LOGIN_PAGE) + Navigator.of(context) + .push(FadePage(page: Login())), }, child: RoundedContainer( borderColor: Colors.grey, @@ -136,8 +140,8 @@ class LoginType extends StatelessWidget { Center( child: InkWell( onTap: () => { - Navigator.of(context) - .pushNamed(FORGOT_PASSWORD) + Navigator.of(context) + .push(FadePage(page: ForgotPassword())), }, child: AppText( TranslationBase.of(context) @@ -166,9 +170,8 @@ class LoginType extends StatelessWidget { child: DefaultButton( TranslationBase.of(context).registerNow, () => { - Navigator.of(context).pushNamed( - REGISTER, - ) + Navigator.of(context) + .push(FadePage(page: Register())), }, )), ], diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 44be9a6d..6bc99be5 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -9,9 +9,10 @@ import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel. import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.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/uitl/app_shared_preferences.dart'; @@ -24,8 +25,6 @@ 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/progress_indicator/app_circular_progress_Indeicator.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'; @@ -48,10 +47,13 @@ class _Login extends State { final authService = new AuthProvider(); var sharedPref = new AppSharedPreferences(); bool isLoading = false; - AppointmentRateViewModel appointmentRateViewModel = locator(); - PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + AppointmentRateViewModel appointmentRateViewModel = + locator(); + PharmacyModuleViewModel pharmacyModuleViewModel = + locator(); - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); ProjectViewModel projectViewModel; ToDoCountProviderModel toDoProvider; @@ -97,7 +99,10 @@ class _Login extends State { children: [ Directionality( textDirection: TextDirection.ltr, - child: MobileNo(onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value)), + child: MobileNo( + onNumberChange: (value) => + {mobileNo = value, validateForm()}, + onCountryChange: (value) => countryCode = value)), Directionality( textDirection: TextDirection.ltr, child: Container( @@ -138,7 +143,9 @@ class _Login extends State { child: DefaultButton( TranslationBase.of(context).login, () => {this.startLogin()}, - color: isButtonDisabled == true ? Colors.grey : Colors.grey[900], + color: isButtonDisabled == true + ? Colors.grey + : Colors.grey[900], textColor: Colors.white, )) ], @@ -159,7 +166,8 @@ class _Login extends State { } void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && + util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); @@ -196,7 +204,7 @@ class _Login extends State { sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']), sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), GifLoaderDialogUtils.hideDialog(context), - Navigator.of(context).pushNamed(CONFIRM_LOGIN) + Navigator.of(context).push(FadePage(page: ConfirmLogin())), } else { @@ -212,9 +220,7 @@ class _Login extends State { cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { ConfirmDialog.closeAlertDialog(context), - Navigator.of(context).pushNamed( - REGISTER, - ), + Navigator.of(context).push(FadePage(page: Register())), }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); @@ -259,9 +265,9 @@ class _Login extends State { projectViewModel.isLogin = true; projectViewModel.user = authenticatedUserObject.user; - await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - if(pharmacyModuleViewModel.error.isNotEmpty) - await pharmacyModuleViewModel.createUser(); + await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { + if (pharmacyModuleViewModel.error.isNotEmpty) + await pharmacyModuleViewModel.createUser(); }); appointmentRateViewModel diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 131db748..c6a3b872 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -3,24 +3,22 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_reponse.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_user_status_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; +import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.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/progress_indicator/app_circular_progress_Indeicator.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'; @@ -43,6 +41,7 @@ class _Register extends State { final sharedPref = new AppSharedPreferences(); bool isLoading; + @override Widget build(BuildContext context) { return AppScaffold( @@ -50,39 +49,38 @@ class _Register extends State { isShowAppBar: true, isShowDecPage: false, body: SingleChildScrollView( - child: Container( - padding: - EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), - height: SizeConfig.realScreenHeight * .9, - width: SizeConfig.realScreenWidth, - child: Column(children: [ - Expanded( - flex: 1, - child: AppText( - TranslationBase.of(context).enterNationalId, - fontSize: SizeConfig.textMultiplier * 3, - textAlign: TextAlign.left, - )), - Expanded( - flex: 4, - 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, - )), + child: Container( + padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column(children: [ + Expanded( + flex: 1, + child: AppText( + TranslationBase.of(context).enterNationalId, + fontSize: SizeConfig.textMultiplier * 3, + textAlign: TextAlign.left, + )), + Expanded( + flex: 4, + 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, + )), Row( children: [ Expanded( @@ -226,9 +224,7 @@ class _Register extends State { cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { ConfirmDialog.closeAlertDialog(context), - Navigator.of(context).pushNamed( - REGISTER, - ), + Navigator.of(context).push(FadePage(page: Register())), }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); @@ -312,16 +308,10 @@ class _Register extends State { { result = CheckUserStatusResponse.fromJson(result), sharedPref.setObject(NHIC_DATA, result), - Navigator.of(context).pushNamed( - CONFIRM_LOGIN, - ) - // Navigator.of(context).pushNamed( - // REGISTER_INFO, - // ) + Navigator.of(context).push(FadePage(page: ConfirmLogin())), } else {AppToast.showErrorToast(message: result)} - //this.onRegister(); }); } diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 4b8e90ae..b2250f5c 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/pages/login/login-type.dart'; +import 'package:diplomaticquarterapp/pages/login/register.dart'; import 'package:diplomaticquarterapp/routes.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'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -72,9 +74,8 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).yes, () => { - Navigator.of(context).pushNamed( - LOGIN_TYPE, - ), + Navigator.of(context) + .push(FadePage(page: LoginType())), }, color: Color(0xFFc5272c), textColor: Colors.white, @@ -87,9 +88,8 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - Navigator.of(context).pushNamed( - REGISTER, - ) + Navigator.of(context) + .push(FadePage(page: Register())), }, )) ], diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index c7dd5d37..0d752e9f 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -214,14 +214,14 @@ class _AdvancePaymentPageState extends State { SizedBox( height: 12, ), - if(model.user!=null) - NewTextFields( - hintText: TranslationBase.of(context).depositorEmail, - initialValue: model.user.emailAddress, - onChanged: (value) { - email = value; - }, - ), + if (model.user != null) + NewTextFields( + hintText: TranslationBase.of(context).depositorEmail, + initialValue: model.user.emailAddress, + onChanged: (value) { + email = value; + }, + ), SizedBox( height: 12, ), @@ -243,7 +243,9 @@ class _AdvancePaymentPageState extends State { child: SecondaryButton( textColor: Colors.white, label: TranslationBase.of(context).submit, - disabled: amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null, + disabled: amount.isEmpty || + _fileTextController.text.isEmpty || + _selectedHospital == null, onTap: () { var mobileNum; var patientName; @@ -278,10 +280,8 @@ class _AdvancePaymentPageState extends State { if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { Utils.hideKeyboard(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PaymentMethod())).then( + Navigator.push(context, FadePage(page: PaymentMethod())) + .then( (value) { Navigator.push( context, diff --git a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart index b33246de..88234fe5 100644 --- a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart +++ b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart @@ -1,99 +1,292 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.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:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; -class PrescriptionDeliveryAddressPage extends StatelessWidget { +import 'PrescriptionOrderOverveiw.dart'; + +class PrescriptionDeliveryAddressPage extends StatefulWidget { final Prescriptions prescriptions; + final List prescriptionReportList; + final List prescriptionReportEnhList; - const PrescriptionDeliveryAddressPage({Key key, this.prescriptions}) + const PrescriptionDeliveryAddressPage( + {Key key, + this.prescriptions, + this.prescriptionReportList, + this.prescriptionReportEnhList}) : super(key: key); + @override + _PrescriptionDeliveryAddressPageState createState() => + _PrescriptionDeliveryAddressPageState(); +} + +class _PrescriptionDeliveryAddressPageState + extends State { + AddressInfo _selectedAddress; + Completer _controller = Completer(); + + CameraPosition _kGooglePlex = CameraPosition( + target: LatLng(24.665011045779107, 46.73502189439707), + zoom: 14.4746, + ); + Set markers = new Set(); + double latitude = 0; + double longitude = 0; + + @override + void initState() { + super.initState(); + _getCurrentLocation(); + } + + _getCurrentLocation() async { + await Geolocator.getLastKnownPosition().then((value) { + latitude = value.latitude; + latitude = value.longitude; + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); + }).catchError((e) { + latitude = 24.665011045779107; + latitude = 46.73502189439707; + }); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - - return AppScaffold( - isShowAppBar: true, - appBarTitle: 'Delivery Address', - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 15, - ), - InkWell( - onTap: () {}, - child: Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - height: 50, - decoration: BoxDecoration( - border: Border.all(color: Colors.grey), - borderRadius: BorderRadius.circular(7), - color: Colors.white, - shape: BoxShape.rectangle, + return BaseView( + onModelReady: (model) => model.getCustomerInfo(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).shippingAddresss, + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 0.65, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 8, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Texts( - 'Selected Address', - variant: 'bodyText', - ), - margin: EdgeInsets.only(left: 10, right: 10), + InkWell( + onTap: () { + confirmSelectLocationDialog(model.addressesList); + }, + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + getAddressName(), + ), + margin: EdgeInsets.only(left: 10, right: 10), + ), + ), + ), + Icon( + Icons.arrow_drop_down, + size: 22, + color: Colors.grey, + ) + ], ), - Icon( - Icons.arrow_drop_down, - size: 22, - color: Colors.grey, - ) - ], + ), ), - ), - ), - SizedBox( - height: 15, + SizedBox( + height: 10, + ), + _selectedAddress == null + ? Container( + child: Image.asset( + projectViewModel.isArabic + ? 'assets/images/pharmacy/shipping_image_ar.png' + : 'assets/images/pharmacy/shipping_image.png', + height: 300, + ), + ) + : Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey)), + height: 200, + child: GoogleMap( + mapType: MapType.normal, + markers: markers, + initialCameraPosition: _kGooglePlex, + onMapCreated: + (GoogleMapController controller) { + _controller.complete(controller); + }, + ), + ), + ), + SizedBox( + height: 10, + ), + Texts( + TranslationBase.of(context).shippingAddresss), + SizedBox( + height: 10, + ), + Texts( + '${model.user.firstName} ${model.user.lastName}'), + SizedBox( + height: 10, + ), + Texts(_selectedAddress.address1), + SizedBox( + height: 10, + ), + Texts(_selectedAddress.address2), + SizedBox( + height: 10, + ), + Texts(_selectedAddress.city + + " " + + _selectedAddress.country), + ], + ), + ) + ], ), - Container( - - child: Image.asset(projectViewModel.isArabic - ? 'assets/images/pharmacy/shipping_image_ar.png' - : 'assets/images/pharmacy/shipping_image.png',height: 300,), - ) - ], + ), ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.25, - color: Colors.grey[100], - child: Column( - children: [ - Divider(), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: 'Add New Address'.toUpperCase(), - onTap: () {}, - ), - ), - Container( + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.25, + color: Colors.grey[100], + child: Column( + children: [ + Divider(), + Container( width: MediaQuery.of(context).size.width * 0.8, child: Button( - label: 'Continue'.toUpperCase(), - backgroundColor: Colors.green[200], - onTap: () {}, - )) - ], - ), - )); + label: + TranslationBase.of(context).addNewAddress.toUpperCase(), + onTap: () { + Navigator.push( + context, + FadePage( + page: LocationPage( + latitude: latitude, + longitude: longitude, + )), + ); + }, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: + TranslationBase.of(context).continues.toUpperCase(), + disabled: _selectedAddress == null, + backgroundColor: _selectedAddress == null + ? Colors.green[300] + : Colors.green[700], + onTap: () { + Navigator.push( + context, + FadePage( + page: PrescriptionOrderOverview( + latitude: latitude, + longitude: longitude, + prescriptionReportEnhList: + widget.prescriptionReportEnhList, + prescriptionReportList: + widget.prescriptionReportList, + prescriptions: widget.prescriptions, + selectedAddress: _selectedAddress, + ), + ), + ); + }, + )) + ], + ), + )), + ); + } + + void confirmSelectLocationDialog( + List addresses, + ) { + showDialog( + context: context, + child: SelectLocationDialog( + addresses: addresses, + selectedAddress: _selectedAddress, + onValueSelected: (value) { + setState(() { + _selectedAddress = value; + List latLongArr = value.latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + markers = Set(); + markers.add( + Marker( + markerId: MarkerId( + _selectedAddress.latLong.hashCode.toString(), + ), + position: LatLng(latitude, longitude), + ), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); + }); + }, + ), + ); + } + + String getAddressName() { + if (_selectedAddress != null) + return _selectedAddress.address1; + else + return TranslationBase.of(context).selectAddress; } } diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart new file mode 100644 index 00000000..bad43a02 --- /dev/null +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -0,0 +1,203 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class PrescriptionOrderOverview extends StatelessWidget { + final Prescriptions prescriptions; + final List prescriptionReportList; + final List prescriptionReportEnhList; + final AddressInfo selectedAddress; + final double latitude; + final double longitude; + PrescriptionOrderOverview( + {Key key, + this.prescriptions, + this.prescriptionReportList, + this.prescriptionReportEnhList, this.selectedAddress, this.latitude, this.longitude}); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).orderOverview, + baseViewModel: model, + body: Container( + height: MediaQuery.of(context).size.height * 0.8, + child: Column( + children: [ + if (!prescriptions.isInOutPatient) + ...List.generate( + prescriptionReportList.length, + (index) => 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( + prescriptionReportList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts(prescriptionReportList[index] + .itemDescription + .isNotEmpty + ? prescriptionReportList[index] + .itemDescription + : prescriptionReportList[index] + .itemDescriptionN)), + )), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + )) + else + ...List.generate( + prescriptionReportEnhList.length, + (index) => Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 70, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(prescriptionReportEnhList[index] + .itemDescription), + ], + ), + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 18, + color: Colors.grey[500], + ) + ], + ), + ), + ) + ], + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.15, + color: Colors.grey[100], + child: Column( + children: [ + SizedBox(height: 12,), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: SecondaryButton( + label: TranslationBase.of(context).submit.toUpperCase(), + color: Colors.green[800], + onTap: () async { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).confirmPrescription, + okTitle: TranslationBase.of(context).ok, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.insertDeliveryOrder(lineItemNo: 0, + longitude: longitude, + latitude: latitude,appointmentNo: prescriptions.appointmentNo, + dischargeID: prescriptions.dischargeNo,createdBy: model.user.patientID) + .then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state == ViewState.ErrorLocal) + showErrorDialog(context,model.error); + else + { + Navigator.pop(context); + Navigator.pop(context); + Navigator.pop(context); + } + + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); + }); + }, + ), + ); + + }, + )) + ], + ), + ), + ), + ); + } + + void showErrorDialog(BuildContext context,String error) { + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).youAlreadyHaveOrder, + okTitle: TranslationBase.of(context).orderOverview, + onTap: () { + Navigator.pop(context); + Navigator.pop(context); + Navigator.pop(context); + + }, + ), + ); + + } + +} diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 864bdca2..c6581493 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -201,16 +201,18 @@ class PrescriptionItemsPage extends StatelessWidget { ), Container( width: MediaQuery.of(context).size.width * 0.8, - child: SecondaryButton( + child: Button( label: TranslationBase.of(context).resendOrder, - color: Colors.green[200], + backgroundColor: Colors.green[800], onTap: (){ - var asd=""; + Navigator.push( context, FadePage( page: PrescriptionDeliveryAddressPage( prescriptions: prescriptions, + prescriptionReportList: model.prescriptionReportList, + prescriptionReportEnhList: model.prescriptionReportEnhList, ), ), ); diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index 2f9a3e60..ea8746e9 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,5 +1,8 @@ +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/stepsTracker.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +// import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; class HealthDataList extends StatefulWidget { @@ -8,13 +11,30 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { + + // List dataTypes = List(); + + @override + void initState() { + // dataTypes.add(DataType.DISTANCE); + // dataTypes.add(DataType.STEP_COUNT); + // dataTypes.add(DataType.HEART_RATE); + // dataTypes.add(DataType.SLEEP); + // dataTypes.add(DataType.ENERGY); + + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( appBarTitle: "Smartwatches", isShowAppBar: true, body: Container( - height: MediaQuery.of(context).size.height, + height: MediaQuery + .of(context) + .size + .height, margin: EdgeInsets.all(20.0), child: SingleChildScrollView( child: Column( @@ -58,21 +78,31 @@ class _HealthDataListState extends State { Divider( color: Colors.grey[500], ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Steps", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: StepsTracker(), + ), + ); + }, + child: Row( + children: [ + Container( + child: Image.asset( + "assets/images/SmartWatches/heartrate_icon.png", + width: 60.0, + height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), + child: Text("Steps", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), ), Divider( color: Colors.grey[500], @@ -121,25 +151,68 @@ class _HealthDataListState extends State { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery + .of(context) + .size + .height * 0.1, color: Colors.grey[100], child: Column( children: [ Divider( color: Colors.transparent, ), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - onTap: () { -// launch(model.radImageURL); - }, - label: 'Sync Health Data', - backgroundColor: Colors.grey[800], - ), - ), + InkWell( + onTap: () { + print("ReadLast"); + // readLast(); + }, + child:Container( + height: (MediaQuery + .of(context) + .size + .height/2)*0.12, + width: MediaQuery + .of(context) + .size + .width * 0.8, + decoration: BoxDecoration( + color: Colors.grey[800], + borderRadius: BorderRadius.circular(6.0), + ), + child: Container( + padding: EdgeInsets.only(top: 10.0), + child: Text( + 'Sync Health Data' , textAlign: TextAlign.center,style: TextStyle( + color: Colors.white , fontSize: 18.0 + ), + ), + ),),), ], ), )); } -} + + + // void readLast() async { + // print("ReadLast"); + // final result = await FitKit.readLast(DataType.DISTANCE); + // print(result); + // print(result); + // } + // + // void readAll() async { + // if (await FitKit.requestPermissions(dataTypes)) { + // for (DataType type in dataTypes) { + // final results = await FitKit.read( + // type, + // dateFrom: DateTime.now().subtract(Duration(days: 7)), + // dateTo: DateTime.now(), + // limit: 100, + // ); + // print(results); + // print(results.length); + // } + // readLast(); + // } + // } +} \ 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 20217ca9..977b99df 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 @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/healt import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -88,8 +89,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 1", + "Apple Watch Series 1", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -108,8 +110,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 2", + "Apple Watch Series 2", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -135,8 +138,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 3", + "Apple Watch Series 3", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -155,8 +159,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 4", + "Apple Watch Series 4", overflow: TextOverflow.clip , style: TextStyle( fontSize: 12.0)), ) @@ -182,8 +187,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 5", + "Apple Watch Series 5", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -202,8 +208,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Apple Watch Series 6", + "Apple Watch Series 6", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -229,7 +236,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Mi Band 3", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -248,7 +256,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Mi Band 4", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -417,9 +426,9 @@ class _SmartWatchInstructionsState extends State { child: CarouselSlider( carouselController: buttonCarouselController, options: CarouselOptions( - enableInfiniteScroll: false, - viewportFraction: 0.95, - height: MediaQuery.of(context).size.height * 0.9), + // enableInfiniteScroll: true, + viewportFraction: 0.99, + height: MediaQuery.of(context).size.height*1.02 ), items: [1, 2].map((i) { return Builder( builder: (BuildContext context) { @@ -427,7 +436,8 @@ class _SmartWatchInstructionsState extends State { width: MediaQuery.of(context).size.width, margin: EdgeInsets.symmetric(horizontal: 5.0), child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + margin: EdgeInsets.only(top:16.0 , bottom: 8.0), + // fromLTRB(8.0, 16.0, 8.0, 8.0), color: Colors.white.withOpacity(1.0), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -457,8 +467,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "Huawei Watch 2", + "Huawei Watch 2", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -477,8 +488,10 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( "Mobovi TicWatch E2", + overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -504,7 +517,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Huawei Watch", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Huawei Watch", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -523,7 +537,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Fossil Sport", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Fossil Sport", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -549,8 +564,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "MisFit Vapor 2", + "MisFit Vapor 2", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -569,8 +585,9 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( + width: MediaQuery.of(context).size.width*0.22, child: Text( - "LG Watch Sport", + "LG Watch Sport", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -596,7 +613,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Mi Band 3", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -615,7 +633,8 @@ class _SmartWatchInstructionsState extends State { width: 70.0, height: 70.0), Container( - child: Text("Mi Band 4", + width: MediaQuery.of(context).size.width*0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle( fontSize: 12.0)), ) @@ -735,7 +754,7 @@ class _SmartWatchInstructionsState extends State { ), Container( margin: EdgeInsets.fromLTRB( - 15.0, 95.0, 15.0, 15.0), + 15.0, 75.0, 15.0, 15.0), child: ButtonTheme( shape: RoundedRectangleBorder( borderRadius: diff --git a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart index 467242e8..3fe1a4ba 100644 --- a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart @@ -84,6 +84,7 @@ class _StepsTrackerState extends State print(res['Med_GetYearStepsTransactionsStsList']); yearlyStepsList.clear(); res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + print('in forEach'); yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); if (element['ValueSum'] != null) { double value = element['ValueSum']; @@ -91,7 +92,7 @@ class _StepsTrackerState extends State dataLength++; } }); - + print("innnnnnnnnnnnnnnnn"); print(avgStepsValue); print(dataLength); setState(() { diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index 782ea018..f3875d1a 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -34,587 +34,675 @@ class _OffersCategorisePageState extends State { builder: (BuildContext context, OffersCategoriseViewModel model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Offers', - isShowAppBar: true, - backgroundColor: Colors.white, - isShowDecPage: false, - baseViewModel: model, - body: Container( - //height: MediaQuery.of(context).size.height * 0.57, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Container( - child: Texts( - 'Categories', - fontWeight: FontWeight.w800, - ), - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - //Expanded widget heree if nassery - Container( - height: MediaQuery.of(context).size.height * 0.20, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categorise.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - InkWell( - child: Column( - children: [ - Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), - ), - child: Icon( - Icons.apps_sharp, - size: 32.0, - ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.2, - height: MediaQuery.of(context) - .size - .height * - 0.09, - child: Center( - child: Texts( - model.categorise[index].name, - fontWeight: FontWeight.w600, - fontSize: 13.8, - ), - ), - ), - ], - ), - onTap: () { - model.getOffersProducts( - i: model.categorise[index].id); - String ids = model.categorise[index].id; - - categoriseName = - model.categorise[index].name; - }), - ], - ), - ); - }), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Texts( - categoriseName, - fontWeight: FontWeight.w800, - ), - ), - Row( + appBarTitle: 'Offers', + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + baseViewModel: model, + body: model.categorise.length != 0 + ? Container( + //height: MediaQuery.of(context).size.height * 0.57, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 0.7, - //width: 0.3, - // indent: 0.0, - ), - ), Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); - }, + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + 'Categories', + fontWeight: FontWeight.w800, + ), ), ), - ], - ), - ], - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - styleOne == true - ? Expanded( - child: Container( - height: MediaQuery.of(context).size.height * 0.50, - child: GridView.builder( - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.85, - ), - itemCount: model.products.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: Card( - color: model.products[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( - height: 250.0, - 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( + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + //Expanded widget heree if nassery + Container( + height: MediaQuery.of(context).size.height * 0.20, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categorise.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + InkWell( + child: Column( children: [ - if (model.products[index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: - BoxDecoration(), - child: Padding( - 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, - ), - ), - transform: new Matrix4 - .rotationZ( - 5.837200), - ), - ), Container( - margin: EdgeInsets.fromLTRB( - 0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model.products[index] - .images.isNotEmpty - ? model - .products[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, + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Icon( + Icons.apps_sharp, + size: 32.0, ), ), Container( - width: model.products[index] - .rxMessage != - null - ? MediaQuery.of(context) + width: + 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.products[index] - .rxMessage != - null - ? model - .products[index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, + .width * + 0.2, + height: + MediaQuery.of(context) + .size + .height * + 0.09, + child: Center( + child: Texts( + model.categorise[index] + .name, + fontWeight: + FontWeight.w600, + fontSize: 13.8, + ), ), ), ], ), - Container( + onTap: () { + model.getOffersProducts( + i: model + .categorise[index].id); + String ids = + model.categorise[index].id; + + categoriseName = model + .categorise[index].name; + }), + ], + ), + ); + }), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts( + categoriseName, + fontWeight: FontWeight.w800, + ), + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 0.7, + //width: 0.3, + // indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Expanded( + child: Container( + height: + MediaQuery.of(context).size.height * + 0.50, + child: GridView.builder( + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.85, + ), + itemCount: model.products.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.products[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: 6, - vertical: 0, + horizontal: 8, + vertical: 4, ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (model.products[index] - .discountName != - null) + child: Container( + height: 250.0, + 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: [ + if (model + .products[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + 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, + ), + ), + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: EdgeInsets + .fromLTRB(0, 16, + 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .products[ + index] + .images + .isNotEmpty + ? model + .products[ + 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 + .products[ + 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 + .products[ + index] + .rxMessage != + null + ? model + .products[ + index] + .rxMessage + : "", + color: + Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ), + ), + ], + ), Container( - width: double.infinity, - height: 22.0, - decoration: - BoxDecoration( - color: - Color(0xff5AB145), + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, ), - child: Center( - child: Texts( - model - .products[index] - .discountName, - regular: true, - color: Colors.white, - fontSize: 12.0, - fontWeight: - FontWeight.w700, - ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .products[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: 22.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .products[ + index] + .discountName, + regular: + true, + color: Colors + .white, + fontSize: + 12.0, + fontWeight: + FontWeight + .w700, + ), + ), + ), + Texts( + model + .products[ + index] + .name, + regular: true, + fontSize: 12.58, + fontWeight: + FontWeight + .w600, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model.products[index].approvedRatingSum > + 0 + ? (model.products[index].approvedRatingSum.toDouble() / model.products[index].approvedRatingSum.toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), ), - Texts( - model - .products[index].name, - regular: true, - fontSize: 12.58, - fontWeight: - FontWeight.w600, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.products[index].price}", - bold: true, - fontSize: 14, + ], + ), + ), + )); + }, + ), + ), + ) + : Expanded( + child: Container( + child: ListView.builder( + itemCount: model.products.length, + itemBuilder: (BuildContext context, + int index) { + return Card( + // color: + // model.products[index].discountName != + // null + // ? Color(0xffFFFF00) + // : Colors.white, + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + if (model + .products[ + index] + .discountName != + null) + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: 10.0, + ), + child: + Container( + color: Colors + .yellow, + height: 25.0, + width: 70.0, + child: Center( + child: + Texts( + 'offer' + .toUpperCase(), + color: Colors + .red, + fontSize: + 13.0, + fontWeight: + FontWeight + .w900, + ), + ), + ), + ), + transform: new Matrix4 + .rotationZ( + 6.15099), + ), + Container( + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .products[ + index] + .images + .isNotEmpty + ? model + .products[ + 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, + ), + ), + ], ), - ), - Row( - children: [ - StarRating( - totalAverage: model + Column( + children: [ + Container( + width: model .products[ index] - .approvedRatingSum > - 0 - ? (model.products[index].approvedRatingSum - .toDouble() / - model - .products[index] - .approvedRatingSum - .toDouble()) - .toDouble() + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 : 0, - forceStars: true), - Texts( - "(${model.products[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - ], - ), - ), - )); - }, - ), - ), - ) - : Expanded( - child: Container( - child: ListView.builder( - itemCount: model.products.length, - itemBuilder: - (BuildContext context, int index) { - return Card( - // color: - // model.products[index].discountName != - // null - // ? Color(0xffFFFF00) - // : Colors.white, - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - if (model.products[index] - .discountName != - null) - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), - child: Container( - color: Colors.yellow, - height: 25.0, - width: 70.0, - child: Center( + padding: + EdgeInsets.all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), child: Texts( - 'offer' - .toUpperCase(), - color: Colors.red, - fontSize: 13.0, + model + .products[ + index] + .rxMessage != + null + ? model + .products[ + index] + .rxMessage + : "", + color: + Colors.white, + regular: true, + fontSize: 10, fontWeight: FontWeight - .w900, + .w400, ), ), - ), + ], ), - transform: - new Matrix4.rotationZ( - 6.15099), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 0, 0, 0), - alignment: Alignment.center, - child: Image.network( - model.products[index] - .images.isNotEmpty - ? model - .products[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, - ), + ], ), - ], - ), - Column( - children: [ Container( - width: model.products[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)), + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - child: Texts( - model.products[index] - .rxMessage != - null - ? model - .products[index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .products[index] + .discountName != + null) + Container( + width: 250.0, + height: 22.5, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Padding( + padding: EdgeInsets + .symmetric( + horizontal: 5.5, + ), + child: Texts( + model + .products[ + index] + .discountName, + regular: true, + color: Colors + .white, + fontSize: 12.0, + fontWeight: + FontWeight + .w700, + ), + ), + ), + SizedBox( + height: 4.0, + ), + Texts( + model.products[index] + .name, + regular: true, + fontSize: 14.0, + fontWeight: + FontWeight.w600, + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.products[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .products[ + index] + .approvedRatingSum > + 0 + ? (model.products[index].approvedRatingSum.toDouble() / + model.products[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.products[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w500, + ) + ], + ), + ], ), ), ], ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - if (model.products[index] - .discountName != - null) - Container( - width: 250.0, - height: 22.5, - decoration: BoxDecoration( - color: Color(0xff5AB145), - ), - child: Padding( - padding: - EdgeInsets.symmetric( - horizontal: 5.5, - ), - child: Texts( - model.products[index] - .discountName, - regular: true, - color: Colors.white, - fontSize: 12.0, - fontWeight: - FontWeight.w700, - ), - ), - ), - SizedBox( - height: 4.0, - ), - Texts( - model.products[index].name, - regular: true, - fontSize: 14.0, - fontWeight: FontWeight.w600, - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.products[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .products[ - index] - .approvedRatingSum > - 0 - ? (model - .products[ - index] - .approvedRatingSum - .toDouble() / - model - .products[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.products[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w500, - ) - ], - ), - ], - ), - ), - ], - ), - ); - }), - ), - ) - ], - ), - ), - )); + ); + }), + ), + ) + ], + ), + ) + : Center( + child: Texts( + "SORRY , there's no listed offers now :(", + color: Colors.green, + )))); } } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 414106b1..46df3df7 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,24 +1,25 @@ import 'package:diplomaticquarterapp/config/size_config.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/pages/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.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/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'; -import 'package:giffy_dialog/giffy_dialog.dart'; import 'base/base_view.dart'; -import 'final_products_page.dart'; class ParentCategorisePage extends StatefulWidget { String id; String titleName; + ParentCategorisePage({this.id, this.titleName}); + @override _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); @@ -27,7 +28,9 @@ class ParentCategorisePage extends StatefulWidget { class _ParentCategorisePageState extends State { String id; String titleName; + _ParentCategorisePageState({this.id, this.titleName}); + Map values = {'huusam': false, 'ali': false, 'noor': false}; bool checkedBrands = false; bool checkedCategorise = false; @@ -39,6 +42,7 @@ class _ParentCategorisePageState extends State { color: Colors.blue, size: 29.0, ); + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -111,10 +115,10 @@ class _ParentCategorisePageState 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( @@ -130,7 +134,7 @@ class _ParentCategorisePageState extends State { child: Padding( padding: EdgeInsets.all( - 8.0), + 4.0), child: InkWell( child: Column( crossAxisAlignment: @@ -152,14 +156,20 @@ class _ParentCategorisePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: - (context) => - SubCategorisePage( - title: model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: id, - )), + FadePage( + page: + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, + parentId: + id, + )), ); }, ), @@ -229,10 +239,10 @@ class _ParentCategorisePageState extends State { .size .width * 0.197, - height: MediaQuery.of(context) - .size - .height * - 0.08, + // height: MediaQuery.of(context) + // .size + // .height * + // 0.08, child: Center( child: Texts( projectViewModel.isArabic @@ -255,19 +265,15 @@ class _ParentCategorisePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - SubCategorisePage( - title: model - .categoriseParent[ - index] - .name, - id: model - .categoriseParent[ - index] - .id, - parentId: id, - )), + FadePage( + page: SubCategorisePage( + title: model + .categoriseParent[index] + .name, + id: model + .categoriseParent[index].id, + parentId: id, + )), ); print(id); }, @@ -646,246 +652,260 @@ class _ParentCategorisePageState extends State { (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, - child: Card( - color: model.parentProducts[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, + child: InkWell( + child: Card( + color: model.parentProducts[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, + ), ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: - Radius.circular(110.0), + child: Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(110.0), + ), + color: Colors.white, ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Stack( - children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: - BoxDecoration(), - child: Padding( - 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, + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + 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, + ), ), + transform: new Matrix4 + .rotationZ( + 5.837200), ), - transform: new Matrix4 - .rotationZ( - 5.837200), ), - ), - Container( - margin: - EdgeInsets.fromLTRB( - 0, 16, 0, 0), - alignment: - Alignment.center, - child: Image.network( - 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 + Container( + margin: EdgeInsets + .fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model .parentProducts[ 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)), + .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, + ), ), - child: Texts( - model + Container( + width: model .parentProducts[ index] .rxMessage != null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, + ? 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 + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + 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: [ - if (model + Container( + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: Center( + child: Texts( + model + .parentProducts[ + index] + .discountName, + regular: true, + color: Colors + .white, + fontSize: + 10.4, + ), + ), + ), + Texts( + model .parentProducts[ index] - .discountName != - null) - Container( - width: - double.infinity, - height: 13.0, - decoration: - BoxDecoration( - color: Color( - 0xff5AB145), - ), - child: Center( - child: Texts( - model - .parentProducts[ - index] - .discountName, - regular: true, - color: Colors - .white, - fontSize: 10.4, - ), + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w700, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, ), ), - Texts( - model - .parentProducts[ - index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w700, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, + Row( + children: [ + StarRating( + 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, + ) + ], ), - ), - Row( - children: [ - StarRating( - 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, - ) - ], - ), - ], + ], + ), ), - ), - ], + ], + ), ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, )); }, ), @@ -898,168 +918,191 @@ class _ParentCategorisePageState extends State { itemCount: model.parentProducts.length, itemBuilder: (BuildContext context, int index) { - return 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, + 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 - .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, - ), - ), - ], - ), - Column( - children: [ - Container( - width: model + Container( + margin: EdgeInsets + .fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model .parentProducts[ 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)), + .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, + ), ), - child: Texts( - model + ], + ), + Column( + children: [ + Container( + width: model .parentProducts[ index] .rxMessage != null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Expanded( + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: + Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ), + ), + ), + ], + ), + ], + ), + Container( + 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 + .parentProducts[ + index] + .name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight.w400, + FontWeight.w500, + maxLines: 5, ), ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + 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, + ) + ], + ), ], ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Texts( - model - .parentProducts[index] - .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.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - 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, - ) - ], - ), - ], - ), - ), - ], + ], + ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage(model + .parentProducts[index]), + )), + }, ); }), ) diff --git a/lib/pages/pharmacies/medicine_search_screen.dart b/lib/pages/pharmacies/medicine_search_screen.dart index 7a61dabe..5c31f2de 100644 --- a/lib/pages/pharmacies/medicine_search_screen.dart +++ b/lib/pages/pharmacies/medicine_search_screen.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.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/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart'; @@ -121,8 +122,8 @@ class MedicineSearch extends StatelessWidget { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => PharmaciesList( + FadePage( + page: PharmaciesList( medicineID: model.pharmacy[index].itemID, imageURL: model diff --git a/lib/pages/pharmacies/product-brands.dart b/lib/pages/pharmacies/product-brands.dart index b9e6db95..6dbfde46 100644 --- a/lib/pages/pharmacies/product-brands.dart +++ b/lib/pages/pharmacies/product-brands.dart @@ -1,14 +1,12 @@ -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/pages/login/register-info.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/search_brands_page.dart'; -import 'package:diplomaticquarterapp/pages/search_products_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; class ProductBrandsPage extends StatefulWidget { @override @@ -16,8 +14,8 @@ class ProductBrandsPage extends StatefulWidget { } var languageID; -class _ProductBrandsPageState extends State { +class _ProductBrandsPageState extends State { @override void initState() { super.initState(); @@ -38,18 +36,11 @@ class _ProductBrandsPageState extends State { children: [ Container( color: Colors.white, - alignment: languageID == 'ar'? - Alignment.topRight : - Alignment.topLeft, - padding: languageID == 'ar' ? - EdgeInsets.only( - right: 10.0, - top: 10.0 - ): - EdgeInsets.only( - left: 10.0, - top: 10.0 - ), + alignment: + languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + padding: languageID == 'ar' + ? EdgeInsets.only(right: 10.0, top: 10.0) + : EdgeInsets.only(left: 10.0, top: 10.0), child: Text( TranslationBase.of(context).topBrands, style: TextStyle( @@ -93,8 +84,7 @@ class _ProductBrandsPageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => SearchBrandsPage()), + FadePage(page: SearchBrandsPage()), ); }, ), @@ -116,7 +106,9 @@ class _ProductBrandsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - languageID == 'ar' ? Text(model.brandsListList[index].namen):Text(model.brandsListList[index].name), + languageID == 'ar' + ? Text(model.brandsListList[index].namen) + : Text(model.brandsListList[index].name), SizedBox( height: 3, ), @@ -124,7 +116,7 @@ class _ProductBrandsPageState extends State { ], ), ), - onTap: (){ + onTap: () { print("ENAD"); }, ); @@ -138,7 +130,6 @@ class _ProductBrandsPageState extends State { } } - topBrand() { return BaseView( onModelReady: (model) => model.getTopBrandsData(), @@ -156,30 +147,32 @@ topBrand() { child: Container( // padding: EdgeInsets.only(left: 5), child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10.0, vertical: 10.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border( - top: BorderSide(width: 1.0, color: Colors.grey), - left: BorderSide(width: 1.0, color: Colors.grey), - right: BorderSide(width: 1.0, color: Colors.grey), - bottom: BorderSide(width: 1.0, color: Colors.grey), + padding: EdgeInsets.symmetric( + horizontal: 10.0, vertical: 10.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide(width: 1.0, color: Colors.grey), + left: BorderSide(width: 1.0, color: Colors.grey), + right: BorderSide(width: 1.0, color: Colors.grey), + bottom: + BorderSide(width: 1.0, color: Colors.grey), + ), + color: Colors.white, ), - color: Colors.white, - ), - child: model.topBrandsListList[index].image != null ?Image.network( - model.topBrandsListList[index].image.src, - fit: BoxFit.cover, - width: 60, - height: 40, - ): Text(model.topBrandsListList[index].name) - ), + child: model.topBrandsListList[index].image != null + ? Image.network( + model.topBrandsListList[index].image.src, + fit: BoxFit.cover, + width: 60, + height: 40, + ) + : Text(model.topBrandsListList[index].name)), ), ), ), ), - onTap: (){ + onTap: () { print("ENAD"); }, ), diff --git a/lib/pages/pharmacies/product_detail.dart b/lib/pages/pharmacies/product_detail.dart index 6cd3a7d1..7df95d5b 100644 --- a/lib/pages/pharmacies/product_detail.dart +++ b/lib/pages/pharmacies/product_detail.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/widgets/others/app_scafold_detail_page.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -80,12 +81,18 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product.discountDescriptionn, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ) : Text( - widget.product.discountDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ), ), ), @@ -96,7 +103,8 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage('assets/images/offer.png'), + image: AssetImage( + 'assets/images/offer.png'), ), ), ), @@ -174,7 +182,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -202,7 +212,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -230,7 +242,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -258,7 +272,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -266,8 +283,13 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.shortDescriptionn : widget.product.shortDescription ?? "", - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.shortDescriptionn + : widget.product.shortDescription ?? + "", + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), SizedBox( @@ -276,7 +298,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).howToUse, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -284,8 +309,12 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), ], @@ -293,98 +322,162 @@ class __ProductDetailPageState extends State { ) : 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, - ), - ), - ], + 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), + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + 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: 50, - ), - Divider(height: 1, color: Colors.grey), - ], + ], + ), ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + 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('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => model.getProductLocationData(), - builder: (_, model, wi) => model.productLocationService.length == 0 + onModelReady: (model) => + model.getProductLocationData(), + builder: (_, model, wi) => model + .productLocationService + .length == + 0 ? Container( padding: EdgeInsets.all(15), alignment: Alignment.center, - child: Text('No location Available'), + child: Text( + 'No location Available'), ) : ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, - itemCount: model.productLocationService.length, - itemBuilder: (BuildContext context, int index) { + itemCount: model + .productLocationService + .length, + itemBuilder: + (BuildContext context, + int index) { return Padding( - padding: EdgeInsets.all(8.0), + padding: + EdgeInsets.all(8.0), child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start, children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment + .start, children: [ Expanded( flex: 1, - child: Image.network(model.productLocationService[index].projectImageUrl), + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), ), SizedBox( width: 10, @@ -392,31 +485,48 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model.productLocationService[index].locationDescription + + model + .productLocationService[ + index] + .locationDescription + "\n" + - fixingString(model.productLocationService[0].cityName.toString()), - style: TextStyle(fontSize: 12), + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: + 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, + icon: Icon(Icons + .location_on), + color: + Colors.red, + onPressed: + () {}, ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + icon: Icon(Icons + .phone), + color: + Colors.red, + onPressed: + () {}, ), ), ], ), - Divider(height: 1.2, color: Colors.grey) + Divider( + height: 1.2, + color: Colors.grey) ], ), ); @@ -431,8 +541,12 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), ) : AppScaffold( appBarTitle: 'product detail page', @@ -465,12 +579,18 @@ class __ProductDetailPageState extends State { alignment: Alignment.centerRight, child: languageID == 'ar' ? Text( - widget.product.discountDescriptionn, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescriptionn, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ) : Text( - widget.product.discountDescription, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 17), + widget.product + .discountDescription, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 17), ), ), ), @@ -481,7 +601,8 @@ class __ProductDetailPageState extends State { flex: 0, child: Container( child: Image( - image: AssetImage('assets/images/offer.png'), + image: AssetImage( + 'assets/images/offer.png'), ), ), ), @@ -551,7 +672,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -579,7 +702,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -607,7 +732,9 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).availability, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold), ), color: Colors.white, ), @@ -635,7 +762,10 @@ class __ProductDetailPageState extends State { Container( child: Text( TranslationBase.of(context).description, - style: TextStyle(fontSize: 17, color: Colors.grey, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), ), ), SizedBox( @@ -643,8 +773,12 @@ class __ProductDetailPageState extends State { ), Container( child: Text( - languageID == 'ar' ? widget.product.fullDescriptionn : widget.product.fullDescription, - style: TextStyle(fontSize: 16, fontFamily: 'WorkSans-Regular'), + languageID == 'ar' + ? widget.product.fullDescriptionn + : widget.product.fullDescription, + style: TextStyle( + fontSize: 16, + fontFamily: 'WorkSans-Regular'), ), ), ], @@ -652,79 +786,132 @@ class __ProductDetailPageState extends State { ) : 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, - ), - ), - ], + 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), + ), ), - ), - SizedBox( - height: 10, - ), - Container( - child: Text( - model.productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + 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: 50, - ), - Divider(height: 1, color: Colors.grey), - ], + ], + ), ), - ); - }, - ) - : Container( - padding: EdgeInsets.all(15), - alignment: Alignment.center, - child: Text('No Reviews Available'), - ), + 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('No Reviews Available'), + ), ) : isAvailabilty ? BaseView( - onModelReady: (model) => model.getProductLocationData(), - builder: (_, model, wi) => ListView.builder( + 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) { + itemCount: model + .productLocationService.length, + itemBuilder: (BuildContext context, + int index) { return Padding( padding: EdgeInsets.all(8.0), child: Column( @@ -733,11 +920,15 @@ class __ProductDetailPageState extends State { children: [ Row( // crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ Expanded( flex: 1, - child: Image.network(model.productLocationService[index].projectImageUrl), + child: Image.network(model + .productLocationService[ + index] + .projectImageUrl), ), SizedBox( width: 10, @@ -745,16 +936,25 @@ class __ProductDetailPageState extends State { Expanded( flex: 4, child: Text( - model.productLocationService[index].locationDescription + + model + .productLocationService[ + index] + .locationDescription + "\n" + - fixingString(model.productLocationService[0].cityName.toString()), - style: TextStyle(fontSize: 12), + fixingString(model + .productLocationService[ + 0] + .cityName + .toString()), + style: TextStyle( + fontSize: 12), ), ), Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.location_on), + icon: Icon(Icons + .location_on), color: Colors.red, onPressed: () {}, ), @@ -762,14 +962,17 @@ class __ProductDetailPageState extends State { Expanded( flex: 1, child: IconButton( - icon: Icon(Icons.phone), + icon: + Icon(Icons.phone), color: Colors.red, onPressed: () {}, ), ), ], ), - Divider(height: 1.2, color: Colors.grey) + Divider( + height: 1.2, + color: Colors.grey) ], ), ); @@ -784,8 +987,12 @@ class __ProductDetailPageState extends State { ], ), ), - bottomSheet: footerWidget(widget.product.stockAvailability != 'Out of stock', widget.product.orderMaximumQuantity, - widget.product.orderMinimumQuantity, widget.product.stockQuantity, widget.product), + bottomSheet: footerWidget( + widget.product.stockAvailability != 'Out of stock', + widget.product.orderMaximumQuantity, + widget.product.orderMinimumQuantity, + widget.product.stockQuantity, + widget.product), ); } } @@ -796,7 +1003,8 @@ class footerWidget extends StatefulWidget { final int minQuantity; final int quantityLimit; final PharmacyProduct item; - footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item); + footerWidget(this.isAvailble, this.maxQuantity, this.minQuantity, + this.quantityLimit, this.item); @override _footerWidgetState createState() => _footerWidgetState(); } @@ -826,7 +1034,8 @@ class _footerWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( TranslationBase.of(context).quantity, - style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 15, fontWeight: FontWeight.bold), ), ), // ListView( @@ -848,7 +1057,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '1', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -873,7 +1084,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '2', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -898,7 +1111,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '3', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -923,7 +1138,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '4', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -948,7 +1165,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '5', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -973,7 +1192,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '6', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -998,7 +1219,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '7', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1023,7 +1246,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '8', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1048,7 +1273,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '9', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1073,7 +1300,9 @@ class _footerWidgetState extends State { color: Colors.white, child: Text( '10', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20), ), ), onTap: () { @@ -1094,7 +1323,8 @@ class _footerWidgetState extends State { Container( width: 50.0, child: TextField( - decoration: InputDecoration(labelText: 'quantity #'), + decoration: + InputDecoration(labelText: 'quantity #'), onChanged: (text) { print(price); print(widget.quantityLimit); @@ -1173,7 +1403,10 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ) @@ -1188,7 +1421,10 @@ class _footerWidgetState extends State { color: Colors.green, child: Text( TranslationBase.of(context).addToCart, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ), @@ -1204,7 +1440,10 @@ class _footerWidgetState extends State { alignment: Alignment.center, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ) @@ -1214,7 +1453,8 @@ class _footerWidgetState extends State { addToCartFunction(price, widget.item.id); Navigator.push( context, - MaterialPageRoute(builder: (context) => CartOrderPage()), + FadePage(page: + CartOrderPage()), ); }, child: Container( @@ -1224,7 +1464,10 @@ class _footerWidgetState extends State { color: Colors.blue, child: Text( TranslationBase.of(context).buyNow, - style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 15), + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 15), ), ), ), @@ -1265,12 +1508,15 @@ class _productNameAndPriceState extends State { widget.item.stockAvailability, style: widget.item.stockAvailability == 'Out of stock' ? TextStyle(fontWeight: FontWeight.bold, color: Colors.red) - : TextStyle(fontWeight: FontWeight.bold, color: Colors.green), + : TextStyle( + fontWeight: FontWeight.bold, color: Colors.green), ), SizedBox(width: 20), - widget.item.stockAvailability == 'Out of stock' && customerId != null + widget.item.stockAvailability == 'Out of stock' && + customerId != null ? InkWell( - onTap: () => notifyMeWhenAvailable(context, widget.item.id), + onTap: () => + notifyMeWhenAvailable(context, widget.item.id), child: Row(children: [ Text( TranslationBase.of(context).notifyMe, @@ -1288,7 +1534,9 @@ class _productNameAndPriceState extends State { ]), ) : Container( - margin: languageID == 'ar' ? EdgeInsets.only(right: 25) : EdgeInsets.only(left: 25), + margin: languageID == 'ar' + ? EdgeInsets.only(right: 25) + : EdgeInsets.only(left: 25), width: 40, height: 40, decoration: BoxDecoration( @@ -1324,9 +1572,12 @@ class _productNameAndPriceState extends State { child: Container( margin: EdgeInsets.only(left: 5), child: Align( - alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, + alignment: + languageID == 'ar' ? Alignment.topRight : Alignment.topLeft, child: Text( - languageID == 'ar' ? widget.item.fullDescriptionn : widget.item.fullDescription, + languageID == 'ar' + ? widget.item.fullDescriptionn + : widget.item.fullDescription, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), ), ), @@ -1358,7 +1609,9 @@ class _productNameAndPriceState extends State { child: Container( child: widget.item.rxMessage != null ? Text( - languageID == 'ar' ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), + languageID == 'ar' + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), style: TextStyle(color: Colors.red, fontSize: 10), ) : Container()), @@ -1524,7 +1777,9 @@ slideDetail() { ), color: Colors.white, ), - child: const Text('1', textAlign: TextAlign.center, style: TextStyle(color: Color(0xFF000000))), + child: const Text('1', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF000000))), ), ) ], @@ -1606,7 +1861,13 @@ settingModalBottomSheet(context) { leading: new Icon(Icons.shopping_cart), title: new Text('Add to cart'), onTap: () => { - if (price > 0) {addToCartFunction(price, itemID)} else {AppToast.showErrorToast(message: "you should add quantity")} + if (price > 0) + {addToCartFunction(price, itemID)} + else + { + AppToast.showErrorToast( + message: "you should add quantity") + } }), new ListTile( leading: new Icon(Icons.favorite_border), @@ -1617,7 +1878,8 @@ settingModalBottomSheet(context) { leading: new Icon(Icons.compare), title: new Text('Compare'), onTap: () => { - Provider.of(context, listen: false).addItem(specificationData), + Provider.of(context, listen: false) + .addItem(specificationData), }, ), ], diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart index 6926f9f4..cca6c1df 100644 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-order-page.dart @@ -27,7 +27,7 @@ class CartOrderPage extends StatelessWidget { value: model.cartResponse, child: AppScaffold( appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: false, + isShowAppBar: true, isPharmacy: true, baseViewModel: model, backgroundColor: Colors.white, diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart index 9d819c1c..e0c062fa 100644 --- a/lib/pages/pharmacies/screens/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-order-preview.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-sel import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_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/others/app_scaffold_widget.dart'; @@ -25,9 +26,7 @@ class OrderPreviewPage extends StatelessWidget { @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); - final height = mediaQuery.size.height - - 60 - - mediaQuery.padding.top; + final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; return BaseView( onModelReady: (model) => model.getShoppingCart(), @@ -781,23 +780,16 @@ class PaymentBottomWidget extends StatelessWidget { ), onPressed: (paymentData.address != null && paymentData.paymentOption != null) - ? () => { - model.makeOrder().then((_) { - if (model.state != ViewState.Idle) { - SnackBar snackBar = SnackBar( - content: Text( - 'Order has been placed successfully!!')); - scaffold.showSnackBar(snackBar); - } - - // Navigator.pushAndRemoveUntil( - // context, - // MaterialPageRoute( - // builder: (context) => - // PharmacyPage()), - // (Route r) => false); - }) + ? () async { + await model.makeOrder(); + if (model.state != ViewState.Idle) { + AppToast.showSuccessToast(message: "Order has been placed successfully!!"); + } else { + AppToast.showErrorToast(message: model.error); } + Navigator.pop(context); + Navigator.pop(context); + } : null, child: Padding( padding: const EdgeInsets.symmetric(vertical: 16), diff --git a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart index fc1270c0..9e281694 100644 --- a/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart +++ b/lib/pages/pharmacies/screens/lacum-activitaion-vida-page.dart @@ -20,8 +20,9 @@ class LakumActivationVidaPage extends StatelessWidget { return BaseView( builder: (_, model, wi) => AppScaffold( - title: "Acount Activation", + appBarTitle: TranslationBase.of(context).accountActivation, isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, backgroundColor: Colors.white, baseViewModel: model, @@ -35,7 +36,7 @@ class LakumActivationVidaPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Texts( - " This service allows you to activate your LAKUM account after registering through the Vida system. ", + TranslationBase.of(context).accountActivationDesc, fontSize: 14, ), Padding( @@ -43,8 +44,10 @@ class LakumActivationVidaPage extends StatelessWidget { child: TextField( controller: _identificationNumberController, decoration: new InputDecoration( - hintText: 'Enter Identification Number', + hintText: TranslationBase.of(context) + .enterIdentificationNumber, ), + keyboardType: TextInputType.number, style: TextStyle( fontSize: 16, color: Colors.grey.shade700, @@ -89,7 +92,7 @@ class LakumActivationVidaPage extends StatelessWidget { } }); } - : null, + : () {}, ), ), ], diff --git a/lib/pages/pharmacies/screens/lacum-setting-page.dart b/lib/pages/pharmacies/screens/lacum-setting-page.dart index 861279f3..4f7f5fd6 100644 --- a/lib/pages/pharmacies/screens/lacum-setting-page.dart +++ b/lib/pages/pharmacies/screens/lacum-setting-page.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/lacum-viewmodel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/lacum-banner-widget.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/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -44,6 +47,7 @@ class _LakumSettingPageState extends State { appBarTitle: "${TranslationBase.of(context).lakum}", isShowAppBar: true, isShowDecPage: false, + isPharmacy: true, backgroundColor: Colors.white, baseViewModel: model, body: Container( @@ -220,13 +224,18 @@ class _LakumSettingPageState extends State { hPadding: 8, vPadding: 12, handler: canUpdate - ? () { - model.createLakumAccount(_nameController.text, _phoneController.text).then((status) => { - if (status == 200) {Navigator.pop(context, "")} - // back to previous page - }); + ? () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.createLakumAccount(_nameController.text, _phoneController.text); + GifLoaderDialogUtils.hideDialog(context); + if(model.state == ViewState.Idle){ + AppToast.showSuccessToast(message: model.successMsg); + Navigator.pop(context, ""); + } else if(model.state == ViewState.ErrorLocal){ + AppToast.showErrorToast(message: model.error); + } } - : null, + : (){}, ), ) ], diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart index 9103b646..f05c6da4 100644 --- a/lib/pages/pharmacies/screens/lacum-transfer-page.dart +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -37,8 +37,9 @@ class _LacumTransferPageState extends State { onModelReady: (model) => model.setLakumData( widget.lacumInformation, widget.lacumGroupInformation), builder: (_, model, wi) => AppScaffold( - appBarTitle: "${TranslationBase.of(context).lakum}", + appBarTitle: "${TranslationBase.of(context).lakumTransfer}", isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, backgroundColor: Colors.white, baseViewModel: model, @@ -83,7 +84,7 @@ class _LacumTransferPageState extends State { children: [ Container( child: Texts( - "Point Balance", + "${TranslationBase.of(context).point} ${TranslationBase.of(context).balance}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, @@ -143,7 +144,7 @@ class _LacumTransferPageState extends State { children: [ Container( child: Texts( - "Riyal Balance", + "${TranslationBase.of(context).riyal} ${TranslationBase.of(context).balance}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, @@ -182,7 +183,7 @@ class _LacumTransferPageState extends State { child: TextField( controller: _beneficieryAccountController, decoration: new InputDecoration( - hintText: 'Enter Beneficiary Account No.', + hintText: TranslationBase.of(context).enterBeneficiaryAccountNo, ), style: TextStyle( fontSize: 16, @@ -209,7 +210,7 @@ class _LacumTransferPageState extends State { _beneficieryAccountController .text); } - : null, + : (){}, ), ), (model.lacumReceiverInformation != null && @@ -250,7 +251,7 @@ class _LacumTransferPageState extends State { width: double.infinity, ), Texts( - "Point's to Transfer :", + TranslationBase.of(context).pointsToTransfer, color: Colors.black, ), Padding( @@ -284,7 +285,7 @@ class _LacumTransferPageState extends State { Container( margin: EdgeInsets.all(8), child: BorderedButton( - "LACUM TRANSFER", + TranslationBase.of(context).lakumTransfer, backgroundColor: Color(0xff339933), textColor: Colors.white, fontSize: 18, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index adbb07c2..fdf3cc78 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -22,7 +22,7 @@ class LakumMainPage extends StatelessWidget { return BaseView( onModelReady: (model) => model.getLacumData(), builder: (_, model, wi) => AppScaffold( - title: "Lakum", + appBarTitle: TranslationBase.of(context).lakum, isShowAppBar: true, isPharmacy: true, isShowDecPage: false, @@ -346,7 +346,7 @@ class LakumHomeButtons extends StatelessWidget { child: Container( padding: EdgeInsets.symmetric(horizontal: 16), child: Texts( - "Account Activation", + TranslationBase.of(context).accountActivation, fontSize: 14, fontWeight: FontWeight.bold, ), @@ -394,7 +394,7 @@ class LakumHomeButtons extends StatelessWidget { child: Container( padding: EdgeInsets.symmetric(horizontal: 16), child: Texts( - "Lakum Transfer", + TranslationBase.of(context).lakumTransfer, fontSize: 14, fontWeight: FontWeight.bold, ), diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index b41c1804..394b516b 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.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'; @@ -16,13 +16,10 @@ 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 'package:flutter_svg/svg.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import '../../final_products_page.dart'; import 'lacum-activitaion-vida-page.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; -import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; class PharmacyPage extends StatelessWidget { @override @@ -48,8 +45,8 @@ class PharmacyPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - BannerPager(model), - // GridViewButtons(model), + BannerPager(model), + GridViewButtons(model), Container( margin: EdgeInsets.fromLTRB(10, 10, 10, 10), child: Row( @@ -68,190 +65,199 @@ class PharmacyPage extends StatelessWidget { hPadding: 4, handler: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - HomePrescriptionsPage())); + context, FadePage(page: HomePrescriptionsPage())); }, ), ], ), ), - Container( - padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), + padding: + EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), height: MediaQuery.of(context).size.height * 0.30, // 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 + 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: 4, - itemCount: model.prescriptionsList.length, - itemBuilder: (context, index) { - return Container( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: NeverScrollableScrollPhysics(), + // itemCount: 4, + itemCount: model.prescriptionsList.length, + itemBuilder: (context, index) { + return Container( // width: 160.0, - height: MediaQuery.of(context).size.height * 0.6, - padding: EdgeInsets.only(bottom: 5.0, left: 5.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( + height: + MediaQuery.of(context).size.height * 0.6, + padding: + EdgeInsets.only(bottom: 5.0, left: 5.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: [ - Column(children: [ - Container( - 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), + Row( + children: [ + Column(children: [ + Container( padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, + 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( + 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( + model.prescriptionsList[index] + .appointmentDate + .toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, +// fontWeight: FontWeight.bold, ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( model.prescriptionsList[index] - .isInOutPatientDescription + .doctorTitle .toString(), style: TextStyle( - color: Colors.white, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, + fontWeight: FontWeight.bold, ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( + ), + 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] - .appointmentDate + .clinicDescription .toString(), style: TextStyle( - color: Colors.black, + color: Colors.green, fontSize: 15.0, -// fontWeight: FontWeight.bold, +// 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( + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( // 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(), - ), + 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), @@ -283,9 +289,8 @@ class PharmacyPage extends StatelessWidget { itemCount: model.bestSellerProduct.length, ), ), - Container( - margin: EdgeInsets.fromLTRB(10, 0, 10, 0), + margin: EdgeInsets.fromLTRB(10, 10, 10, 0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -333,7 +338,17 @@ class PharmacyPage extends StatelessWidget { hPadding: 4, borderColor: Colors.green, textColor: Colors.green, - handler: () {}, + handler: () { + Navigator.push( + context, + FadePage( + page: FinalProductsPage( + id: "", + productType: 3, + ), + ), + ); + }, ), ], ), @@ -367,7 +382,14 @@ class PharmacyPage extends StatelessWidget { hPadding: 4, handler: () => { Navigator.push( - context, FadePage(page: ProductBrandsPage())), + context, + FadePage( + page: FinalProductsPage( + id: "", + productType: 4, + ), + ), + ), }, ), ], diff --git a/lib/pages/pharmacies/widgets/manufacturerItem.dart b/lib/pages/pharmacies/widgets/manufacturerItem.dart index 7ffa3d89..574c37c5 100644 --- a/lib/pages/pharmacies/widgets/manufacturerItem.dart +++ b/lib/pages/pharmacies/widgets/manufacturerItem.dart @@ -1,6 +1,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import '../../final_products_page.dart'; + class ManufacturerItem extends StatelessWidget { final Manufacturer item; @@ -8,25 +11,38 @@ class ManufacturerItem extends StatelessWidget { @override Widget build(BuildContext context) { - return Card( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), - margin: EdgeInsets.symmetric( - horizontal: 8, - 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)), + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FinalProductsPage( + id: item.id, + productType: 2, + ), + ), + ); + }, + child: Card( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 8), - child: Image.network( - item.image.src, - fit: BoxFit.cover, + 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, + ), ), ), ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 4ef14389..6488b421 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -1,21 +1,17 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; dynamic languageID; -class OrderPage extends StatefulWidget { +class OrderPage extends StatefulWidget { // orderList({this.customerId, this.pageId}); String customerID; @@ -26,19 +22,22 @@ class OrderPage extends StatefulWidget { _OrderPageState createState() => _OrderPageState(); } -class _OrderPageState extends State with SingleTickerProviderStateMixin{ - - String pageID= "1"; +class _OrderPageState extends State + with SingleTickerProviderStateMixin { + String pageID = "1"; String customerId = ""; - String order =""; + String order = ""; - List orderList = [] ; - List deliveredOrderList = [] ; - List processingOrderList = []; - List cancelledOrderList = []; - List pendingOrderList = []; + List orderList = []; + + List deliveredOrderList = []; + + List processingOrderList = []; + List cancelledOrderList = []; + List pendingOrderList = []; TabController _tabController; + // AppSharedPreferences sharedPref = AppSharedPreferences(); getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); @@ -49,28 +48,29 @@ class _OrderPageState extends State with SingleTickerProviderStateMix getLanguageID(); super.initState(); - - _tabController = new TabController(length: 4, vsync: this,); + _tabController = new TabController( + length: 4, + vsync: this, + ); } @override Widget build(BuildContext context) { - print( "customerID" + widget.customerID); + print("customerID" + widget.customerID); return BaseView( onModelReady: (model) => model.getOrder(widget.customerID, pageID), - builder: (_,model, wi )=> AppScaffold( - appBarTitle:TranslationBase.of(context).order, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).order, baseViewModel: model, - isShowAppBar: true, - isPharmacy:true , + isShowAppBar: true, + isPharmacy: true, body: Container( child: Column( children: [ TabBar( - labelPadding: - EdgeInsets.only(left: 3.0, right: 3.0), + labelPadding: EdgeInsets.only(left: 3.0, right: 3.0), tabs: [ - Tab(text: TranslationBase.of(context).delivered), + Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).processing), Tab(text: TranslationBase.of(context).pending), Tab(text: TranslationBase.of(context).cancelled), @@ -103,226 +103,277 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ); } - - - Widget getDeliveredOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.orders.length; i++){ - if( model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 - || model.orders[i].orderStatusId == 994 - ){ + Widget getDeliveredOrder(OrderModelViewModel model) { + for (int i = 0; i < model.orders.length; i++) { + if (model.orders[i].orderStatusId == 30 || + model.orders[i].orderStatusId == 997 || + model.orders[i].orderStatusId == 994) { deliveredOrderList.add(model.orders[i]); } } return Container( width: MediaQuery.of(context).size.width, child: model.orders.length != 0 - ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: deliveredOrderList.length, - itemBuilder: (context, index){ - return Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderNumber, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), - ), - ), - Container( - child: Text(deliveredOrderList[index].id.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: deliveredOrderList.length, + itemBuilder: (context, index) { + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text( + deliveredOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderDate, - style: TextStyle(fontSize: 14.0, - ), + SizedBox( + height: 5, ), - ), - Container( - child: Text(deliveredOrderList[index].createdOnUtc.toString().substring(0,10), - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + child: Text( + deliveredOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + deliveredOrderList[ + index]), + )); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + : 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20, ), - ], + ), ), ], ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: deliveredOrderList[index]),)); - }, - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - :'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20,), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - padding: EdgeInsets.only(left: 13.0, right: 13.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.blue[700], - style: BorderStyle.solid, - width: 5.0, - ), - color: Colors.blue[700], - borderRadius: BorderRadius.circular(30.0) - ), - child: deliveredOrderList[index].orderStatusId == 30 - ? Text( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only( + left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only( + left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.blue[700], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.blue[700], + borderRadius: + BorderRadius.circular(30.0)), + child: 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" - ? deliveredOrderList[index].orderStatusn.toString(): - deliveredOrderList[index].orderStatus.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - child: Column( + TranslationBase.of(context) + .deliveredOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? deliveredOrderList[index] + .orderStatusn + .toString() + : deliveredOrderList[index] + .orderStatus + .toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + Container( + margin: EdgeInsets.only( + left: 8, right: 8, top: 1, bottom: 8), + child: Column( // crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text(deliveredOrderList[index].orderTotal.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).sar, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + deliveredOrderList[index] + .orderTotal + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - child: Text(deliveredOrderList[index].productCount.toString(), - style: TextStyle(fontSize: 14.0, - ), + SizedBox( + height: 5, ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).itemsNo, - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + child: Text( + deliveredOrderList[index] + .productCount + .toString(), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .itemsNo, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), - ), - ], + ], + ), ), ], ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, - ), - ], - ), - ); - } + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + }) + ], + ), ) - ], - ), - ) : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/empty_box.svg'), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noOrder, - style: TextStyle( - fontSize: 16.0, - )), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), ), - ], - ), - ), - ), + ), ); } - Widget getProcessingOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.orders.length; i++){ - if( model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || - model.orders[i].orderStatusId == 998 || model.orders[i].orderStatusId == 999){ + Widget getProcessingOrder(OrderModelViewModel model) { + for (int i = 0; i < model.orders.length; i++) { + if (model.orders[i].orderStatusId == 20 || + model.orders[i].orderStatusId == 995 || + model.orders[i].orderStatusId == 998 || + model.orders[i].orderStatusId == 999) { processingOrderList.add(model.orders[i]); } } @@ -330,206 +381,255 @@ class _OrderPageState extends State with SingleTickerProviderStateMix width: MediaQuery.of(context).size.width, child: model.orders.length != 0 ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: processingOrderList.length, - itemBuilder: (context, index){ - return Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderNumber, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), - ), - ), - Container( - child: Text(processingOrderList[index].id.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: processingOrderList.length, + itemBuilder: (context, index) { + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text( + processingOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderDate, - style: TextStyle(fontSize: 14.0, - ), + SizedBox( + height: 5, ), - ), - Container( - child: Text(processingOrderList[index].createdOnUtc.toString().substring(0,10), - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + child: Text( + processingOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + processingOrderList[ + index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + : 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20, ), - ], + ), ), ], ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel :processingOrderList[index]))); - - }, - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - :'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20,), - ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - padding: EdgeInsets.only(left: 13.0, right: 13.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 5.0, - ), - color: Colors.green, - borderRadius: BorderRadius.circular(30.0) + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, ), - child: processingOrderList[index].orderStatusId == 20 - ? Text( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only( + left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only( + left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.green, + borderRadius: + BorderRadius.circular(30.0)), + child: processingOrderList[index] + .orderStatusId == + 20 + ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), - TranslationBase.of(context).processingOrder, - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - : Text( - languageID == "ar" - ? processingOrderList[index].orderStatusn.toString(): - processingOrderList[index].orderStatus.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - child: Column( + TranslationBase.of(context) + .processingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? processingOrderList[index] + .orderStatusn + .toString() + : processingOrderList[index] + .orderStatus + .toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + Container( + margin: EdgeInsets.only( + left: 8, right: 8, top: 1, bottom: 8), + child: Column( // crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text(processingOrderList[index].orderTotal.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).sar, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + processingOrderList[index] + .orderTotal + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - child: Text(processingOrderList[index].productCount.toString(), - style: TextStyle(fontSize: 14.0, - ), + SizedBox( + height: 5, ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).itemsNo, - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + child: Text( + processingOrderList[index] + .productCount + .toString(), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .itemsNo, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), - ), - ], + ], + ), ), ], ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, - ), - ], - ), - ); - } + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + }) + ], + ), ) - ], - ), - ) : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/empty_box.svg'), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noOrder, - style: TextStyle( - fontSize: 16.0, - )), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), ), - ], - ), - ), - ), + ), ); // return Container( // child: model.order.length != 0 @@ -589,7 +689,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix // child: InkWell( // onTap: () { // Navigator.push(context, -// MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[0]))); +// FadePage(page: OrderDetailsPage(orderModel:processingOrderList[0]))); // }, // child: SvgPicture.asset( // 'assets/images/pharmacy/arrow_right.svg', @@ -712,447 +812,552 @@ class _OrderPageState extends State with SingleTickerProviderStateMix // ); } - Widget getPendingOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.orders.length; i++){ - if( model.orders[i].orderStatusId == 10){ + Widget getPendingOrder(OrderModelViewModel model) { + for (int i = 0; i < model.orders.length; i++) { + if (model.orders[i].orderStatusId == 10) { pendingOrderList.add(model.orders[i]); } } return Container( child: model.orders.length != 0 - ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: pendingOrderList.length , - itemBuilder: (context, index){ - return Container( - child: SingleChildScrollView( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderNumber, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: pendingOrderList.length, + itemBuilder: (context, index) { + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text( + pendingOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - Container( - child: Text(pendingOrderList[index].id.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + SizedBox( + height: 5, ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderDate, - style: TextStyle(fontSize: 14.0, - ), - ), - ), - Container( - child: Text(pendingOrderList[index].createdOnUtc.toString().substring(0,10), - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + child: Text( + pendingOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + pendingOrderList[ + index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + : 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20, ), - ], + ), ), ], ), - ), - Container( - margin: EdgeInsets.all( 8.0), - child: InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index]))); - - }, - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - :'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20,), - ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - padding: EdgeInsets.only(left: 13.0, right: 13.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.orange[300], - style: BorderStyle.solid, - width: 5.0, - ), - color: Colors.orange[300], - borderRadius: BorderRadius.circular(30.0) + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, ), - child: pendingOrderList[index].orderStatusId == 10 - ? Text( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.only( + left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange[300], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.orange[300], + borderRadius: + BorderRadius.circular(30.0)), + child: pendingOrderList[index] + .orderStatusId == + 10 + ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), - TranslationBase.of(context).pendingOrder, - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - : Text( - languageID == "ar" - ? pendingOrderList[index].orderStatusn.toString(): - pendingOrderList[index].orderStatus.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - Container( - margin: EdgeInsets.all(8.0), - child: Column( + TranslationBase.of(context) + .pendingOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? pendingOrderList[index] + .orderStatusn + .toString() + : pendingOrderList[index] + .orderStatus + .toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + Container( + margin: EdgeInsets.all(8.0), + child: Column( // crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text(pendingOrderList[index].orderTotal.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + pendingOrderList[index] + .orderTotal + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .sar, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).sar, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + SizedBox( + height: 5, ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - child: Text(pendingOrderList[index].productCount.toString(), - style: TextStyle(fontSize: 14.0, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).itemsNo, - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + child: Text( + pendingOrderList[index] + .productCount + .toString(), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .itemsNo, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), - ), - ], + ], + ), ), ], ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), ), - ], - ), - ), - - ); - } + ); + }) + ], + ), ) - ], - ), - ) : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/empty_box.svg'), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noOrder, - style: TextStyle( - fontSize: 16.0, - )), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), ), - ], - ), - ), - ), - + ), ); } - Widget getCancelledOrder(OrderModelViewModel model){ - for(int i=0 ; i< model.orders.length; i++){ - if( model.orders[i].orderStatusId == 40 || model.orders[i].orderStatus == 996 - || model.orders[i].orderStatusId == 200){ + Widget getCancelledOrder(OrderModelViewModel model) { + for (int i = 0; i < model.orders.length; i++) { + if (model.orders[i].orderStatusId == 40 || + model.orders[i].orderStatus == 996 || + model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } } return Container( child: model.orders.length != 0 - ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: cancelledOrderList.length, - itemBuilder: (context, index){ - return Container( - child: SingleChildScrollView( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all( 8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderNumber, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: cancelledOrderList.length, + itemBuilder: (context, index) { + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text( + cancelledOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - Container( - child: Text(cancelledOrderList[index].id.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + SizedBox( + height: 5, ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text(TranslationBase.of(context).orderDate, - style: TextStyle(fontSize: 14.0, - ), - ), - ), - Container( - child: Text(cancelledOrderList[index].createdOnUtc.toString().substring(0,10), - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + child: Text( + cancelledOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + cancelledOrderList[ + index]))); + }, + child: SvgPicture.asset( + languageID == "ar" + ? 'assets/images/pharmacy/arrow_left.svg' + : 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20, ), - ], + ), ), ], ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel: cancelledOrderList[index]))); - - }, - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - :'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20,), - ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - padding: EdgeInsets.only(left: 10.0, right: 10.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.red[900], - style: BorderStyle.solid, - width: 5.0, - ), - color: Colors.red[900], - borderRadius: BorderRadius.circular(30.0) + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, ), - child: cancelledOrderList[index].orderStatusId == 40 - ? Text( + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only( + left: 8, + right: 8, + top: 1, + bottom: 8), + padding: EdgeInsets.only( + left: 10.0, right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.red[900], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.red[900], + borderRadius: + BorderRadius.circular(30.0)), + child: cancelledOrderList[index] + .orderStatusId == + 40 + ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), - TranslationBase.of(context).cancelledOrder, - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - : Text( - languageID == "ar" - ? cancelledOrderList[index].orderStatusn.toString(): - cancelledOrderList[index].orderStatus.toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), - Container( - margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), - child: Column( + TranslationBase.of(context) + .cancelledOrder, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + languageID == "ar" + ? cancelledOrderList[index] + .orderStatusn + .toString() + : cancelledOrderList[index] + .orderStatus + .toString(), + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + Container( + margin: EdgeInsets.only( + left: 8, right: 8, top: 1, bottom: 8), + child: Column( // crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text(cancelledOrderList[index].orderTotal.toString(), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), - ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).sar, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, - ), + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + cancelledOrderList[index] + .orderTotal + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .sar, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5,), - Row( - children: [ - Container( - child: Text(cancelledOrderList[index].productCount.toString(), - style: TextStyle(fontSize: 14.0, - ), + SizedBox( + height: 5, ), - ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).itemsNo, - style: TextStyle(fontSize: 14.0, - ), + Row( + children: [ + Container( + child: Text( + cancelledOrderList[index] + .productCount + .toString(), + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + Container( + margin: + EdgeInsets.only(left: 5), + child: Text( + TranslationBase.of(context) + .itemsNo, + style: TextStyle( + fontSize: 14.0, + ), + ), + ), + ], ), - ), - ], + ], + ), ), ], ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), ), - ], - ), - ), - - ); - } + ); + }) + ], + ), ) - ], - ), - ) : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/empty_box.svg'), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noOrder, - style: TextStyle( - fontSize: 16.0, - )), - ), - ], - ), - ), - ), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/pharmacy/empty_box.svg'), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).noOrder, + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), + ), ); int test = Test()["1"]; } - } -class Test{ - static const values = { - "1":1, - "2":2, - "3":3 - }; +class Test { + static const values = {"1": 1, "2": 2, "3": 3}; + int operator [](String key) => values[key]; -} \ No newline at end of file +} diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 670cb951..047fda85 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -1,28 +1,25 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/order/TrackDriver.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:flutter/src/widgets/image.dart' as flutterImage; - -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:provider/provider.dart'; +import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class OrderDetailsPage extends StatefulWidget { Orders orderModel; + OrderDetailsPage({@required this.orderModel}); // Orders orderModel; @@ -40,9 +37,9 @@ class _OrderDetailsPageState extends State { // AppSharedPreferences sharedPref = AppSharedPreferences(); String customerId; - List ordersList = []; + List ordersList = []; - List cancelledOrderList = []; + List cancelledOrderList = []; // String orderId="3516"; var model; @@ -52,6 +49,8 @@ class _OrderDetailsPageState extends State { var dataIsCancel; var dataIsRefund; + MyInAppBrowser browser; + @override void initState() { getLanguageID(); @@ -71,183 +70,179 @@ class _OrderDetailsPageState extends State { appBarTitle: TranslationBase.of(context).orderDetail, isShowAppBar: true, isPharmacy: true, - body: Container( - color: Colors.white, - child: SingleChildScrollView( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), - child: Row( + baseViewModel: model, + body: model.orderListModel.length > 0 + ? Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SvgPicture.asset( - 'assets/images/pharmacy/shipping_mark_icon.svg', - width: 28, - height: 28, + Container( + margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_mark_icon.svg', + width: 28, + height: 28, + ), + Text( + TranslationBase.of(context).shippingAddress, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), ), - Text( - TranslationBase.of(context).shippingAddress, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, + Container( + margin: EdgeInsets.only(top: 15.0, right: 10.0), + padding: EdgeInsets.only(left: 11.0, right: 11.0), + decoration: BoxDecoration( + border: Border.all( + color: getStatusBackgroundColor(), + style: BorderStyle.solid, + width: 5.0, + ), + color: getStatusBackgroundColor(), + borderRadius: BorderRadius.circular(30.0)), + child: 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, + ), ), ), ], ), - ), - Container( - margin: EdgeInsets.only(top: 15.0, right: 10.0), - padding: EdgeInsets.only(left: 11.0, right: 11.0), - decoration: BoxDecoration( - border: Border.all( - color: getStatusBackgroundColor(), - style: BorderStyle.solid, - width: 5.0, - ), - color: getStatusBackgroundColor(), - borderRadius: BorderRadius.circular(30.0)), - child: Text( - languageID == "ar" - ? model.orderListModel[0].orderStatusn.toString() - : model.orderListModel[0].orderStatus - .toString() - .substring(12), -// TranslationBase.of(context).delivered, - style: TextStyle( - color: Colors.white, - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), + Container( + margin: EdgeInsets.only(left: 10.0, top: 13.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}", + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), - ), - ], - ), - Container( - margin: EdgeInsets.only(left: 10.0, top: 13.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orderListModel[0].shippingAddress.firstName - .toString() - .substring(10) + - ' ' + - model.orderListModel[0].shippingAddress.lastName - .toString() - .substring(9), - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ]), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orderListModel[0].shippingAddress.address1 - .toString() - .substring(9), - style: TextStyle( - fontSize: 10.0, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ), - ]), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orderListModel[0].shippingAddress.address2 - .toString() - .substring(9) + - ' ' + - model.orderListModel[0].shippingAddress.country - .toString() + - ' ' + - model.orderListModel[0].shippingAddress - .zipPostalCode - .toString(), - style: TextStyle( - fontSize: 10.0, - fontWeight: FontWeight.bold, - color: Colors.grey, - ), - ), - ]), - ), - Container( - child: Row( - children: [ Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), - child: SvgPicture.asset( - 'assets/images/pharmacy/mobile_number_icon.svg', - height: 13, - ), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.orderListModel[0].shippingAddress.address1 + .toString() + .substring(9), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), ), Container( - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text( - model.orderListModel[0].shippingAddress.phoneNumber - .toString(), - style: TextStyle( - fontSize: 15.0, - ), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.orderListModel[0].shippingAddress.address2 + .toString() + .substring(9) + + ' ' + + model.orderListModel[0].shippingAddress + .country + .toString() + + ' ' + + model.orderListModel[0].shippingAddress + .zipPostalCode + .toString(), + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ]), + ), + Container( + child: Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/mobile_number_icon.svg', + height: 13, + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text( + model.orderListModel[0].shippingAddress + .phoneNumber + .toString(), + style: TextStyle( + fontSize: 15.0, + ), + ), + ), + ], ), ), - ], - ), - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - children: [ - Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), - child: SvgPicture.asset( - 'assets/images/pharmacy/shipping_truck_icon.svg', + Divider( + color: Colors.grey[350], height: 20, - width: 20, - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).shippedMethod, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), + thickness: 1, + indent: 0, + endIndent: 0, ), - ), - Container( - child: flutterImage.Image.asset( - model.orderListModel[0] - .shippingRateComputationMethodSystemName != - "Shipping.Aramex" - ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" - : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", - fit: BoxFit.contain, + Row( + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/shipping_truck_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text( + TranslationBase.of(context).shippedMethod, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: flutterImage.Image.asset( + model.orderListModel[0] + .shippingRateComputationMethodSystemName != + "Shipping.Aramex" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" + : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", + fit: BoxFit.contain, // height: 100, - width: 100, - ), - ), + width: 100, + ), + ), // Container( // child: widget.orderModel // .shippingRateComputationMethodSystemName == @@ -269,357 +264,373 @@ class _OrderDetailsPageState extends State { // ), // ), // ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, - ), - Row( - children: [ - Container( - margin: EdgeInsets.all(10.0), - child: SvgPicture.asset( - 'assets/images/pharmacy/credit_card_icon.svg', + ], + ), + Divider( + color: Colors.grey[350], height: 20, - width: 20, + thickness: 8, + indent: 0, + endIndent: 0, ), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0, top: 10.0), - child: Text( - model.orderListModel[0].paymentName - .toString() - .substring(12), - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), + Row( + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/credit_card_icon.svg', + height: 20, + width: 20, + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Text( + model.orderListModel[0].paymentName + .toString() + .substring(12), + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ), - ], - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 8, - indent: 0, - endIndent: 0, - ), - Container( - padding: EdgeInsets.only(bottom: 15.0), - margin: EdgeInsets.only(left: 10.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).orderDetail, - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, ), - ], - ), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - itemCount: model.orderListModel[0].orderItems.length, - itemBuilder: (context, index) { - return Container( - child: productTile( - productName: model - .orderListModel[0].orderItems[index].product.name - .toString(), - productPrice: model - .orderListModel[0].orderItems[index].product.price - .toString(), - productRate: model.orderListModel[0].orderItems[index] - .product.approvedRatingSum - .toDouble(), - productReviews: model.orderListModel[0] - .orderItems[index].product.approvedTotalReviews, - totalPrice: - "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", - qyt: model - .orderListModel[0].orderItems[index].quantity - .toString(), - isOrderDetails: true, - imgs: model.orderListModel[0].orderItems[index] - .product.images != - null && - model.orderListModel[0].orderItems[index] - .product.images.length != - 0 - ? model.orderListModel[0].orderItems[index] - .product.images[0].src - .toString() - : null, - status: model.orderListModel[0].orderStatusId, - product: - model.orderListModel[0].orderItems[index].product, - ), - ); - }), - - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.only(left: 10.0, top: 5.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).orderSummary, - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, + Container( + padding: EdgeInsets.only(bottom: 15.0), + margin: EdgeInsets.only(left: 10.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderDetail, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ], - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.only(top: 5.0, left: 10.0), - child: Text( - TranslationBase.of(context).subtotal, - style: TextStyle( - fontSize: 13.0, + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: model.orderListModel[0].orderItems.length, + itemBuilder: (context, index) { + return Container( + child: productTile( + productName: model.orderListModel[0] + .orderItems[index].product.name + .toString(), + productPrice: model.orderListModel[0] + .orderItems[index].product.price + .toString(), + productRate: model.orderListModel[0] + .orderItems[index].product.approvedRatingSum + .toDouble(), + productReviews: model + .orderListModel[0] + .orderItems[index] + .product + .approvedTotalReviews, + totalPrice: + "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}", + qyt: model.orderListModel[0].orderItems[index] + .quantity + .toString(), + isOrderDetails: true, + imgs: model.orderListModel[0].orderItems[index] + .product.images != + null && + model + .orderListModel[0] + .orderItems[index] + .product + .images + .length != + 0 + ? model.orderListModel[0].orderItems[index] + .product.images[0].src + .toString() + : null, + status: model.orderListModel[0].orderStatusId, + product: model.orderListModel[0] + .orderItems[index].product, + ), + ); + }), + + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(left: 10.0, top: 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).orderSummary, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], ), ), - ), - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), - child: Row( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - margin: EdgeInsets.only(right: 5.0), + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), child: Text( - TranslationBase.of(context).sar, + TranslationBase.of(context).subtotal, style: TextStyle( fontSize: 13.0, ), ), ), - Text( - model.orderListModel[0].orderSubtotalExclTax - .toString(), - style: TextStyle( - fontSize: 13.0, + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + model.orderListModel[0].orderSubtotalExclTax + .toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], ), ), ], ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.only(top: 5.0, left: 10.0), - child: Text( - TranslationBase.of(context).shipping, - style: TextStyle( - fontSize: 13.0, - ), - ), - ), - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), - child: Row( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - margin: EdgeInsets.only(right: 5.0), + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), child: Text( - TranslationBase.of(context).sar, + TranslationBase.of(context).shipping, style: TextStyle( fontSize: 13.0, ), ), ), - Text( - model.orderListModel[0].orderShippingExclTax - .toString(), - style: TextStyle( - fontSize: 13.0, + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + model.orderListModel[0].orderShippingExclTax + .toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], ), ), ], ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.only(top: 5.0, left: 10.0), - child: Text( - TranslationBase.of(context).vat, - style: TextStyle( - fontSize: 13.0, - ), - ), - ), - Container( - padding: EdgeInsets.only(bottom: 10.0), - margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), - child: Row( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - margin: EdgeInsets.only(right: 5.0), + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), child: Text( - TranslationBase.of(context).sar, + TranslationBase.of(context).vat, style: TextStyle( fontSize: 13.0, ), ), ), - Text( - model.orderListModel[0].orderTax.toString(), - style: TextStyle( - fontSize: 13.0, + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Text( + model.orderListModel[0].orderTax.toString(), + style: TextStyle( + fontSize: 13.0, + ), + ), + ], ), ), ], ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.only(top: 5.0, left: 10.0), - child: Text( - TranslationBase.of(context).total, - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), - child: Row( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - margin: EdgeInsets.only(right: 5.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0), child: Text( - TranslationBase.of(context).sar, + TranslationBase.of(context).total, style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, ), ), ), - Text( - model.orderListModel[0].orderTotal.toString(), - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + model.orderListModel[0].orderTotal.toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ], ), ), ], ), - ), - ], - ), - model.orderListModel[0].orderStatusId == 10 - ? InkWell( - onTap: () { - model.makeOrder(); - }, - child: Container( + model.orderListModel[0].orderStatusId == 10 + ? InkWell( + onTap: () { + print(widget.orderModel.toString()); + print(model.orderListModel.toString()); + print("calc = ${5.9 * 3}"); + // TODO MOSA + openPayment( + model.orderListModel[0], model.user); + }, + child: Container( // margin: EdgeInsets.only(top: 20.0), - height: 50.0, - color: Colors.transparent, - child: Container( - padding: EdgeInsets.only(left: 130.0, right: 130.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0), - color: Colors.green, - borderRadius: BorderRadius.circular(5.0)), - child: Center( - child: Text( - TranslationBase.of(context).payOnline, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, + height: 50.0, + color: Colors.transparent, + child: Container( + padding: EdgeInsets.only( + left: 130.0, right: 130.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 4.0), + color: Colors.green, + borderRadius: BorderRadius.circular(5.0)), + child: Center( + child: Text( + TranslationBase.of(context).payOnline, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), ), ), - ), - ), - ), - ) - : Container(), + ) + : Container(), // getCancelOrder(canCancel, canRefund), - isCancel - ? InkWell( - onTap: () { - presentConfirmDialog(model, widget.orderModel.id); - // model.orderListModel[0].id//(widget.orderModel.id)); + isCancel + ? InkWell( + onTap: () { + presentConfirmDialog( + model, widget.orderModel.id); + // model.orderListModel[0].id//(widget.orderModel.id)); // - }, - child: Container( + }, + child: Container( // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), - height: 50.0, - color: Colors.transparent, - child: Center( - child: Text( - TranslationBase.of(context).cancelOrder, - style: TextStyle( - color: Colors.red[900], - fontWeight: FontWeight.bold, - decoration: TextDecoration.underline), - ), - ), - ), - ) - : Container(), - isActiveDelivery - ? InkWell( - onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel), - // )); - }, - child: Container( - height: 50.0, - color: Colors.transparent, - child: Center( - child: Text( - TranslationBase.of(context).trackDeliveryDriver, - style: TextStyle( - color: Colors.green[900], - fontWeight: FontWeight.normal, - decoration: TextDecoration.none), - ), - ), - ), - ) - : Container(), - ], - ), - ), - ), + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context).cancelOrder, + style: TextStyle( + color: Colors.red[900], + fontWeight: FontWeight.bold, + decoration: TextDecoration.underline), + ), + ), + ), + ) + : Container(), + isActiveDelivery + ? InkWell( + onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute(builder: (context) => TrackDriver(order: widget.orderModel), + // )); + }, + child: Container( + height: 50.0, + color: Colors.transparent, + child: Center( + child: Text( + TranslationBase.of(context) + .trackDeliveryDriver, + style: TextStyle( + color: Colors.green[900], + fontWeight: FontWeight.normal, + decoration: TextDecoration.none), + ), + ), + ), + ) + : Container(), + ], + ), + ), + ) + : Container(), ), ); } @@ -681,8 +692,8 @@ class _OrderDetailsPageState extends State { // Navigator.pop(context); Navigator.push( context, - MaterialPageRoute( - builder: (context) => OrderPage( + FadePage( + page: OrderPage( // customerID: model.ordersList[0].customerId.toString() customerID: widget.orderModel.customerId.toString())), ); @@ -701,4 +712,55 @@ class _OrderDetailsPageState extends State { } } + + /*** + * + * Online payment methods + */ + + 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(bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + // if (isPaymentMade) checkPaymentStatus(appo); + } } diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart index 4d09191c..7f58fa21 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; @@ -12,7 +13,7 @@ import 'package:rating_bar/rating_bar.dart'; import 'package:flutter/src/widgets/image.dart' as flutterImage; class ProductReviewPage extends StatefulWidget { - final Product product; + final PharmacyProduct product; ProductReviewPage(this.product); diff --git a/lib/pages/pharmacy/order/TrackDriver.dart b/lib/pages/pharmacy/order/TrackDriver.dart index b9a8056f..63dc0ace 100644 --- a/lib/pages/pharmacy/order/TrackDriver.dart +++ b/lib/pages/pharmacy/order/TrackDriver.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; @@ -9,7 +10,7 @@ import 'package:location/location.dart'; class TrackDriver extends StatefulWidget { - final OrderModel order; + final OrderDetailModel order; TrackDriver({this.order}); @override @@ -17,7 +18,7 @@ class TrackDriver extends StatefulWidget { } class _TrackDriverState extends State { - OrderModel _order; + OrderDetailModel _order; Completer _controller = Completer(); diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index fb1e1c2a..9c32b23f 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; @@ -14,20 +15,14 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-con import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.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:flutter_svg/flutter_svg.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; - -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart'; dynamic languageID; @@ -47,8 +42,6 @@ class _ProfilePageState extends State { String lastName, mobileNo, identificationNo; int languageId; - _ProfilePageState({this.customerId}); - getLanguageID() async { languageID = await sharedPref.getString(APP_LANGUAGE); } @@ -76,7 +69,7 @@ class _ProfilePageState extends State { if (userData == null) { Navigator.push( context, - MaterialPageRoute(builder: (context) => WelcomeLogin()), + FadePage(page: WelcomeLogin()), ); } } @@ -94,7 +87,10 @@ class _ProfilePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrder(customerId, page_id), + onModelReady: (model) async { + var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + model.getOrder(customerId, page_id); + }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, isShowAppBar: false, @@ -164,8 +160,8 @@ class _ProfilePageState extends State { } Navigator.push( context, - MaterialPageRoute( - builder: (context) => OrderPage( + FadePage( + page: OrderPage( customerID: customerId))); }, child: Column( @@ -193,11 +189,8 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - LakumMainPage())); + Navigator.push(context, + FadePage(page: LakumMainPage())); }, child: Column( children: [ @@ -222,11 +215,8 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - WishlistPage())); + Navigator.push(context, + FadePage(page: WishlistPage())); }, child: Column( children: [ @@ -252,11 +242,8 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MyReviewsPage())); + Navigator.push(context, + FadePage(page: MyReviewsPage())); }, child: Column( children: [ @@ -316,9 +303,8 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - HomePrescriptionsPage())); + FadePage( + page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -349,11 +335,8 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - ComparePage())); + Navigator.push(context, + FadePage(page: ComparePage())); }, child: Row( children: [ @@ -384,9 +367,8 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - HomePrescriptionsPage())); + FadePage( + page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -418,10 +400,7 @@ class _ProfilePageState extends State { InkWell( onTap: () { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - MyFamily())); + context, FadePage(page: MyFamily())); }, child: Row( children: [ @@ -453,9 +432,8 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - PharmacyAddressesPage())); + FadePage( + page: PharmacyAddressesPage())); }, child: Row( children: [ @@ -488,9 +466,8 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - PharmacyTermsConditions())); + FadePage( + page: PharmacyTermsConditions())); }, child: Row( children: [ @@ -523,14 +500,13 @@ class _ProfilePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - LakumTermsConditions( - this.identificationNo, - this.firstName, - this.lastName, - this.mobileNo, - this.languageId))); + FadePage( + page: LakumTermsConditions( + this.identificationNo, + this.firstName, + this.lastName, + this.mobileNo, + this.languageId))); }, child: Row( children: [ @@ -590,11 +566,8 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - LiveChatPage())); + Navigator.push(context, + FadePage(page: LiveChatPage())); }, child: Row( children: [ @@ -622,11 +595,8 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - FindUsPage())); + Navigator.push(context, + FadePage(page: FindUsPage())); }, child: Row( children: [ diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index f0062a1c..316978a7 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:barcode_scan_fix/barcode_scan.dart'; -import 'package:charts_flutter/flutter.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -11,8 +10,10 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/utils.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 'package:provider/provider.dart'; + import 'base/base_view.dart'; import 'final_products_page.dart'; @@ -29,7 +30,9 @@ class _PharmacyCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getCategorise(), - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( + builder: (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( isShowDecPage: false, baseViewModel: model, body: Column( @@ -57,7 +60,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, + projectViewModel.isArabic + ? model.categorise[index].namen + : model.categorise[index].name, fontWeight: FontWeight.w600, ), ), @@ -65,8 +70,8 @@ class _PharmacyCategorisePageState extends State { onTap: () => { Navigator.push( context, - MaterialPageRoute( - builder: (context) => model.categorise[index].id != '12' + FadePage( + page: model.categorise[index].id != '12' ? ParentCategorisePage( id: model.categorise[index].id, titleName: model.categorise[index].name, @@ -86,7 +91,10 @@ class _PharmacyCategorisePageState extends State { height: 140, child: Column( children: [ - Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)), + Divider( + height: 2.0, + thickness: 1.0, + color: Colors.black12.withOpacity(0.14)), SizedBox( height: 10.0, ), @@ -102,12 +110,16 @@ class _PharmacyCategorisePageState extends State { width: 55.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.0), - color: Colors.green.shade300.withOpacity(0.34), + color: + Colors.green.shade300.withOpacity(0.34), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers', + projectViewModel.isArabic + ? 'الاكثر مبيعا' + : 'Best Sellers', fontWeight: FontWeight.w600, ), ), @@ -122,13 +134,16 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.orangeAccent.shade200.withOpacity(0.34), + color: Colors.orangeAccent.shade200 + .withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed', + projectViewModel.isArabic + ? 'الاكثر مشاهدة' + : 'Most Viewed', fontWeight: FontWeight.w600, ), ), @@ -152,7 +167,9 @@ class _PharmacyCategorisePageState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products', + projectViewModel.isArabic + ? 'منتجات جديدة' + : 'New Products', fontWeight: FontWeight.w600, ), ), @@ -170,13 +187,17 @@ class _PharmacyCategorisePageState extends State { height: 50.0, width: 55.0, decoration: BoxDecoration( - color: Colors.purple.shade200.withOpacity(0.34), + color: + Colors.purple.shade200.withOpacity(0.34), borderRadius: BorderRadius.circular(5.0), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), + padding: + EdgeInsets.symmetric(horizontal: 10.0), child: Texts( - projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed', + projectViewModel.isArabic + ? 'شوهد مؤخرا' + : 'Recently Viewed', fontWeight: FontWeight.w600, ), ), @@ -214,7 +235,7 @@ class _PharmacyCategorisePageState extends State { { Navigator.push( context, - MaterialPageRoute(builder: (context) => LandingPagePharmacy()), + FadePage(page: LandingPagePharmacy()), ); } } diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 45cafd35..73b17558 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -8,6 +10,7 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.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 'base/base_view.dart'; @@ -45,13 +48,13 @@ class _SearchProductsPageState extends State { child: Row( children: [ Container( - width: MediaQuery.of(context).size.width * 0.79, + width: MediaQuery.of(context).size.width * 0.70, child: Form( key: _formKey, child: TextFields( autoFocus: true, hintText: 'Search', - fontSize: 19.0, + fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, onSaved: (value) { @@ -102,170 +105,192 @@ class _SearchProductsPageState extends State { child: NetworkBaseView( baseViewModel: model, child: model.searchList.isNotEmpty - ? Container( - height: MediaQuery.of(context).size.height * 0.80, - child: GridView.builder( - //physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 1.0, - ), - itemCount: model.searchList.length, - itemBuilder: (BuildContext context, int index) { - return Card( - color: model.searchList[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), + ? InkWell( + child: Container( + height: MediaQuery.of(context).size.height * 0.80, + child: GridView.builder( + //physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 1.0, + ), + itemCount: model.searchList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: Card( + color: model.searchList[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, + ), ), - color: Colors.white, - ), - padding: - EdgeInsets.symmetric(horizontal: 0), - width: - MediaQuery.of(context).size.width / 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Stack( + 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: [ - Container( - margin: EdgeInsets.fromLTRB( - 0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model.searchList[index].images - .isNotEmpty - ? model.searchList[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, - ), + Stack( + children: [ + Container( + margin: EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: Alignment.center, + child: Image.network( + model.searchList[index] + .images.isNotEmpty + ? model + .searchList[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.searchList[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.searchList[index] + .rxMessage != + null + ? model + .searchList[index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), + ), + ], ), Container( - width: model.searchList[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)), + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - child: Texts( - model.searchList[index] - .rxMessage != - null - ? model.searchList[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: [ - Texts( - model.searchList[index].name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w400, - ), - Padding( - padding: const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.searchList[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - StarRating( - totalAverage: model - .searchList[ - index] - .approvedRatingSum > - 0 - ? (model - .searchList[ - index] - .approvedRatingSum - .toDouble() / - model - .searchList[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), Texts( - "(${model.searchList[index].approvedTotalReviews})", + model + .searchList[index].name, regular: true, - fontSize: 10, + fontSize: 12, fontWeight: FontWeight.w400, - ) + ), + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.searchList[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .searchList[ + index] + .approvedRatingSum > + 0 + ? (model + .searchList[ + index] + .approvedRatingSum + .toDouble() / + model + .searchList[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.searchList[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), ], ), - ], - ), + ), + ], ), - ], + ), ), - ), - ); - }, + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.searchList[index]), + )), + }, + ); + }, + ), ), ) : Texts(msg), diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 45c9fd6c..7c14e05d 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1,12 +1,12 @@ 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/widgets/buttons/button.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:provider/provider.dart'; import 'base/base_view.dart'; import 'final_products_page.dart'; @@ -17,6 +17,7 @@ class SubCategorisePage extends StatefulWidget { String parentId; SubCategorisePage({this.id, this.parentId, this.title}); + @override _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId); @@ -28,7 +29,9 @@ class _SubCategorisePageState extends State { String id; String title; String parentId; + _SubCategorisePageState({this.title, this.parentId, this.id}); + String categoriseName = "Personal Care"; bool styleOne = true; bool styleTwo = false; @@ -37,6 +40,7 @@ class _SubCategorisePageState extends State { color: Colors.blue, size: 29.0, ); + @override Widget build(BuildContext context) { return BaseView( @@ -140,8 +144,8 @@ class _SubCategorisePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => + FadePage( + page: FinalProductsPage( id: model .subCategorise[ @@ -228,9 +232,8 @@ class _SubCategorisePageState extends State { onTap: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => - FinalProductsPage( + FadePage( + page: FinalProductsPage( id: model.subCategorise[index].id, ), ), @@ -607,168 +610,189 @@ class _SubCategorisePageState extends State { itemBuilder: (BuildContext context, int index) { return NetworkBaseView( baseViewModel: model, - child: Card( - color: model.subProducts[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, + child: InkWell( + child: Card( + color: model.subProducts[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, + ), ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(110.0), + ), + color: Colors.white, ), - 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.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 + 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 .subProducts[ 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)), + .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, + ), ), - child: Texts( - model.subProducts[index] + Container( + width: model + .subProducts[ + index] .rxMessage != null - ? model - .subProducts[ - 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: [ - Texts( - model.subProducts[index] - .name, - regular: true, - fontSize: 12, - fontWeight: - FontWeight.w400, - ), - Padding( + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, padding: - const EdgeInsets.only( - top: 4, - bottom: 4), + EdgeInsets.all(4), + decoration: BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), child: Texts( - "SAR ${model.subProducts[index].price}", - bold: true, - fontSize: 14, + model.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, ), ), - Row( - children: [ - StarRating( - 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, - ) - ], - ), ], ), - ), - ], + Container( + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + model.subProducts[index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w400, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + 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, + ) + ], + ), + ], + ), + ), + ], + ), ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.subProducts[index]), + )), + }, )); }, ), @@ -780,158 +804,184 @@ class _SubCategorisePageState extends State { itemCount: model.subProducts.length, itemBuilder: (BuildContext context, int index) { - return 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, + 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.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, + Container( + margin: + EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: Image.network( + 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, + ), ), - ), - ], + ], + ), + Column( + children: [ + Container( + width: model + .subProducts[ + 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.subProducts[index] + .rxMessage != + null + ? model + .subProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + ], + ), + Container( + height: 100.0, + margin: EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, ), - Column( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ + SizedBox( + height: 4.0, + ), Container( - width: model - .subProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) + width: + MediaQuery.of(context) .size - .width / - 5 - : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular(6)), - ), + .width * + 0.65, child: Texts( model.subProducts[index] - .rxMessage != - null - ? model - .subProducts[ - index] - .rxMessage - : "", - color: Colors.white, + .name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight.w400, + FontWeight.w500, + maxLines: 5, ), ), - ], - ), - ], - ), - 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( - height: 35.0, - width: 250.0, - child: Texts( - model.subProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 2, + SizedBox( + height: 8.0, ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.subProducts[index].price}", - bold: true, - fontSize: 14, + Padding( + padding: + const EdgeInsets.only( + top: 4, bottom: 4), + child: Texts( + "SAR ${model.subProducts[index].price}", + bold: true, + fontSize: 14, + ), ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .subProducts[ - index] - .approvedRatingSum > - 0 - ? (model - .subProducts[ - index] - .approvedRatingSum - .toDouble() / - model - .parentProducts[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.subProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], + Row( + children: [ + StarRating( + totalAverage: model + .subProducts[ + index] + .approvedRatingSum > + 0 + ? (model + .subProducts[ + index] + .approvedRatingSum + .toDouble() / + model + .parentProducts[ + index] + .approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: true), + Texts( + "(${model.subProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], + ), ), - ), - ], + ], + ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.subProducts[index]), + )), + }, ); }), ) diff --git a/lib/services/pharmacy_services/cancelOrder_service.dart b/lib/services/pharmacy_services/cancelOrder_service.dart index f848c2ff..3804b19b 100644 --- a/lib/services/pharmacy_services/cancelOrder_service.dart +++ b/lib/services/pharmacy_services/cancelOrder_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -16,8 +17,8 @@ class CancelOrderService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); - List _cancelOrderList = List(); - List get cancelOrderList => _cancelOrderList; + List _cancelOrderList = List(); + List get cancelOrderList => _cancelOrderList; String url =""; diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index b8ea8214..4178c50a 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -1,12 +1,13 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:flutter/material.dart'; class OrderDetailsService extends BaseService{ @@ -16,10 +17,8 @@ class OrderDetailsService extends BaseService{ AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); -// String url =""; -// List get orderDetails => ordeDetails; - List _orderList = List(); - List get orderList => _orderList; + List _orderList = List(); + List get orderList => _orderList; Future getOrderDetails(OrderId) async { @@ -28,7 +27,7 @@ class OrderDetailsService extends BaseService{ onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { - _orderList.add(OrderModel.fromJson(item)); + _orderList.add(OrderDetailModel.fromJson(item)); print(response); }); }, onFailure: (String error, int statusCode) { @@ -37,7 +36,7 @@ class OrderDetailsService extends BaseService{ }); } - Future makeReview(Product product, double rating, String reviewText) async { + Future makeReview(PharmacyProduct product, double rating, String reviewText) async { hasError = false; super.error = ""; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cd481df0..9b52b54d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -855,6 +855,9 @@ class TranslationBase { localizedValues['beneficiaryName'][locale.languageCode]; String get accountActivation => localizedValues['accountActivation'][locale.languageCode]; + + String get lakumTransfer => + localizedValues['lakumTransfer'][locale.languageCode]; String get acceptLbl => localizedValues['acceptLbl'][locale.languageCode]; String get termsService => @@ -1553,6 +1556,23 @@ class TranslationBase { String get preferredunit => localizedValues["preferredunit"][locale.languageCode]; String get trySaying => localizedValues["try-saying"][locale.languageCode]; + String get enterIdentificationNumber => + localizedValues["enterIdentificationNumber"][locale.languageCode]; + String get accountActivationDesc => + localizedValues["accountActivationDesc"][locale.languageCode]; + String get pointsToTransfer => + localizedValues["pointsToTransfer"][locale.languageCode]; + String get enterBeneficiaryAccountNo => + localizedValues["enterBeneficiaryAccountNo"][locale.languageCode]; + String get confirmPrescription => + localizedValues["confirm-prescription"][locale.languageCode]; + String get youAlreadyHaveOrder => + localizedValues["you-already-have-order"][locale.languageCode]; + String get orderOverview => + localizedValues["order-overview"][locale.languageCode]; + String get shippingAddresss => + localizedValues["shipping-address"][locale.languageCode]; + String get covidAlert => localizedValues["covid-alert"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 85e97429..c08d68a4 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -183,6 +183,15 @@ class Utils { // } } + static getPhoneNumberWithoutZero(String number){ + String newNumber=""; + if(number.startsWith('0')) + { + newNumber = number.substring(1); + } + return newNumber; + } + static Uint8List dataFromBase64String(String base64String) { return base64Decode(base64String); } @@ -541,6 +550,8 @@ Future userData() async { return userData; } + + // extension function that use in iterations(list.. etc) to iterate items and get index and item it self extension IndexedIterable on Iterable { Iterable mapIndexed(T Function(E e, int i) f) { diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 53822f1d..f33e9dd5 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -116,12 +117,10 @@ class _BottomNavBarState extends State { } Future navigateToBookingOptions(context) async { - Navigator.push( - context, MaterialPageRoute(builder: (context) => BookingOptions())); + Navigator.push(context, FadePage(page: BookingOptions())); } Future navigateToToDoList(context) async { - Navigator.push(context, - MaterialPageRoute(builder: (context) => ToDo(isShowAppBar: false))); + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); } } diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index 5d7c9257..331ce4b6 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -19,7 +19,7 @@ class Button extends StatefulWidget { this.onTap, this.backgroundColor, this.loading: false, - this.elevation: true}) + this.elevation: true, this.disabled=false}) : super(key: key); final String label; @@ -28,6 +28,7 @@ class Button extends StatefulWidget { final bool loading; final bool elevation; final Color backgroundColor; + final bool disabled; @override _ButtonState createState() => _ButtonState(); @@ -83,75 +84,78 @@ class _ButtonState extends State