Merge branches 'development' and 'fix_bugs_Mar' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into fix_bugs_Mar

merge-requests/297/head
Elham Rababah 4 years ago
commit fa23c607bd

1
.gitignore vendored

@ -25,6 +25,7 @@
.dart_tool/
.flutter-plugins
pubspec.lock
/ios/Podfile.lock
.flutter-plugins-dependencies
.packages
.pub-cache/

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

@ -0,0 +1,37 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 299.19 299.19">
<defs>
<style>
.cls-1 {
fill: #a02228;
}
.cls-2 {
fill: #c42829;
}
.cls-3, .cls-4 {
fill: #fff;
}
.cls-4 {
font-size: 63.99px;
font-family: GESSTwoMedium-Medium, GE SS Two;
font-weight: 500;
}
</style>
</defs>
<g id="Layer_2" data-name="Layer 2">
<g id="Layer_1-2" data-name="Layer 1">
<g>
<rect class="cls-1" x="154.78" width="144.13" height="42.56"/>
<rect class="cls-1" y="154.77" width="42.56" height="144.13"/>
<polygon class="cls-2" points="0 154.31 154.31 0 299.19 0 0 299.19 0 154.31"/>
<g>
<polygon class="cls-2" points="14.51 160.32 160.32 14.51 264.16 14.51 14.51 264.16 14.51 160.32"/>
<path class="cls-3" d="M259.49,16.44l-243,243.05V161.12L161.12,16.44Zm9.34-3.86H159.52L12.58,159.52V268.83L268.83,12.58Z"/>
</g>
<text class="cls-4" transform="translate(64.37 181.67) rotate(-45)">مصخ</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 312.6 292.7" style="enable-background:new 0 0 312.6 292.7;" xml:space="preserve">
<style type="text/css">
.st0{fill:#A02228;}
.st1{fill:#C42829;}
.st2{fill:#FFFFFF;}
</style>
<g id="Layer_2_1_">
<g id="Layer_1-2">
<g>
<rect x="152.5" y="1" class="st0" width="141.2" height="41.7"/>
<rect x="0.9" y="152.6" class="st0" width="41.7" height="141.2"/>
<polygon class="st1" points="0.9,152.2 152.1,1 294,1 0.9,294.1 "/>
<g>
<polygon class="st1" points="15.1,158.1 158,15.2 259.7,15.2 15.1,259.8 "/>
<path class="st2" d="M255.1,17.1l-238,238.1v-96.4L158.7,17.1H255.1z M264.3,13.3H157.2L13.2,157.3v107.1
C13.2,264.4,264.3,13.3,264.3,13.3z"/>
</g>
<g>
<path class="st2" d="M30.9,176.1l7.3-7.3c6.3-6.3,13.6-6.2,19.3-0.5c5.3,5.3,5.4,12.8-0.7,18.9l-7.4,7.4L30.9,176.1z
M49.9,186.6l3-3c3.8-3.8,3.6-7.8,0.4-11c-3.5-3.5-7.5-3.6-11.4,0.3l-2.9,2.9L49.9,186.6z"/>
<path class="st2" d="M50.8,156.2L55,152l18.5,18.5l-4.2,4.2L50.8,156.2z"/>
<path class="st2" d="M67.9,149.1c1.4,1.4,3.5,0.6,6.3-1.4c5.6-3.8,8.9-4.5,12.4-1c3.3,3.3,2.8,8.5-1.9,13.2
c-1.8,1.8-4,3.2-6.5,3.9c-2.6,0.7-5.4,0.4-7.8-0.8l1.3-5.8c3,1.9,7,1.4,9.4-1.2c2-1.9,2.5-3.8,1.4-5c-1.1-1.1-2.7-1.1-6.5,1.7
c-4.5,3.4-8.9,4.1-12.4,0.6c-2.9-2.9-2.6-7.9,1.6-12.1c3.5-3.5,7.7-4.5,11.8-2.5l-1.5,5.4c-2.8-1.4-4.9-1.2-6.9,0.8
C67.2,146.4,67,148.2,67.9,149.1z"/>
<path class="st2" d="M99.9,137c3.1-3.1,3-7,0.5-10.8l5.4-2.3c3.5,5.6,2.9,11.9-2.2,16.9c-5.9,5.9-13.8,5.6-19.2,0.2
c-5.3-5.1-5.4-13.6-0.2-18.8c0.1-0.1,0.3-0.3,0.4-0.4c4.9-4.9,10.7-5.3,14.9-2.6l-2.1,5.6c-2.8-2-6.7-1.6-9.1,0.9
c-2.9,2.9-3.1,7.6,0.3,11.1c2.8,3.1,7.7,3.4,10.8,0.6C99.7,137.2,99.8,137.1,99.9,137z"/>
<path class="st2" d="M125.2,100.4c5.3,5.1,5.2,14.1-0.3,19.3c-5.2,5.4-14.3,5.5-19.3,0.3c-5.3-5.1-5.2-14.1,0.3-19.3
C111.1,95.2,120.1,95.1,125.2,100.4z M120.9,104.6c-3.1-3.1-8-3-11.1,0c-3.1,3.1-3,8,0,11.1c3.1,3,8,3,11,0
c3.2-2.6,4-7.1,1.3-10.3C121.9,105,121.6,104.6,120.9,104.6z"/>
<path class="st2" d="M122.7,84.3l11,11c2.4,2.4,5.2,2.7,7.5,0.4c2.3-2.3,2-5.1-0.4-7.5l-11-11L134,73l11,11
c4.8,4.8,4.8,10.8,0,15.6c-4.8,4.8-10.9,4.8-15.6,0l-11-11L122.7,84.3z"/>
<path class="st2" d="M160,84l-4.2,4.2l-18.5-18.5l7.2-7.2l22.5,8.9l-15.7-15.7l4.2-4.2L174.1,70l-7.2,7.2l-22.5-8.9L160,84z"/>
<path class="st2" d="M178.6,36.1l-6.3,6.3l14.7,14.7l-4.2,4.2L168,46.7l-6.4,6.4l-3.8-3.8l16.9-16.9L178.6,36.1z"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -1,3 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="312.602" height="292.689" viewBox="0 0 312.602 292.689">
<defs>
<radialGradient id="radial-gradient" cx="0.236" cy="0.508" r="0.361" gradientTransform="matrix(4.725, 0.181, -0.871, 0.983, -15.148, -0.89)" gradientUnits="objectBoundingBox">

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

@ -1 +1 @@
59a6c452ee075b50114918f17f1ad8f5
45a7d43b55124e1b314759554f9a14d3

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt</string>
<key>ANDROID_CLIENT_ID</key>
<string>815750722565-m14h8mkosm7cnq6uh6rhqr54dn02d705.apps.googleusercontent.com</string>
<key>API_KEY</key>
<string>AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA</string>
<key>GCM_SENDER_ID</key>
<string>815750722565</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.HMG.HMG-Smartphone</string>
<key>PROJECT_ID</key>
<string>api-project-815750722565</string>
<key>STORAGE_BUCKET</key>
<string>api-project-815750722565.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:815750722565:ios:328ec247a81a2ca23c186c</string>
<key>DATABASE_URL</key>
<string>https://api-project-815750722565.firebaseio.com</string>
</dict>
</plist>

@ -1,9 +1,235 @@
PODS:
- abseil/algorithm (0.20200225.0):
- abseil/algorithm/algorithm (= 0.20200225.0)
- abseil/algorithm/container (= 0.20200225.0)
- abseil/algorithm/algorithm (0.20200225.0):
- abseil/base/config
- abseil/algorithm/container (0.20200225.0):
- abseil/algorithm/algorithm
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/base (0.20200225.0):
- abseil/base/atomic_hook (= 0.20200225.0)
- abseil/base/base (= 0.20200225.0)
- abseil/base/base_internal (= 0.20200225.0)
- abseil/base/bits (= 0.20200225.0)
- abseil/base/config (= 0.20200225.0)
- abseil/base/core_headers (= 0.20200225.0)
- abseil/base/dynamic_annotations (= 0.20200225.0)
- abseil/base/endian (= 0.20200225.0)
- abseil/base/errno_saver (= 0.20200225.0)
- abseil/base/exponential_biased (= 0.20200225.0)
- abseil/base/log_severity (= 0.20200225.0)
- abseil/base/malloc_internal (= 0.20200225.0)
- abseil/base/periodic_sampler (= 0.20200225.0)
- abseil/base/pretty_function (= 0.20200225.0)
- abseil/base/raw_logging_internal (= 0.20200225.0)
- abseil/base/spinlock_wait (= 0.20200225.0)
- abseil/base/throw_delegate (= 0.20200225.0)
- abseil/base/atomic_hook (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/base (0.20200225.0):
- abseil/base/atomic_hook
- abseil/base/base_internal
- abseil/base/config
- abseil/base/core_headers
- abseil/base/dynamic_annotations
- abseil/base/log_severity
- abseil/base/raw_logging_internal
- abseil/base/spinlock_wait
- abseil/meta/type_traits
- abseil/base/base_internal (0.20200225.0):
- abseil/base/config
- abseil/meta/type_traits
- abseil/base/bits (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/config (0.20200225.0)
- abseil/base/core_headers (0.20200225.0):
- abseil/base/config
- abseil/base/dynamic_annotations (0.20200225.0)
- abseil/base/endian (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/errno_saver (0.20200225.0):
- abseil/base/config
- abseil/base/exponential_biased (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/log_severity (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/malloc_internal (0.20200225.0):
- abseil/base/base
- abseil/base/base_internal
- abseil/base/config
- abseil/base/core_headers
- abseil/base/dynamic_annotations
- abseil/base/raw_logging_internal
- abseil/base/periodic_sampler (0.20200225.0):
- abseil/base/core_headers
- abseil/base/exponential_biased
- abseil/base/pretty_function (0.20200225.0)
- abseil/base/raw_logging_internal (0.20200225.0):
- abseil/base/atomic_hook
- abseil/base/config
- abseil/base/core_headers
- abseil/base/log_severity
- abseil/base/spinlock_wait (0.20200225.0):
- abseil/base/base_internal
- abseil/base/core_headers
- abseil/base/errno_saver
- abseil/base/throw_delegate (0.20200225.0):
- abseil/base/config
- abseil/base/raw_logging_internal
- abseil/container/compressed_tuple (0.20200225.0):
- abseil/utility/utility
- abseil/container/inlined_vector (0.20200225.0):
- abseil/algorithm/algorithm
- abseil/base/core_headers
- abseil/base/throw_delegate
- abseil/container/inlined_vector_internal
- abseil/memory/memory
- abseil/container/inlined_vector_internal (0.20200225.0):
- abseil/base/core_headers
- abseil/container/compressed_tuple
- abseil/memory/memory
- abseil/meta/type_traits
- abseil/types/span
- abseil/memory (0.20200225.0):
- abseil/memory/memory (= 0.20200225.0)
- abseil/memory/memory (0.20200225.0):
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/meta (0.20200225.0):
- abseil/meta/type_traits (= 0.20200225.0)
- abseil/meta/type_traits (0.20200225.0):
- abseil/base/config
- abseil/numeric/int128 (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/strings/internal (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/base/endian
- abseil/base/raw_logging_internal
- abseil/meta/type_traits
- abseil/strings/str_format (0.20200225.0):
- abseil/strings/str_format_internal
- abseil/strings/str_format_internal (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/numeric/int128
- abseil/strings/strings
- abseil/types/span
- abseil/strings/strings (0.20200225.0):
- abseil/base/base
- abseil/base/bits
- abseil/base/config
- abseil/base/core_headers
- abseil/base/endian
- abseil/base/raw_logging_internal
- abseil/base/throw_delegate
- abseil/memory/memory
- abseil/meta/type_traits
- abseil/numeric/int128
- abseil/strings/internal
- abseil/time (0.20200225.0):
- abseil/time/internal (= 0.20200225.0)
- abseil/time/time (= 0.20200225.0)
- abseil/time/internal (0.20200225.0):
- abseil/time/internal/cctz (= 0.20200225.0)
- abseil/time/internal/cctz (0.20200225.0):
- abseil/time/internal/cctz/civil_time (= 0.20200225.0)
- abseil/time/internal/cctz/time_zone (= 0.20200225.0)
- abseil/time/internal/cctz/civil_time (0.20200225.0):
- abseil/base/config
- abseil/time/internal/cctz/time_zone (0.20200225.0):
- abseil/base/config
- abseil/time/internal/cctz/civil_time
- abseil/time/time (0.20200225.0):
- abseil/base/base
- abseil/base/core_headers
- abseil/base/raw_logging_internal
- abseil/numeric/int128
- abseil/strings/strings
- abseil/time/internal/cctz/civil_time
- abseil/time/internal/cctz/time_zone
- abseil/types (0.20200225.0):
- abseil/types/any (= 0.20200225.0)
- abseil/types/bad_any_cast (= 0.20200225.0)
- abseil/types/bad_any_cast_impl (= 0.20200225.0)
- abseil/types/bad_optional_access (= 0.20200225.0)
- abseil/types/bad_variant_access (= 0.20200225.0)
- abseil/types/compare (= 0.20200225.0)
- abseil/types/optional (= 0.20200225.0)
- abseil/types/span (= 0.20200225.0)
- abseil/types/variant (= 0.20200225.0)
- abseil/types/any (0.20200225.0):
- abseil/base/config
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/types/bad_any_cast
- abseil/utility/utility
- abseil/types/bad_any_cast (0.20200225.0):
- abseil/base/config
- abseil/types/bad_any_cast_impl
- abseil/types/bad_any_cast_impl (0.20200225.0):
- abseil/base/config
- abseil/base/raw_logging_internal
- abseil/types/bad_optional_access (0.20200225.0):
- abseil/base/config
- abseil/base/raw_logging_internal
- abseil/types/bad_variant_access (0.20200225.0):
- abseil/base/config
- abseil/base/raw_logging_internal
- abseil/types/compare (0.20200225.0):
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/types/optional (0.20200225.0):
- abseil/base/base_internal
- abseil/base/config
- abseil/base/core_headers
- abseil/memory/memory
- abseil/meta/type_traits
- abseil/types/bad_optional_access
- abseil/utility/utility
- abseil/types/span (0.20200225.0):
- abseil/algorithm/algorithm
- abseil/base/core_headers
- abseil/base/throw_delegate
- abseil/meta/type_traits
- abseil/types/variant (0.20200225.0):
- abseil/base/base_internal
- abseil/base/config
- abseil/base/core_headers
- abseil/meta/type_traits
- abseil/types/bad_variant_access
- abseil/utility/utility
- abseil/utility/utility (0.20200225.0):
- abseil/base/base_internal
- abseil/base/config
- abseil/meta/type_traits
- android_intent (0.0.1):
- Flutter
- barcode_scan_fix (0.0.1):
- Flutter
- MTBBarcodeScanner
- BoringSSL-GRPC (0.0.7):
- BoringSSL-GRPC/Implementation (= 0.0.7)
- BoringSSL-GRPC/Interface (= 0.0.7)
- BoringSSL-GRPC/Implementation (0.0.7):
- BoringSSL-GRPC/Interface (= 0.0.7)
- BoringSSL-GRPC/Interface (0.0.7)
- cloud_firestore (0.14.4):
- Firebase/CoreOnly (~> 6.33.0)
- Firebase/Firestore (~> 6.33.0)
- firebase_core
- Flutter
- cloud_firestore_web (0.1.0):
- Flutter
- connectivity (0.0.1):
- Flutter
- Reachability
@ -15,8 +241,47 @@ PODS:
- Flutter
- device_info (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.2):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.2)
- DKImagePickerController/PhotoGallery (4.3.2):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.2)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
- DKPhotoGallery/Preview (= 0.0.17)
- DKPhotoGallery/Resource (= 0.0.17)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.17):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- file_picker_web (0.0.1):
- Flutter
- Firebase/CoreOnly (6.33.0):
- FirebaseCore (= 6.10.3)
- Firebase/Firestore (6.33.0):
- Firebase/CoreOnly
- FirebaseFirestore (~> 1.18.0)
- Firebase/Messaging (6.33.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.7.0)
@ -39,6 +304,18 @@ PODS:
- GoogleUtilities/Environment (~> 6.7)
- GoogleUtilities/Logger (~> 6.7)
- nanopb (~> 1.30906.0)
- FirebaseFirestore (1.18.0):
- abseil/algorithm (= 0.20200225.0)
- abseil/base (= 0.20200225.0)
- abseil/memory (= 0.20200225.0)
- abseil/meta (= 0.20200225.0)
- abseil/strings/strings (= 0.20200225.0)
- abseil/time (= 0.20200225.0)
- abseil/types (= 0.20200225.0)
- FirebaseCore (~> 6.10)
- "gRPC-C++ (~> 1.28.0)"
- leveldb-library (~> 1.22)
- nanopb (~> 1.30906.0)
- FirebaseInstallations (1.7.0):
- FirebaseCore (~> 6.10)
- GoogleUtilities/Environment (~> 6.7)
@ -70,7 +347,10 @@ PODS:
- Flutter
- flutter_tts (0.0.1):
- Flutter
- geolocator (6.1.9):
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- geolocator (6.2.0):
- Flutter
- google_maps_flutter (0.0.1):
- Flutter
@ -99,6 +379,30 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.7.2):
- GoogleUtilities/Logger
- "gRPC-C++ (1.28.2)":
- "gRPC-C++/Implementation (= 1.28.2)"
- "gRPC-C++/Interface (= 1.28.2)"
- "gRPC-C++/Implementation (1.28.2)":
- abseil/container/inlined_vector (= 0.20200225.0)
- abseil/memory/memory (= 0.20200225.0)
- abseil/strings/str_format (= 0.20200225.0)
- abseil/strings/strings (= 0.20200225.0)
- abseil/types/optional (= 0.20200225.0)
- "gRPC-C++/Interface (= 1.28.2)"
- gRPC-Core (= 1.28.2)
- "gRPC-C++/Interface (1.28.2)"
- gRPC-Core (1.28.2):
- gRPC-Core/Implementation (= 1.28.2)
- gRPC-Core/Interface (= 1.28.2)
- gRPC-Core/Implementation (1.28.2):
- abseil/container/inlined_vector (= 0.20200225.0)
- abseil/memory/memory (= 0.20200225.0)
- abseil/strings/str_format (= 0.20200225.0)
- abseil/strings/strings (= 0.20200225.0)
- abseil/types/optional (= 0.20200225.0)
- BoringSSL-GRPC (= 0.0.7)
- gRPC-Core/Interface (= 1.28.2)
- gRPC-Core/Interface (1.28.2)
- hexcolor (0.0.1):
- Flutter
- image_cropper (0.0.3):
@ -108,6 +412,7 @@ PODS:
- Flutter
- just_audio (0.0.1):
- Flutter
- leveldb-library (1.22)
- local_auth (0.0.1):
- Flutter
- location (0.0.1):
@ -126,8 +431,6 @@ PODS:
- 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)
@ -139,13 +442,16 @@ PODS:
- Flutter
- path_provider_windows (0.0.1):
- Flutter
- "permission_handler (5.0.1+1)":
- "permission_handler (5.1.0+2)":
- Flutter
- PromisesObjC (1.2.11)
- Protobuf (3.13.0)
- PromisesObjC (1.2.12)
- Protobuf (3.14.0)
- Reachability (3.2)
- screen (0.0.1):
- Flutter
- SDWebImage (5.10.4):
- SDWebImage/Core (= 5.10.4)
- SDWebImage/Core (5.10.4)
- shared_preferences (0.0.1):
- Flutter
- shared_preferences_linux (0.0.1):
@ -156,9 +462,15 @@ PODS:
- Flutter
- shared_preferences_windows (0.0.1):
- Flutter
- sms_otp_auto_verify (0.0.1):
- Flutter
- speech_to_text (0.0.1):
- Flutter
- Try
- sqflite (0.0.2):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.0)
- TOCropViewController (2.5.5)
- Try (2.1.1)
- "twilio_programmable_video (0.5.0+4)":
@ -193,11 +505,15 @@ PODS:
DEPENDENCIES:
- android_intent (from `.symlinks/plugins/android_intent/ios`)
- barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`)
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
- cloud_firestore_web (from `.symlinks/plugins/cloud_firestore_web/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`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_picker_web (from `.symlinks/plugins/file_picker_web/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`)
@ -220,7 +536,6 @@ DEPENDENCIES:
- 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`)
@ -233,7 +548,9 @@ DEPENDENCIES:
- 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`)
- sms_otp_auto_verify (from `.symlinks/plugins/sms_otp_auto_verify/ios`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
- sqflite (from `.symlinks/plugins/sqflite/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`)
@ -250,21 +567,32 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- abseil
- BoringSSL-GRPC
- DKImagePickerController
- DKPhotoGallery
- Firebase
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseFirestore
- FirebaseInstallations
- FirebaseInstanceID
- FirebaseMessaging
- FMDB
- GoogleDataTransport
- GoogleMaps
- GoogleUtilities
- "gRPC-C++"
- gRPC-Core
- leveldb-library
- MTBBarcodeScanner
- nanopb
- NVActivityIndicatorView
- PromisesObjC
- Protobuf
- Reachability
- SDWebImage
- SwiftyGif
- TOCropViewController
- Try
- TwilioVideo
@ -274,6 +602,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/android_intent/ios"
barcode_scan_fix:
:path: ".symlinks/plugins/barcode_scan_fix/ios"
cloud_firestore:
:path: ".symlinks/plugins/cloud_firestore/ios"
cloud_firestore_web:
:path: ".symlinks/plugins/cloud_firestore_web/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
connectivity_for_web:
@ -284,6 +616,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/device_calendar/ios"
device_info:
:path: ".symlinks/plugins/device_info/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_picker_web:
:path: ".symlinks/plugins/file_picker_web/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_core_web:
@ -328,8 +664,6 @@ EXTERNAL SOURCES:
: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:
@ -352,8 +686,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_web/ios"
shared_preferences_windows:
:path: ".symlinks/plugins/shared_preferences_windows/ios"
sms_otp_auto_verify:
:path: ".symlinks/plugins/sms_otp_auto_verify/ios"
speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
twilio_programmable_video:
:path: ".symlinks/plugins/twilio_programmable_video/ios"
url_launcher:
@ -382,19 +720,28 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wifi/ios"
SPEC CHECKSUMS:
abseil: 6c8eb7892aefa08d929b39f9bb108e5367e3228f
android_intent: 367df2f1277a74e4a90e14a8ab3df3112d087052
barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1
BoringSSL-GRPC: 8edf627ee524575e2f8d19d56f068b448eea3879
cloud_firestore: b8c0e15fa49dfff87c2817d288b577e5dca2df13
cloud_firestore_web: 9ec3dc7f5f98de5129339802d491c1204462bfec
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b
connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191
device_calendar: 23b28a5f1ab3bf77e34542fb1167e1b8b29a98f5
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
file_picker_web: 37b10786e88885124fac99dc899866e78a132ef3
Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5
firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659
firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1
firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75
FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd
FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1
FirebaseFirestore: adff4877869ca91a11250cc0989a6cd56bad163f
FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2
FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1
FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a
@ -405,15 +752,19 @@ SPEC CHECKSUMS:
flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186
flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35
flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d
geolocator: 057a0c63a43e9c5296d8ad845a3ac8e6df23d899
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
geolocator: f5e3de65e241caba7ce3e8a618803387bda73384
google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619
GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
"gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2
gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5
hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89
image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7
local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34
@ -422,23 +773,26 @@ SPEC CHECKSUMS:
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
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
Protobuf: 0cde852566359049847168e51bd1c690e0f70056
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
SDWebImage: c666b97e1fa9c64b4909816a903322018f0a9c84
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae
sms_otp_auto_verify: 201803ac25e13feedaae96eda8b70b10c55b3338
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7
TOCropViewController: da59f531f8ac8a94ef6d6c0fc34009350f9e8bfe
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
twilio_programmable_video: 6a41593640f3d86af60b22541fd457b22deaae7f
@ -456,6 +810,6 @@ SPEC CHECKSUMS:
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
wifi: d7d77c94109e36c4175d845f0a5964eadba71060
PODFILE CHECKSUM: 5a17be3f8af73a757fa4439c77cf6ab2db29a6e7
PODFILE CHECKSUM: ac5efa1ac3c9555d0008dc18004313c84746da62
COCOAPODS: 1.10.0
COCOAPODS: 1.10.1

@ -220,6 +220,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
EFDAD5E1235DCA1DB6187148 /* [CP] Embed Pods Frameworks */,
A22727229BC544AD6D5B2B5F /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -333,6 +334,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
A22727229BC544AD6D5B2B5F /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
EFDAD5E1235DCA1DB6187148 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

@ -11,7 +11,7 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil
override func application( _ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
GMSServices.provideAPIKey("AIzaSyCiiJiHkocPbcziHt9O8rGWavDrxHRQys8")
GMSServices.provideAPIKey("AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw")
GeneratedPluginRegistrant.register(with: self)
initializePlatformChannel()

@ -6,20 +6,23 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
const MAX_SMALL_SCREEN = 660;
// PACKAGES and OFFERS
const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/exacartapi';
const EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000';
const PACKAGES_CATEGORIES = '/api/categories';
const PACKAGES_PRODUCTS = '/api/products';
const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
// const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
// Pharmacy Production URLs
const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
// const BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/';
// const PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/';
const PING_SERVICE = 'Services/Weather.svc/REST/CheckConnectivity';
@ -28,6 +31,10 @@ const GET_PROJECT = 'Services/Lists.svc/REST/GetProject';
///Geofencing
const GET_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_GetAllPoints';
const LOG_GEO_ZONES = 'Services/Patients.svc/REST/GeoF_InsertPatientFileInfo';
// Delivery Driver
const DRIVER_LOCATION = 'Services/Patients.svc/REST/PatientER_GetDriverLocation';
//weather
const WEATHER_INDICATOR = 'Services/Weather.svc/REST/GetCityInfo';
@ -95,9 +102,12 @@ const GET_NEAREST_HOSPITAL =
'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime';
///ED Online
const ER_GET_VISUAL_TRIAGE_QUESTIONS = "services/Doctors.svc/REST/ER_GetVisualTriageQuestions";
const ER_SAVE_TRIAGE_INFORMATION = "services/Doctors.svc/REST/ER_SaveTriageInformation";
const ER_GetPatientPaymentInformationForERClinic = "services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic";
const ER_GET_VISUAL_TRIAGE_QUESTIONS =
"services/Doctors.svc/REST/ER_GetVisualTriageQuestions";
const ER_SAVE_TRIAGE_INFORMATION =
"services/Doctors.svc/REST/ER_SaveTriageInformation";
const ER_GetPatientPaymentInformationForERClinic =
"services/Doctors.svc/REST/ER_GetPatientPaymentInformationForERClinic";
///Er Nearest
const GET_AMBULANCE_REQUEST =
@ -210,6 +220,10 @@ const GET_PATIENT_SHARE =
const GET_PATIENT_APPOINTMENT_HISTORY =
"Services/Doctors.svc/REST/PateintHasAppoimentHistory";
const SEND_REPORT_EYE_EMAIL = "Services/Notifications.svc/REST/SendGlassesPrescriptionEmail";
const SEND_CONTACT_LENS_PRESCRIPTION_EMAIL = "Services/Notifications.svc/REST/SendContactLensPrescriptionEmail";
//URL to get patient appointment curfew history
const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY =
"Services/Doctors.svc/REST/AppoimentHistoryForCurfew";
@ -312,7 +326,7 @@ var DEVICE_TOKEN = "";
var IS_VOICE_COMMAND_CLOSED = false;
var IS_TEXT_COMPLETED = false;
var DeviceTypeID = Platform.isIOS ? 1 : 2;
const LANGUAGE_ID = 1;
const LANGUAGE_ID = 2;
const GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region";
const GET_PHARMACY_LIST = "Services/Patients.svc/REST/GetPharmcyList";
const GET_PAtIENTS_INSURANCE =
@ -534,12 +548,9 @@ const GET_SPECIFICATION = "productspecification/";
const GET_BRAND_ITEMS = "products";
// External API
const ADD_ADDRESS_INFO =
"addcustomeraddress";
const GET_CUSTOMER_ADDRESSES =
"Customers/";
const GET_CUSTOMER_INFO =
"VerifyCustomer";
const ADD_ADDRESS_INFO = "addcustomeraddress";
const GET_CUSTOMER_ADDRESSES = "Customers/";
const GET_CUSTOMER_INFO = "VerifyCustomer";
//Pharmacy

@ -546,6 +546,9 @@ const Map localizedValues = {
"History": {"en": "History", "ar": "السجلات"},
"OrderNo": {"en": "Order No", "ar": "رقم الطلب"},
"OrderDetails": {"en": "Order Details", "ar": "تفاصيل الطلب"},
"DeliveryDriverTrack": {"en": "Driver Tracking", "ar": "تتبع السائق"},
"DeliveryLocation": {"en": "Delivery Location", "ar": "موقع التسليم"},
"Driver": {"en": "Driver", "ar": "السائق"},
"VitalSign": {"en": "Vital Sign", "ar": "العلامة حيوية"},
"MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"},
"km": {"en": "KMs:", "ar": "كم"},
@ -643,8 +646,8 @@ const Map localizedValues = {
"Remarks": {"en": "Remarks", "ar": "ملاحضات"},
"ActiveMedications": {"en": "Active Medications", "ar": "ادويتي النشطة"},
"ExpDate": {"en": "Active Exp Date :", "VA": "تاريخ الإنتهاء"},
"Route": {"en": "Route :", "ar": "الطريقة"},
"Frequency": {"en": "Frequency :", "ar": "المعدل"},
"Route": {"en": "Route", "ar": "الطريقة"},
"Frequency": {"en": "Frequency", "ar": "المعدل"},
"DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"},
"AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"},
"reminderDes": {
@ -836,6 +839,7 @@ const Map localizedValues = {
"bestSellers": {"en": "Best Sellers", "ar": "أفضل البائعين"},
"deleteAllItems": {"en": "Delete All Items", "ar": "حذف كافة العناصر"},
"total": {"en": "Total", "ar": "المجموع"},
"totalWithColonRight": {"en": "Total:", "ar": ":المجموع"},
"selectAddress": {"en": "Select Address", "ar": "حدد العنوان"},
"shippingAddress": {"en": "SHIPPING ADDRESS", "ar": "عنوان الشحن"},
"changeAddress": {"en": "Change Address", "ar": "تغيير العنوان"},
@ -1084,6 +1088,7 @@ const Map localizedValues = {
"Average": {"en": "Average", "ar": "المعدل"},
"DailyDoses": {"en": "Daily Doses", "ar": "جرعات يومية"},
"Period": {"en": "Period", "ar": "الفترة"},
"duration": {"en": "Duration", "ar": "المدة"},
"cm": {"en": "CM", "ar": "سم"},
"ft": {"en": "ft", "ar": "قدم"},
"kg": {"en": "kg", "ar": "كجم"},

@ -0,0 +1,34 @@
enum PaymentOptions {
VISA,
MASTERCARD,
MADA,
INSTALLMENT,
APPLEPAY
}
extension PaymentOptions_ on PaymentOptions{
String value(){
switch(this){
case PaymentOptions.VISA:
return "VISA";
break;
case PaymentOptions.MASTERCARD:
return "MASTERCARD";
break;
case PaymentOptions.MADA:
return "MADA";
break;
case PaymentOptions.INSTALLMENT:
return "INSTALLMENT";
break;
case PaymentOptions.APPLEPAY:
return "APPLEPAY";
break;
}
return null;
}
}

@ -0,0 +1,7 @@
class ResponseModel<T>{
final bool status;
final String error;
final T data;
ResponseModel({this.status, this.data, this.error});
}

@ -0,0 +1,26 @@
import 'package:flutter/cupertino.dart';
class AddProductToCartRequestModel {
int quantity;
int product_id;
String shopping_cart_type;
int customer_id;
AddProductToCartRequestModel({@required this.product_id, this.customer_id, this.shopping_cart_type = "ShoppingCart", this.quantity = 1});
Map<String, dynamic> json() {
return {
"shopping_cart_item" : {
"quantity": quantity,
"product_id": product_id,
"shopping_cart_type": shopping_cart_type,
"customer_id": customer_id
}
};
}
}
class UpdateProductToCartRequestModel extends AddProductToCartRequestModel{
UpdateProductToCartRequestModel({@required int product_id, @required int customer_id, String shopping_cart_type = "ShoppingCart", int quantity = 1})
: super(customer_id: customer_id, product_id: product_id, quantity: quantity, shopping_cart_type: shopping_cart_type);
}

@ -0,0 +1,21 @@
import 'package:flutter/cupertino.dart';
class PackagesCustomerRequestModel {
String email;
String phoneNumber;
PackagesCustomerRequestModel({@required this.email, @required this.phoneNumber});
Map<String, dynamic> json() {
return {
"customer" : {
"email": email,
"addresses": [{
"email": email,
"phone_number": phoneNumber
}]
}
};
}
}

@ -6,6 +6,12 @@ class OffersCategoriesRequestModel {
OffersCategoriesRequestModel({this.limit, this.page, this.sinceId});
Map<String, String> toFlatMap() {
return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString()};
return {
if(limit != null && limit > 0)
"limit": limit.toString(),
if(page != null && page > 0)
"page": page.toString(),
};
}
}

@ -1,12 +1,24 @@
class OffersProductsRequestModel {
final int categoryId;
final int limit;
final int page;
final int sinceId;
// final int page;
int sinceId;
OffersProductsRequestModel({this.categoryId, this.limit, this.page, this.sinceId});
OffersProductsRequestModel({this.categoryId, this.limit = 50});
Map<String, String> toFlatMap() {
return {"limit": limit.toString(), "page": page.toString(), "sinceId": sinceId.toString(), "categoryId": categoryId.toString()};
return {
if(limit != null && limit > 0)
"limit": limit.toString(),
// if(page != null && page > 0)
// "page": page.toString(),
if(categoryId != null && categoryId > 0)
"categoryId": categoryId.toString(),
"sinceId": sinceId != null ? sinceId.toString() : "0",
};
}
}

@ -0,0 +1,132 @@
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
class PackagesCartItemsResponseModel {
int _quantity;
set quantity(int value) {
_quantity = value;
}
String _shoppingCartType;
int _productId;
PackagesResponseModel _product;
int _id;
int get quantity => _quantity;
String get shoppingCartType => _shoppingCartType;
int get productId => _productId;
PackagesResponseModel get product => _product;
int get id => _id;
PackagesCartItemsResponseModel({
int quantity,
String shoppingCartType,
int productId,
PackagesResponseModel product,
int id}){
_quantity = quantity;
_shoppingCartType = shoppingCartType;
_productId = productId;
_product = product;
_id = id;
}
PackagesCartItemsResponseModel.fromJson(dynamic json) {
_quantity = json["quantity"];
_shoppingCartType = json["shopping_cart_type"];
_productId = json["product_id"];
_product = json["product"] != null ? PackagesResponseModel().fromJson(json["product"]) : null;
_id = json["id"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["quantity"] = _quantity;
map["shopping_cart_type"] = _shoppingCartType;
map["product_id"] = _productId;
if (_product != null) {
map["product"] = _product.toJson();
}
map["id"] = _id;
return map;
}
}
class Images {
int _id;
int _pictureId;
int _position;
String _src;
dynamic _attachment;
int get id => _id;
int get pictureId => _pictureId;
int get position => _position;
String get src => _src;
dynamic get attachment => _attachment;
Images({
int id,
int pictureId,
int position,
String src,
dynamic attachment}){
_id = id;
_pictureId = pictureId;
_position = position;
_src = src;
_attachment = attachment;
}
Images.fromJson(dynamic json) {
_id = json["id"];
_pictureId = json["picture_id"];
_position = json["position"];
_src = json["src"];
_attachment = json["attachment"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["id"] = _id;
map["picture_id"] = _pictureId;
map["position"] = _position;
map["src"] = _src;
map["attachment"] = _attachment;
return map;
}
}
/// language_id : 1
/// localized_name : "Dermatology testing"
class Localized_names {
int _languageId;
String _localizedName;
int get languageId => _languageId;
String get localizedName => _localizedName;
Localized_names({
int languageId,
String localizedName}){
_languageId = languageId;
_localizedName = localizedName;
}
Localized_names.fromJson(dynamic json) {
_languageId = json["language_id"];
_localizedName = json["localized_name"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["language_id"] = _languageId;
map["localized_name"] = _localizedName;
return map;
}
}

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart';
import 'package:diplomaticquarterapp/generated/json/base/json_field.dart';
class OfferCategoriesResponseModel with JsonConvert<OfferCategoriesResponseModel> {
String id;
class PackagesCategoriesResponseModel with JsonConvert<PackagesCategoriesResponseModel> {
int id;
String name;
String namen;
@JSONField(name: "localized_names")
@ -49,6 +49,18 @@ class OfferCategoriesResponseModel with JsonConvert<OfferCategoriesResponseModel
String seName;
@JSONField(name: "is_leaf")
bool isLeaf;
@override
String toString() {
if(localizedNames.length == 2){
if(localizedNames.first.languageId == 1)
return localizedNames.first.localizedName ?? name;
else if(localizedNames.first.languageId == 2)
return localizedNames.last.localizedName ?? name;
}
return name;
}
}
class OfferCategoriesResponseModelLocalizedName with JsonConvert<OfferCategoriesResponseModelLocalizedName> {

@ -0,0 +1,367 @@
import 'PackagesCartItemsResponseModel.dart';
/// shopping_cart_items : []
/// billing_address : null
/// shipping_address : null
/// addresses : [{"first_name":null,"last_name":null,"email":"a2zzuhaib@gmil.com","company":null,"country_id":null,"country":null,"state_province_id":null,"city":null,"address1":null,"address2":null,"zip_postal_code":null,"phone_number":"0500409598","fax_number":null,"customer_attributes":null,"created_on_utc":"2021-03-11T09:40:23.8091261Z","province":null,"id":0}]
/// customer_guid : "1367e5c7-be3b-43cc-ad81-ff1fc8d3b130"
/// username : null
/// email : "a2zzuhaib@gmil.com"
/// first_name : null
/// last_name : null
/// language_id : null
/// date_of_birth : null
/// gender : null
/// admin_comment : null
/// is_tax_exempt : false
/// has_shopping_cart_items : false
/// active : true
/// deleted : false
/// is_system_account : false
/// system_name : null
/// last_ip_address : null
/// created_on_utc : "2021-03-11T09:40:23.7535859Z"
/// last_login_date_utc : null
/// last_activity_date_utc : "2021-03-11T09:40:23.7535892Z"
/// registered_in_store_id : 0
/// subscribed_to_newsletter : false
/// role_ids : []
/// id : 76823
class PackagesCustomerResponseModel {
List<PackagesCartItemsResponseModel> _shoppingCartItems;
dynamic _billingAddress;
dynamic _shippingAddress;
List<Addresses> _addresses;
String _customerGuid;
dynamic _username;
String _email;
dynamic _firstName;
dynamic _lastName;
dynamic _languageId;
dynamic _dateOfBirth;
dynamic _gender;
dynamic _adminComment;
bool _isTaxExempt;
bool _hasShoppingCartItems;
bool _active;
bool _deleted;
bool _isSystemAccount;
dynamic _systemName;
dynamic _lastIpAddress;
String _createdOnUtc;
dynamic _lastLoginDateUtc;
String _lastActivityDateUtc;
int _registeredInStoreId;
bool _subscribedToNewsletter;
List<int> _roleIds;
int _id;
List<dynamic> get shoppingCartItems => _shoppingCartItems;
dynamic get billingAddress => _billingAddress;
dynamic get shippingAddress => _shippingAddress;
List<Addresses> get addresses => _addresses;
String get customerGuid => _customerGuid;
dynamic get username => _username;
String get email => _email;
dynamic get firstName => _firstName;
dynamic get lastName => _lastName;
dynamic get languageId => _languageId;
dynamic get dateOfBirth => _dateOfBirth;
dynamic get gender => _gender;
dynamic get adminComment => _adminComment;
bool get isTaxExempt => _isTaxExempt;
bool get hasShoppingCartItems => _hasShoppingCartItems;
bool get active => _active;
bool get deleted => _deleted;
bool get isSystemAccount => _isSystemAccount;
dynamic get systemName => _systemName;
dynamic get lastIpAddress => _lastIpAddress;
String get createdOnUtc => _createdOnUtc;
dynamic get lastLoginDateUtc => _lastLoginDateUtc;
String get lastActivityDateUtc => _lastActivityDateUtc;
int get registeredInStoreId => _registeredInStoreId;
bool get subscribedToNewsletter => _subscribedToNewsletter;
List<dynamic> get roleIds => _roleIds;
int get id => _id;
PackagesCustomerResponseModel({
List<dynamic> shoppingCartItems,
dynamic billingAddress,
dynamic shippingAddress,
List<Addresses> addresses,
String customerGuid,
dynamic username,
String email,
dynamic firstName,
dynamic lastName,
dynamic languageId,
dynamic dateOfBirth,
dynamic gender,
dynamic adminComment,
bool isTaxExempt,
bool hasShoppingCartItems,
bool active,
bool deleted,
bool isSystemAccount,
dynamic systemName,
dynamic lastIpAddress,
String createdOnUtc,
dynamic lastLoginDateUtc,
String lastActivityDateUtc,
int registeredInStoreId,
bool subscribedToNewsletter,
List<dynamic> roleIds,
int id}){
_shoppingCartItems = shoppingCartItems;
_billingAddress = billingAddress;
_shippingAddress = shippingAddress;
_addresses = addresses;
_customerGuid = customerGuid;
_username = username;
_email = email;
_firstName = firstName;
_lastName = lastName;
_languageId = languageId;
_dateOfBirth = dateOfBirth;
_gender = gender;
_adminComment = adminComment;
_isTaxExempt = isTaxExempt;
_hasShoppingCartItems = hasShoppingCartItems;
_active = active;
_deleted = deleted;
_isSystemAccount = isSystemAccount;
_systemName = systemName;
_lastIpAddress = lastIpAddress;
_createdOnUtc = createdOnUtc;
_lastLoginDateUtc = lastLoginDateUtc;
_lastActivityDateUtc = lastActivityDateUtc;
_registeredInStoreId = registeredInStoreId;
_subscribedToNewsletter = subscribedToNewsletter;
_roleIds = roleIds;
_id = id;
}
PackagesCustomerResponseModel.fromJson(dynamic json) {
_billingAddress = json["billing_address"];
_shippingAddress = json["shipping_address"];
if (json["addresses"] != null) {
_addresses = [];
json["addresses"].forEach((v) {
_addresses.add(Addresses.fromJson(v));
});
}
_customerGuid = json["customer_guid"];
_username = json["username"];
_email = json["email"];
_firstName = json["first_name"];
_lastName = json["last_name"];
_languageId = json["language_id"];
_dateOfBirth = json["date_of_birth"];
_gender = json["gender"];
_adminComment = json["admin_comment"];
_isTaxExempt = json["is_tax_exempt"];
_hasShoppingCartItems = json["has_shopping_cart_items"];
_active = json["active"];
_deleted = json["deleted"];
_isSystemAccount = json["is_system_account"];
_systemName = json["system_name"];
_lastIpAddress = json["last_ip_address"];
_createdOnUtc = json["created_on_utc"];
_lastLoginDateUtc = json["last_login_date_utc"];
_lastActivityDateUtc = json["last_activity_date_utc"];
_registeredInStoreId = json["registered_in_store_id"];
_subscribedToNewsletter = json["subscribed_to_newsletter"];
if (json["role_ids"] != null) {
_roleIds = [];
json["role_ids"].forEach((v) {
_roleIds.add(v);
});
}
if (json["shopping_cart_items"] != null) {
_shoppingCartItems = [];
json["shopping_cart_items"].forEach((v) {
_shoppingCartItems.add(PackagesCartItemsResponseModel.fromJson(v));
});
}
_id = json["id"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
if (_shoppingCartItems != null) {
map["shopping_cart_items"] = _shoppingCartItems.map((v) => v.toJson()).toList();
}
map["billing_address"] = _billingAddress;
map["shipping_address"] = _shippingAddress;
if (_addresses != null) {
map["addresses"] = _addresses.map((v) => v.toJson()).toList();
}
map["customer_guid"] = _customerGuid;
map["username"] = _username;
map["email"] = _email;
map["first_name"] = _firstName;
map["last_name"] = _lastName;
map["language_id"] = _languageId;
map["date_of_birth"] = _dateOfBirth;
map["gender"] = _gender;
map["admin_comment"] = _adminComment;
map["is_tax_exempt"] = _isTaxExempt;
map["has_shopping_cart_items"] = _hasShoppingCartItems;
map["active"] = _active;
map["deleted"] = _deleted;
map["is_system_account"] = _isSystemAccount;
map["system_name"] = _systemName;
map["last_ip_address"] = _lastIpAddress;
map["created_on_utc"] = _createdOnUtc;
map["last_login_date_utc"] = _lastLoginDateUtc;
map["last_activity_date_utc"] = _lastActivityDateUtc;
map["registered_in_store_id"] = _registeredInStoreId;
map["subscribed_to_newsletter"] = _subscribedToNewsletter;
if (_roleIds != null) {
map["role_ids"] = _roleIds.map((v) => v).toList();
}
map["id"] = _id;
return map;
}
}
/// first_name : null
/// last_name : null
/// email : "a2zzuhaib@gmil.com"
/// company : null
/// country_id : null
/// country : null
/// state_province_id : null
/// city : null
/// address1 : null
/// address2 : null
/// zip_postal_code : null
/// phone_number : "0500409598"
/// fax_number : null
/// customer_attributes : null
/// created_on_utc : "2021-03-11T09:40:23.8091261Z"
/// province : null
/// id : 0
class Addresses {
dynamic _firstName;
dynamic _lastName;
String _email;
dynamic _company;
dynamic _countryId;
dynamic _country;
dynamic _stateProvinceId;
dynamic _city;
dynamic _address1;
dynamic _address2;
dynamic _zipPostalCode;
String _phoneNumber;
dynamic _faxNumber;
dynamic _customerAttributes;
String _createdOnUtc;
dynamic _province;
int _id;
dynamic get firstName => _firstName;
dynamic get lastName => _lastName;
String get email => _email;
dynamic get company => _company;
dynamic get countryId => _countryId;
dynamic get country => _country;
dynamic get stateProvinceId => _stateProvinceId;
dynamic get city => _city;
dynamic get address1 => _address1;
dynamic get address2 => _address2;
dynamic get zipPostalCode => _zipPostalCode;
String get phoneNumber => _phoneNumber;
dynamic get faxNumber => _faxNumber;
dynamic get customerAttributes => _customerAttributes;
String get createdOnUtc => _createdOnUtc;
dynamic get province => _province;
int get id => _id;
Addresses({
dynamic firstName,
dynamic lastName,
String email,
dynamic company,
dynamic countryId,
dynamic country,
dynamic stateProvinceId,
dynamic city,
dynamic address1,
dynamic address2,
dynamic zipPostalCode,
String phoneNumber,
dynamic faxNumber,
dynamic customerAttributes,
String createdOnUtc,
dynamic province,
int id}){
_firstName = firstName;
_lastName = lastName;
_email = email;
_company = company;
_countryId = countryId;
_country = country;
_stateProvinceId = stateProvinceId;
_city = city;
_address1 = address1;
_address2 = address2;
_zipPostalCode = zipPostalCode;
_phoneNumber = phoneNumber;
_faxNumber = faxNumber;
_customerAttributes = customerAttributes;
_createdOnUtc = createdOnUtc;
_province = province;
_id = id;
}
Addresses.fromJson(dynamic json) {
_firstName = json["first_name"];
_lastName = json["last_name"];
_email = json["email"];
_company = json["company"];
_countryId = json["country_id"];
_country = json["country"];
_stateProvinceId = json["state_province_id"];
_city = json["city"];
_address1 = json["address1"];
_address2 = json["address2"];
_zipPostalCode = json["zip_postal_code"];
_phoneNumber = json["phone_number"];
_faxNumber = json["fax_number"];
_customerAttributes = json["customer_attributes"];
_createdOnUtc = json["created_on_utc"];
_province = json["province"];
_id = json["id"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["first_name"] = _firstName;
map["last_name"] = _lastName;
map["email"] = _email;
map["company"] = _company;
map["country_id"] = _countryId;
map["country"] = _country;
map["state_province_id"] = _stateProvinceId;
map["city"] = _city;
map["address1"] = _address1;
map["address2"] = _address2;
map["zip_postal_code"] = _zipPostalCode;
map["phone_number"] = _phoneNumber;
map["fax_number"] = _faxNumber;
map["customer_attributes"] = _customerAttributes;
map["created_on_utc"] = _createdOnUtc;
map["province"] = _province;
map["id"] = _id;
return map;
}
}

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/generated/json/base/json_convert_content.dart';
import 'package:diplomaticquarterapp/generated/json/base/json_field.dart';
class OfferProductsResponseModel with JsonConvert<OfferProductsResponseModel> {
String id;
class PackagesResponseModel with JsonConvert<PackagesResponseModel> {
int id;
@JSONField(name: "visible_individually")
bool visibleIndividually;
String name;
@ -205,6 +205,17 @@ class OfferProductsResponseModel with JsonConvert<OfferProductsResponseModel> {
int vendorId;
@JSONField(name: "se_name")
String seName;
String getName() {
if(localizedNames.length == 2){
if(localizedNames.first.languageId == 2)
return localizedNames.first.localizedName ?? name;
else if(localizedNames.first.languageId == 1)
return localizedNames.last.localizedName ?? name;
}
return name;
}
}
class OfferProductsResponseModelLocalizedName with JsonConvert<OfferProductsResponseModelLocalizedName> {

@ -0,0 +1,323 @@
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart';
import 'PackagesCartItemsResponseModel.dart';
class PackagesOrderResponseModel {
String _customOrderNumber;
int _storeId;
dynamic _pickUpInStore;
String _paymentMethodSystemName;
String _customerCurrencyCode;
double _currencyRate;
int _customerTaxDisplayTypeId;
dynamic _vatNumber;
double _orderSubtotalInclTax;
double _orderSubtotalExclTax;
double _orderSubTotalDiscountInclTax;
double _orderSubTotalDiscountExclTax;
double _orderShippingInclTax;
double _orderShippingExclTax;
double _paymentMethodAdditionalFeeInclTax;
double _paymentMethodAdditionalFeeExclTax;
String _taxRates;
double _orderTax;
double _orderDiscount;
double _orderTotal;
double _refundedAmount;
dynamic _rewardPointsWereAdded;
String _checkoutAttributeDescription;
int _customerLanguageId;
int _affiliateId;
String _customerIp;
dynamic _authorizationTransactionId;
dynamic _authorizationTransactionCode;
dynamic _authorizationTransactionResult;
dynamic _captureTransactionId;
dynamic _captureTransactionResult;
dynamic _subscriptionTransactionId;
dynamic _paidDateUtc;
dynamic _shippingMethod;
dynamic _shippingRateComputationMethodSystemName;
String _customValuesXml;
dynamic _paymentOption;
bool _deleted;
String _createdOnUtc;
PackagesCustomerResponseModel _customer;
int _customerId;
dynamic _billingAddress;
dynamic _shippingAddress;
List<PackagesCartItemsResponseModel> _orderItems;
String _orderStatus;
String _paymentStatus;
String _shippingStatus;
String _customerTaxDisplayType;
int _id;
String get customOrderNumber => _customOrderNumber;
int get storeId => _storeId;
dynamic get pickUpInStore => _pickUpInStore;
String get paymentMethodSystemName => _paymentMethodSystemName;
String get customerCurrencyCode => _customerCurrencyCode;
double get currencyRate => _currencyRate;
int get customerTaxDisplayTypeId => _customerTaxDisplayTypeId;
dynamic get vatNumber => _vatNumber;
double get orderSubtotalInclTax => _orderSubtotalInclTax;
double get orderSubtotalExclTax => _orderSubtotalExclTax;
double get orderSubTotalDiscountInclTax => _orderSubTotalDiscountInclTax;
double get orderSubTotalDiscountExclTax => _orderSubTotalDiscountExclTax;
double get orderShippingInclTax => _orderShippingInclTax;
double get orderShippingExclTax => _orderShippingExclTax;
double get paymentMethodAdditionalFeeInclTax => _paymentMethodAdditionalFeeInclTax;
double get paymentMethodAdditionalFeeExclTax => _paymentMethodAdditionalFeeExclTax;
String get taxRates => _taxRates;
double get orderTax => _orderTax;
double get orderDiscount => _orderDiscount;
double get orderTotal => _orderTotal;
double get refundedAmount => _refundedAmount;
dynamic get rewardPointsWereAdded => _rewardPointsWereAdded;
String get checkoutAttributeDescription => _checkoutAttributeDescription;
int get customerLanguageId => _customerLanguageId;
int get affiliateId => _affiliateId;
String get customerIp => _customerIp;
dynamic get authorizationTransactionId => _authorizationTransactionId;
dynamic get authorizationTransactionCode => _authorizationTransactionCode;
dynamic get authorizationTransactionResult => _authorizationTransactionResult;
dynamic get captureTransactionId => _captureTransactionId;
dynamic get captureTransactionResult => _captureTransactionResult;
dynamic get subscriptionTransactionId => _subscriptionTransactionId;
dynamic get paidDateUtc => _paidDateUtc;
dynamic get shippingMethod => _shippingMethod;
dynamic get shippingRateComputationMethodSystemName => _shippingRateComputationMethodSystemName;
String get customValuesXml => _customValuesXml;
dynamic get paymentOption => _paymentOption;
bool get deleted => _deleted;
String get createdOnUtc => _createdOnUtc;
PackagesCustomerResponseModel get customer => _customer;
int get customerId => _customerId;
dynamic get billingAddress => _billingAddress;
dynamic get shippingAddress => _shippingAddress;
List<PackagesCartItemsResponseModel> get orderItems => _orderItems;
String get orderStatus => _orderStatus;
String get paymentStatus => _paymentStatus;
String get shippingStatus => _shippingStatus;
String get customerTaxDisplayType => _customerTaxDisplayType;
int get id => _id;
OrderResponseModel({
String customOrderNumber,
int storeId,
dynamic pickUpInStore,
String paymentMethodSystemName,
String customerCurrencyCode,
double currencyRate,
int customerTaxDisplayTypeId,
dynamic vatNumber,
double orderSubtotalInclTax,
double orderSubtotalExclTax,
double orderSubTotalDiscountInclTax,
double orderSubTotalDiscountExclTax,
double orderShippingInclTax,
double orderShippingExclTax,
double paymentMethodAdditionalFeeInclTax,
double paymentMethodAdditionalFeeExclTax,
String taxRates,
double orderTax,
double orderDiscount,
double orderTotal,
double refundedAmount,
dynamic rewardPointsWereAdded,
String checkoutAttributeDescription,
int customerLanguageId,
int affiliateId,
String customerIp,
dynamic authorizationTransactionId,
dynamic authorizationTransactionCode,
dynamic authorizationTransactionResult,
dynamic captureTransactionId,
dynamic captureTransactionResult,
dynamic subscriptionTransactionId,
dynamic paidDateUtc,
dynamic shippingMethod,
dynamic shippingRateComputationMethodSystemName,
String customValuesXml,
dynamic paymentOption,
bool deleted,
String createdOnUtc,
PackagesCustomerResponseModel customer,
int customerId,
dynamic billingAddress,
dynamic shippingAddress,
List<PackagesCartItemsResponseModel> orderItems,
String orderStatus,
String paymentStatus,
String shippingStatus,
String customerTaxDisplayType,
int id}){
_customOrderNumber = customOrderNumber;
_storeId = storeId;
_pickUpInStore = pickUpInStore;
_paymentMethodSystemName = paymentMethodSystemName;
_customerCurrencyCode = customerCurrencyCode;
_currencyRate = currencyRate;
_customerTaxDisplayTypeId = customerTaxDisplayTypeId;
_vatNumber = vatNumber;
_orderSubtotalInclTax = orderSubtotalInclTax;
_orderSubtotalExclTax = orderSubtotalExclTax;
_orderSubTotalDiscountInclTax = orderSubTotalDiscountInclTax;
_orderSubTotalDiscountExclTax = orderSubTotalDiscountExclTax;
_orderShippingInclTax = orderShippingInclTax;
_orderShippingExclTax = orderShippingExclTax;
_paymentMethodAdditionalFeeInclTax = paymentMethodAdditionalFeeInclTax;
_paymentMethodAdditionalFeeExclTax = paymentMethodAdditionalFeeExclTax;
_taxRates = taxRates;
_orderTax = orderTax;
_orderDiscount = orderDiscount;
_orderTotal = orderTotal;
_refundedAmount = refundedAmount;
_rewardPointsWereAdded = rewardPointsWereAdded;
_checkoutAttributeDescription = checkoutAttributeDescription;
_customerLanguageId = customerLanguageId;
_affiliateId = affiliateId;
_customerIp = customerIp;
_authorizationTransactionId = authorizationTransactionId;
_authorizationTransactionCode = authorizationTransactionCode;
_authorizationTransactionResult = authorizationTransactionResult;
_captureTransactionId = captureTransactionId;
_captureTransactionResult = captureTransactionResult;
_subscriptionTransactionId = subscriptionTransactionId;
_paidDateUtc = paidDateUtc;
_shippingMethod = shippingMethod;
_shippingRateComputationMethodSystemName = shippingRateComputationMethodSystemName;
_customValuesXml = customValuesXml;
_paymentOption = paymentOption;
_deleted = deleted;
_createdOnUtc = createdOnUtc;
_customer = customer;
_customerId = customerId;
_billingAddress = billingAddress;
_shippingAddress = shippingAddress;
_orderItems = orderItems;
_orderStatus = orderStatus;
_paymentStatus = paymentStatus;
_shippingStatus = shippingStatus;
_customerTaxDisplayType = customerTaxDisplayType;
_id = id;
}
PackagesOrderResponseModel.fromJson(dynamic json) {
_customOrderNumber = json["custom_order_number"];
_storeId = json["store_id"];
_pickUpInStore = json["pick_up_in_store"];
_paymentMethodSystemName = json["payment_method_system_name"];
_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"];
_orderTotal = json["order_total"];
_refundedAmount = json["refunded_amount"];
_rewardPointsWereAdded = json["reward_points_were_added"];
_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"];
_paymentOption = json["payment_option"];
_deleted = json["deleted"];
_createdOnUtc = json["created_on_utc"];
_customer = json["customer"] != null ? PackagesCustomerResponseModel.fromJson(json["customer"]) : null;
_customerId = json["customer_id"];
_billingAddress = json["billing_address"];
_shippingAddress = json["shipping_address"];
if (json["order_items"] != null) {
_orderItems = [];
json["order_items"].forEach((v) {
_orderItems.add(PackagesCartItemsResponseModel.fromJson(v));
});
}
_orderStatus = json["order_status"];
_paymentStatus = json["payment_status"];
_shippingStatus = json["shipping_status"];
_customerTaxDisplayType = json["customer_tax_display_type"];
_id = json["id"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["custom_order_number"] = _customOrderNumber;
map["store_id"] = _storeId;
map["pick_up_in_store"] = _pickUpInStore;
map["payment_method_system_name"] = _paymentMethodSystemName;
map["customer_currency_code"] = _customerCurrencyCode;
map["currency_rate"] = _currencyRate;
map["customer_tax_display_type_id"] = _customerTaxDisplayTypeId;
map["vat_number"] = _vatNumber;
map["order_subtotal_incl_tax"] = _orderSubtotalInclTax;
map["order_subtotal_excl_tax"] = _orderSubtotalExclTax;
map["order_sub_total_discount_incl_tax"] = _orderSubTotalDiscountInclTax;
map["order_sub_total_discount_excl_tax"] = _orderSubTotalDiscountExclTax;
map["order_shipping_incl_tax"] = _orderShippingInclTax;
map["order_shipping_excl_tax"] = _orderShippingExclTax;
map["payment_method_additional_fee_incl_tax"] = _paymentMethodAdditionalFeeInclTax;
map["payment_method_additional_fee_excl_tax"] = _paymentMethodAdditionalFeeExclTax;
map["tax_rates"] = _taxRates;
map["order_tax"] = _orderTax;
map["order_discount"] = _orderDiscount;
map["order_total"] = _orderTotal;
map["refunded_amount"] = _refundedAmount;
map["reward_points_were_added"] = _rewardPointsWereAdded;
map["checkout_attribute_description"] = _checkoutAttributeDescription;
map["customer_language_id"] = _customerLanguageId;
map["affiliate_id"] = _affiliateId;
map["customer_ip"] = _customerIp;
map["authorization_transaction_id"] = _authorizationTransactionId;
map["authorization_transaction_code"] = _authorizationTransactionCode;
map["authorization_transaction_result"] = _authorizationTransactionResult;
map["capture_transaction_id"] = _captureTransactionId;
map["capture_transaction_result"] = _captureTransactionResult;
map["subscription_transaction_id"] = _subscriptionTransactionId;
map["paid_date_utc"] = _paidDateUtc;
map["shipping_method"] = _shippingMethod;
map["shipping_rate_computation_method_system_name"] = _shippingRateComputationMethodSystemName;
map["custom_values_xml"] = _customValuesXml;
map["payment_option"] = _paymentOption;
map["deleted"] = _deleted;
map["created_on_utc"] = _createdOnUtc;
if (_customer != null) {
map["customer"] = _customer.toJson();
}
map["customer_id"] = _customerId;
map["billing_address"] = _billingAddress;
map["shipping_address"] = _shippingAddress;
if (_orderItems != null) {
map["order_items"] = _orderItems.map((v) => v.toJson()).toList();
}
map["order_status"] = _orderStatus;
map["payment_status"] = _paymentStatus;
map["shipping_status"] = _shippingStatus;
map["customer_tax_display_type"] = _customerTaxDisplayType;
map["id"] = _id;
return map;
}
}

@ -66,6 +66,8 @@ class OrderDetailModel {
String preferDeliveryDate;
String preferDeliveryTime;
String preferDeliveryTimen;
String driverOTP;
String driverID;
OrderDetailModel(
{this.id,
@ -130,7 +132,9 @@ class OrderDetailModel {
this.lakumAmount,
this.preferDeliveryDate,
this.preferDeliveryTime,
this.preferDeliveryTimen});
this.preferDeliveryTimen,
this.driverID,
this.driverOTP,});
OrderDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
@ -210,6 +214,10 @@ class OrderDetailModel {
preferDeliveryDate = json['prefer_delivery_date'];
preferDeliveryTime = json['prefer_delivery_time'];
preferDeliveryTimen = json['prefer_delivery_timen'];
// Driver Detail
driverID: json["DriverID"];
driverOTP: json["DriverOTP"];
}
Map<String, dynamic> toJson() {

@ -73,6 +73,8 @@ class OrderModel {
DateTime preferDeliveryDate;
PreferDeliveryTime preferDeliveryTime;
PreferDeliveryTimen preferDeliveryTimen;
String driverOTP;
String driverID;
OrderModel({
this.id,
@ -138,6 +140,8 @@ class OrderModel {
this.preferDeliveryDate,
this.preferDeliveryTime,
this.preferDeliveryTimen,
this.driverID,
this.driverOTP,
});
factory OrderModel.fromJson(Map<String, dynamic> json) => OrderModel(
@ -204,6 +208,11 @@ class OrderModel {
preferDeliveryDate: json["prefer_delivery_date"] == null ? null : DateTime.parse(json["prefer_delivery_date"]),
preferDeliveryTime: json["prefer_delivery_time"] == null ? null : preferDeliveryTimeValues.map[json["prefer_delivery_time"]],
preferDeliveryTimen: json["prefer_delivery_timen"] == null ? null : preferDeliveryTimenValues.map[json["prefer_delivery_timen"]],
// Driver Detail
driverID: json["DriverID"],
driverOTP: json["DriverOTP"],
);
Map<String, dynamic> toJson() => {
@ -1366,7 +1375,7 @@ final titleValues = EnumValues({
"ممتاز": Title.TITLE
});
enum OrderStatus { ORDER_SUBMITTED, PENDING, ORDER_IN_PROGRESS, ORDER_COMPLETED, CANCELLED, PROCESSING, ORDER_REFUNDED, COMPLETE }
enum OrderStatus { ORDER_SUBMITTED, PENDING, ORDER_IN_PROGRESS,ORDER_SENT_FOR_DELIVERY, ORDER_COMPLETED, CANCELLED, PROCESSING, ORDER_REFUNDED, COMPLETE }
final orderStatusValues = EnumValues({
"Cancelled": OrderStatus.CANCELLED,
@ -1376,7 +1385,8 @@ final orderStatusValues = EnumValues({
"OrderRefunded": OrderStatus.ORDER_REFUNDED,
"OrderSubmitted": OrderStatus.ORDER_SUBMITTED,
"Pending": OrderStatus.PENDING,
"Processing": OrderStatus.PROCESSING
"Processing": OrderStatus.PROCESSING,
"orderSentForDelivery": OrderStatus.ORDER_SENT_FOR_DELIVERY
});
enum OrderStatusn { ORDER_SUBMITTED, EMPTY, ORDER_IN_PROGRESS, ORDER_COMPLETED, ORDER_STATUSN, PURPLE, FLUFFY, TENTACLED }
@ -1389,6 +1399,7 @@ final orderStatusnValues = EnumValues({
"ملغي": OrderStatusn.ORDER_STATUSN,
"Order Submitted": OrderStatusn.ORDER_SUBMITTED,
"قيد التنفيذ": OrderStatusn.PURPLE,
"مكتمل": OrderStatusn.TENTACLED,
"مكتمل": OrderStatusn.TENTACLED
});

@ -1,127 +1,193 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class PrescriptionReport {
String address;
int appointmentNo;
String clinic;
String companyName;
int days;
String doctorName;
var doseDailyQuantity;
String frequency;
int frequencyNumber;
String image;
String imageExtension;
String imageSRCUrl;
String imageString;
String imageThumbUrl;
String isCovered;
String itemDescription;
int itemID;
String orderDate;
int patientID;
String patientName;
String phoneOffice1;
String prescriptionQR;
int prescriptionTimes;
String productImage;
String productImageBase64;
String productImageString;
int projectID;
String projectName;
String remarks;
String route;
String sKU;
int scaleOffset;
String startDate;
String patientAge;
String patientGender;
String address;
String phoneOffice;
String itemDescription;
int doseTimingID;
int frequencyID;
int routeID;
String clinic;
String doctorName;
String route;
String frequency;
String remarks;
String name;
int days;
String startDate;
String orderDate;
int doseDailyQuantity;
int itemID;
Null productImage;
String sKU;
String itemDescriptionN;
String routeN;
String frequencyN;
String imageSRCUrl;
String imageThumbUrl;
PrescriptionReport(
{this.patientID,
this.patientName,
this.patientAge,
this.patientGender,
this.address,
this.phoneOffice,
this.itemDescription,
this.doseTimingID,
this.frequencyID,
this.routeID,
this.clinic,
this.doctorName,
this.route,
this.frequency,
this.remarks,
this.name,
this.days,
this.startDate,
this.orderDate,
this.doseDailyQuantity,
this.itemID,
this.productImage,
this.sKU,
this.itemDescriptionN,
this.routeN,
this.frequencyN,
this.imageSRCUrl,
this.imageThumbUrl});
PrescriptionReport({
this.address,
this.appointmentNo,
this.clinic,
this.companyName,
this.days,
this.doctorName,
this.doseDailyQuantity,
this.frequency,
this.frequencyNumber,
this.image,
this.imageExtension,
this.imageSRCUrl,
this.imageString,
this.imageThumbUrl,
this.isCovered,
this.itemDescription,
this.itemID,
this.orderDate,
this.patientID,
this.patientName,
this.phoneOffice1,
this.prescriptionQR,
this.prescriptionTimes,
this.productImage,
this.productImageBase64,
this.productImageString,
this.projectID,
this.projectName,
this.remarks,
this.route,
this.sKU,
this.scaleOffset,
this.startDate,
this.patientAge,
this.patientGender,
this.phoneOffice,
this.doseTimingID,
this.frequencyID,
this.routeID,
this.name,
this.itemDescriptionN,
this.routeN,
this.frequencyN,
});
PrescriptionReport.fromJson(Map<String, dynamic> json) {
patientID = json['PatientID'];
patientName = json['PatientName'];
patientAge = json['PatientAge'];
patientGender = json['PatientGender'];
address = json['Address'];
phoneOffice = json['PhoneOffice'];
itemDescription = json['ItemDescription'];
doseTimingID = json['DoseTimingID'];
frequencyID = json['FrequencyID'];
routeID = json['RouteID'];
appointmentNo = json['AppointmentNo'];
clinic = json['Clinic'];
doctorName = json['DoctorName'];
route = json['Route'];
frequency = json['Frequency'];
remarks = json['Remarks'];
name = json['Name'];
companyName = json['CompanyName'];
days = json['Days'];
startDate = json['StartDate'];
orderDate = json['OrderDate'];
doctorName = json['DoctorName'];
doseDailyQuantity = json['DoseDailyQuantity'];
frequency = json['Frequency'];
frequencyNumber = json['FrequencyNumber'];
image = json['Image'];
imageExtension = json['ImageExtension'];
imageSRCUrl = json['ImageSRCUrl'];
imageString = json['ImageString'];
imageThumbUrl = json['ImageThumbUrl'];
isCovered = json['IsCovered'];
itemDescription = json['ItemDescription'];
itemID = json['ItemID'];
orderDate = json['OrderDate'];
patientID = json['PatientID'];
patientName = json['PatientName'];
phoneOffice1 = json['PhoneOffice1'];
prescriptionQR = json['PrescriptionQR'];
prescriptionTimes = json['PrescriptionTimes'];
productImage = json['ProductImage'];
productImageBase64 = json['ProductImageBase64'];
productImageString = json['ProductImageString'];
projectID = json['ProjectID'];
projectName = json['ProjectName'];
remarks = json['Remarks'];
route = json['Route'];
sKU = json['SKU'];
itemDescriptionN = json['ItemDescriptionN'];
routeN = json['RouteN'];
frequencyN = json['FrequencyN'];
imageSRCUrl = json['ImageSRCUrl'];
imageThumbUrl = json['ImageThumbUrl'];
scaleOffset = json['ScaleOffset'];
startDate = json['StartDate'];
patientAge = json['patientAge'];
patientGender = json['patientGender'];
phoneOffice = json['phoneOffice'];
doseTimingID = json['doseTimingID'];
frequencyID = json['frequencyID'];
routeID = json['routeID'];
name = json['name'];
itemDescriptionN = json['itemDescriptionN'];
routeN = json['routeN'];
frequencyN = json['frequencyN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Address'] = this.address;
data['AppointmentNo'] = this.appointmentNo;
data['Clinic'] = this.clinic;
data['CompanyName'] = this.companyName;
data['Days'] = this.days;
data['DoctorName'] = this.doctorName;
data['DoseDailyQuantity'] = this.doseDailyQuantity;
data['Frequency'] = this.frequency;
data['FrequencyNumber'] = this.frequencyNumber;
data['Image'] = this.image;
data['ImageExtension'] = this.imageExtension;
data['ImageSRCUrl'] = this.imageSRCUrl;
data['ImageString'] = this.imageString;
data['ImageThumbUrl'] = this.imageThumbUrl;
data['IsCovered'] = this.isCovered;
data['ItemDescription'] = this.itemDescription;
data['ItemID'] = this.itemID;
data['OrderDate'] = this.orderDate;
data['PatientID'] = this.patientID;
data['PatientName'] = this.patientName;
data['PhoneOffice1'] = this.phoneOffice1;
data['PrescriptionQR'] = this.prescriptionQR;
data['PrescriptionTimes'] = this.prescriptionTimes;
data['ProductImage'] = this.productImage;
data['ProductImageBase64'] = this.productImageBase64;
data['ProductImageString'] = this.productImageString;
data['ProjectID'] = this.projectID;
data['ProjectName'] = this.projectName;
data['Remarks'] = this.remarks;
data['Route'] = this.route;
data['SKU'] = this.sKU;
data['ScaleOffset'] = this.scaleOffset;
data['StartDate'] = this.startDate;
data['PatientAge'] = this.patientAge;
data['PatientGender'] = this.patientGender;
data['Address'] = this.address;
data['PhoneOffice'] = this.phoneOffice;
data['ItemDescription'] = this.itemDescription;
data['DoseTimingID'] = this.doseTimingID;
data['FrequencyID'] = this.frequencyID;
data['RouteID'] = this.routeID;
data['Clinic'] = this.clinic;
data['DoctorName'] = this.doctorName;
data['Route'] = this.route;
data['Frequency'] = this.frequency;
data['Remarks'] = this.remarks;
data['Name'] = this.name;
data['Days'] = this.days;
data['StartDate'] = this.startDate;
data['OrderDate'] = this.orderDate;
data['DoseDailyQuantity'] = this.doseDailyQuantity;
data['ItemID'] = this.itemID;
data['ProductImage'] = this.productImage;
data['SKU'] = this.sKU;
data['ItemDescriptionN'] = this.itemDescriptionN;
data['RouteN'] = this.routeN;
data['FrequencyN'] = this.frequencyN;
data['ImageSRCUrl'] = this.imageSRCUrl;
data['ImageThumbUrl'] = this.imageThumbUrl;
data['hasPlan'] = false;
return data;
}
}

@ -1,7 +1,9 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
import 'package:intl/intl.dart';
import '../../../locator.dart';
import '../base_service.dart';
class CustomerAddressesService extends BaseService {
@ -9,6 +11,7 @@ class CustomerAddressesService extends BaseService {
List<AddressInfo> addressesList = List();
CustomerInfo customerInfo;
Future addAddressInfo({ AddNewAddressRequestModel
addNewAddressRequestModel }) async {
@ -25,7 +28,7 @@ class CustomerAddressesService extends BaseService {
var date = f.format(DateTime.now().toUtc()) + " GMT";
addNewAddressRequestModel.customer.addresses[0].createdOnUtc = date;
hasError = false;
await baseAppClient.post(BASE_PHARMACY_URL+ADD_ADDRESS_INFO,
await baseAppClient.post(ADD_CUSTOMER_ADDRESS,
onSuccess: (dynamic response, int statusCode) {
addressesList.clear();
response["customers"][0]["addresses"].forEach((data) {
@ -35,7 +38,7 @@ class CustomerAddressesService extends BaseService {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: addNewAddressRequestModel.toJson(), isExternal: true, isAllowAny: true);
}, body: addNewAddressRequestModel.toJson(), isAllowAny: true);
}
Future getCustomerAddresses() async {

@ -115,7 +115,9 @@ class BaseAppClient {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': pharmacyToken,
'Mobilenumber': user['MobileNumber'].toString(),
'Mobilenumber': user != null
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user['PatientID'].toString(),
};
@ -216,11 +218,10 @@ class BaseAppClient {
postPharmacy(String endPoint,
{Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
bool isAllowAny = false,
bool isExternal = false}) async {
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
bool isAllowAny = false,
bool isExternal = false}) async {
var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN);
var user = await sharedPref.getObject(USER_PROFILE);
String url;
@ -238,7 +239,7 @@ class BaseAppClient {
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null
? getPhoneNumberWithoutZero(user['MobileNumber'].toString())
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
@ -246,12 +247,12 @@ class BaseAppClient {
if (!isExternal) {
String token = await sharedPref.getString(TOKEN);
var languageID =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null
? body['SetupID']
: SETUP_ID
? body['SetupID']
: SETUP_ID
: SETUP_ID;
}
@ -263,17 +264,17 @@ class BaseAppClient {
body['generalid'] = GENERAL_ID;
body['PatientOutSA'] = body.containsKey('PatientOutSA')
? body['PatientOutSA'] != null
? body['PatientOutSA']
: PATIENT_OUT_SA
? body['PatientOutSA']
: PATIENT_OUT_SA
: PATIENT_OUT_SA;
if (body.containsKey('isDentalAllowedBackend')) {
body['isDentalAllowedBackend'] =
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
body.containsKey('isDentalAllowedBackend')
? body['isDentalAllowedBackend'] != null
? body['isDentalAllowedBackend']
: IS_DENTAL_ALLOWED_BACKEND
: IS_DENTAL_ALLOWED_BACKEND;
}
body['DeviceTypeID'] = DeviceTypeID;
@ -281,18 +282,18 @@ class BaseAppClient {
if (!body.containsKey('IsPublicRequest')) {
body['PatientType'] = body.containsKey('PatientType')
? body['PatientType'] != null
? body['PatientType']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE
? body['PatientType']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE
: PATIENT_TYPE;
body['PatientTypeID'] = body.containsKey('PatientTypeID')
? body['PatientTypeID'] != null
? body['PatientTypeID']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE_ID
? body['PatientTypeID']
: user['PatientType'] != null
? user['PatientType']
: PATIENT_TYPE_ID
: PATIENT_TYPE_ID;
if (user != null) {
body['TokenID'] = token;
@ -478,7 +479,7 @@ class BaseAppClient {
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null
? getPhoneNumberWithoutZero(user['MobileNumber'].toString())
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",
@ -504,19 +505,44 @@ class BaseAppClient {
}
}
getPhoneNumberWithoutZero(String number) {
String newNumber = number;
if (number.startsWith('0')) {
newNumber = number.substring(1);
simplePost(String fullUrl,
{ Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,}) async {
String url = fullUrl;
print("URL Query String: $url");
if (await Utils.checkConnection()) {
final response = await http.post(
url.trim(),
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {
onSuccess(response.body.toString(), statusCode);
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
return newNumber;
}
simpleGet(String fullUrl,
{Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
Map<String, String> queryParams}) async {
Function(String error, int statusCode) onFailure,
Map<String, String> queryParams}) async {
String url = fullUrl;
print("URL Query String: $url");
var haveParams = (queryParams != null);
if (haveParams) {
String queryString = Uri(queryParameters: queryParams).query;
@ -546,6 +572,75 @@ class BaseAppClient {
}
}
simplePut(String fullUrl,
{ Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
String url = fullUrl;
print("URL Query String: $url");
if (await Utils.checkConnection()) {
final response = await http.put(
url.trim(),
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {
onSuccess(response.body.toString(), statusCode);
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
}
simpleDelete(String fullUrl,
{Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
Map<String, String> queryParams}) async {
String url = fullUrl;
print("URL Query String: $url");
var haveParams = (queryParams != null);
if (haveParams) {
String queryString = Uri(queryParameters: queryParams).query;
url += '?' + queryString;
print("URL Query String: $url");
}
if (await Utils.checkConnection()) {
final response = await http.delete(
url.trim(),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
);
final int statusCode = response.statusCode;
print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {
onSuccess(response.body.toString(), statusCode);
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
}
logout() async {
await sharedPref.remove(LOGIN_TOKEN_ID);
await sharedPref.remove(PHARMACY_CUSTOMER_ID);
@ -587,7 +682,6 @@ class BaseAppClient {
return params;
}
pharmacyPost(String endPoint,
{Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
@ -680,7 +774,7 @@ class BaseAppClient {
'Accept': 'application/json',
'Authorization': token ?? '',
'Mobilenumber': user != null
? getPhoneNumberWithoutZero(user['MobileNumber'].toString())
? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString())
: "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "",

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
class EyeService extends BaseService {
List<AppoimentAllHistoryResultList> appoimentAllHistoryResultList = List();
@ -23,4 +24,53 @@ class EyeService extends BaseService {
super.error = error;
}, body: body);
}
sendGlassesPrescriptionEmail({int appointmentNo,String projectName,int projectID}) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
body['PatientIditificationNum'] = user.patientIdentificationNo;
body['PatientName'] = user.firstName+" "+user.lastName;
body['To'] = user.emailAddress;
body['SetupID'] = user.setupID;
body['DateofBirth'] = user.dateofBirth;
body['ProjectID'] = projectID;
body['AppointmentNo'] = appointmentNo;
body['ProjectName'] = projectName;
body['PatientID'] = user.patientID;
body['PatientMobileNumber'] = Utils.getPhoneNumberWithoutZero(user.mobileNumber);
await baseAppClient.post(SEND_REPORT_EYE_EMAIL,
onSuccess: (response, statusCode) async {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
sendContactLensPrescriptionEmail({int appointmentNo,String projectName,int projectID}) async {
hasError = false;
super.error = "";
Map<String, dynamic> body = Map();
body['isDentalAllowedBackend'] = false;
body['AppointmentNo'] = appointmentNo;
body['PatientIditificationNum'] = user.patientIdentificationNo;
body['PatientName'] = user.firstName+" "+user.lastName;
body['To'] = user.emailAddress;
body['SetupID'] = user.setupID;
body['DateofBirth'] = user.dateofBirth;
body['ProjectID'] = projectID;
body['AppointmentNo'] = appointmentNo;
body['ProjectName'] = projectName;
body['PatientID'] = user.patientID;
body['PatientMobileNumber'] = Utils.getPhoneNumberWithoutZero(user.mobileNumber);
await baseAppClient.post(SEND_CONTACT_LENS_PRESCRIPTION_EMAIL,
onSuccess: (response, statusCode) async {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -11,7 +11,7 @@ class RadiologyService extends BaseService {
hasError = false;
final Map<String, dynamic> body = new Map<String, dynamic>();
body['InvoiceNo'] = invoiceNo;
body['LineItemNo'] = lineItem;
body['LineIt emNo'] = lineItem;
body['ProjectID'] = projectId;
await baseAppClient.post(GET_RAD_IMAGE_URL,

@ -1,27 +1,46 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:ui';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/enum/PaymentOptions.dart';
import 'package:diplomaticquarterapp/core/model/ResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/order_response_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:flutter/cupertino.dart';
import '../../../locator.dart';
class OffersAndPackagesServices extends BaseService {
List<OfferCategoriesResponseModel> categoryList = List();
List<PackagesCategoriesResponseModel> categoryList = List();
List<PackagesResponseModel> productList = List();
List<PackagesResponseModel> latestOffersList = List();
List<PackagesResponseModel> bestSellerList = List();
List<PackagesResponseModel> bannersList = List();
List<PackagesCartItemsResponseModel> cartItemList = List();
String cartItemCount = "";
PackagesCustomerResponseModel customer;
Future<List<PackagesCategoriesResponseModel>> getAllCategories(OffersCategoriesRequestModel request) async {
Future errorThrow;
Future<List<OfferCategoriesResponseModel>> getAllCategories(OffersCategoriesRequestModel request) async {
hasError = false;
var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES;
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['categories'].forEach((json) {
categoryList.add(OfferCategoriesResponseModel().fromJson(json));
categoryList.add(PackagesCategoriesResponseModel().fromJson(json));
});
}
}, onFailure: (String error, int statusCode) {
@ -31,15 +50,18 @@ class OffersAndPackagesServices extends BaseService {
return categoryList;
}
List<OfferProductsResponseModel> productList = List();
Future<List<OfferProductsResponseModel>> getAllProducts(OffersProductsRequestModel request) async {
hasError = false;
Future<List<PackagesResponseModel>> getAllProducts({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
Future errorThrow;
request.sinceId = (productList.isNotEmpty) ? productList.last.id : 0;
productList = List();
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
productList.add(OfferProductsResponseModel().fromJson(json));
productList.add(PackagesResponseModel().fromJson(json));
});
}
}, onFailure: (String error, int statusCode) {
@ -48,4 +70,276 @@ class OffersAndPackagesServices extends BaseService {
return productList;
}
Future<List<PackagesResponseModel>> getLatestOffers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
latestOffersList.add(PackagesResponseModel().fromJson(json));
});
}
}, onFailure: (String error, int statusCode) {
log(error);
}, queryParams: request.toFlatMap());
return latestOffersList;
}
Future<List<PackagesResponseModel>> getBestSellers({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
bestSellerList.add(PackagesResponseModel().fromJson(json));
});
}
}, onFailure: (String error, int statusCode) {
log(error);
}, queryParams: request.toFlatMap());
return bestSellerList;
}
Future<List<PackagesResponseModel>> getBanners({@required OffersProductsRequestModel request, @required BuildContext context, @required bool showLoading = true}) async {
var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS;
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
if (statusCode == 200) {
var jsonResponse = json.decode(stringResponse);
jsonResponse['products'].forEach((json) {
bannersList.add(PackagesResponseModel().fromJson(json));
});
}
}, onFailure: (String error, int statusCode) {
log(error);
}, queryParams: request.toFlatMap());
return bannersList;
}
Future loadOffersPackagesDataForMainPage({@required BuildContext context, bool showLoading = true, Function completion }) async {
var finished = 0;
var totalCalls = 3;
completedAll(){
finished++;
if(completion != null && finished == totalCalls) {
_hideLoading(context, showLoading);
completion();
}
}
_showLoading(context, showLoading);
// Performing Parallel Request on same time
// # 1
getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){
completedAll();
});
// # 2
getLatestOffers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){
completedAll();
});
// # 3
getBanners(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){
completedAll();
});
}
// --------------------
// Create Customer
// --------------------
Future createCustomer(PackagesCustomerRequestModel request, {@required BuildContext context, bool showLoading = true, Function(bool) completion }) async{
if(customer != null)
return Future.value(customer);
customer = null;
Future errorThrow;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER;
await baseAppClient.simplePost(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
var customerJson = jsonResponse['customers'].first;
customer = PackagesCustomerResponseModel.fromJson(customerJson);
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
errorThrow = Future.error(error);
log(error);
});
await Future.delayed(Duration(seconds: 1));
return errorThrow ?? customer;
}
// --------------------
// Shopping Cart
// --------------------
Future<List<PackagesCartItemsResponseModel>> cartItems({@required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
cartItemList.clear();
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/${customer.id}';
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
jsonResponse['shopping_carts'].forEach((json) {
cartItemList.add(PackagesCartItemsResponseModel.fromJson(json));
});
}, onFailure: (String error, int statusCode) {
_hideLoading(context, showLoading);
log(error);
errorThrow = Future.error({"error":error, "statusCode":statusCode});
}, queryParams: null);
return errorThrow ?? cartItemList;
}
Future<ResponseModel<PackagesCartItemsResponseModel>> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
ResponseModel<PackagesCartItemsResponseModel> response;
request.customer_id = customer.id;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART;
await baseAppClient.simplePost(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
var jsonCartItem = jsonResponse["shopping_carts"][0];
response = ResponseModel(status: true, data: PackagesCartItemsResponseModel.fromJson(jsonCartItem), error: null);
cartItemCount = response.data.quantity.toString();
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
errorThrow = Future.error(ResponseModel(status: true, data: null, error: error));
});
return errorThrow ?? response;
}
Future updateProductToCart(int cartItemID, {UpdateProductToCartRequestModel request, @required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID';
await baseAppClient.simplePut(url, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
log(error);
errorThrow = Future.error({"error":error, "statusCode":statusCode});
});
return errorThrow ?? bannersList;
}
Future<bool> deleteProductFromCart(int cartItemID, {@required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID';
await baseAppClient.simpleDelete(url, onSuccess: (dynamic stringResponse, int statusCode){
_hideLoading(context, showLoading);
// var jsonResponse = json.decode(stringResponse);
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
log(error);
errorThrow = Future.error({"error":error, "statusCode":statusCode});
});
return errorThrow ?? true;
}
// --------------------
// Place Order
// --------------------
Future placeOrder({@required String paymentOption, @required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
var jsonBody = {
"order": {
"customer_id" : customer.id,
"billing_address": {
"email": customer.email,
"phone_number": customer.addresses.first.phoneNumber
},
"payment_method_system_name": "Payments.PayFort",
"payment_option": paymentOption
}
};
int order_id;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS;
await baseAppClient.simplePost(url, body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode){
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
order_id = jsonResponse['orders'][0]['id'];
}, onFailure: (String error, int statusCode){
_hideLoading(context, showLoading);
log(error);
errorThrow = Future.error(error);
});
return errorThrow ?? order_id;
}
Future<ResponseModel<PackagesOrderResponseModel>> getOrderById(int id, {@required BuildContext context, bool showLoading = true}) async{
Future errorThrow;
ResponseModel<PackagesOrderResponseModel> response;
_showLoading(context, showLoading);
var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS + '/$id';
await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) {
_hideLoading(context, showLoading);
var jsonResponse = json.decode(stringResponse);
var jsonOrder = jsonResponse['orders'][0];
response = ResponseModel(status: true, data: PackagesOrderResponseModel.fromJson(jsonOrder));
}, onFailure: (String error, int statusCode) {
_hideLoading(context, showLoading);
errorThrow = Future.error(ResponseModel(status: false,error: error));
}, queryParams: null);
return errorThrow ?? response;
}
}
_showLoading(BuildContext context, bool flag){
if(flag)
GifLoaderDialogUtils.showMyDialog(context);
}
_hideLoading(BuildContext context, bool flag){
if(flag)
GifLoaderDialogUtils.hideDialog(context);
}

@ -7,6 +7,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart';
import 'package:flutter/cupertino.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class OrderPreviewService extends BaseService {
bool isFinished = true;
@ -260,4 +262,26 @@ class OrderPreviewService extends BaseService {
return "";
}
}
Future<LatLng> getDriverLocation(dynamic driverId) async{
Map<String, dynamic> jsonBody = Map();
jsonBody['DriverID'] = driverId;
LatLng coordinates;
await baseAppClient.post(DRIVER_LOCATION,
onSuccess: (response, statusCode) async {
if(statusCode == 200){
dynamic locationObject = response['PatientER_GetDriverLocationList'][0];
double lat = locationObject['Latitude'];
double lon = locationObject['Longitude'];
if(lat != null && lon != null){
coordinates = LatLng(lat,lon);
}
}
}, onFailure: (String error, int statusCode) {
}, body: jsonBody);
return coordinates;
}
}

@ -55,7 +55,7 @@ class Addresses {
String firstName;
String lastName;
String email;
Null company;
dynamic company;
int countryId;
String country;
Null stateProvinceId;
@ -64,7 +64,7 @@ class Addresses {
String address2;
String zipPostalCode;
String phoneNumber;
Null faxNumber;
dynamic faxNumber;
String customerAttributes;
String createdOnUtc;
Null province;

@ -40,6 +40,8 @@ class HomeHealthCareViewModel extends BaseViewModel {
PharmacyModuleService _pharmacyModuleService = locator<PharmacyModuleService>();
bool get isOrderUpdated => _homeHealthCareService.isOrderUpdated;
GetHHCAllPresOrdersResponseModel pendingOrder;
@ -136,9 +138,13 @@ class HomeHealthCareViewModel extends BaseViewModel {
{AddNewAddressRequestModel addNewAddressRequestModel}) async {
setState(ViewState.Busy);
await _customerAddressesService.addAddressInfo(
addNewAddressRequestModel: addNewAddressRequestModel
);
await _pharmacyModuleService.generatePharmacyToken().then((value) async{
await _customerAddressesService.addAddressInfo(
addNewAddressRequestModel: addNewAddressRequestModel
);
});
if (_customerAddressesService.hasError) {
error = _customerAddressesService.error;
setState(ViewState.ErrorLocal);

@ -43,4 +43,34 @@ class EyeViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
}
sendGlassesPrescriptionEmail({int appointmentNo, String projectName, int projectID}) async {
setState(ViewState.Busy);
await _eyeService.sendGlassesPrescriptionEmail(
appointmentNo: appointmentNo,
projectID: projectID,
projectName: projectName);
if (_eyeService.hasError) {
error = _eyeService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
sendContactLensPrescriptionEmail({int appointmentNo, String projectName, int projectID}) async {
setState(ViewState.Busy);
await _eyeService.sendContactLensPrescriptionEmail(
appointmentNo: appointmentNo,
projectID: projectID,
projectName: projectName);
if (_eyeService.hasError) {
error = _eyeService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
}
}
}

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart';
@ -8,12 +9,29 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:diplomaticquarterapp/locator.dart';
class OfferCategoriesViewModel extends BaseViewModel {
class OfferCategoriesViewModel extends BaseViewModel{
OffersAndPackagesServices service = locator<OffersAndPackagesServices>();
List<OfferCategoriesResponseModel> get list => service.categoryList;
get categoryList => service.categoryList;
get productList => service.categoryList;
}
class OfferProductsViewModel extends BaseViewModel {
class PackagesViewModel extends BaseViewModel {
OffersAndPackagesServices service = locator<OffersAndPackagesServices>();
List<OfferProductsResponseModel> get list => service.productList;
List<PackagesCategoriesResponseModel> get categoryList => service.categoryList;
List<PackagesResponseModel> get productList => service.productList;
List<PackagesResponseModel> get latestOffersList => service.latestOffersList;
List<PackagesResponseModel> get bestSellerList => service.bestSellerList;
List<PackagesResponseModel> get bannersList => service.bannersList;
List<PackagesCartItemsResponseModel> get cartItemList => service.cartItemList;
String _cartItemCount = "";
String get cartItemCount => _cartItemCount;
set cartItemCount(String value) {
_cartItemCount = value;
notifyListeners();
}
}

@ -49,7 +49,7 @@ class OrderModelViewModel extends BaseViewModel {
}
}
Future getOrderDetails(OrderId) async {
Future<OrderDetailModel> getOrderDetails(OrderId) async {
setState(ViewState.Busy);
await _orderDetailsService.getOrderDetails(OrderId);
if (_orderDetailsService.hasError) {
@ -58,6 +58,7 @@ class OrderModelViewModel extends BaseViewModel {
} else {
setState(ViewState.Idle);
}
return _orderDetailsService.orderList.first;
}
Future getProductReview() async {

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
offerCategoriesResponseModelFromJson(OfferCategoriesResponseModel data, Map<String, dynamic> json) {
offerCategoriesResponseModelFromJson(PackagesCategoriesResponseModel data, Map<String, dynamic> json) {
if (json['id'] != null) {
data.id = json['id']?.toString();
data.id = json['id'];
}
if (json['name'] != null) {
data.name = json['name']?.toString();
@ -91,7 +91,7 @@ offerCategoriesResponseModelFromJson(OfferCategoriesResponseModel data, Map<Stri
return data;
}
Map<String, dynamic> offerCategoriesResponseModelToJson(OfferCategoriesResponseModel entity) {
Map<String, dynamic> offerCategoriesResponseModelToJson(PackagesCategoriesResponseModel entity) {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = entity.id;
data['name'] = entity.name;

@ -1,8 +1,8 @@
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
offerProductsResponseModelFromJson(OfferProductsResponseModel data, Map<String, dynamic> json) {
offerProductsResponseModelFromJson(PackagesResponseModel data, Map<String, dynamic> json) {
if (json['id'] != null) {
data.id = json['id']?.toString();
data.id = json['id'];
}
if (json['visible_individually'] != null) {
data.visibleIndividually = json['visible_individually'];
@ -353,7 +353,7 @@ offerProductsResponseModelFromJson(OfferProductsResponseModel data, Map<String,
return data;
}
Map<String, dynamic> offerProductsResponseModelToJson(OfferProductsResponseModel entity) {
Map<String, dynamic> offerProductsResponseModelToJson(PackagesResponseModel entity) {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = entity.id;
data['visible_individually'] = entity.visibleIndividually;

@ -3,11 +3,11 @@
// ignore_for_file: prefer_single_quotes
// This file is automatically generated. DO NOT EDIT, all your changes would be lost.
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/generated/json/OfferCategoriesResponseModel_helper.dart';
import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart';
import 'package:diplomaticquarterapp/generated/json/log_geo_zone_response_model_entity_helper.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/OfferProductsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper.dart';
import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart';
import 'package:diplomaticquarterapp/generated/json/GeoZonesResponseModel_helper.dart';
@ -23,16 +23,16 @@ class JsonConvert<T> {
static _getFromJson<T>(Type type, data, json) {
switch (type) {
case OfferCategoriesResponseModel:
return offerCategoriesResponseModelFromJson(data as OfferCategoriesResponseModel, json) as T;
case PackagesCategoriesResponseModel:
return offerCategoriesResponseModelFromJson(data as PackagesCategoriesResponseModel, json) as T;
case OfferCategoriesResponseModelLocalizedName:
return offerCategoriesResponseModelLocalizedNameFromJson(data as OfferCategoriesResponseModelLocalizedName, json) as T;
case OfferCategoriesResponseModelImage:
return offerCategoriesResponseModelImageFromJson(data as OfferCategoriesResponseModelImage, json) as T;
case LogGeoZoneResponseModel:
return logGeoZoneResponseModelEntityFromJson(data as LogGeoZoneResponseModel, json) as T;
case OfferProductsResponseModel:
return offerProductsResponseModelFromJson(data as OfferProductsResponseModel, json) as T;
case PackagesResponseModel:
return offerProductsResponseModelFromJson(data as PackagesResponseModel, json) as T;
case OfferProductsResponseModelLocalizedName:
return offerProductsResponseModelLocalizedNameFromJson(data as OfferProductsResponseModelLocalizedName, json) as T;
case OfferProductsResponseModelImage:
@ -47,16 +47,16 @@ class JsonConvert<T> {
static _getToJson<T>(Type type, data) {
switch (type) {
case OfferCategoriesResponseModel:
return offerCategoriesResponseModelToJson(data as OfferCategoriesResponseModel);
case PackagesCategoriesResponseModel:
return offerCategoriesResponseModelToJson(data as PackagesCategoriesResponseModel);
case OfferCategoriesResponseModelLocalizedName:
return offerCategoriesResponseModelLocalizedNameToJson(data as OfferCategoriesResponseModelLocalizedName);
case OfferCategoriesResponseModelImage:
return offerCategoriesResponseModelImageToJson(data as OfferCategoriesResponseModelImage);
case LogGeoZoneResponseModel:
return logGeoZoneResponseModelEntityToJson(data as LogGeoZoneResponseModel);
case OfferProductsResponseModel:
return offerProductsResponseModelToJson(data as OfferProductsResponseModel);
case PackagesResponseModel:
return offerProductsResponseModelToJson(data as PackagesResponseModel);
case OfferProductsResponseModelLocalizedName:
return offerProductsResponseModelLocalizedNameToJson(data as OfferProductsResponseModelLocalizedName);
case OfferProductsResponseModelImage:
@ -72,16 +72,16 @@ class JsonConvert<T> {
//Go back to a single instance by type
static _fromJsonSingle<M>(json) {
String type = M.toString();
if (type == (OfferCategoriesResponseModel).toString()) {
return OfferCategoriesResponseModel().fromJson(json);
if (type == (PackagesCategoriesResponseModel).toString()) {
return PackagesCategoriesResponseModel().fromJson(json);
} else if (type == (OfferCategoriesResponseModelLocalizedName).toString()) {
return OfferCategoriesResponseModelLocalizedName().fromJson(json);
} else if (type == (OfferCategoriesResponseModelImage).toString()) {
return OfferCategoriesResponseModelImage().fromJson(json);
} else if (type == (LogGeoZoneResponseModel).toString()) {
return LogGeoZoneResponseModel().fromJson(json);
} else if (type == (OfferProductsResponseModel).toString()) {
return OfferProductsResponseModel().fromJson(json);
} else if (type == (PackagesResponseModel).toString()) {
return PackagesResponseModel().fromJson(json);
} else if (type == (OfferProductsResponseModelLocalizedName).toString()) {
return OfferProductsResponseModelLocalizedName().fromJson(json);
} else if (type == (OfferProductsResponseModelImage).toString()) {
@ -96,16 +96,16 @@ class JsonConvert<T> {
//list is returned by type
static M _getListChildType<M>(List<Map> data) {
if (List<OfferCategoriesResponseModel>() is M) {
return data.map((e) => OfferCategoriesResponseModel().fromJson(e)).toList() as M;
if (List<PackagesCategoriesResponseModel>() is M) {
return data.map((e) => PackagesCategoriesResponseModel().fromJson(e)).toList() as M;
} else if (List<OfferCategoriesResponseModelLocalizedName>() is M) {
return data.map((e) => OfferCategoriesResponseModelLocalizedName().fromJson(e)).toList() as M;
} else if (List<OfferCategoriesResponseModelImage>() is M) {
return data.map((e) => OfferCategoriesResponseModelImage().fromJson(e)).toList() as M;
} else if (List<LogGeoZoneResponseModel>() is M) {
return data.map((e) => LogGeoZoneResponseModel().fromJson(e)).toList() as M;
} else if (List<OfferProductsResponseModel>() is M) {
return data.map((e) => OfferProductsResponseModel().fromJson(e)).toList() as M;
} else if (List<PackagesResponseModel>() is M) {
return data.map((e) => PackagesResponseModel().fromJson(e)).toList() as M;
} else if (List<OfferProductsResponseModelLocalizedName>() is M) {
return data.map((e) => OfferProductsResponseModelLocalizedName().fromJson(e)).toList() as M;
} else if (List<OfferProductsResponseModelImage>() is M) {

@ -300,12 +300,9 @@ void setupLocator() {
// Offer And Packages
//----------------------
locator.registerLazySingleton(
() => OffersAndPackagesServices()); // offerPackagesServices Service
locator.registerFactory(
() => OfferCategoriesViewModel()); // Categories View Model
locator
.registerFactory(() => OfferProductsViewModel()); // Products View Model
locator.registerLazySingleton(() => OffersAndPackagesServices()); // offerPackagesServices Service
locator.registerFactory(() => OfferCategoriesViewModel()); // Categories View Model
locator.registerFactory(() => PackagesViewModel()); // Products View Model
//pharmacy
// locator.registerFactory(() => PharmacyCategoriseViewModel());

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/theme/theme_value.dart';
import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -15,6 +16,7 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import 'Constants.dart';
import 'config/shared_pref_kay.dart';
import 'config/size_config.dart';
import 'core/model/geofencing/requests/GeoZonesRequestModel.dart';
import 'core/service/geofencing/GeofencingServices.dart';
@ -34,7 +36,7 @@ class MyApp extends StatefulWidget {
class _MyApp extends State<MyApp> {
@override
void initState() {
void initState(){
// ProjectViewModel projectProvider;
// projectProvider = Provider.of(context);
// var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans';
@ -70,7 +72,10 @@ class _MyApp extends State<MyApp> {
value: SearchProvider(),
),
ChangeNotifierProvider<ThemeNotifier>(
create: (context) => ThemeNotifier(defaultTheme())),
create: (context) => ThemeNotifier(
defaultTheme()
)
),
StreamProvider.value(
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),
@ -138,6 +143,8 @@ class _MyApp extends State<MyApp> {
// ),
// ),
initialRoute: SPLASH,
// initialRoute: PACKAGES_OFFERS,
// initialRoute: PACKAGES_ORDER_COMPLETED,
routes: routes,
debugShowCheckedModeBanner: false,
),

@ -122,6 +122,7 @@ class _LocationPageState
}
});
await model.addAddressInfo(
addNewAddressRequestModel: addNewAddressRequestModel);
if (model.state == ViewState.ErrorLocal) {
@ -130,7 +131,7 @@ class _LocationPageState
AppToast.showSuccessToast(
message: "Address Added Successfully");
}
Navigator.of(context).pop();
Navigator.of(context).pop(addNewAddressRequestModel);
},
label: TranslationBase.of(context).addNewAddress,
),

@ -509,8 +509,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
Navigator.push(
context,
FadePage(
page:
LaboratoryResultPage(patientLabOrders: patientLabOrders)))
page: LaboratoryResultPage(patientLabOrders: patientLabOrders)))
.then((value) {});
}
@ -518,8 +517,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
Navigator.push(
context,
FadePage(
page:
RadiologyDetailsPage(finalRadiology: finalRadiology)))
page: RadiologyDetailsPage(finalRadiology: finalRadiology)))
.then((value) {});
}
@ -542,7 +540,17 @@ class _AppointmentActionsState extends State<AppointmentActions> {
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: ReminderDialog(appo: appo),
child: ReminderDialog(
eventId: appo.appointmentNo.toString(),
title: "Doctor Appointment",
description: "You have an appointment with " +
appo.doctorTitle +
" " +
appo.doctorNameObj,
startDate: appo.appointmentDate,
endDate: appo.appointmentDate,
location: appo.projectName,
),
),
);
},
@ -668,7 +676,10 @@ class _AppointmentActionsState extends State<AppointmentActions> {
context,
FadePage(
page: VitalSignDetailsScreen(
appointmentNo: appoNo, projectID: projectID,isNotOneAppointment: false,)));
appointmentNo: appoNo,
projectID: projectID,
isNotOneAppointment: false,
)));
}
navigateToInsertComplaint() {

@ -9,9 +9,14 @@ import 'package:manage_calendar_events/manage_calendar_events.dart';
class ReminderDialog extends StatefulWidget {
static var selectedDuration;
AppoitmentAllHistoryResultList appo;
final String eventId;
final String title;
final String description;
final String startDate;
final String endDate;
final String location;
ReminderDialog({@required this.appo});
ReminderDialog({@required this.eventId, @required this.title, @required this.description, @required this.startDate, @required this.endDate, @required this.location});
@override
_ReminderDialogState createState() => _ReminderDialogState();
@ -98,17 +103,14 @@ class _ReminderDialogState extends State<ReminderDialog> {
});
CalendarEvent calendarEvent = new CalendarEvent(
eventId: widget.appo.appointmentNo.toString(),
title: "Doctor Appointment",
description: "You have an appointment with " +
widget.appo.doctorTitle +
" " +
widget.appo.doctorNameObj,
startDate: DateUtil.convertStringToDate(widget.appo.appointmentDate)
eventId: widget.eventId,
title: widget.title,
description: widget.description,
startDate: DateUtil.convertStringToDate(widget.startDate)
.subtract(
new Duration(microseconds: ReminderDialog.selectedDuration)),
endDate: DateUtil.convertStringToDate(widget.appo.appointmentDate),
location: widget.appo.projectName,
endDate: DateUtil.convertStringToDate(widget.endDate),
location: widget.location,
duration: new Duration(minutes: 15).inMinutes,
isAllDay: false,
hasAlarm: true);
@ -118,7 +120,7 @@ class _ReminderDialogState extends State<ReminderDialog> {
.then((value) {
print("Cal event");
print(value);
if (int.parse(value) == widget.appo.appointmentNo) {
if (int.parse(value) == int.parse(widget.eventId)) {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
}
Navigator.of(context).pop();

@ -16,7 +16,7 @@ class InsurancePage extends StatelessWidget {
final InsuranceViewModel model;
InsuranceCardService _insuranceCardService = locator<InsuranceCardService>();
InsurancePage({Key key, this.model}) : super(key: key);
InsurancePage({Key key, this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
@ -31,24 +31,20 @@ class InsurancePage extends StatelessWidget {
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
if (model.user != null)
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 2.0,
left: 10.0,
right: 20.0),
margin:
EdgeInsets.only(top: 2.0, left: 10.0, right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
model.user.firstName ?? '' + " " + model.user.lastName ?? '',
model.user.firstName + " " + model.user.lastName,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -57,11 +53,9 @@ class InsurancePage extends StatelessWidget {
height: 8,
),
Texts(
TranslationBase.of(context)
.fileno +
TranslationBase.of(context).fileno +
": " +
model.user.patientID
.toString(),
model.user.patientID.toString(),
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -78,9 +72,7 @@ class InsurancePage extends StatelessWidget {
children: <Widget>[
Container(
child: SecondaryButton(
label: TranslationBase.of(
context)
.fetchData,
label: TranslationBase.of(context).fetchData,
small: true,
textColor: Colors.white,
onTap: () {
@ -88,15 +80,12 @@ class InsurancePage extends StatelessWidget {
setupID: '010266',
projectID: 15,
patientIdentificationID:
model.user
.patientIdentificationNo,
patientID: model
.user.patientID,
name: model.user
.firstName +
model.user.patientIdentificationNo,
patientID: model.user.patientID,
name: model.user.firstName +
" " +
model
.user.lastName,context: context);
model.user.lastName,
context: context);
},
),
),
@ -107,122 +96,115 @@ class InsurancePage extends StatelessWidget {
],
),
),
if(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList != null ?? false)
...List.generate(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.length, (index) =>
model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList[index].status == 3
? Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin: EdgeInsets.fromLTRB(
8.0, 16.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 2.0,
left: 10.0,
right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: <Widget>[
Texts(
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientName,
fontSize: 14,
color: Colors.black,
fontWeight:
FontWeight.w500,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(
context)
.fileno +
": " +
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientID
.toString(),
fontSize: 14,
color: Colors.black,
fontWeight:
FontWeight.w500,
)
],
),
),
),
Expanded(
flex: 2,
child: Container(
margin:
EdgeInsets.only(top: 2.0),
child: Column(
children: <Widget>[
Container(
child: SecondaryButton(
label: TranslationBase
.of(context)
.fetchData,
small: true,
textColor:
Colors.white,
onTap: () {
getDetails(
projectID: 15,
patientIdentificationID: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientIdenficationNumber,
setupID:
'010266',
patientID: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.responseID,
name: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index].patientName,context: context);
},
),
if (model.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList !=
null ??
false)
...List.generate(
model.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList.length,
(index) => model.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[index].status ==
3
? Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 2.0, left: 10.0, right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Texts(
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientName,
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
),
SizedBox(
height: 8,
),
Texts(
TranslationBase.of(context).fileno +
": " +
model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientID
.toString(),
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
)
],
),
),
),
Expanded(
flex: 2,
child: Container(
margin: EdgeInsets.only(top: 2.0),
child: Column(
children: <Widget>[
Container(
child: SecondaryButton(
label: TranslationBase.of(context)
.fetchData,
small: true,
textColor: Colors.white,
onTap: () {
getDetails(
projectID: 15,
patientIdentificationID: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientIdenficationNumber,
setupID: '010266',
patientID: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.responseID,
name: model
.getAllSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList[
index]
.patientName,
context: context);
},
),
),
],
),
),
)
],
),
],
),
),
),
)
],
),
),
),
)
: Container()
),
)
: Container()),
],
),
);
@ -230,29 +212,32 @@ class InsurancePage extends StatelessWidget {
getDetails(
{String setupID,
int projectID,
String patientIdentificationID,
int patientID,
String name,BuildContext context}) {
int projectID,
String patientIdentificationID,
int patientID,
String name,
BuildContext context}) {
GifLoaderDialogUtils.showMyDialog(context);
_insuranceCardService
.getPatientInsuranceDetails(
setupID: setupID,
projectID: projectID,
patientID: patientID,
patientIdentificationID: patientIdentificationID)
setupID: setupID,
projectID: projectID,
patientID: patientID,
patientIdentificationID: patientIdentificationID)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) {
if (!_insuranceCardService.hasError &&
_insuranceCardService.isHaveInsuranceCard) {
Navigator.push(
context,
FadePage(
page: InsuranceCardUpdateDetails(
insuranceCardDetailsModel: _insuranceCardService.insuranceCardDetailsList,
patientID: patientID,
patientIdentificationID: patientIdentificationID,
name: name,
)));
insuranceCardDetailsModel:
_insuranceCardService.insuranceCardDetailsList,
patientID: patientID,
patientIdentificationID: patientIdentificationID,
name: name,
)));
} else {
AppToast.showErrorToast(message: _insuranceCardService.error);
}

@ -32,7 +32,11 @@ class _InsuranceUpdateState extends State<InsuranceUpdate>
super.initState();
_tabController = TabController(length: 2, vsync: this);
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
imagesInfo.add(ImagesInfo(
imageEn:
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
}
void dispose() {
@ -111,7 +115,7 @@ class _InsuranceUpdateState extends State<InsuranceUpdate>
physics: BouncingScrollPhysics(),
controller: _tabController,
children: <Widget>[
InsurancePage(model:model),
InsurancePage(model: model),
Container(
child: ListView.builder(
itemCount: model.insuranceUpdate == null
@ -227,6 +231,4 @@ class _InsuranceUpdateState extends State<InsuranceUpdate>
),
);
}
}

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-locat
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -459,6 +460,33 @@ class _HomePageState extends State<HomePage> {
),
],
),
Padding(
padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15),
child: InkWell(
onTap: (){
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage()));
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xffB8382C),
),
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
children: [
Texts(
TranslationBase.of(context).offerAndPackages,
color: Colors.white, fontSize: 20, fontWeight: FontWeight.normal,
),
Spacer(),
Image.asset("assets/images/offer_icon.png"),
],
),
),
),
),
),
if (projectViewModel.havePrivilege(64) ||
projectViewModel.havePrivilege(65) ||
projectViewModel.havePrivilege(67))

@ -237,7 +237,7 @@ class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.10,
height: 90,
width: double.infinity,
padding: EdgeInsets.all(18),
child: SecondaryButton(

@ -49,7 +49,7 @@ class MyBalancePage extends StatelessWidget {
width: double.infinity,
height: 65,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
color: Colors.red[700],
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(7),
),
@ -79,7 +79,7 @@ class MyBalancePage extends StatelessWidget {
height: 65,
margin: EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(7),
),

@ -1,17 +1,28 @@
import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.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/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ClassesPage extends StatelessWidget {
final ListHISGetGlassPerscription glassPerscription;
final int appointmentNo;
final String projectName;
final int projectID;
const ClassesPage({Key key, this.glassPerscription}) : super(key: key);
const ClassesPage(
{Key key,
this.glassPerscription,
this.appointmentNo,
this.projectName,
this.projectID})
: super(key: key);
@override
Widget build(BuildContext context) {
@ -38,11 +49,16 @@ class ClassesPage extends StatelessWidget {
bold: true,
),
),
getRow(TranslationBase.of(context).sphere, '${glassPerscription.rightEyeSpherical}', '-'),
getRow(TranslationBase.of(context).cylinder, '${glassPerscription.rightEyeCylinder}', '-'),
getRow(TranslationBase.of(context).axis, '${glassPerscription.rightEyeAxis}', '-'),
getRow(TranslationBase.of(context).prism, '${glassPerscription.rightEyePrism}', '-'),
getRow(TranslationBase.of(context).va, '${glassPerscription.rightEyeVA}', '-'),
getRow(TranslationBase.of(context).sphere,
'${glassPerscription.rightEyeSpherical}', '-'),
getRow(TranslationBase.of(context).cylinder,
'${glassPerscription.rightEyeCylinder}', '-'),
getRow(TranslationBase.of(context).axis,
'${glassPerscription.rightEyeAxis}', '-'),
getRow(TranslationBase.of(context).prism,
'${glassPerscription.rightEyePrism}', '-'),
getRow(TranslationBase.of(context).va,
'${glassPerscription.rightEyeVA}', '-'),
],
),
),
@ -65,11 +81,16 @@ class ClassesPage extends StatelessWidget {
bold: true,
),
),
getRow(TranslationBase.of(context).sphere, '${glassPerscription.leftEyeSpherical}', '-'),
getRow(TranslationBase.of(context).cylinder, '${glassPerscription.leftEyeCylinder}', '-'),
getRow(TranslationBase.of(context).axis, '${glassPerscription.leftEyeAxis}', '-'),
getRow(TranslationBase.of(context).prism, '${glassPerscription.leftEyePrism}', '-'),
getRow(TranslationBase.of(context).va, '${glassPerscription.leftEyeVA}', '-'),
getRow(TranslationBase.of(context).sphere,
'${glassPerscription.leftEyeSpherical}', '-'),
getRow(TranslationBase.of(context).cylinder,
'${glassPerscription.leftEyeCylinder}', '-'),
getRow(TranslationBase.of(context).axis,
'${glassPerscription.leftEyeAxis}', '-'),
getRow(TranslationBase.of(context).prism,
'${glassPerscription.leftEyePrism}', '-'),
getRow(TranslationBase.of(context).va,
'${glassPerscription.leftEyeVA}', '-'),
],
),
),
@ -80,6 +101,16 @@ class ClassesPage extends StatelessWidget {
width: double.infinity,
child: SecondaryButton(
label: TranslationBase.of(context).sendEmail,
onTap: () {
showConfirmMessage(context, () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.sendGlassesPrescriptionEmail(
appointmentNo: appointmentNo,
projectName: projectName,
projectID: projectID);
GifLoaderDialogUtils.hideDialog(context);
}, model.user.emailAddress);
},
textColor: Colors.white,
color: Colors.red[700],
icon: Icon(
@ -96,6 +127,19 @@ class ClassesPage extends StatelessWidget {
);
}
void showConfirmMessage(
BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
),
);
}
Widget getRow(String title, String val1, String val2) => Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
@ -113,7 +157,7 @@ class ClassesPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Texts(val1 == 'null' ? '-' : val1),
Texts(val2 != 'null' ? '-' :val2),
Texts(val2 != 'null' ? '-' : val2),
],
),
)

@ -1,8 +1,12 @@
import 'package:diplomaticquarterapp/core/model/eye/AppoimentAllHistoryResult.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/EyeViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.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/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -10,95 +14,126 @@ import 'package:provider/provider.dart';
class ContactLensPage extends StatelessWidget {
final ListHISGetContactLensPerscription listHISGetContactLensPerscription;
final int appointmentNo;
final String projectName;
final int projectID;
const ContactLensPage({Key key, this.listHISGetContactLensPerscription})
const ContactLensPage(
{Key key,
this.listHISGetContactLensPerscription,
this.appointmentNo,
this.projectName,
this.projectID})
: super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 70, left: 15, right: 15, bottom: 15),
child: Column(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
TranslationBase.of(context).rightEye,
fontSize: 23,
bold: true,
return BaseView<EyeViewModel>(
builder: (_,model,w)=>
AppScaffold(
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(top: 70, left: 15, right: 15, bottom: 15),
child: Column(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
TranslationBase.of(context).rightEye,
fontSize: 23,
bold: true,
),
),
),
getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'),
getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow('Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}'),
],
getRow(TranslationBase.of(context).brand,
'${listHISGetContactLensPerscription.brand}'),
getRow('B.C',
'${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power,
'${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter,
'${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow(
'Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder,
'${listHISGetContactLensPerscription.remarks}'),
],
),
),
),
SizedBox(
height: 17,
),
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
TranslationBase.of(context).leftEye,
fontSize: 23,
bold: true,
),
),
getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription.brand}'),
getRow('B.C', '${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow('Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}'),
],
SizedBox(
height: 17,
),
),
SizedBox(
height: 17,
),
if(projectViewModel.havePrivilege(15))
Container(
width: double.infinity,
child: SecondaryButton(
label: TranslationBase.of(context).sendEmail,
textColor: Colors.white,
color: Colors.red[700],
icon: Icon(
Icons.email,
color: Colors.white,
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)),
color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(
TranslationBase.of(context).leftEye,
fontSize: 23,
bold: true,
),
),
getRow(TranslationBase.of(context).brand,
'${listHISGetContactLensPerscription.brand}'),
getRow('B.C',
'${listHISGetContactLensPerscription.baseCurve}'),
getRow(TranslationBase.of(context).power,
'${listHISGetContactLensPerscription.power}'),
getRow(TranslationBase.of(context).diameter,
'${listHISGetContactLensPerscription.diameter}'),
getRow('OZ', '${listHISGetContactLensPerscription.oZ}'),
getRow('CT', '${listHISGetContactLensPerscription.cT}'),
getRow(
'Blend', '${listHISGetContactLensPerscription.blend}'),
getRow(TranslationBase.of(context).reminder,
'${listHISGetContactLensPerscription.remarks}'),
],
),
),
)
],
SizedBox(
height: 17,
),
if (projectViewModel.havePrivilege(15))
Container(
width: double.infinity,
child: SecondaryButton(
label: TranslationBase.of(context).sendEmail,
textColor: Colors.white,
color: Colors.red[700],
onTap: (){
showConfirmMessage(context, () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.sendContactLensPrescriptionEmail(
appointmentNo: appointmentNo,
projectName: projectName,
projectID: projectID);
GifLoaderDialogUtils.hideDialog(context);
}, model.user.emailAddress);
},
icon: Icon(
Icons.email,
color: Colors.white,
),
),
)
],
),
),
),
),
@ -130,4 +165,18 @@ class ContactLensPage extends StatelessWidget {
],
),
);
void showConfirmMessage(
BuildContext context, GestureTapCallback onTap, String email) {
showDialog(
context: context,
child: ConfirmSendEmailDialog(
email: email,
onTapSendEmail: () {
onTap();
},
),
);
}
}

@ -43,6 +43,7 @@ class _EyeHomePageState extends State<EyeHomePage>
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
appBarTitle: TranslationBase.of(context).measurements,
body: Scaffold(
extendBodyBehindAppBar: true,
@ -81,13 +82,13 @@ class _EyeHomePageState extends State<EyeHomePage>
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.27,
width: MediaQuery.of(context).size.width * 0.40,
child: Center(
child: Texts(TranslationBase.of(context).classes),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.27,
width: MediaQuery.of(context).size.width * 0.40,
child: Center(
child: Texts(TranslationBase.of(context).contactLens),
),
@ -110,11 +111,15 @@ class _EyeHomePageState extends State<EyeHomePage>
ClassesPage(
glassPerscription: widget.appointmentAllHistoryResultList
.listHISGetGlassPerscription[0],
appointmentNo: widget.appointmentAllHistoryResultList.appointmentNo,
projectName: widget.appointmentAllHistoryResultList.projectName,
projectID: widget.appointmentAllHistoryResultList.projectID,
),
ContactLensPage(
listHISGetContactLensPerscription: widget
.appointmentAllHistoryResultList
.listHISGetContactLensPerscription[0],
listHISGetContactLensPerscription: widget.appointmentAllHistoryResultList.listHISGetContactLensPerscription[0],
appointmentNo: widget.appointmentAllHistoryResultList.appointmentNo,
projectName: widget.appointmentAllHistoryResultList.projectName,
projectID: widget.appointmentAllHistoryResultList.projectID,
)
],
),

@ -4,6 +4,7 @@ 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/AlHabibMedicalService/add_new_address_Request_Model.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';
@ -212,7 +213,51 @@ class _PrescriptionDeliveryAddressPageState
latitude: latitude,
longitude: longitude,
)),
);
).then((value) {
if (value != null &&
value is AddNewAddressRequestModel) {
setState(() {
_selectedAddress = AddressInfo(
id: value.customer.id.toString(),
email: value.customer.email,
firstName: value.customer.addresses[0].firstName,
lastName: value.customer.addresses[0].lastName,
address1: value.customer.addresses[0].address1,
address2: value.customer.addresses[0].address2,
city: value.customer.addresses[0].city,
country: value.customer.addresses[0].country,
phoneNumber: value.customer.addresses[0].phoneNumber,
latLong: value.customer.addresses[0].latLong,
company: value.customer.addresses[0].company,
countryId: value.customer.addresses[0].countryId,
createdOnUtc: value.customer.addresses[0].createdOnUtc,
customerAttributes: value.customer.addresses[0].customerAttributes,
faxNumber: value.customer.addresses[0].faxNumber,
province: value.customer.addresses[0].province,
stateProvinceId: value.customer.addresses[0].stateProvinceId,
zipPostalCode: value.customer.addresses[0].zipPostalCode,
);
List latLongArr = _selectedAddress.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,
);
});
}
});
},
),
),

@ -20,7 +20,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget {
onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: prescriptionReport.itemID),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).ports,
appBarTitle: TranslationBase.of(context).availability,
baseViewModel: model,
body: ListView.builder(
itemBuilder: (context, index) => Container(

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -6,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PrescriptionDetailsPage extends StatelessWidget {
final PrescriptionReport prescriptionReport;
@ -59,40 +62,49 @@ class PrescriptionDetailsPage extends StatelessWidget {
),
Container(
margin: EdgeInsets.all(8),
child: InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PharmacyForPrescriptionsPage(
prescriptionReport: prescriptionReport),
),
),
child: Center(
child: Column(
children: <Widget>[
Container(
width: 50,
decoration: BoxDecoration(
color: Colors.white, shape: BoxShape.rectangle),
child: Row(
children: [
Expanded(
child: InkWell(
onTap: () => Navigator.push(
context,
FadePage(
page: PharmacyForPrescriptionsPage(
prescriptionReport: prescriptionReport),
),
),
child: Center(
child: Column(
children: <Widget>[
Icon(
Icons.pin_drop,
color: Colors.red[800],
size: 55,
Container(
width: 50,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle),
child: Column(
children: <Widget>[
Icon(
Icons.pin_drop,
color: Colors.red[800],
size: 55,
),
],
),
),
SizedBox(
height: 5,
),
Texts(TranslationBase.of(context).availability)
],
),
),
SizedBox(
height: 5,
),
Texts(TranslationBase.of(context).ports)
],
),
)),
)),
),
_addReminderButton(context)
],
),
),
Container(
color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table(
border: TableBorder.symmetric(
@ -106,28 +118,28 @@ class PrescriptionDetailsPage extends StatelessWidget {
height: 30,
width: double.infinity,
child: Center(
child: Texts(TranslationBase.of(context).way))),
child: Texts(TranslationBase.of(context).route, fontSize: 14,))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child:
Texts(TranslationBase.of(context).average))),
Texts(TranslationBase.of(context).frequency, fontSize: 14,))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 4),
child: Center(
child: Texts(
TranslationBase.of(context).dailyDoses))),
"${TranslationBase.of(context).dailyDoses}", fontSize: 14,))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child:
Texts(TranslationBase.of(context).period))),
Texts(TranslationBase.of(context).duration, fontSize: 14,))),
],
),
TableRow(
@ -192,4 +204,96 @@ class PrescriptionDetailsPage extends StatelessWidget {
),
);
}
Widget _addReminderButton(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return GestureDetector(
onTap: () {
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month,
startDate.day + prescriptionReport.days);
print(prescriptionReport);
showGeneralDialog(
barrierColor: Colors.black.withOpacity(0.5),
transitionBuilder: (context, a1, a2, widget) {
final curvedValue =
Curves.easeInOutBack.transform(a1.value) - 1.0;
return Transform(
transform:
Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: ReminderDialog(
eventId: prescriptionReport.itemID.toString(),
title: "Prescription Reminder",
description:
"${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ",
startDate:
"/Date(${startDate.millisecondsSinceEpoch}+0300)/",
endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/",
location: prescriptionReport.remarks,
),
),
);
},
transitionDuration: Duration(milliseconds: 500),
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {});
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
// height: 100.0,
margin: EdgeInsets.all(7.0),
padding: EdgeInsets.only(bottom: 4.0),
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)
], borderRadius: BorderRadius.circular(10), color: Colors.white),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0),
child: Text("add",
overflow: TextOverflow.clip,
style: TextStyle(
color: new Color(0xffB8382C),
letterSpacing: 1.0,
fontSize: 18.0)),
),
Container(
margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
child: Text("reminder",
overflow: TextOverflow.clip,
style: TextStyle(
color: Colors.black,
letterSpacing: 1.0,
fontSize: 15.0)),
),
Container(
alignment: projectViewModel.isArabic
? Alignment.bottomLeft
: Alignment.bottomRight,
margin: projectViewModel.isArabic
? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0)
: EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0),
child: Image.asset(
"assets/images/new-design/reminder_icon.png",
width: 45.0,
height: 45.0),
),
],
),
),
],
),
);
}
}

@ -106,26 +106,26 @@ class _HomeReportPageState extends State<HomeReportPage>
unselectedLabelColor: Colors.grey[800],
tabs: [
Container(
width: MediaQuery.of(context).size.width * 0.15,
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child: Texts(TranslationBase.of(context).requested,fontSize: 11,),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.15,
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child: Texts(TranslationBase.of(context).ready,fontSize: 11,),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.15,
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child:
Texts(TranslationBase.of(context).completed,fontSize: 11,),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.15,
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child:
Texts(TranslationBase.of(context).cancelled,fontSize: 11,),

@ -48,16 +48,13 @@ class MedicalReports extends StatelessWidget {
)),
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.only(left: 5, right: 5),
child: LargeAvatar(
width: 50,
height: 50,
name: model.appointHistoryList[index].doctorNameObj,
url: model.appointHistoryList[index].doctorImageURL,
),
Container(
margin: EdgeInsets.only(left: 5, right: 5),
child: LargeAvatar(
width: 50,
height: 50,
name: model.appointHistoryList[index].doctorNameObj,
url: model.appointHistoryList[index].doctorImageURL,
),
),
Expanded(
@ -85,29 +82,26 @@ class MedicalReports extends StatelessWidget {
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () =>
confirmBox(model.appointHistoryList[index], model),
child: Container(
width: 85,
height: 50,
decoration: BoxDecoration(
color: Colors.black54,
border:
Border.all(color: Colors.transparent, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
InkWell(
onTap: () =>
confirmBox(model.appointHistoryList[index], model),
child: Container(
width: 120,
height: 50,
decoration: BoxDecoration(
color: Colors.black54,
border:
Border.all(color: Colors.transparent, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(
Radius.circular(8.0),
),
child: Center(
child: Texts(
TranslationBase.of(context).requestReport,
fontSize: 12,
color: Colors.white,
),
),
child: Center(
child: Texts(
TranslationBase.of(context).requestReport,
fontSize: 12,
color: Colors.white,
),
),
),

@ -81,7 +81,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
height: 20,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.grey),
color: Colors.red),
),
SizedBox(width: 5,),
Texts(TranslationBase.of(context).diastolicLng)
@ -125,7 +125,6 @@ class LineChartCurvedBloodPressure extends StatelessWidget {
fontSize: 10,
),
rotateAngle: -65,
//rotateAngle:-65,
margin: 22,
getTitles: (value) {
if (timeSeries1.length < 15) {

@ -0,0 +1,108 @@
import 'package:after_layout/after_layout.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'CreateCustomerDailogPage.dart';
dynamic languageID;
class ClinicPackagesPage extends StatefulWidget {
List<PackagesResponseModel> products;
ClinicPackagesPage({@required this.products});
@override
_ClinicPackagesPageState createState() => _ClinicPackagesPageState();
}
class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayoutMixin<ClinicPackagesPage>{
AppScaffold appScaffold;
List<PackagesResponseModel> get _products => widget.products;
PackagesViewModel viewModel;
onProductCartClick(PackagesResponseModel product) async {
if(viewModel.service.customer == null)
viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) {
utils.Utils.showErrorToast(error);
});
}
}
@override
void afterFirstLayout(BuildContext context) async{
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model){
viewModel = model;
},
builder: (_, model, wi) => appScaffold = AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: true,
isShowDecPage: false,
body: Padding(
padding: const EdgeInsets.all(5),
child: StaggeredGridView.countBuilder(
crossAxisCount:4,
itemCount: _products.length,
itemBuilder: (BuildContext context, int index) => new Container(
color: Colors.transparent,
child: PackagesItemCard( itemContentPadding: 10,itemModel: _products[index], onCartClick: onProductCartClick,)
),
staggeredTileBuilder: (int index) => StaggeredTile.fit(2),
mainAxisSpacing: 20,
crossAxisSpacing: 10,
)
),
),
);
}
}

@ -0,0 +1,198 @@
import 'package:after_layout/after_layout.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/AnimatedTextFields.dart';
import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart';
import 'package:diplomaticquarterapp/widgets/LoadingButton.dart';
import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
dynamic languageID;
var emailRegex = RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$');
class CreateCustomerDialogPage extends StatefulWidget {
final BuildContext context;
CreateCustomerDialogPage({this.context});
PackagesViewModel viewModel;
Future<PackagesCustomerResponseModel> show() async{
await showDialog(context: context, builder: (context ){
return AlertDialog(content: this, shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
), elevation: 5, );
});
return viewModel.service.customer;
}
@override
_CreateCustomerDialogPageState createState() => _CreateCustomerDialogPageState();
}
class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> with AfterLayoutMixin<CreateCustomerDialogPage>, TickerProviderStateMixin{
AnimationController _loadingController;
AnimationController _submitController;
bool _enableInput = true;
Interval _nameTextFieldLoadingAnimationInterval = const Interval(0, .85);
final _phoneFocusNode = FocusNode();
@override
void initState() {
_submitController = AnimationController(vsync: this, duration: Duration(milliseconds: 1000),);
super.initState();
}
@override
void afterFirstLayout(BuildContext context) async{
}
// Controllers
TextEditingController _emailTextController = TextEditingController();
TextEditingController _phoneTextController = TextEditingController();
TextEditingController _emailPinTextController = TextEditingController();
TextEditingController _phonePinTextController = TextEditingController();
bool verifyPin = false;
PackagesViewModel viewModel() => widget.viewModel;
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model) => widget.viewModel = model,
builder: (_, model, wi) => verifyPin ? verifyPinWidget() : userDetailWidget()
);
}
Widget verifyPinWidget(){
}
Widget userDetailWidget(){
return
Container(
width: SizeConfig.realScreenWidth * 0.8,
height: 270,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Align(
alignment: Alignment.center,
child: Texts("Create Guest Customer", textAlign: TextAlign.center, fontSize: 18, fontWeight: FontWeight.bold,)
),
SizedBox(height: 30,),
AnimatedTextFormField(
enabled: _enableInput,
controller: _emailTextController,
width: 100,
loadingController: _loadingController,
interval: _nameTextFieldLoadingAnimationInterval,
labelText: "Email",
prefixIcon: Icon(Icons.email),
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next,
onFieldSubmitted: (value) {
FocusScope.of(context).requestFocus(_phoneFocusNode);
},
validator: (value){
return (value.isEmpty || !emailRegex.hasMatch(value))
? 'Invalid email!'
: null;
},
),
SizedBox(height: 30,),
AnimatedTextFormField(
enabled: _enableInput,
controller: _phoneTextController,
width: 100,
loadingController: _loadingController,
interval: _nameTextFieldLoadingAnimationInterval,
labelText: "Mobile Number",
prefixIcon: Icon(Icons.phone_android),
keyboardType: TextInputType.phone,
textInputAction: TextInputAction.next,
onFieldSubmitted: (value) {
FocusScope.of(context).requestFocus(_phoneFocusNode);
},
validator: (value){
return (value.isEmpty || !emailRegex.hasMatch(value))
? 'Invalid email!'
: null;
},
),
Spacer(flex: 1,),
AnimatedButton(
color: Theme.of(context).primaryColor,
loadingColor: Theme.of(context).primaryColor,
controller: _submitController,
text: TranslationBase.of(context).done,
onPressed: (){
createCustomer();
},
)
,
],
),
);
}
createCustomer() async{
setState(() => _enableInput = false);
loading(true);
var request = PackagesCustomerRequestModel(email: _emailTextController.text, phoneNumber: _phoneTextController.text);
viewModel().service
.createCustomer(request, context: context, showLoading: false)
.then((value) => success())
.catchError((error) => showError(error));
}
success() async{
loading(false);
await Future.delayed(Duration(seconds: 2));
Navigator.of(context).pop();
}
showError(String errorMessage) async{
loading(false);
setState(() => _enableInput = true);
}
loading(bool can){
can ? _submitController.forward() : _submitController.reverse();
}
}

@ -0,0 +1,221 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/ProductCheckTypeWidget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'ClinicOfferAndPackagesPage.dart';
class OfferAndPackagesDetail extends StatefulWidget{
final dynamic model;
const OfferAndPackagesDetail({@required this.model, Key key}) : super(key: key);
@override
State<StatefulWidget> createState() => OfferAndPackagesDetailState();
}
class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail>{
PackagesViewModel viewModel;
@override
Widget build(BuildContext context) {
getLanguageID();
return BaseView<PackagesViewModel>(
onModelReady: (model){
viewModel = model;
},
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: true,
isShowDecPage: false,
body: Stack(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 60),
child: ListView(
children: [
Padding(
padding: const EdgeInsets.all(5),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.all(10),
child: AspectRatio(
aspectRatio: 1/1,
child: utils.applyShadow(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: utils.Utils.loadNetworkImage(url: "https://wallpaperaccess.com/full/30103.jpg",)
),
)
),
),
Align(
alignment: Alignment.topLeft,
child: Image.asset(
'assets/images/discount_${'en'}.png',
height: 70,
width: 70,
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
"Child Dental Offer",
fontSize: 25,
fontWeight: FontWeight.normal,
color: Colors.black,
),
Stack(
children: [
Texts(
"200 SAR",
fontWeight: FontWeight.normal,
decoration: TextDecoration.lineThrough,
color: Colors.grey,
fontSize: 12
),
Padding(
padding: const EdgeInsets.only(top: 15),
child: Texts(
"894.99 SAR",
fontWeight: FontWeight.bold,
color: Colors.green,
fontSize: 18
),
),
],
),
StarRating(
size: 20,
totalCount: null,
totalAverage: 5,
forceStars: true),
SizedBox(height: 20,),
Texts(
"Details",
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 20
),
AspectRatio(
aspectRatio: 2/1,
child: Container(
color: Colors.grey[300],
child: Padding(
padding: const EdgeInsets.all(10),
child: Texts("Detail of offers written here"),
)
),
),
SizedBox(height: 10,),
],
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(10),
child: Align(
alignment: Alignment.bottomRight,
child: Row(
children: [
Expanded(
child: RaisedButton.icon(
padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
side: BorderSide(color: Colors.red, width: 0.5)
),
color: Colors.red,
icon: Icon(
Icons.add_shopping_cart_outlined,
size: 25,
color: Colors.white,
),
label: Texts(
"Add to Cart",
fontSize: 17, color: Colors.white, fontWeight: FontWeight.normal,
),
onPressed: (){},),
),
SizedBox(width: 15,),
Expanded(
child: OutlineButton.icon(
padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
borderSide: BorderSide(width: 1.0, color: Colors.red),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
),
color: Colors.white,
icon: Icon(
Icons.favorite_rounded,
size: 25,
color: Colors.red,
),
label: Texts(
"Add to Favorites",
fontSize: 17, color: Colors.red, fontWeight: FontWeight.normal
),
onPressed: (){
},),
),
],
),
),
)
],
)
),
);
}
}

@ -0,0 +1,405 @@
import 'package:after_layout/after_layout.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/enum/PaymentOptions.dart';
import 'package:diplomaticquarterapp/core/model/ResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart';
import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesCartItemCard.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.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/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
dynamic languageID;
const _columnCount = 1;
AnimationController _animationController;
class PackagesCartPage extends StatefulWidget {
PackagesCartPage();
@override
_PackagesCartPageState createState() => _PackagesCartPageState();
}
class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMixin<PackagesCartPage>, SingleTickerProviderStateMixin {
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
@override
void initState() {
_agreeTerms = false;
_selectedPaymentMethod = null;
_animationController = AnimationController(vsync: this, duration: Duration(seconds: 500));
super.initState();
}
@override
void dispose() {
_animationController.dispose();
viewModel.cartItemList.clear();
super.dispose();
}
PackagesViewModel viewModel;
bool loadWidgets = false;
onTermsClick(bool isAgree) {
setState(() => _agreeTerms = isAgree);
}
onTermsInfoClick() {
Navigator.push(context, FadePage(page: PharmacyTermsConditions()));
}
onPayNowClick() async{
await viewModel.service.placeOrder(context: context,paymentOption: _selectedPaymentMethod.toUpperCase()).then((orderId){
if(orderId.runtimeType == int){ // result == order_id
var browser = MyInAppBrowser(
context: context,
onExitCallback: (data, isDone) => paymentClosed(orderId: orderId, withStatus: isDone, data: data)
);
browser.openPackagesPaymentBrowser(customer_id: viewModel.service.customer.id, order_id: orderId);
}else{
utils.Utils.showErrorToast('Failed to place order, please try again later');
}
}).catchError((error){
utils.Utils.showErrorToast(error);
});
}
@override
void afterFirstLayout(BuildContext context) {
fetchData();
}
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model) => viewModel = model,
builder: (_, model, wi) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: false,
isShowDecPage: false,
body: Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.all(5),
child: StaggeredGridView.countBuilder(
crossAxisCount: (_columnCount * _columnCount),
itemCount: viewModel.cartItemList.length,
itemBuilder: (BuildContext context, int index) {
var item = viewModel.cartItemList[index];
return Dismissible(
key: Key(index.toString()),
direction: DismissDirection.startToEnd,
background: _cartItemDeleteContainer(),
secondaryBackground: _cartItemDeleteContainer(),
confirmDismiss: (direction) async {
bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false);
return status;
},
onDismissed: (direction) {
debugPrint('Index: $index');
viewModel.cartItemList.removeAt(index);
},
child: PackagesCartItemCard(
itemModel: item,
shouldStepperChangeApply: (apply,total) async{
var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply);
ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error){
utils.Utils.showErrorToast(error);
});
return response.status ?? false;
},
)
);
},
staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount),
mainAxisSpacing: 0,
crossAxisSpacing: 10,
)),
),
Container(
height: 0.25,
color: Theme.of(context).primaryColor,
),
Container(
color: Colors.white,
child: Column(
children: [
Texts(
TranslationBase.of(context).selectPaymentOption,
fontSize: 10,
fontWeight: FontWeight.bold
),
Container(height: 0.25, width: 100, color: Colors.grey[300],),
_paymentOptions(context, (paymentMethod) {
setState(() => _selectedPaymentMethod = paymentMethod);
}),
Container(height: 0.25, color: Colors.grey[300],),
Container(height: 40,
child: _termsAndCondition(context, onSelected: onTermsClick, onInfoClick: onTermsInfoClick)
),
Container(height: 0.25, color: Colors.grey[300],),
_payNow(context, onPayNowClick: onPayNowClick)
],
),
)
],
),
);
});
}
fetchData() async {
await viewModel.service.cartItems(context: context).catchError((error) {});
setState((){});
}
paymentClosed({@required int orderId, @required bool withStatus, dynamic data}) async{
viewModel.service.getOrderById(orderId, context: context).then((value){
var heading = withStatus ? "Success" : "Failed";
var title = "Your order has been placed successfully";
var subTitle = "Order# ${value.data.customOrderNumber}";
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => PackageOrderCompletedPage(heading: heading, title: title, subTitle: subTitle))
);
}).catchError((error){
debugPrint(error);
});
}
}
// /* Payment Footer Widgets */
// ---------------------------
String _selectedPaymentMethod;
Widget _paymentOptions(BuildContext context, Function(String) onSelected) {
double height = 30;
Widget buttonContent(bool isSelected, String imageName) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: isSelected ? Colors.green[50] : Colors.grey[200],
blurRadius: 1,
spreadRadius: 2,
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
border: Border.all(color: isSelected ? Colors.green : Colors.grey, width: isSelected ? 1 : 0.5)
),
child: Padding(
padding: const EdgeInsets.all(4),
child: Image.asset('assets/images/new-design/$imageName'),
)
);
}
return Padding(
padding: const EdgeInsets.all(5),
child: Container(
height: height,
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'),
onTap: () {
onSelected("mada");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "visa", 'visa.png'),
onTap: () {
onSelected("visa");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "mastercard", 'mastercard.png'),
onTap: () {
onSelected("mastercard");
},
),
SizedBox(
width: 5,
),
InkWell(
child: buttonContent(_selectedPaymentMethod == "installment", 'installment.png'),
onTap: () {
onSelected("installment");
},
),
],
),
),
);
}
bool _agreeTerms = false;
Widget _termsAndCondition(BuildContext context, {@required Function(bool) onSelected, @required VoidCallback onInfoClick}) {
return Padding(
padding: const EdgeInsets.all(5),
child: Row(
children: [
InkWell(
child: Icon(
_agreeTerms ? Icons.check_circle : Icons.radio_button_unchecked_sharp,
size: 20,
color: _agreeTerms ? Colors.green[600] : Colors.grey[400],
),
onTap: () {
onSelected(!_agreeTerms);
},
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Texts(
TranslationBase.of(context).pharmacyServiceTermsCondition,
fontWeight: FontWeight.normal, fontSize: 13,
),
)),
InkWell(
child: Icon(
Icons.info,
size: 20,
color: Colors.grey[600],
),
onTap: () {
onInfoClick();
},
),
],
),
);
}
Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) {
bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null));
return Padding(
padding: const EdgeInsets.all(5),
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts('${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}',
heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Texts('${TranslationBase.of(context).vat}: ${'14.9'} ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 8),
Padding(
padding: const EdgeInsets.all(3),
child: Container(
height: 0.25,
width: 120,
color: Colors.grey[300],
),
),
Texts('${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}',
heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, fontSize: 15)
],
),
),
Expanded(child: Container()),
RaisedButton(
child: Texts(
TranslationBase.of(context).payNow,
fontSize: 15, color: Colors.white, fontWeight: FontWeight.bold,
),
padding: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5), side: BorderSide(color: Theme.of(context).primaryColor, width: 0.5)),
color: Theme.of(context).primaryColor,
onPressed: isPayNowAQctive ? onPayNowClick : null,
),
],
)),
);
}
// -------------------
Widget _cartItemDeleteContainer() {
_animationController.duration = Duration(milliseconds: 500);
_animationController.repeat(reverse: true);
return FadeTransition(
opacity: _animationController,
child: Padding(
padding: const EdgeInsets.all(5),
child: Container(
decoration: BoxDecoration(
color: Colors.red,
boxShadow: [
BoxShadow(
color: Colors.grey[500],
blurRadius: 2,
spreadRadius: 1,
),
],
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Center(
child: Texts(
"Deleting...",
fontWeight: FontWeight.normal,
fontSize: 15,
color: Colors.white,
)),
),
),
);
}

@ -0,0 +1,418 @@
import 'package:after_layout/after_layout.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/CreateCustomerRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/CreateCustomerDailogPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/widgets/Loader/gif_loader_container.dart';
import 'package:diplomaticquarterapp/widgets/carousel_indicator/carousel_indicator.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/loadings/ShimmerLoading.dart';
import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
dynamic languageID;
class PackagesHomePage extends StatefulWidget {
dynamic offersModel;
PackagesHomePage({@required this.offersModel});
@override
_PackagesHomePageState createState() => _PackagesHomePageState();
}
class _PackagesHomePageState extends State<PackagesHomePage> with AfterLayoutMixin<PackagesHomePage>{
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
}
@override
void initState() {
super.initState();
getLanguageID();
}
@override
void afterFirstLayout(BuildContext context) async{
viewModel.service.loadOffersPackagesDataForMainPage(context: context, completion: (){
setState((){});
});
}
// Controllers
var _searchTextController = TextEditingController();
var _filterTextController = TextEditingController();
var _carouselController = CarouselController();
int carouselIndicatorIndex = 0;
CarouselSlider _bannerCarousel;
TextField _textFieldSearch;
TextField _textFieldFilterSelection;
ListView _listViewLatestOffers;
ListView _listViewBestSeller;
PackagesViewModel viewModel;
onCartClick(){
if (viewModel.service.customer == null){
utils.Utils.showErrorToast("Cart is empty for your current session");
return;
}
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => PackagesCartPage()
)
);
}
onProductCartClick(PackagesResponseModel product) async {
if(viewModel.service.customer == null)
viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
if(viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response){
appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount);
}).catchError((error) {
utils.Utils.showErrorToast(error);
});
}
}
AppScaffold appScaffold;
@override
Widget build(BuildContext context) {
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model) => viewModel = model,
builder: (_, model, wi){
return
appScaffold =
AppScaffold(
appBarTitle: TranslationBase.of(context).offerAndPackages,
isShowAppBar: true,
isPharmacy: false,
showPharmacyCart: false,
showHomeAppBarIcon: false,
isOfferPackages: true,
showOfferPackagesCart: true,
isShowDecPage: false,
body: ListView(
children: [
// Top Banner Carousel
AspectRatio(
aspectRatio: 2.2/1,
child: bannerCarousel()
),
Center(
child: CarouselIndicator(
activeColor: Theme.of(context).appBarTheme.color,
color: Colors.grey[300],
cornerRadius: 15,
width: 15, height: 15,
count: _bannerCarousel.itemCount,
index: carouselIndicatorIndex,
onClick: (index){
debugPrint('onClick at ${index}');
},
),
),
SizedBox(height: 10,),
Padding(
padding: const EdgeInsets.all(15),
child: Column(
children: [
// Search Textfield
searchTextField(),
SizedBox(height: 10,),
// Filter Selection
filterOptionSelection(),
SizedBox(height: 20,),
// Horizontal Scrollable Cards
Texts(
"Latest offers",
fontWeight: FontWeight.bold,
color: Colors.black87,
fontSize: 20
),
// Latest Offers Horizontal Scrollable List
AspectRatio(
aspectRatio: 1.3/1,
child: LayoutBuilder(builder: (context, constraints){
double itemContentPadding = 10;
double itemWidth = (constraints.maxWidth/2) - (itemContentPadding*2);
return latestOfferListView(itemWidth: itemWidth, itemContentPadding: itemContentPadding);
}),
),
SizedBox(height: 10,),
Texts(
"Best sellers",
fontWeight: FontWeight.bold,
color: Colors.black87,
fontSize: 20
),
// Best Seller Horizontal Scrollable List
AspectRatio(
aspectRatio: 1.3/1,
child: LayoutBuilder(builder: (context, constraints){
double itemContentPadding = 10; // 10 is content padding in each item
double itemWidth = (constraints.maxWidth/2) - (itemContentPadding*2 /* 2 = LeftRight */);
return bestSellerListView(itemWidth: itemWidth, itemContentPadding: itemContentPadding);
}),
)
],),
),
],
),
)
.setOnAppBarCartClick(onCartClick);
}
);
}
showClinicSelectionList() async {
var clinics = viewModel.service.categoryList;
if(clinics.isEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
clinics = await viewModel.service.getAllCategories(OffersCategoriesRequestModel());
GifLoaderDialogUtils.hideDialog(context);
}
List<String> options = clinics.map((e) => e.toString()).toList();
showMaterialSelectionPicker(
context: context,
title: "Select Clinic",
items: options,
selectedItem: options.first,
onChanged: (value) async {
var selectedClinic = clinics.firstWhere((element) => element.toString() == value);
var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true);
if(clinicProducts.isNotEmpty)
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => ClinicPackagesPage(products: clinicProducts)
)
);
else
utils.Utils.showErrorToast("No offers available for this clinic");
},
);
}
//----------------------------------
// Main Widgets of Page
//----------------------------------
CarouselSlider bannerCarousel(){
_bannerCarousel = CarouselSlider.builder(
carouselController: _carouselController,
itemCount: 10,
itemBuilder: (BuildContext context, int itemIndex) {
return Padding(
padding: const EdgeInsets.only(top: 10, bottom: 10, left: 15, right: 15),
child: FractionallySizedBox(
widthFactor: 1,
heightFactor: 1,
child: utils.applyShadow(
spreadRadius: 1,
blurRadius: 5,
child: InkWell(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: utils.Utils.loadNetworkImage(url: "https://wallpaperaccess.com/full/30103.jpg",)
),
onTap: (){
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => OfferAndPackagesDetail(model: "",)
)
);
},
)
),
),
);
},
options: CarouselOptions(
autoPlayInterval: Duration(milliseconds: 3500),
enlargeStrategy: CenterPageEnlargeStrategy.scale,
enlargeCenterPage: true,
autoPlay: false,
autoPlayCurve: Curves.fastOutSlowIn,
enableInfiniteScroll: true,
autoPlayAnimationDuration: Duration(milliseconds: 1500),
viewportFraction: 1,
onPageChanged: (page, reason){
setState(() {
carouselIndicatorIndex = page;
});
},
),
);
return _bannerCarousel;
}
TextField searchTextField(){
return _textFieldSearch =
TextField(
controller: _searchTextController,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(top: 0.0, bottom: 0.0, left: 10, right: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide( width: 0.5, color: Colors.grey),
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide( width: 1, color: Colors.grey),
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
filled: true,
fillColor: Colors.white,
hintText: "Search",
hintStyle: TextStyle(color: Colors.grey[350], fontWeight: FontWeight.bold),
suffixIcon: IconButton(
onPressed: (){
// viewModel.search(text: _searchTextController.text);
},
icon: Icon(Icons.search_rounded, size: 35,),
),
),
);
}
Widget filterOptionSelection(){
_textFieldFilterSelection =
TextField(
enabled: false,
controller: _searchTextController,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(top: 0.0, bottom: 0.0, left: 10, right: 10),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1),
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide( width: 0.5, color: Colors.grey),
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
focusedBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(10.0),
),
),
filled: true,
fillColor: Colors.white,
hintText: "Browse offers by Clinic",
hintStyle: TextStyle(color: Colors.grey[350], fontWeight: FontWeight.bold),
suffixIcon: IconButton(
onPressed: (){
showClinicSelectionList();
},
icon: Icon(Icons.keyboard_arrow_down_rounded, size: 35, color: Colors.grey,),
),
),
);
return InkWell(
child: _textFieldFilterSelection,
onTap: (){
showClinicSelectionList();
},
);
}
Widget latestOfferListView({@required double itemWidth, @required double itemContentPadding}){
return _listViewLatestOffers =
ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: viewModel.bestSellerList.length,
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(itemWidth: itemWidth, itemContentPadding: itemContentPadding, itemModel: viewModel.bestSellerList[index], onCartClick: onProductCartClick,);
},
separatorBuilder: separator,
);
}
Widget bestSellerListView({@required double itemWidth, @required double itemContentPadding}){
return _listViewLatestOffers =
ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: viewModel.bestSellerList.length,
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(itemWidth: itemWidth, itemContentPadding: itemContentPadding, itemModel: viewModel.bestSellerList[index], onCartClick: onProductCartClick,);
},
separatorBuilder: separator,
);
}
Widget separator(BuildContext context, int index){
return Container(
width: 1,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(-1.0, -2.0),
end: Alignment(1.0, 4.0),
colors: [
Colors.grey,
Colors.grey[100],
Colors.grey[200],
Colors.grey[300],
Colors.grey[400],
Colors.grey[500]
]
)),
);
}
}

@ -0,0 +1,136 @@
import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_svg/svg.dart';
dynamic languageID;
class PackageOrderCompletedPage extends StatelessWidget{
double buttonHeight;
double buttonWidth;
Widget icon;
String heading;
String title;
String subTitle;
String actionTitle;
PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, @required this.heading, @required this.title, @required this.subTitle, this.actionTitle });
@override
Widget build(BuildContext context) {
assert((heading != null || title != null || subTitle != null), "Data missing in properties");
buttonWidth = buttonWidth ?? MediaQuery.of(context).size.width/2;
buttonHeight = buttonHeight ?? 40;
actionTitle = actionTitle ?? TranslationBase.of(context).done;
return BaseView<PackagesViewModel>(
allowAny: true,
onModelReady: (model){},
builder: (_, model, wi){
return Container(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 1.2/1,
child:
iconWidget(context),
),
headingWidget(context),
AspectRatio(
aspectRatio: 1/1,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
titleWidget(context),
SizedBox(height: 20,),
subTitleWidget(context),
SizedBox(height: 50,),
actionWidget(context)
],
),
),
)
],
),
),
);
}
);
}
Widget iconWidget(BuildContext context){
return Padding(
padding: const EdgeInsets.all(50),
child: icon ?? SvgPicture.asset(
"assets/images/svg/success.svg",
semanticsLabel: 'icon'
),
);
}
Widget headingWidget(BuildContext context) => Texts(
heading,
textAlign: TextAlign.center,
maxLines: 1,
color: Theme.of(context).primaryColor,
fontSize: 35.0,
fontWeight: FontWeight.bold,
);
Widget titleWidget(BuildContext context) => Texts(
title,
textAlign: TextAlign.center,
maxLines: 2,
color: Theme.of(context).primaryColor,
fontSize: 25.0,
fontWeight: FontWeight.w200,
);
Widget subTitleWidget(BuildContext context) => Texts(
subTitle,
textAlign: TextAlign.center,
maxLines: 2,
color: Theme.of(context).primaryColor,
fontSize: 15.0,
fontWeight: FontWeight.normal,
);
Widget actionWidget(BuildContext context) => Container(
height: buttonHeight,
width: buttonWidth,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape:RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(buttonHeight/2),
)
),
child: Texts(
actionTitle,
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.normal,
),
onPressed: (){
Navigator.of(context).pop();
},
),
);
}

@ -117,7 +117,7 @@ class PaymentService extends StatelessWidget {
)
],
),
// if(!projectViewModel.havePrivilege(33))
//if(!projectViewModel.havePrivilege(33))
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

@ -1,13 +1,26 @@
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:async/async.dart';
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:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/locator.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:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_animarker/lat_lng_interpolation.dart';
import 'package:flutter_animarker/models/lat_lng_delta.dart';
import 'package:flutter_animarker/models/lat_lng_info.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'package:flutter_animarker/streams/lat_lng_stream.dart';
class TrackDriver extends StatefulWidget {
final OrderDetailModel order;
@ -18,12 +31,13 @@ class TrackDriver extends StatefulWidget {
}
class _TrackDriverState extends State<TrackDriver> {
OrderPreviewService _orderServices = locator<OrderPreviewService>();
OrderDetailModel _order;
Completer<GoogleMapController> _controller = Completer();
double CAMERA_ZOOM = 16;
double CAMERA_ZOOM = 14;
double CAMERA_TILT = 0;
double CAMERA_BEARING = 30;
LatLng SOURCE_LOCATION = null;
@ -40,66 +54,120 @@ class _TrackDriverState extends State<TrackDriver> {
BitmapDescriptor destinationIcon; // for my custom marker pins
Location location;// wrapper around the location API
int locationUpdateFreq = 2;
LatLngInterpolationStream _latLngStream;
StreamGroup<LatLngDelta> subscriptions;
@override
void initState() {
super.initState();
_order = widget.order;
DEST_LOCATION = _order.shippingAddress.getLocation();
location = new Location();
polylinePoints = PolylinePoints();
setSourceAndDestinationIcons();
initMarkerUpdateStream();
startUpdatingDriverLocation();
}
@override
void dispose() {
super.dispose();
subscriptions.close();
_latLngStream.cancel();
stopUpdatingDriverLocation();
}
initMarkerUpdateStream(){
_latLngStream = LatLngInterpolationStream(movementDuration: Duration(seconds: locationUpdateFreq+1));
subscriptions = StreamGroup<LatLngDelta>();
subscriptions.add(_latLngStream.getAnimatedPosition('sourcePin'));
subscriptions.stream.listen((LatLngDelta delta) {
//Update the marker with animation
setState(() {
//Get the marker Id for this animation
var markerId = MarkerId(delta.markerId);
Marker sourceMarker = Marker(
markerId: markerId,
// rotation: delta.rotation,
icon: sourceIcon,
position: LatLng(
delta.from.latitude,
delta.from.longitude,
),
onTap: onSourceMarkerTap
);
_markers.removeWhere((m) => m.markerId.value == 'sourcePin');
_markers.add(sourceMarker);
});
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
return AppScaffold(
appBarTitle: TranslationBase.of(context).deliveryDriverTrack,
isShowAppBar: true,
isPharmacy: true,
showPharmacyCart: false,
showHomeAppBarIcon: false,
body: GoogleMap(
myLocationEnabled: true,
compassEnabled: true,
markers: _markers,
polylines: _polylines,
mapType: MapType.normal,
initialCameraPosition: _orderDeliveryLocationCamera(),
initialCameraPosition: CameraPosition(target: DEST_LOCATION, zoom: 4),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
showPinsOnMap();
// showPinsOnMap();
},
),
floatingActionButton: FloatingActionButton.extended(
onPressed: _goToDriver,
label: Text('To the lake!'),
icon: Icon(Icons.directions_boat),
),
// floatingActionButton: FloatingActionButton.extended(
// onPressed: _goToDriver,
// label: Text('To the lake!'),
// icon: Icon(Icons.directions_boat),
// ),
);
}
void setSourceAndDestinationIcons() async {
sourceIcon = await BitmapDescriptor.fromAssetImage(
ImageConfiguration(devicePixelRatio: 2.5),
'assets/images/map_markers/source_map_marker.png');
destinationIcon = await BitmapDescriptor.fromAssetImage(
ImageConfiguration(devicePixelRatio: 2.5),
'assets/images/map_markers/destination_map_marker.png');
final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize());
final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize());
sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes);
destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes);
}
CameraPosition _orderDeliveryLocationCamera(){
final CameraPosition orderDeliveryLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: DEST_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return orderDeliveryLocCamera;
if(DEST_LOCATION != null){
final CameraPosition orderDeliveryLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: DEST_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return orderDeliveryLocCamera;
}
return null;
}
CameraPosition _driverLocationCamera(){
final CameraPosition driverLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: SOURCE_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return driverLocCamera;
if(DEST_LOCATION != null) {
final CameraPosition driverLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: SOURCE_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
return driverLocCamera;
}
return null;
}
@ -116,25 +184,18 @@ class _TrackDriverState extends State<TrackDriver> {
}
Future<void> _fitCameraBetweenBothPoints() async {
final GoogleMapController controller = await _controller.future;
final CameraPosition driverLocCamera = CameraPosition(
bearing: CAMERA_BEARING,
target: SOURCE_LOCATION,
tilt: CAMERA_TILT,
zoom: CAMERA_ZOOM);
controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera));
}
void showPinsOnMap() {
// source pin
if(SOURCE_LOCATION != null){
setState(() {
var pinPosition = SOURCE_LOCATION;
_markers.removeWhere((m) => m.markerId.value == 'sourcePin');
_markers.add(Marker(
markerId: MarkerId('sourcePin'),
position: pinPosition,
icon: sourceIcon
icon: sourceIcon,
infoWindow: InfoWindow(title: TranslationBase.of(context).driver),
onTap: onSourceMarkerTap
));
});
}
@ -143,10 +204,13 @@ class _TrackDriverState extends State<TrackDriver> {
if(DEST_LOCATION != null){
setState(() {
var destPosition = DEST_LOCATION;
_markers.removeWhere((m) => m.markerId.value == 'destPin');
_markers.add(Marker(
markerId: MarkerId('destPin'),
position: destPosition,
icon: destinationIcon
icon: destinationIcon,
infoWindow: InfoWindow(title: TranslationBase.of(context).deliveryLocation),
onTap: onDestinationMarkerTap
));
});
}
@ -156,32 +220,8 @@ class _TrackDriverState extends State<TrackDriver> {
}
void updatePinOnMap() async {
// create a new CameraPosition instance
// every time the location changes, so the camera
// follows the pin as it moves with an animation
CameraPosition cPosition = CameraPosition(
zoom: CAMERA_ZOOM,
tilt: CAMERA_TILT,
bearing: CAMERA_BEARING,
target: SOURCE_LOCATION,
);
final GoogleMapController controller = await _controller.future;
controller.animateCamera(CameraUpdate.newCameraPosition(cPosition));
// do this inside the setState() so Flutter gets notified
// that a widget update is due
setState(() {
// updated position
var pinPosition = SOURCE_LOCATION;
// the trick is to remove the marker (by id)
// and add it again at the updated location
_markers.removeWhere((m) => m.markerId.value == 'sourcePin');
_markers.add(Marker(
markerId: MarkerId('sourcePin'),
position: pinPosition, // updated position
icon: sourceIcon
));
});
_latLngStream.addLatLng(LatLngInfo(SOURCE_LOCATION.latitude, SOURCE_LOCATION.longitude, "sourcePin"));
drawRoute();
}
void drawRoute() async {
@ -209,4 +249,96 @@ class _TrackDriverState extends State<TrackDriver> {
});
}
}
}
bool isLocationUpdating = false;
startUpdatingDriverLocation({int frequencyInSeconds = 2}) async{
isLocationUpdating = true;
int driverId = int.tryParse(_order.driverID);
Future.doWhile(() async{
if(isLocationUpdating){
await Future.delayed(Duration(seconds: frequencyInSeconds));
showLoading();
LatLng driverLocation = (await _orderServices.getDriverLocation(driverId));
hideLoading();
if(driverLocation != null){
if(SOURCE_LOCATION == null || DEST_LOCATION == null){
SOURCE_LOCATION = driverLocation;
DEST_LOCATION = _order.shippingAddress.getLocation();
showPinsOnMap();
}
SOURCE_LOCATION = driverLocation;
updatePinOnMap();
updateMapCamera();
}else{
GifLoaderDialogUtils.hideDialog(context);
}
}
return isLocationUpdating;
});
}
showLoading(){
if(SOURCE_LOCATION == null){
GifLoaderDialogUtils.showMyDialog(context);
}
}
hideLoading(){
if(SOURCE_LOCATION == null){
GifLoaderDialogUtils.hideDialog(context);
}
}
stopUpdatingDriverLocation(){
isLocationUpdating = false;
}
Future<Uint8List> getBytesFromAsset(String path, int width) async {
ByteData data = await rootBundle.load(path);
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
ui.FrameInfo fi = await codec.getNextFrame();
return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
}
int getMarkerIconSize(){
return 140;
}
updateMapCamera() async{
if(SOURCE_LOCATION != null && DEST_LOCATION != null){
// 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true.
LatLngBounds bound;
if(SOURCE_LOCATION.latitude <= DEST_LOCATION.latitude){
bound = LatLngBounds(southwest: SOURCE_LOCATION, northeast: DEST_LOCATION);
}else{
bound = LatLngBounds(southwest: DEST_LOCATION, northeast: SOURCE_LOCATION);
}
if(bound == null)
return;
CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, 50);
final GoogleMapController controller = await _controller.future;
controller.animateCamera(camera);
}
}
bool showSrcMarkerTitle = false;
onSourceMarkerTap() async{
// showSrcMarkerTitle = !showSrcMarkerTitle;
}
bool showDestMarkerTitle = false;
onDestinationMarkerTap() async{
// showDestMarkerTitle = !showDestMarkerTitle;
// Marker m = _markers.firstWhere((m) => m.markerId.value == 'destPin');
// if(showDestMarkerTitle){
// }
}
}

@ -104,7 +104,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
fontWeight: FontWeight.bold,
backgroundColor: Color(0xFF5AB145),
fontSize: 14,
vPadding: 12,
vPadding: 8,
handler: () {
model.saveSelectedAddressLocally(
model.addresses[model.selectedAddressIndex]);

@ -284,9 +284,13 @@ class _GeneralSettings extends State<GeneralSettings>
getTheme(value) async {
if (value == 1) {
return invertThemes();
return invertThemes(
fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'WorkSans'
);
} else if (value == 3) {
return bwThemes();
return bwThemes(
fontName: Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 'Cairo' : 'WorkSans'
);
} else {
return defaultTheme(
fontName:

@ -169,29 +169,30 @@ class _MyVaccinesState extends State<MyVaccines> {
width: double.infinity,
// height: 80.0,
child: Button(
disabled: true,
label: TranslationBase.of(context).checkVaccineAvailability,
backgroundColor: Color(0xff9EA3A4),
onTap: () =>
Navigator.push(context, FadePage(page: MyVaccinesItemPage())),
onTap: () => Navigator.push(
context, FadePage(page: MyVaccinesItemPage())),
),
),
if(projectViewModel.havePrivilege(27))
Container(
width: double.infinity,
// height: 80.0,
child: SecondaryButton(
label: TranslationBase.of(context).sendEmail,
color: Color(0xffF62426),
textColor: Colors.white,
disabled: model.vaccineList.length == 0,
loading: model.state == ViewState.BusyLocal,
onTap: () async {
model.sendEmail(
message:
TranslationBase.of(context).emailSentSuccessfully);
},
if (projectViewModel.havePrivilege(27))
Container(
width: double.infinity,
// height: 80.0,
child: SecondaryButton(
label: TranslationBase.of(context).sendEmail,
color: Color(0xffF62426),
textColor: Colors.white,
disabled: model.vaccineList.length == 0,
loading: model.state == ViewState.BusyLocal,
onTap: () async {
model.sendEmail(
message: TranslationBase.of(context)
.emailSentSuccessfully);
},
),
),
),
],
),
),

@ -12,6 +12,9 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/pages/login/login.dart';
import 'package:diplomaticquarterapp/pages/login/register.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart';
import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart';
import 'package:diplomaticquarterapp/pages/settings/settings.dart';
import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart';
import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart';
@ -37,6 +40,10 @@ const String SYMPTOM_CHECKER = 'symptom-checker';
const String SYMPTOM_CHECKER_INFO = 'symptom-checker-info';
const String SELECT_GENDER = 'select-gender';
const String SETTINGS = 'settings';
const String PACKAGES_OFFERS = 'packages-offers';
const String PACKAGES_OFFERS_CART = 'packages-offers-cart';
const String PACKAGES_ORDER_COMPLETED = 'packages-offers-cart';
const String HEALTH_WEATHER = 'health-weather';
const APP_UPDATE = 'app-update';
var routes = {
@ -57,6 +64,9 @@ var routes = {
SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(),
SELECT_GENDER: (_) => SelectGender(),
SETTINGS: (_) => Settings(),
PACKAGES_OFFERS: (_) => PackagesHomePage(),
PACKAGES_OFFERS_CART: (_) => PackagesCartPage(),
PACKAGES_ORDER_COMPLETED: (_) => PackageOrderCompletedPage(),
HEALTH_WEATHER: (_) => HealthWeatherIndicator(),
APP_UPDATE: (_) => AppUpdatePage(),
SETTINGS: (_) => Settings(),

@ -11,6 +11,8 @@ class ThemeNotifier with ChangeNotifier {
getTheme() => _themeData;
getTheme_(String font) => _themeData;
setTheme(ThemeData themeData) async {
_themeData = themeData;
notifyListeners();

@ -48,6 +48,8 @@ defaultTheme({fontName}) {
bodyText1: TextStyle(color: Colors.black),
headline1: TextStyle(color: Colors.white),
headline2: TextStyle(color: Colors.white)),
floatingActionButtonTheme: FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2),
appBarTheme: AppBarTheme(
color: Color(0xff515A5D),
brightness: Brightness.light,

@ -8,6 +8,10 @@ class GifLoaderDialogUtils {
}
static hideDialog(BuildContext context) {
Navigator.of(context).pop();
try{
Navigator.of(context).pop();
}catch(error){
Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop());
}
}
}

@ -752,6 +752,9 @@ class TranslationBase {
String get shippedMethod =>
localizedValues['shippedMethod'][locale.languageCode];
String get orderDetail => localizedValues['orderDetail'][locale.languageCode];
String get deliveryDriverTrack => localizedValues['DeliveryDriverTrack'][locale.languageCode];
String get deliveryLocation => localizedValues['DeliveryLocation'][locale.languageCode];
String get driver => localizedValues['Driver'][locale.languageCode];
String get subtotal => localizedValues['subtotal'][locale.languageCode];
String get shipping => localizedValues['shipping'][locale.languageCode];
String get shipBy => localizedValues['shipBy'][locale.languageCode];
@ -985,6 +988,7 @@ class TranslationBase {
String get average => localizedValues['Average'][locale.languageCode];
String get dailyDoses => localizedValues['DailyDoses'][locale.languageCode];
String get period => localizedValues['Period'][locale.languageCode];
String get duration => localizedValues['duration'][locale.languageCode];
String get cm => localizedValues['cm'][locale.languageCode];
String get kg => localizedValues['kg'][locale.languageCode];
String get lb => localizedValues['lb'][locale.languageCode];
@ -1553,6 +1557,12 @@ class TranslationBase {
String get submitncontinue =>
localizedValues["submitncontinue"][locale.languageCode];
String get areyousure => localizedValues["areyousure"][locale.languageCode];
// Offer And Packahes
String get subT=> localizedValues['OffersAndPackages'][locale.languageCode];
String get totalWithColonRight => localizedValues['totalWithColonRight'][locale.languageCode];
String get preferredunit =>
localizedValues["preferredunit"][locale.languageCode];
String get trySaying => localizedValues["try-saying"][locale.languageCode];

@ -3,6 +3,7 @@ import 'dart:core';
import 'dart:typed_data';
import 'package:badges/badges.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:connectivity/connectivity.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -37,7 +38,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
import '../Constants.dart';
import 'app_shared_preferences.dart';
import 'app_toast.dart';
@ -550,8 +550,44 @@ class Utils {
return medical;
}
static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}){
return CachedNetworkImage(
placeholderFadeInDuration: Duration(milliseconds: 250),
fit: fitting,
imageUrl: url,
placeholder: (context, url) => Container(
child: Center(
child: CircularProgressIndicator()
)
),
errorWidget: (context, url, error){
return Icon(Icons.error, color: Colors.red, size: 50,);
}
);
}
}
Widget applyShadow({ Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}){
return Container(
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: color.withOpacity(shadowOpacity),
spreadRadius: spreadRadius,
blurRadius: blurRadius,
offset: offset, // changes position of shadow
),
],
),
child: child,
);
}
Future<AuthenticatedUser> userData() async {
var userData = AuthenticatedUser.fromJson(
await AppSharedPreferences().getObject(MAIN_USER));

@ -0,0 +1,347 @@
import 'dart:math';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
enum TextFieldInertiaDirection {
left,
right,
}
Interval _getInternalInterval(
double start,
double end,
double externalStart,
double externalEnd, [
Curve curve = Curves.linear,
]) {
return Interval(
start + (end - start) * externalStart,
start + (end - start) * externalEnd,
curve: curve,
);
}
class AnimatedTextFormField extends StatefulWidget {
AnimatedTextFormField({
Key key,
this.interval = const Interval(0.0, 1.0),
@required this.width,
this.loadingController,
this.inertiaController,
this.inertiaDirection,
this.enabled = true,
this.labelText,
this.prefixIcon,
this.suffixIcon,
this.keyboardType,
this.textInputAction,
this.obscureText = false,
this.controller,
this.focusNode,
this.validator,
this.onFieldSubmitted,
this.onSaved,
}) : assert((inertiaController == null && inertiaDirection == null) ||
(inertiaController != null && inertiaDirection != null)),
super(key: key);
final Interval interval;
final AnimationController loadingController;
final AnimationController inertiaController;
final double width;
final bool enabled;
final String labelText;
final Widget prefixIcon;
final Widget suffixIcon;
final TextInputType keyboardType;
final TextInputAction textInputAction;
final bool obscureText;
final TextEditingController controller;
final FocusNode focusNode;
final FormFieldValidator<String> validator;
final ValueChanged<String> onFieldSubmitted;
final FormFieldSetter<String> onSaved;
final TextFieldInertiaDirection inertiaDirection;
@override
_AnimatedTextFormFieldState createState() => _AnimatedTextFormFieldState();
}
class _AnimatedTextFormFieldState extends State<AnimatedTextFormField> {
Animation<double> scaleAnimation;
Animation<double> sizeAnimation;
Animation<double> suffixIconOpacityAnimation;
Animation<double> fieldTranslateAnimation;
Animation<double> iconRotationAnimation;
Animation<double> iconTranslateAnimation;
@override
void initState() {
super.initState();
widget.inertiaController?.addStatusListener(handleAnimationStatus);
final interval = widget.interval;
final loadingController = widget.loadingController;
if (loadingController != null) {
scaleAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(
0, .2, interval.begin, interval.end, Curves.easeOutBack),
));
suffixIconOpacityAnimation =
Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(.65, 1.0, interval.begin, interval.end),
));
_updateSizeAnimation();
}
final inertiaController = widget.inertiaController;
final inertiaDirection = widget.inertiaDirection;
final sign = inertiaDirection == TextFieldInertiaDirection.right ? 1 : -1;
if (inertiaController != null) {
fieldTranslateAnimation = Tween<double>(
begin: 0.0,
end: sign * 15.0,
).animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(0, .5, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
iconRotationAnimation =
Tween<double>(begin: 0.0, end: sign * pi / 12 /* ~15deg */)
.animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(.5, 1.0, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
iconTranslateAnimation =
Tween<double>(begin: 0.0, end: 8.0).animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(.5, 1.0, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
}
}
void _updateSizeAnimation() {
final interval = widget.interval;
final loadingController = widget.loadingController;
sizeAnimation = Tween<double>(
begin: 48.0,
end: widget.width,
).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(
.2, 1.0, interval.begin, interval.end, Curves.linearToEaseOut),
reverseCurve: Curves.easeInExpo,
));
}
@override
void didUpdateWidget(AnimatedTextFormField oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.width != widget.width) {
_updateSizeAnimation();
}
}
@override
dispose() {
widget.inertiaController?.removeStatusListener(handleAnimationStatus);
super.dispose();
}
void handleAnimationStatus(status) {
if (status == AnimationStatus.completed) {
widget.inertiaController?.reverse();
}
}
Widget _buildInertiaAnimation(Widget child) {
if (widget.inertiaController == null) {
return child;
}
return AnimatedBuilder(
animation: iconTranslateAnimation,
builder: (context, child) => Transform(
alignment: Alignment.center,
transform: Matrix4.identity()
..translate(iconTranslateAnimation.value)
..rotateZ(iconRotationAnimation.value),
child: child,
),
child: child,
);
}
InputDecoration _getInputDecoration(ThemeData theme) {
return InputDecoration(
contentPadding: EdgeInsets.fromLTRB(0, 0, 0, 0),
border: OutlineInputBorder(
borderRadius: new BorderRadius.circular(10.0),
borderSide: new BorderSide(),
),
labelText: widget.labelText,
prefixIcon: _buildInertiaAnimation(widget.prefixIcon),
suffixIcon: _buildInertiaAnimation(widget.loadingController != null
? FadeTransition(
opacity: suffixIconOpacityAnimation,
child: widget.suffixIcon,
)
: widget.suffixIcon),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
Widget textField = TextFormField(
controller: widget.controller,
focusNode: widget.focusNode,
decoration: _getInputDecoration(theme),
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
obscureText: widget.obscureText,
onFieldSubmitted: widget.onFieldSubmitted,
onSaved: widget.onSaved,
validator: widget.validator,
enabled: widget.enabled,
);
if (widget.loadingController != null) {
textField = ScaleTransition(
scale: scaleAnimation,
child: AnimatedBuilder(
animation: sizeAnimation,
builder: (context, child) => ConstrainedBox(
constraints: BoxConstraints.tightFor(width: sizeAnimation.value),
child: child,
),
child: textField,
),
);
}
if (widget.inertiaController != null) {
textField = AnimatedBuilder(
animation: fieldTranslateAnimation,
builder: (context, child) => Transform.translate(
offset: Offset(fieldTranslateAnimation.value, 0),
child: child,
),
child: textField,
);
}
return textField;
}
}
class AnimatedPasswordTextFormField extends StatefulWidget {
AnimatedPasswordTextFormField({
Key key,
this.interval = const Interval(0.0, 1.0),
@required this.animatedWidth,
this.loadingController,
this.inertiaController,
this.inertiaDirection,
this.enabled = true,
this.labelText,
this.keyboardType,
this.textInputAction,
this.controller,
this.focusNode,
this.validator,
this.onFieldSubmitted,
this.onSaved,
}) : assert((inertiaController == null && inertiaDirection == null) ||
(inertiaController != null && inertiaDirection != null)),
super(key: key);
final Interval interval;
final AnimationController loadingController;
final AnimationController inertiaController;
final double animatedWidth;
final bool enabled;
final String labelText;
final TextInputType keyboardType;
final TextInputAction textInputAction;
final TextEditingController controller;
final FocusNode focusNode;
final FormFieldValidator<String> validator;
final ValueChanged<String> onFieldSubmitted;
final FormFieldSetter<String> onSaved;
final TextFieldInertiaDirection inertiaDirection;
@override
_AnimatedPasswordTextFormFieldState createState() =>
_AnimatedPasswordTextFormFieldState();
}
class _AnimatedPasswordTextFormFieldState
extends State<AnimatedPasswordTextFormField> {
var _obscureText = true;
@override
Widget build(BuildContext context) {
return AnimatedTextFormField(
interval: widget.interval,
loadingController: widget.loadingController,
inertiaController: widget.inertiaController,
width: widget.animatedWidth,
enabled: widget.enabled,
labelText: widget.labelText,
prefixIcon: Icon(Icons.lock, size: 20),
suffixIcon: GestureDetector(
onTap: () => setState(() => _obscureText = !_obscureText),
dragStartBehavior: DragStartBehavior.down,
child: AnimatedCrossFade(
duration: const Duration(milliseconds: 250),
firstCurve: Curves.easeInOutSine,
secondCurve: Curves.easeInOutSine,
alignment: Alignment.center,
layoutBuilder: (Widget topChild, _, Widget bottomChild, __) {
return Stack(
alignment: Alignment.center,
children: <Widget>[bottomChild, topChild],
);
},
firstChild: Icon(
Icons.visibility,
size: 25.0,
semanticLabel: 'show password',
),
secondChild: Icon(
Icons.visibility_off,
size: 25.0,
semanticLabel: 'hide password',
),
crossFadeState: _obscureText
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
),
),
obscureText: _obscureText,
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
controller: widget.controller,
focusNode: widget.focusNode,
validator: widget.validator,
onFieldSubmitted: widget.onFieldSubmitted,
onSaved: widget.onSaved,
inertiaDirection: widget.inertiaDirection,
);
}
}

@ -0,0 +1,188 @@
import 'package:flutter/material.dart';
typedef StepperCallbackFuture = Future<bool> Function(int apply, int total);
class StepperView extends StatefulWidget {
final double height;
final Color foregroundColor;
final Color backgroundColor;
final double buttonPadding;
final int initialNumber;
final int maxNumber;
final int minNumber;
final StepperCallbackFuture counterCallback;
final Function increaseCallback;
final Function decreaseCallback;
StepperView({this.initialNumber = 1, this.minNumber = 1, this.maxNumber, @required this.counterCallback, this.increaseCallback, this.decreaseCallback, this.height = 25, @required this.foregroundColor, @required this.backgroundColor, this.buttonPadding = 1}){
assert((this.initialNumber >= this.minNumber && this.initialNumber <= this.maxNumber));
}
@override
_StepperViewState createState() => _StepperViewState();
}
class _StepperViewState extends State<StepperView> {
int _currentCount;
StepperCallbackFuture _counterCallback;
Function _increaseCallback;
Function _decreaseCallback;
@override
void initState() {
_currentCount = widget.initialNumber ?? 1;
_counterCallback = widget.counterCallback;
_increaseCallback = widget.increaseCallback ?? () {};
_decreaseCallback = widget.decreaseCallback ?? () {};
super.initState();
}
bool loadingInc = false;
bool loadingDec = false;
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(widget.buttonPadding),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular((widget.height/2) + (widget.buttonPadding*2)),
color: widget.backgroundColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_createDecrementButton(
(_currentCount > widget.minNumber) ? () => _decrement() : null,
),
Container(
width: 25,
child: Center(
child: Text(
_currentCount.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
height: 1.5,
color: Colors.black,
)
),
)
),
_createIncrementButton(
(_currentCount < widget.maxNumber) ? () => _increment() : null
),
],
),
);
}
void _increment() async{
doInc({@required bool can}){
if(can)
setState(() {
_currentCount++;
_increaseCallback();
});
}
if (_currentCount < widget.maxNumber){
if(_counterCallback == null)
doInc(can: true);
else {
setState(() => loadingInc = true);
var result = (await _counterCallback(1,_currentCount));
doInc(can: result);
setState(() => loadingInc = false);
}
}
}
void _decrement() async{
doDec({@required bool can}){
if(can)
setState(() {
_currentCount--;
_decreaseCallback();
});
}
if (_currentCount > widget.minNumber) {
if(_counterCallback == null)
doDec(can: true);
else {
setState(() => loadingDec = true);
var result = (await _counterCallback(-1,_currentCount));
doDec(can: result);
setState(() => loadingDec = false);
}
}
}
Widget _createIncrementButton(Function onPressed,) {
return Stack(
children: [
RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
constraints: BoxConstraints(minWidth: widget.height, minHeight: widget.height),
onPressed: onPressed,
elevation: 2.0,
fillColor: widget.foregroundColor,
child:
Icon(
Icons.add,
color: (_currentCount < widget.maxNumber) ? Colors.grey[700] : Colors.grey[400],
size: 12.0,
),
shape: CircleBorder(),
),
if(loadingInc)
Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.circular(widget.height/2),
),
height: widget.height,
width: widget.height,
child: CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation<Color>(Colors.green)
)
)
],
);
}
Widget _createDecrementButton(Function onPressed) {
return Stack(
children: [
RawMaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
constraints: BoxConstraints(minWidth: widget.height, minHeight: widget.height),
onPressed: onPressed,
elevation: 2.0,
fillColor: widget.foregroundColor,
child: Icon(
Icons.remove,
color: (_currentCount > widget.minNumber) ? Colors.grey[700] : Colors.grey[400],
size: 12.0,
),
shape: CircleBorder(),
),
if(loadingDec)
Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.circular(widget.height/2),
),
height: widget.height,
width: widget.height,
child: CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation<Color>(Colors.red)
)
)
],
);
}
}

@ -0,0 +1,463 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'dart:math';
import 'data_display/text.dart';
class AnimatedButton extends StatefulWidget {
AnimatedButton({
Key key,
@required this.text,
@required this.onPressed,
@required this.controller,
this.textColor,
this.loadingColor,
this.color,
}) : super(key: key);
final String text;
final Color color;
final Color textColor;
final Color loadingColor;
final Function onPressed;
final AnimationController controller;
@override
_AnimatedButtonState createState() => _AnimatedButtonState();
}
class _AnimatedButtonState extends State<AnimatedButton>
with SingleTickerProviderStateMixin {
Animation<double> _sizeAnimation;
Animation<double> _textOpacityAnimation;
Animation<double> _buttonOpacityAnimation;
Animation<double> _ringThicknessAnimation;
Animation<double> _ringOpacityAnimation;
Animation<Color> _colorAnimation;
var _isLoading = false;
var _hover = false;
var _width = 120.0;
Color _color;
Color _loadingColor;
static const _height = 40.0;
static const _loadingCircleRadius = _height / 2;
static const _loadingCircleThickness = 4.0;
@override
void initState() {
super.initState();
_textOpacityAnimation = Tween<double>(begin: 1.0, end: 0.0).animate(
CurvedAnimation(
parent: widget.controller,
curve: Interval(0.0, .25),
),
);
// _colorAnimation
// _width, _sizeAnimation
_buttonOpacityAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(CurvedAnimation(
parent: widget.controller,
curve: Threshold(.65),
));
_ringThicknessAnimation =
Tween<double>(begin: _loadingCircleRadius, end: _loadingCircleThickness)
.animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(.65, .85),
));
_ringOpacityAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(.85, 1.0),
));
widget.controller.addStatusListener(handleStatusChanged);
}
@override
void didChangeDependencies() {
_updateColorAnimation();
_updateWidth();
super.didChangeDependencies();
}
void _updateColorAnimation() {
final theme = Theme.of(context);
final buttonTheme = theme.floatingActionButtonTheme;
_color = widget.color ?? buttonTheme.backgroundColor;
_loadingColor = widget.loadingColor ?? theme.accentColor;
_colorAnimation = ColorTween(
begin: _color,
end: _loadingColor,
).animate(
CurvedAnimation(
parent: widget.controller,
curve: const Interval(0.0, .65, curve: Curves.fastOutSlowIn),
),
);
}
@override
void didUpdateWidget(AnimatedButton oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.color != widget.color ||
oldWidget.loadingColor != widget.loadingColor) {
_updateColorAnimation();
}
if (oldWidget.text != widget.text) {
_updateWidth();
}
}
@override
void dispose() {
super.dispose();
widget.controller.removeStatusListener(handleStatusChanged);
}
void handleStatusChanged(status) {
if (status == AnimationStatus.forward) {
setState(() => _isLoading = true);
}
if (status == AnimationStatus.dismissed) {
setState(() => _isLoading = false);
}
}
/// sets width and size animation
void _updateWidth() {
final theme = Theme.of(context);
final fontSize = theme.textTheme.button.fontSize;
final renderParagraph = RenderParagraph(
TextSpan(
text: widget.text,
style: TextStyle(
fontSize: fontSize,
fontWeight: theme.textTheme.button.fontWeight,
letterSpacing: theme.textTheme.button.letterSpacing,
),
),
textDirection: TextDirection.ltr,
maxLines: 1,
);
renderParagraph.layout(BoxConstraints(minWidth: 120.0));
// text width based on fontSize, plus 45.0 for padding
var textWidth =
renderParagraph.getMinIntrinsicWidth(fontSize).ceilToDouble() + 45.0;
// button width is min 120.0 and max 240.0
_width = textWidth > 120.0 && textWidth < 240.0
? textWidth
: textWidth >= 240.0 ? 240.0 : 120.0;
_sizeAnimation = Tween<double>(begin: 1.0, end: _height / _width)
.animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(0.0, .65, curve: Curves.fastOutSlowIn),
));
}
Widget _buildButtonText(ThemeData theme) {
return FadeTransition(
opacity: _textOpacityAnimation,
child: AnimatedText(
text: widget.text,
style: TextStyle(color: widget.textColor ?? Colors.white),
),
);
}
Widget _buildButton(ThemeData theme) {
final buttonTheme = theme.floatingActionButtonTheme;
return FadeTransition(
opacity: _buttonOpacityAnimation,
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
child: AnimatedBuilder(
animation: _colorAnimation,
builder: (context, child) => Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(_height/2)
),
color: _colorAnimation.value,
child: child,
shadowColor: _color,
elevation: !_isLoading
? (_hover ? buttonTheme.highlightElevation : buttonTheme.elevation)
: 0,
),
child: InkWell(
onTap: !_isLoading ? widget.onPressed : null,
splashColor: buttonTheme.splashColor,
customBorder: buttonTheme.shape,
onHighlightChanged: (value) => setState(() => _hover = value),
child: SizeTransition(
sizeFactor: _sizeAnimation,
axis: Axis.horizontal,
child: Container(
width: _width,
height: _height,
alignment: Alignment.center,
child: _buildButtonText(theme),
),
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Stack(
alignment: Alignment.center,
children: <Widget>[
FadeTransition(
opacity: _ringOpacityAnimation,
child: AnimatedBuilder(
animation: _ringThicknessAnimation,
builder: (context, child) => Ring(
color: widget.loadingColor,
size: _height,
thickness: _ringThicknessAnimation.value,
),
),
),
if (_isLoading)
SizedBox(
width: _height - _loadingCircleThickness,
height: _height - _loadingCircleThickness,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(widget.loadingColor),
// backgroundColor: Colors.red,
strokeWidth: _loadingCircleThickness,
),
),
_buildButton(theme),
],
);
}
}
class Ring extends StatelessWidget {
Ring({
Key key,
this.color,
this.size = 40.0,
this.thickness = 2.0,
this.value = 1.0,
}) : assert(size - thickness > 0),
assert(thickness >= 0),
super(key: key);
final Color color;
final double size;
final double thickness;
final double value;
@override
Widget build(BuildContext context) {
return SizedBox(
width: size - thickness,
height: size - thickness,
child: thickness == 0
? null
: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(color),
strokeWidth: thickness,
value: value,
),
);
}
}
enum AnimatedTextRotation { up, down }
/// https://medium.com/flutter-community/flutter-challenge-3d-bottom-navigation-bar-48952a5fd996
class AnimatedText extends StatefulWidget {
AnimatedText({
Key key,
@required this.text,
this.style,
this.textRotation = AnimatedTextRotation.up,
}) : super(key: key);
final String text;
final TextStyle style;
final AnimatedTextRotation textRotation;
@override
_AnimatedTextState createState() => _AnimatedTextState();
}
class _AnimatedTextState extends State<AnimatedText>
with SingleTickerProviderStateMixin {
var _newText = '';
var _oldText = '';
var _layoutHeight = 0.0;
final _textKey = GlobalKey();
Animation<double> _animation;
AnimationController _controller;
double get radius => _layoutHeight / 2;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 500),
);
_animation = Tween<double>(begin: 0.0, end: pi / 2).animate(CurvedAnimation(
parent: _controller,
curve: Curves.easeOutBack,
));
_oldText = widget.text;
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() => _layoutHeight = getWidgetSize(_textKey)?.height);
});
}
@override
void didUpdateWidget(AnimatedText oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.text != oldWidget.text) {
_oldText = oldWidget.text;
_newText = widget.text;
_controller.forward().then((_) {
setState(() {
final t = _oldText;
_oldText = _newText;
_newText = t;
});
_controller.reset();
});
}
}
@override
void dispose() {
super.dispose();
_controller.dispose();
}
Matrix4 get _matrix {
// Fix: The text is not centered after applying perspective effect in the web build. Idk why
if (kIsWeb) {
return Matrix4.identity();
}
return Matrix4.identity()..setEntry(3, 2, .006);
}
Matrix4 _getFrontSideUp(double value) {
return _matrix
..translate(
0.0,
-radius * sin(_animation.value),
-radius * cos(_animation.value),
)
..rotateX(-_animation.value); // 0 -> -pi/2
}
Matrix4 _getBackSideUp(double value) {
return _matrix
..translate(
0.0,
radius * cos(_animation.value),
-radius * sin(_animation.value),
)
..rotateX((pi / 2) - _animation.value); // pi/2 -> 0
}
Matrix4 _getFrontSideDown(double value) {
return _matrix
..translate(
0.0,
radius * sin(_animation.value),
-radius * cos(_animation.value),
)
..rotateX(_animation.value); // 0 -> pi/2
}
Matrix4 _getBackSideDown(double value) {
return _matrix
..translate(
0.0,
-radius * cos(_animation.value),
-radius * sin(_animation.value),
)
..rotateX(_animation.value - pi / 2); // -pi/2 -> 0
}
@override
Widget build(BuildContext context) {
final rollUp = widget.textRotation == AnimatedTextRotation.up;
final oldText = Text(
_oldText,
key: _textKey,
style: widget.style,
);
final newText = Text(
_newText,
style: widget.style,
);
return AnimatedBuilder(
animation: _animation,
builder: (context, child) => Stack(
alignment: Alignment.center,
children: <Widget>[
if (_animation.value <= toRadian(85))
Transform(
alignment: Alignment.center,
transform: rollUp
? _getFrontSideUp(_animation.value)
: _getFrontSideDown(_animation.value),
child: oldText,
),
if (_animation.value >= toRadian(5))
Transform(
alignment: Alignment.center,
transform: rollUp
? _getBackSideUp(_animation.value)
: _getBackSideDown(_animation.value),
child: newText,
),
],
),
);
}
// Helpers
double toRadian(double degree) => degree * pi / 180;
double lerp(double start, double end, double percent) => (start + percent * (end - start));
Size getWidgetSize(GlobalKey key) {
final RenderBox renderBox = key.currentContext?.findRenderObject();
return renderBox?.size;
}
}

@ -0,0 +1,343 @@
import 'dart:math';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
enum TextFieldInertiaDirection {
left,
right,
}
Interval _getInternalInterval(
double start,
double end,
double externalStart,
double externalEnd, [
Curve curve = Curves.linear,
]) {
return Interval(
start + (end - start) * externalStart,
start + (end - start) * externalEnd,
curve: curve,
);
}
class AnimatedTextFormField extends StatefulWidget {
AnimatedTextFormField({
Key key,
this.interval = const Interval(0.0, 1.0),
@required this.width,
this.loadingController,
this.inertiaController,
this.inertiaDirection,
this.enabled = true,
this.labelText,
this.prefixIcon,
this.suffixIcon,
this.keyboardType,
this.textInputAction,
this.obscureText = false,
this.controller,
this.focusNode,
this.validator,
this.onFieldSubmitted,
this.onSaved,
}) : assert((inertiaController == null && inertiaDirection == null) ||
(inertiaController != null && inertiaDirection != null)),
super(key: key);
final Interval interval;
final AnimationController loadingController;
final AnimationController inertiaController;
final double width;
final bool enabled;
final String labelText;
final Widget prefixIcon;
final Widget suffixIcon;
final TextInputType keyboardType;
final TextInputAction textInputAction;
final bool obscureText;
final TextEditingController controller;
final FocusNode focusNode;
final FormFieldValidator<String> validator;
final ValueChanged<String> onFieldSubmitted;
final FormFieldSetter<String> onSaved;
final TextFieldInertiaDirection inertiaDirection;
@override
_AnimatedTextFormFieldState createState() => _AnimatedTextFormFieldState();
}
class _AnimatedTextFormFieldState extends State<AnimatedTextFormField> {
Animation<double> scaleAnimation;
Animation<double> sizeAnimation;
Animation<double> suffixIconOpacityAnimation;
Animation<double> fieldTranslateAnimation;
Animation<double> iconRotationAnimation;
Animation<double> iconTranslateAnimation;
@override
void initState() {
super.initState();
widget.inertiaController?.addStatusListener(handleAnimationStatus);
final interval = widget.interval;
final loadingController = widget.loadingController;
if (loadingController != null) {
scaleAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(
0, .2, interval.begin, interval.end, Curves.easeOutBack),
));
suffixIconOpacityAnimation =
Tween<double>(begin: 0.0, end: 1.0).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(.65, 1.0, interval.begin, interval.end),
));
_updateSizeAnimation();
}
final inertiaController = widget.inertiaController;
final inertiaDirection = widget.inertiaDirection;
final sign = inertiaDirection == TextFieldInertiaDirection.right ? 1 : -1;
if (inertiaController != null) {
fieldTranslateAnimation = Tween<double>(
begin: 0.0,
end: sign * 15.0,
).animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(0, .5, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
iconRotationAnimation =
Tween<double>(begin: 0.0, end: sign * pi / 12 /* ~15deg */)
.animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(.5, 1.0, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
iconTranslateAnimation =
Tween<double>(begin: 0.0, end: 8.0).animate(CurvedAnimation(
parent: inertiaController,
curve: Interval(.5, 1.0, curve: Curves.easeOut),
reverseCurve: Curves.easeIn,
));
}
}
void _updateSizeAnimation() {
final interval = widget.interval;
final loadingController = widget.loadingController;
sizeAnimation = Tween<double>(
begin: 48.0,
end: widget.width,
).animate(CurvedAnimation(
parent: loadingController,
curve: _getInternalInterval(
.2, 1.0, interval.begin, interval.end, Curves.linearToEaseOut),
reverseCurve: Curves.easeInExpo,
));
}
@override
void didUpdateWidget(AnimatedTextFormField oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.width != widget.width) {
_updateSizeAnimation();
}
}
@override
dispose() {
widget.inertiaController?.removeStatusListener(handleAnimationStatus);
super.dispose();
}
void handleAnimationStatus(status) {
if (status == AnimationStatus.completed) {
widget.inertiaController?.reverse();
}
}
Widget _buildInertiaAnimation(Widget child) {
if (widget.inertiaController == null) {
return child;
}
return AnimatedBuilder(
animation: iconTranslateAnimation,
builder: (context, child) => Transform(
alignment: Alignment.center,
transform: Matrix4.identity()
..translate(iconTranslateAnimation.value)
..rotateZ(iconRotationAnimation.value),
child: child,
),
child: child,
);
}
InputDecoration _getInputDecoration(ThemeData theme) {
return InputDecoration(
labelText: widget.labelText,
prefixIcon: _buildInertiaAnimation(widget.prefixIcon),
suffixIcon: _buildInertiaAnimation(widget.loadingController != null
? FadeTransition(
opacity: suffixIconOpacityAnimation,
child: widget.suffixIcon,
)
: widget.suffixIcon),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
Widget textField = TextFormField(
controller: widget.controller,
focusNode: widget.focusNode,
decoration: _getInputDecoration(theme),
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
obscureText: widget.obscureText,
onFieldSubmitted: widget.onFieldSubmitted,
onSaved: widget.onSaved,
validator: widget.validator,
enabled: widget.enabled,
);
if (widget.loadingController != null) {
textField = ScaleTransition(
scale: scaleAnimation,
child: AnimatedBuilder(
animation: sizeAnimation,
builder: (context, child) => ConstrainedBox(
constraints: BoxConstraints.tightFor(width: sizeAnimation.value),
child: child,
),
child: textField,
),
);
}
if (widget.inertiaController != null) {
textField = AnimatedBuilder(
animation: fieldTranslateAnimation,
builder: (context, child) => Transform.translate(
offset: Offset(fieldTranslateAnimation.value, 0),
child: child,
),
child: textField,
);
}
return textField;
}
}
class AnimatedPasswordTextFormField extends StatefulWidget {
AnimatedPasswordTextFormField({
Key key,
this.interval = const Interval(0.0, 1.0),
@required this.animatedWidth,
this.loadingController,
this.inertiaController,
this.inertiaDirection,
this.enabled = true,
this.labelText,
this.keyboardType,
this.textInputAction,
this.controller,
this.focusNode,
this.validator,
this.onFieldSubmitted,
this.onSaved,
}) : assert((inertiaController == null && inertiaDirection == null) ||
(inertiaController != null && inertiaDirection != null)),
super(key: key);
final Interval interval;
final AnimationController loadingController;
final AnimationController inertiaController;
final double animatedWidth;
final bool enabled;
final String labelText;
final TextInputType keyboardType;
final TextInputAction textInputAction;
final TextEditingController controller;
final FocusNode focusNode;
final FormFieldValidator<String> validator;
final ValueChanged<String> onFieldSubmitted;
final FormFieldSetter<String> onSaved;
final TextFieldInertiaDirection inertiaDirection;
@override
_AnimatedPasswordTextFormFieldState createState() =>
_AnimatedPasswordTextFormFieldState();
}
class _AnimatedPasswordTextFormFieldState
extends State<AnimatedPasswordTextFormField> {
var _obscureText = true;
@override
Widget build(BuildContext context) {
return AnimatedTextFormField(
interval: widget.interval,
loadingController: widget.loadingController,
inertiaController: widget.inertiaController,
width: widget.animatedWidth,
enabled: widget.enabled,
labelText: widget.labelText,
prefixIcon: Icon(FontAwesomeIcons.lock, size: 20),
suffixIcon: GestureDetector(
onTap: () => setState(() => _obscureText = !_obscureText),
dragStartBehavior: DragStartBehavior.down,
child: AnimatedCrossFade(
duration: const Duration(milliseconds: 250),
firstCurve: Curves.easeInOutSine,
secondCurve: Curves.easeInOutSine,
alignment: Alignment.center,
layoutBuilder: (Widget topChild, _, Widget bottomChild, __) {
return Stack(
alignment: Alignment.center,
children: <Widget>[bottomChild, topChild],
);
},
firstChild: Icon(
Icons.visibility,
size: 25.0,
semanticLabel: 'show password',
),
secondChild: Icon(
Icons.visibility_off,
size: 25.0,
semanticLabel: 'hide password',
),
crossFadeState: _obscureText
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
),
),
obscureText: _obscureText,
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
controller: widget.controller,
focusNode: widget.focusNode,
validator: widget.validator,
onFieldSubmitted: widget.onFieldSubmitted,
onSaved: widget.onSaved,
inertiaDirection: widget.inertiaDirection,
);
}
}

@ -0,0 +1,197 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class CarouselIndicator extends StatefulWidget {
/// width of the indicator
final double width;
/// height of the indicator
final double height;
/// space between indicators.
final double space;
/// count of indicator
final int count;
/// active color
final Color activeColor;
/// normal color
final Color color;
/// use this to give some radius to the corner indicator
final double cornerRadius;
/// duration for slide animation
final int animationDuration;
final int index;
final Function(int index) onClick;
CarouselIndicator({
Key key,
this.width: 20.0,
this.height: 6,
this.space: 5.0,
this.count,
this.cornerRadius: 6,
this.animationDuration: 300,
this.color: Colors.white30,
this.index,
this.activeColor: Colors.white,
this.onClick
}) : assert(count != null && count != 0),
assert(index != null && index >= 0),
super(key: key);
@override
State<StatefulWidget> createState() {
return new _CarouselIndicatorState();
}
}
class _CarouselIndicatorState extends State<CarouselIndicator>
with TickerProviderStateMixin {
/// [Tween] object of type double
Tween<double> _tween;
/// [AnimationController] object
AnimationController _animationController;
/// [Aniamtion] object
Animation _animation;
/// [Paint] object to paint our indicator
Paint _paint = new Paint();
/// Method to initilize [BasePainter] to paint indicators.
BasePainter _createPainer() {
return SlidePainter(widget, _animation.value, _paint);
}
@override
Widget build(BuildContext context) {
Widget child = new SizedBox(
width: widget.count * widget.width + (widget.count - 1) * widget.space,
height: widget.height,
child: CustomPaint(
painter: _createPainer(),
),
);
return InkWell(
child: child,
onTap: (){
if(widget.onClick != null)
widget.onClick(0);
},
);
}
@override
void initState() {
/// for initial index=0 we do not want to change any value so setting [_tween] to (0.0,0.0),
createAnimation(0.0, 0.0);
super.initState();
}
@override
void didUpdateWidget(CarouselIndicator oldWidget) {
if (widget.index != oldWidget.index) {
if (widget.index != 0) {
_animationController.reset();
/// for each new index we want to change value so setting [_tween] to (oldWidget.index,widget.index) so animation tween from old position to new position rather not start from 0.0 again and again.
createAnimation(oldWidget.index.toDouble(), widget.index.toDouble());
_animationController.forward();
} else {
_animationController.reset();
createAnimation(oldWidget.index.toDouble(), 0.0);
_animationController.forward();
}
}
super.didUpdateWidget(oldWidget);
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
void createAnimation(double begin, double end) {
_tween = Tween(begin: begin, end: end);
_animationController = AnimationController(
vsync: this,
duration: Duration(milliseconds: widget.animationDuration));
_animation = _tween.animate(_animationController)
..addListener(() {
setState(() {});
});
}
}
/// Base Painter class to draw indicator
abstract class BasePainter extends CustomPainter {
final CarouselIndicator widget;
final double page;
final Paint _paint;
BasePainter(this.widget, this.page, this._paint);
/// This method will get body to class extending [BasePainter] and this method will draw the sliding indicator which slide over changing index.
void draw(Canvas canvas, double space, double width, double height,
double radius, double cornerRadius);
@override
void paint(Canvas canvas, Size size) {
_paint.color = widget.color;
double space = widget.space;
double width = widget.width;
double height = widget.height;
double distance = width + space;
double radius = width / 2;
for (int i = 0, c = widget.count; i < c; ++i) {
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromCenter(
center: Offset((i * distance) + radius, radius),
width: width,
height: height),
Radius.circular(widget.cornerRadius)),
_paint);
}
_paint.color = widget.activeColor;
draw(canvas, space, width, height, radius, widget.cornerRadius);
}
@override
bool shouldRepaint(BasePainter oldDelegate) {
return oldDelegate.page != page;
}
}
/// This class we draw the indicator which slides.
class SlidePainter extends BasePainter {
SlidePainter(CarouselIndicator widget, double page, Paint paint)
: super(widget, page, paint);
@override
void draw(Canvas canvas, double space, double width, double height,
double radius, double cornerRadius) {
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromCenter(
center: Offset(radius + (page * (width + space)), radius),
width: width,
height: height),
Radius.circular(cornerRadius)),
_paint);
}
}

@ -24,6 +24,7 @@ class Texts extends StatefulWidget {
final double marginBottom;
final double marginLeft;
final TextDecoration decoration;
final double heightFactor;
Texts(this.text,
{Key key,
@ -46,7 +47,8 @@ class Texts extends StatefulWidget {
this.marginLeft,
this.marginRight,
this.marginTop,
this.decoration})
this.decoration,
this.heightFactor,})
: super(key: key);
@override
@ -226,6 +228,7 @@ class _TextsState extends State<Texts> {
fontWeight: widget.fontWeight ?? _getFontWeight(),
)
: TextStyle(
height: widget.heightFactor,
decoration: widget.decoration,
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color ??

@ -1,14 +1,26 @@
import 'dart:convert';
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/models/Appointments/AppoimentAllHistoryResultList.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/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
enum _PAYMENT_TYPE{PACKAGES, PHARMACY, PATIENT}
var _InAppBrowserOptions = InAppBrowserClassOptions(
inAppWebViewGroupOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)),
crossPlatform: InAppBrowserOptions(hideUrlBar: true),
ios: IOSInAppBrowserOptions(toolbarBottom: false,)
);
class MyInAppBrowser extends InAppBrowser {
_PAYMENT_TYPE paymentType;
// static String SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT
@ -27,6 +39,11 @@ class MyInAppBrowser extends InAppBrowser {
static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
'https://mdlaboratories.com/exacartapi/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; //Live
// Packages
static String PACKAGES_REQUEST_PAYMENT_URL = '$EXA_CART_API_BASE_URL/checkout/OpcCompleteRedirectionPayment1';
static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess';
static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed';
static List<String> successURLS = [
'success',
'PayFortResponse',
@ -38,6 +55,7 @@ class MyInAppBrowser extends InAppBrowser {
final Function onExitCallback;
final Function onLoadStartCallback;
final BuildContext context;
AppSharedPreferences sharedPref = AppSharedPreferences();
AuthProvider authProvider = new AuthProvider();
@ -53,7 +71,7 @@ class MyInAppBrowser extends InAppBrowser {
static bool isPaymentDone = false;
MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback});
MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback, this.context});
Future onBrowserCreated() async {
print("\n\nBrowser Created!\n\n");
@ -61,7 +79,8 @@ class MyInAppBrowser extends InAppBrowser {
@override
Future onLoadStart(String url) async {
onLoadStartCallback(url);
if(onLoadStartCallback != null)
onLoadStartCallback(url);
}
@override
@ -82,13 +101,20 @@ class MyInAppBrowser extends InAppBrowser {
@override
void onExit() {
print("\n\nBrowser closed!\n\n");
onExitCallback(appo, isPaymentDone);
if(onExitCallback != null)
onExitCallback(appo, isPaymentDone);
}
@override
Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
print("\n\n override ${shouldOverrideUrlLoadingRequest.url}\n\n");
Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async {
var url = shouldOverrideUrlLoadingRequest.url;
debugPrint("redirecting/overriding to: $url");
if(paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL,PACKAGES_PAYMENT_FAIL_URL].contains(url)){
isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL);
close();
}
return ShouldOverrideUrlLoadingAction.ALLOW;
}
@ -114,6 +140,12 @@ class MyInAppBrowser extends InAppBrowser {
}
}
openPackagesPaymentBrowser({@required int customer_id, @required int order_id}){
paymentType = _PAYMENT_TYPE.PACKAGES;
var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id';
this.openUrl(url: full_url, options: _InAppBrowserOptions);
}
openPaymentBrowser(
double amount,
String orderDesc,
@ -150,7 +182,9 @@ class MyInAppBrowser extends InAppBrowser {
clinicID,
doctorID)
.then((value) {
this.browser.openUrl(url: value);
paymentType = _PAYMENT_TYPE.PATIENT;
this.browser.openUrl(url: value, options: _InAppBrowserOptions);
});
}
@ -176,7 +210,7 @@ class MyInAppBrowser extends InAppBrowser {
openBrowser(String url) {
this.browser = browser;
this.browser.openUrl(url: url);
this.browser.openUrl(url: url, options: _InAppBrowserOptions);
}
Future<String> generateURL(
@ -357,4 +391,4 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
void onClosed() {
print("ChromeSafari browser closed");
}
}
}

@ -0,0 +1,213 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/CounterView.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
bool wide = true;
class PackagesCartItemCard extends StatefulWidget {
final PackagesCartItemsResponseModel itemModel;
final StepperCallbackFuture shouldStepperChangeApply ;
const PackagesCartItemCard(
{
@required this.itemModel,
@required this.shouldStepperChangeApply,
Key key})
: super(key: key);
@override
State<StatefulWidget> createState() => PackagesCartItemCardState();
}
class PackagesCartItemCardState extends State<PackagesCartItemCard> {
@override
Widget build(BuildContext context) {
wide = !wide;
return Container(
color: Colors.transparent,
child: Card(
elevation: 3,
shadowColor: Colors.grey[100],
color: Colors.white,
child: Stack(
children: [
Container(
height: 100,
child: Row(
children: [
_image(widget.itemModel.product),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
_itemName(widget.itemModel.product.getName()),
Row(
children: [
_itemPrice(widget.itemModel.product.price, context: context),
_priceSeperator(),
_itemOldPrice(widget.itemModel.product.oldPrice, context: context),
],
),
Row(
children: [
_itemCounter(
widget.itemModel.quantity,
minQuantity: widget.itemModel.product.orderMinimumQuantity,
maxQuantity: widget.itemModel.product.orderMaximumQuantity,
shouldStepperChangeApply: (apply,total) async{
bool success = await widget.shouldStepperChangeApply(apply,total);
if(success == true)
setState(() => widget.itemModel.quantity = total);
return success;
}
),
],
),
],
)
],
),
),
Positioned(
bottom: 8,
left: 10,
child: Row(
children: [
_totalPrice((widget.itemModel.product.price * widget.itemModel.quantity), context: context),
_totalLabel(context: context),
],
),
)
],
)
)
);
}
}
// --------------------
// Product Image
// --------------------
Widget _image(PackagesResponseModel model) => AspectRatio(
aspectRatio: 1/1,
child: Padding(
padding: const EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300], width: 0.25),
boxShadow: [
BoxShadow(color: Colors.grey[200], blurRadius: 2.0, spreadRadius: 1, offset: Offset(1,1.5))
],
borderRadius: BorderRadius.circular(8),
color: Colors.white,
shape: BoxShape.rectangle,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: (model.images.isNotEmpty)
? Utils.loadNetworkImage(url: model.images.first.src, fitting:BoxFit.fill)
: Container(color: Colors.grey[200])
),
),
),
);
// --------------------
// Product Name
// --------------------
Widget _itemName(String name) => Padding(
padding: const EdgeInsets.all(0),
child: Texts(
name,
fontWeight: FontWeight.normal,
color: Colors.black,
fontSize: 15
)
);
Widget _itemPrice(double price, {@required BuildContext context}) => Padding(
padding: const EdgeInsets.all(0),
child: Texts(
'${price} ${TranslationBase.of(context).sar}',
fontWeight: FontWeight.bold,
color: Colors.green,
fontSize: 15
)
);
// --------------------
// Price Seperator
// --------------------
Widget _priceSeperator() => Padding(
padding: const EdgeInsets.only(left: 3, right: 3),
child: Container(height: 0.5, width: 5, color: Colors.grey[100],),
);
// --------------------
// Product Price
// --------------------
Widget _itemOldPrice(double oldPrice, {@required BuildContext context}) => Padding(
padding: const EdgeInsets.all(0),
child: Texts(
'${oldPrice} ${TranslationBase.of(context).sar}',
fontWeight: FontWeight.normal,
decoration: TextDecoration.lineThrough,
color: Colors.grey,
fontSize: 10
)
);
// --------------------
// Product Price
// --------------------
Widget _itemCounter(int quantity, {int minQuantity, int maxQuantity, StepperCallbackFuture shouldStepperChangeApply}) => Padding(
padding: const EdgeInsets.all(0),
child: StepperView(
height: 25,
backgroundColor: Colors.grey[300],
foregroundColor: Colors.grey[200],
initialNumber: quantity,
minNumber: minQuantity,
maxNumber: maxQuantity,
counterCallback: shouldStepperChangeApply,
decreaseCallback: (){},
increaseCallback: (){},
)
);
Widget _totalLabel({@required BuildContext context}) => Padding(
padding: const EdgeInsets.all(0),
child: Texts(
'${TranslationBase.of(context).totalWithColonRight}',
fontWeight: FontWeight.bold,
color: Colors.grey[600],
fontSize: 13
)
);
Widget _totalPrice(double totalPrice, {@required BuildContext context}) => Padding(
padding: const EdgeInsets.all(0),
child: Texts(
'${totalPrice.toStringAsFixed(2)} ${TranslationBase.of(context).sar}',
fontWeight: FontWeight.normal,
color: Colors.green,
)
);

@ -0,0 +1,158 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
bool wide = true;
class PackagesItemCard extends StatefulWidget {
final double itemWidth;
final double itemHeight;
final double itemContentPadding;
final PackagesResponseModel itemModel;
final Function(PackagesResponseModel product) onCartClick;
const PackagesItemCard(
{
this.itemWidth,
this.itemHeight,
@required this.itemModel,
@required this.itemContentPadding,
@required this.onCartClick,
Key key})
: super(key: key);
@override
State<StatefulWidget> createState() => PackagesItemCardState();
}
class PackagesItemCardState extends State<PackagesItemCard> {
imageUrl() => widget.itemModel.images.isNotEmpty ? widget.itemModel.images.first.src : "https://wallpaperaccess.com/full/30103.jpg";
@override
Widget build(BuildContext context) {
wide = !wide;
return Directionality(
textDirection: TextDirection.rtl,
child: Stack(
children: [
Padding(
padding: EdgeInsets.only(
left: widget.itemContentPadding,
right: widget.itemContentPadding,
top: widget.itemContentPadding + 5),
child: Container(
width: widget.itemWidth,
color: Colors.transparent,
child: Stack(
children: [
Column(
mainAxisSize: MainAxisSize.max,
children: [
AspectRatio(
aspectRatio:1 / 1,
child: applyShadow(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Utils.loadNetworkImage(
url: imageUrl(),
)),
)),
Texts(
widget.itemModel.getName(),
fontWeight: FontWeight.normal,
color: Colors.black,
fontSize: 15
),
Padding(
padding: const EdgeInsets.only(left: 10, right: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: [
Stack(
children: [
Texts(
'${widget.itemModel.oldPrice} ${'SAR'}',
fontWeight: FontWeight.normal,
decoration: TextDecoration.lineThrough,
color: Colors.grey,
fontSize: 12
),
Padding(
padding: const EdgeInsets.only(top: 8),
child: Texts(
'${widget.itemModel.price} ${'SAR'}',
fontWeight: FontWeight.bold,
color: Colors.green,
fontSize: 18
),
),
Padding(
padding: const EdgeInsets.only(top: 35),
child: StarRating(
size: 15,
totalCount: null,
totalAverage: widget.itemModel.approvedRatingSum.toDouble(),
forceStars: true),
)
],
),
Spacer(
flex: 1,
),
InkWell(
child: Icon(
Icons.add_shopping_cart_rounded,
size: 30.0,
color: Colors.grey,
),
onTap: () {
widget.onCartClick(widget.itemModel);
},
),
],
),
),
],
),
],
),
),
),
Positioned(
top: 0,
right: 0,
child: Visibility(
visible: false,
child: InkWell(
child: Icon(
Icons.favorite,
size: 40.0,
color: Colors.red,
),
onTap: () {
},
),
),
),
Positioned(
top: 7,
left: 2,
child: Image.asset(
'assets/images/discount_${'en'}.png',
height: 60,
width: 60,
),
),
],
),
);
}
}

@ -1,6 +1,5 @@
import 'dart:developer';
import 'package:carousel_pro/carousel_pro.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersCategoriesRequestModel.dart';
import 'package:diplomaticquarterapp/core/model/packages_offers/requests/OffersProductsRequestModel.dart';
@ -264,8 +263,8 @@ class OfferPackagesItemModel<T> {
print(value.toString());
});
var vm_products = locator<OfferProductsViewModel>();
vm_products.service.getAllProducts(OffersProductsRequestModel(categoryId: 125, limit: 100, page: 1, sinceId: 0)).then((value) {
var vm_products = locator<PackagesViewModel>();
vm_products.service.getAllProducts(request: OffersProductsRequestModel(categoryId: 125, limit: 100)).then((value) {
print(value.toString());
print(value.toString());
});

@ -14,26 +14,26 @@ class StarRating extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget> [
if (!forceStars && (totalAverage==null || totalAverage==0))
Texts("New", style: "caption"),
if (forceStars || (totalAverage!=null && totalAverage>0))
...List.generate(5, (index) =>
Padding(
padding: EdgeInsets.only(right: 1.0),
child: Icon(
(index+1) <= (totalAverage ?? 0) ? EvaIcons.star : EvaIcons.starOutline,
size: size,
color: (index+1) <= (totalAverage ?? 0) ? Color.fromRGBO(255, 186, 0, 1.0) : Theme.of(context).hintColor
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget> [
if (!forceStars && (totalAverage==null || totalAverage==0))
Texts("New", style: "caption"),
if (forceStars || (totalAverage!=null && totalAverage>0))
...List.generate(5, (index) =>
Padding(
padding: EdgeInsets.only(right: 1.0),
child: Icon(
(index+1) <= (totalAverage ?? 0) ? EvaIcons.star : EvaIcons.starOutline,
size: size,
color: (index+1) <= (totalAverage ?? 0) ? Color.fromRGBO(255, 186, 0, 1.0) : Theme.of(context).hintColor
),
)
),
)
),
if (totalCount!=null)
SizedBox(width: 9.0),
if (totalCount!=null)
Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],)
]
if (totalCount!=null)
SizedBox(width: 9.0),
if (totalCount!=null)
Texts("("+totalCount.toString()+")", style: "overline", color: Colors.grey[400],)
]
);
}
}

@ -1,3 +1,4 @@
import 'package:badges/badges.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
@ -31,6 +32,8 @@ import 'not_auh_page.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
VoidCallback _onCartClick;
class AppScaffold extends StatelessWidget {
final String appBarTitle;
final Widget body;
@ -42,6 +45,9 @@ class AppScaffold extends StatelessWidget {
final bool isBottomBar;
final Widget floatingActionButton;
final bool isPharmacy;
final bool isOfferPackages;
final bool showPharmacyCart;
final bool showOfferPackagesCart;
final String title;
final String description;
final bool isShowDecPage;
@ -55,6 +61,7 @@ class AppScaffold extends StatelessWidget {
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AppBarWidget appBar;
AppScaffold(
{@required this.body,
this.appBarTitle = '',
@ -65,6 +72,9 @@ class AppScaffold extends StatelessWidget {
this.baseViewModel,
this.floatingActionButton,
this.isPharmacy = false,
this.showPharmacyCart = true,
this.isOfferPackages = false,
this.showOfferPackagesCart = false,
this.title,
this.description,
this.isShowDecPage = true,
@ -77,6 +87,11 @@ class AppScaffold extends StatelessWidget {
this.showHomeAppBarIcon = true,
this.imagesInfo});
AppScaffold setOnAppBarCartClick(VoidCallback onClick){
_onCartClick = onClick;
return this;
}
@override
Widget build(BuildContext context) {
AppGlobal.context = context;
@ -84,29 +99,35 @@ class AppScaffold extends StatelessWidget {
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar
? AppBarWidget(
? appBar = AppBarWidget(
appBarTitle: appBarTitle,
appBarIcons: appBarIcons,
showHomeAppBarIcon: showHomeAppBarIcon,
isPharmacy: isPharmacy,
showPharmacyCart: showPharmacyCart,
isOfferPackages: isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart,
isShowDecPage: isShowDecPage,
)
: null,
bottomSheet: bottomSheet,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage)
? NotAutPage(
title: title ?? appBarTitle,
description: description,
infoList: infoList,
imagesInfo: imagesInfo,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: baseViewModel,
)
: buildBodyWidget(context),
body: SafeArea(
top: true, bottom: true,
child: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage)
? NotAutPage(
title: title ?? appBarTitle,
description: description,
infoList: infoList,
imagesInfo: imagesInfo,
)
: baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: baseViewModel,
)
: buildBodyWidget(context),
),
);
}
@ -120,7 +141,7 @@ class AppScaffold extends StatelessWidget {
}
}
class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@ -128,34 +149,59 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final bool showHomeAppBarIcon;
final List<Widget> appBarIcons;
final bool isPharmacy;
final bool isOfferPackages;
final bool showPharmacyCart;
final bool showOfferPackagesCart;
final bool isShowDecPage;
Function(String) badgeUpdater;
AppBarWidget(
{this.appBarTitle,
this.showHomeAppBarIcon,
this.appBarIcons,
this.isPharmacy = true,
this.showPharmacyCart = true,
this.isOfferPackages = false,
this.showOfferPackagesCart = false,
this.isShowDecPage = true});
@override
State<StatefulWidget> createState() => AppBarWidgetState();
@override
Size get preferredSize => Size(double.maxFinite, 60);
}
class AppBarWidgetState extends State<AppBarWidget>{
String badgeText = "0";
@override
Widget build(BuildContext context) {
widget.badgeUpdater = badgeUpdateBlock;
return buildAppBar(context);
}
badgeUpdateBlock(String value){
setState(() {
badgeText = value;
});
}
Widget buildAppBar(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppBar(
elevation: 0,
backgroundColor:
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme(
headline6: TextStyle(
color: Theme.of(context).textTheme.headline1.color,
fontWeight: FontWeight.bold),
),
title: Text(
authenticatedUserObject.isLogin || !isShowDecPage
? appBarTitle.toUpperCase()
widget.authenticatedUserObject.isLogin || !widget.isShowDecPage
? widget.appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
@ -168,28 +214,56 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
),
centerTitle: true,
actions: <Widget>[
isPharmacy
(widget.isPharmacy && widget.showPharmacyCart)
? IconButton(
icon: Icon(Icons.shopping_cart),
color: Theme.of(context).textTheme.headline1.color,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CartOrderPage()),
);
})
icon: Badge(
badgeContent: Text(
badgeText
),
child: Icon(Icons.shopping_cart)
),
color: Colors.white,
onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/'));
})
: Container(),
IconButton(
icon: Icon(FontAwesomeIcons.home),
color: Theme.of(context).textTheme.headline1.color,
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
},
),
if (appBarIcons != null) ...appBarIcons
(widget.isOfferPackages && widget.showOfferPackagesCart)
? IconButton(
icon: Badge(
position: BadgePosition.topStart(top: -15,start: -10),
badgeContent: Text(
badgeText,
style: TextStyle(fontSize: 9,color: Colors.white, fontWeight: FontWeight.normal),
),
child: Icon(Icons.shopping_cart)
),
color: Colors.white,
onPressed: () {
// Cart Click Event
if(_onCartClick != null)
_onCartClick();
})
: Container(),
if (widget.showHomeAppBarIcon)
IconButton(
icon: Icon(FontAwesomeIcons.home),
color: Colors.white,
onPressed: () {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
// Cart Click Event
if(_onCartClick != null)
_onCartClick();
},
),
if (widget.appBarIcons != null) ...widget.appBarIcons
],
);
}

@ -21,6 +21,8 @@ dependencies:
# http client
http: ^0.12.1
connectivity: ^0.4.9+3
async: ^2.4.2
audio_wave: ^0.0.3
# State Management
provider: ^4.3.2+2
@ -87,7 +89,6 @@ dependencies:
# Qr code Scanner TODO fix it
# barcode_scanner: ^1.0.1
barcode_scan: ^2.0.0
flutter_polyline_points: ^0.1.0
location: ^2.3.5
# Qr code Scanner
@ -105,9 +106,6 @@ dependencies:
# Location Helper
map_launcher: ^0.8.1
#carousel slider
carousel_slider: ^2.3.1
#Calendar Events
manage_calendar_events: ^1.0.2
@ -181,6 +179,12 @@ dependencies:
# Dep by Zohaib
shimmer: ^1.1.2
carousel_slider: ^2.3.1
flutter_material_pickers: 1.7.4
flutter_staggered_grid_view: 0.3.4
# Marker Animation
flutter_animarker: ^1.0.0
dev_dependencies:
flutter_test:

Loading…
Cancel
Save