diff --git a/android/app/agconnect-services-new.json b/android/app/agconnect-services-new.json new file mode 100644 index 00000000..fce77eec --- /dev/null +++ b/android/app/agconnect-services-new.json @@ -0,0 +1,74 @@ +{ + "agcgw":{ + "backurl":"connect-drcn.hispace.hicloud.com", + "url":"connect-drcn.dbankcloud.cn", + "websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com", + "websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn" + }, + "agcgw_all":{ + "CN":"connect-drcn.dbankcloud.cn", + "CN_back":"connect-drcn.hispace.hicloud.com", + "DE":"connect-dre.dbankcloud.cn", + "DE_back":"connect-dre.hispace.hicloud.com", + "RU":"connect-drru.dbankcloud.cn", + "RU_back":"connect-drru.hispace.hicloud.com", + "SG":"connect-dra.dbankcloud.cn", + "SG_back":"connect-dra.hispace.hicloud.com" + }, + "client":{ + "cp_id":"2640966000002322881", + "product_id":"736430079244816567", + "client_id":"563735388191982656", + "client_secret":"650C7C799812AFFD53A10C7756CF05FB9F215A7E49032ABA8EBF3E14B77535CF", + "project_id":"736430079244816567", + "app_id":"102857389", + "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", + "package_name":"com.ejada.hmg" + }, + "oauth_client":{ + "client_id":"102857389", + "client_type":1 + }, + "app_info":{ + "app_id":"102857389", + "package_name":"com.ejada.hmg" + }, + "service":{ + "analytics":{ + "collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn", + "collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn", + "collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn", + "collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "resource_id":"p1", + "channel_id":"" + }, + "search":{ + "url":"https://search-drcn.cloud.huawei.com" + }, + "cloudstorage":{ + "storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn" + }, + "ml":{ + "mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn" + } + }, + "region":"CN", + "configuration_version":"3.0", + "appInfos":[ + { + "package_name":"com.ejada.hmg", + "client":{ + "app_id":"102857389" + }, + "app_info":{ + "package_name":"com.ejada.hmg", + "app_id":"102857389" + }, + "oauth_client":{ + "client_type":1, + "client_id":"102857389" + } + } + ] +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index bfe7fde4..25230849 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -52,12 +52,21 @@ android { } + signingConfigs { + config{ + storeFile file('key') + keyAlias 'HMG' + storePassword 'HmGsa123' + keyPassword 'HmGsa123' + } + } + buildTypes { - debug {} + debug { + signingConfig signingConfigs.config + } release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig signingConfigs.config } staging { // Specifies a sorted list of fallback build types that the @@ -98,6 +107,13 @@ dependencies { implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0' implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android - implementation 'com.google.android.gms:play-services-basement:17.5.0' + implementation 'com.google.android.gms:play-services-basement:17.5.0' + + + implementation "com.opentok.android:opentok-android-sdk:2.19.1" + + compile 'com.facebook.stetho:stetho:1.5.1' + implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' + } diff --git a/android/app/key b/android/app/key new file mode 100644 index 00000000..15b9f5d1 Binary files /dev/null and b/android/app/key differ diff --git a/lib/pages/pharmacies/product_detail.dart b/android/app/keystores/keystore similarity index 100% rename from lib/pages/pharmacies/product_detail.dart rename to android/app/keystores/keystore diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt index 0708653a..a9c5ea88 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt @@ -1,16 +1,40 @@ //package com.cloud.diplomaticquarterapp package com.ejada.hmg +import com.facebook.stetho.Stetho import io.flutter.app.FlutterApplication import io.flutter.plugin.common.PluginRegistry import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback -import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService class Application : FlutterApplication(), PluginRegistrantCallback { override fun onCreate() { super.onCreate() FlutterFirebaseMessagingService.setPluginRegistrant(this) + +// Stetho.initializeWithDefaults(this); + // Create an InitializerBuilder + // Create an InitializerBuilder + val initializerBuilder = Stetho.newInitializerBuilder(this) + + + // Enable Chrome DevTools + initializerBuilder.enableWebKitInspector( + Stetho.defaultInspectorModulesProvider(this) + ) + + // Enable command line interface + initializerBuilder.enableDumpapp( + Stetho.defaultDumperPluginsProvider(this) + ) + + + // Use the InitializerBuilder to generate an Initializer + val initializer = initializerBuilder.build() + + + // Initialize Stetho with the Initializer + Stetho.initialize(initializer) } override fun registerWith(registry: PluginRegistry) { diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index 26484b5c..e754e44c 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -4,15 +4,16 @@ import android.util.Log import androidx.annotation.NonNull; import com.ejada.hmg.utils.* import io.flutter.embedding.android.FlutterFragmentActivity - import io.flutter.embedding.engine.FlutterEngine +import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodChannel import io.flutter.plugins.GeneratedPluginRegistrant class MainActivity: FlutterFragmentActivity() { override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - // Create Flutter Platform Bridge - PlatformBridge(flutterEngine.dartExecutor.binaryMessenger, this).create() + GeneratedPluginRegistrant.registerWith(flutterEngine); + // Create Flutter Platform Bridge + PlatformBridge(flutterEngine, this).create() + OpenTokPlatformBridge(flutterEngine, this).create() val time = timeToMillis("04:00:00", "HH:mm:ss") @@ -24,7 +25,7 @@ class MainActivity: FlutterFragmentActivity() { // val d5 = Logs.GeofenceEvent.list(this) // val d6 = Logs.GeofenceEvent.raw(this) - } + } override fun onResume() { super.onResume() diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt new file mode 100644 index 00000000..cfebfe65 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt @@ -0,0 +1,58 @@ +package com.ejada.hmg.opentok + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.FrameLayout +import android.widget.LinearLayout +import com.ejada.hmg.R +import io.flutter.plugin.common.StandardMessageCodec +import io.flutter.plugin.platform.PlatformView +import io.flutter.plugin.platform.PlatformViewFactory + +class LocalVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { + + companion object { + private lateinit var view: LocalVideoPlatformView + + fun getViewInstance(context: Context): LocalVideoPlatformView { + if(!this::view.isInitialized) { + view = LocalVideoPlatformView(context) + } + + return view + } + } + + override fun create(context: Context, viewId: Int, args: Any?): PlatformView { + return getViewInstance(context) + } +} + +class LocalVideoPlatformView(context: Context) : PlatformView { + private val videoContainer: LocalVideoContainer = LocalVideoContainer(context) + + val container get() = videoContainer.publisherContainer + + override fun getView(): View { + return videoContainer + } + + override fun dispose() {} +} + +class LocalVideoContainer @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyle: Int = 0, + defStyleRes: Int = 0 +) : LinearLayout(context, attrs, defStyle, defStyleRes) { + + var publisherContainer: FrameLayout private set + + init { + val view = LayoutInflater.from(context).inflate(R.layout.local_video, this, true) + publisherContainer = view.findViewById(R.id.publisher_container) + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt new file mode 100644 index 00000000..d53d6f9a --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt @@ -0,0 +1,170 @@ +package com.ejada.hmg.opentok + +import android.content.Context +import android.os.Handler +import android.os.Looper +import android.util.Log +import android.view.ViewGroup +import com.facebook.stetho.urlconnection.StethoURLConnectionManager +import com.opentok.android.* +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel + + +enum class OpenTokSDKState { + LOGGED_OUT, + LOGGED_IN, + WAIT, + ERROR +} + +class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){ + private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView + private lateinit var localVideoPlatformView: LocalVideoPlatformView + + init { + remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context) + flutterEngine + .platformViewsController + .registry + .registerViewFactory("remote-video-container", RemoteVideoFactory()) + + localVideoPlatformView = LocalVideoFactory.getViewInstance(context) + flutterEngine + .platformViewsController + .registry + .registerViewFactory("local-video-container", LocalVideoFactory()) + } + + private var session: Session? = null + private var publisher: Publisher? = null + private var subscriber: Subscriber? = null + + + + private val sessionListener: Session.SessionListener = object: Session.SessionListener { + override fun onConnected(session: Session) { + // Connected to session + Log.d("MainActivity", "Connected to session ${session.sessionId}") + + publisher = Publisher.Builder(context).build().apply { + setPublisherListener(publisherListener) + renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) + + view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + localVideoPlatformView.container.addView(view) + } + + notifyFlutter(OpenTokSDKState.LOGGED_IN) + session.publish(publisher) + } + + override fun onDisconnected(session: Session) { + notifyFlutter(OpenTokSDKState.LOGGED_OUT) + } + + override fun onStreamReceived(session: Session, stream: Stream) { + Log.d( + "MainActivity", + "onStreamReceived: New Stream Received " + stream.streamId + " in session: " + session.sessionId + ) + if (subscriber == null) { + subscriber = Subscriber.Builder(context, stream).build().apply { + renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) + setSubscriberListener(subscriberListener) + session.subscribe(this) + + remoteVideoPlatformView.container.addView(view) + } + } + } + + override fun onStreamDropped(session: Session, stream: Stream) { + Log.d( + "MainActivity", + "onStreamDropped: Stream Dropped: " + stream.streamId + " in session: " + session.sessionId + ) + + if (subscriber != null) { + subscriber = null + + remoteVideoPlatformView.container.removeAllViews() + } + } + + override fun onError(session: Session, opentokError: OpentokError) { + Log.d("MainActivity", "Session error: " + opentokError.message) + notifyFlutter(OpenTokSDKState.ERROR) + } + } + + private val publisherListener: PublisherKit.PublisherListener = object : PublisherKit.PublisherListener { + override fun onStreamCreated(publisherKit: PublisherKit, stream: Stream) { + Log.d("MainActivity", "onStreamCreated: Publisher Stream Created. Own stream " + stream.streamId) + } + + override fun onStreamDestroyed(publisherKit: PublisherKit, stream: Stream) { + Log.d("MainActivity", "onStreamDestroyed: Publisher Stream Destroyed. Own stream " + stream.streamId) + } + + override fun onError(publisherKit: PublisherKit, opentokError: OpentokError) { + Log.d("MainActivity", "PublisherKit onError: " + opentokError.message) + notifyFlutter(OpenTokSDKState.ERROR) + } + } + + var subscriberListener: SubscriberKit.SubscriberListener = object : SubscriberKit.SubscriberListener { + override fun onConnected(subscriberKit: SubscriberKit) { + Log.d("MainActivity", "onConnected: Subscriber connected. Stream: " + subscriberKit.stream.streamId) + } + + override fun onDisconnected(subscriberKit: SubscriberKit) { + Log.d("MainActivity", "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.stream.streamId) + notifyFlutter(OpenTokSDKState.LOGGED_OUT) + } + + override fun onError(subscriberKit: SubscriberKit, opentokError: OpentokError) { + Log.d("MainActivity", "SubscriberKit onError: " + opentokError.message) + notifyFlutter(OpenTokSDKState.ERROR) + } + } + + fun initSession(call: MethodCall, result: MethodChannel.Result) { + + val apiKey = requireNotNull(call.argument("apiKey")) + val sessionId = requireNotNull(call.argument("sessionId")) + val token = requireNotNull(call.argument("token")) + + notifyFlutter(OpenTokSDKState.WAIT) + session = Session.Builder(context, apiKey, sessionId).build() + session?.setSessionListener(sessionListener) + session?.connect(token) + result.success("") + } + + fun swapCamera(call: MethodCall, result: MethodChannel.Result) { + publisher?.cycleCamera() + result.success("") + } + + fun toggleAudio(call: MethodCall, result: MethodChannel.Result) { + val publishAudio = requireNotNull(call.argument("publishAudio")) + publisher?.publishAudio = publishAudio + result.success("") + } + + fun toggleVideo(call: MethodCall, result: MethodChannel.Result) { + val publishVideo = requireNotNull(call.argument("publishVideo")) + publisher?.publishVideo = publishVideo + result.success("") + } + + private fun notifyFlutter(state: OpenTokSDKState) { + Handler(Looper.getMainLooper()).post { + MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "OpenTok-Platform-Bridge") + .invokeMethod("updateState", state.toString()) + } + } +} diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt new file mode 100644 index 00000000..9116a1e8 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt @@ -0,0 +1,58 @@ +package com.ejada.hmg.opentok + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.FrameLayout +import android.widget.LinearLayout +import com.ejada.hmg.R +import io.flutter.plugin.common.StandardMessageCodec +import io.flutter.plugin.platform.PlatformView +import io.flutter.plugin.platform.PlatformViewFactory + +class RemoteVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { + + companion object { + private lateinit var view: RemoteVideoPlatformView + + fun getViewInstance(context: Context): RemoteVideoPlatformView { + if(!this::view.isInitialized) { + view = RemoteVideoPlatformView(context) + } + + return view + } + } + + override fun create(context: Context, viewId: Int, args: Any?): PlatformView { + return getViewInstance(context) + } +} + +class RemoteVideoPlatformView(context: Context) : PlatformView { + private val videoContainer: RemoteVideoContainer = RemoteVideoContainer(context) + + val container get() = videoContainer.subscriberContainer + + override fun getView(): View { + return videoContainer + } + + override fun dispose() {} +} + +class RemoteVideoContainer @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyle: Int = 0, + defStyleRes: Int = 0 +) : LinearLayout(context, attrs, defStyle, defStyleRes) { + + var subscriberContainer: FrameLayout private set + + init { + val view = LayoutInflater.from(context).inflate(R.layout.remote_video, this, true) + subscriberContainer = view.findViewById(R.id.subscriber_container) + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt new file mode 100644 index 00000000..6ac62546 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt @@ -0,0 +1,42 @@ +package com.ejada.hmg.utils + +import com.ejada.hmg.MainActivity +import com.ejada.hmg.opentok.OpenTok +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel + +class OpenTokPlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) { + + private lateinit var channel: MethodChannel + private lateinit var openTok: OpenTok + + companion object { + private const val CHANNEL = "OpenTok-Platform-Bridge" + } + + fun create(){ + openTok = OpenTok(mainActivity, flutterEngine) + channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) + channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> + when (call.method) { + "initSession" -> { + openTok.initSession(call, result) + } + "swapCamera" -> { + openTok.swapCamera(call, result) + } + "toggleAudio" -> { + openTok.toggleAudio(call, result) + } + "toggleVideo" -> { + openTok.toggleVideo(call, result) + } + else -> { + result.notImplemented() + } + } + } + } + +} diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt index cb8c2c3d..003b9e24 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/PlatformBridge.kt @@ -8,13 +8,12 @@ import com.ejada.hmg.hmgwifi.HMG_Guest import com.ejada.hmg.hmgwifi.HMG_Internet import com.ejada.hmg.geofence.GeoZoneModel import com.ejada.hmg.geofence.HMG_Geofence +import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.BinaryMessenger import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel -class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: MainActivity) { - private var binaryMessenger = binaryMessenger - private var mainActivity = flutterMainActivity +class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) { private lateinit var channel: MethodChannel @@ -28,7 +27,7 @@ class PlatformBridge(binaryMessenger: BinaryMessenger, flutterMainActivity: Main } fun create(){ - channel = MethodChannel(binaryMessenger, CHANNEL) + channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) HMGUtils.setPlatformChannel(channel) channel.setMethodCallHandler { methodCall: MethodCall, result: MethodChannel.Result -> diff --git a/android/app/src/main/res/layout/local_video.xml b/android/app/src/main/res/layout/local_video.xml new file mode 100644 index 00000000..f47c48cd --- /dev/null +++ b/android/app/src/main/res/layout/local_video.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main/res/layout/remote_video.xml b/android/app/src/main/res/layout/remote_video.xml new file mode 100644 index 00000000..cfdbeb0d --- /dev/null +++ b/android/app/src/main/res/layout/remote_video.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 4ef0d731..ecb1ed70 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,7 +23,12 @@ allprojects { google() // jcenter() mavenCentral() - maven { url 'https://developer.huawei.com/repo/' } + maven { + url 'https://developer.huawei.com/repo/' + } + maven{ + url "https://artifactory.ess-dev.com/artifactory/gradle-dev-local" + } } } diff --git a/android/gradle.properties b/android/gradle.properties index 38c8d454..a5965ab8 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ org.gradle.jvmargs=-Xmx1536M android.enableR8=true android.useAndroidX=true -android.enableJetifier=true +android.enableJetifier=true \ No newline at end of file diff --git a/assets/images/SmartWatches/distance.png b/assets/images/SmartWatches/distance.png new file mode 100644 index 00000000..d07f3e8a Binary files /dev/null and b/assets/images/SmartWatches/distance.png differ diff --git a/assets/images/SmartWatches/steps.png b/assets/images/SmartWatches/steps.png new file mode 100644 index 00000000..974668ea Binary files /dev/null and b/assets/images/SmartWatches/steps.png differ diff --git a/assets/images/new-design/ic_schedule.svg b/assets/images/new-design/ic_schedule.svg new file mode 100644 index 00000000..c6fe44a1 --- /dev/null +++ b/assets/images/new-design/ic_schedule.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/images/new-design/tamara.png b/assets/images/new-design/tamara.png new file mode 100644 index 00000000..ab58e3ac Binary files /dev/null and b/assets/images/new-design/tamara.png differ diff --git a/assets/images/new/body/abdomin.svg b/assets/images/new/body/abdomin.svg new file mode 100644 index 00000000..c28cd70b --- /dev/null +++ b/assets/images/new/body/abdomin.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/chest.svg b/assets/images/new/body/chest.svg new file mode 100644 index 00000000..77f603cb --- /dev/null +++ b/assets/images/new/body/chest.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/head.svg b/assets/images/new/body/head.svg new file mode 100644 index 00000000..5ec9c3f3 --- /dev/null +++ b/assets/images/new/body/head.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_ankle.svg b/assets/images/new/body/left_ankle.svg new file mode 100644 index 00000000..e7bf8080 --- /dev/null +++ b/assets/images/new/body/left_ankle.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_arm.svg b/assets/images/new/body/left_arm.svg new file mode 100644 index 00000000..6445b6be --- /dev/null +++ b/assets/images/new/body/left_arm.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/left_ear.svg b/assets/images/new/body/left_ear.svg new file mode 100644 index 00000000..402f5f20 --- /dev/null +++ b/assets/images/new/body/left_ear.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/left_elbow.svg b/assets/images/new/body/left_elbow.svg new file mode 100644 index 00000000..9e741679 --- /dev/null +++ b/assets/images/new/body/left_elbow.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_eye.svg b/assets/images/new/body/left_eye.svg new file mode 100644 index 00000000..add3c780 --- /dev/null +++ b/assets/images/new/body/left_eye.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_foot.svg b/assets/images/new/body/left_foot.svg new file mode 100644 index 00000000..c3f8de42 --- /dev/null +++ b/assets/images/new/body/left_foot.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_forearm.svg b/assets/images/new/body/left_forearm.svg new file mode 100644 index 00000000..7a8224b6 --- /dev/null +++ b/assets/images/new/body/left_forearm.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_hand.svg b/assets/images/new/body/left_hand.svg new file mode 100644 index 00000000..168d05c4 --- /dev/null +++ b/assets/images/new/body/left_hand.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_knee.svg b/assets/images/new/body/left_knee.svg new file mode 100644 index 00000000..5ff004f6 --- /dev/null +++ b/assets/images/new/body/left_knee.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_leg.svg b/assets/images/new/body/left_leg.svg new file mode 100644 index 00000000..352cf2b9 --- /dev/null +++ b/assets/images/new/body/left_leg.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_soulder.svg b/assets/images/new/body/left_soulder.svg new file mode 100644 index 00000000..8bd69c8c --- /dev/null +++ b/assets/images/new/body/left_soulder.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_thigh.svg b/assets/images/new/body/left_thigh.svg new file mode 100644 index 00000000..880e1da2 --- /dev/null +++ b/assets/images/new/body/left_thigh.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/left_wrist.svg b/assets/images/new/body/left_wrist.svg new file mode 100644 index 00000000..b99c3f1c --- /dev/null +++ b/assets/images/new/body/left_wrist.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/mouth.svg b/assets/images/new/body/mouth.svg new file mode 100644 index 00000000..1dd7ca76 --- /dev/null +++ b/assets/images/new/body/mouth.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/neck.svg b/assets/images/new/body/neck.svg new file mode 100644 index 00000000..e3c0d951 --- /dev/null +++ b/assets/images/new/body/neck.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/nose.svg b/assets/images/new/body/nose.svg new file mode 100644 index 00000000..1e08b591 --- /dev/null +++ b/assets/images/new/body/nose.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/pelvis.svg b/assets/images/new/body/pelvis.svg new file mode 100644 index 00000000..77d32820 --- /dev/null +++ b/assets/images/new/body/pelvis.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/publs.svg b/assets/images/new/body/publs.svg new file mode 100644 index 00000000..40909b35 --- /dev/null +++ b/assets/images/new/body/publs.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_ankle.svg b/assets/images/new/body/right_ankle.svg new file mode 100644 index 00000000..2eec1180 --- /dev/null +++ b/assets/images/new/body/right_ankle.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_arm.svg b/assets/images/new/body/right_arm.svg new file mode 100644 index 00000000..60a03321 --- /dev/null +++ b/assets/images/new/body/right_arm.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_ear.svg b/assets/images/new/body/right_ear.svg new file mode 100644 index 00000000..65de3b24 --- /dev/null +++ b/assets/images/new/body/right_ear.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/right_elbow.svg b/assets/images/new/body/right_elbow.svg new file mode 100644 index 00000000..0a58f385 --- /dev/null +++ b/assets/images/new/body/right_elbow.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_eye.svg b/assets/images/new/body/right_eye.svg new file mode 100644 index 00000000..4642c353 --- /dev/null +++ b/assets/images/new/body/right_eye.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/right_foot.svg b/assets/images/new/body/right_foot.svg new file mode 100644 index 00000000..5faa7b58 --- /dev/null +++ b/assets/images/new/body/right_foot.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_forearm.svg b/assets/images/new/body/right_forearm.svg new file mode 100644 index 00000000..fea91ddf --- /dev/null +++ b/assets/images/new/body/right_forearm.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_hand.svg b/assets/images/new/body/right_hand.svg new file mode 100644 index 00000000..b36dd80c --- /dev/null +++ b/assets/images/new/body/right_hand.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_knee.svg b/assets/images/new/body/right_knee.svg new file mode 100644 index 00000000..16a174cf --- /dev/null +++ b/assets/images/new/body/right_knee.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_leg.svg b/assets/images/new/body/right_leg.svg new file mode 100644 index 00000000..2cd6a760 --- /dev/null +++ b/assets/images/new/body/right_leg.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_soulder.svg b/assets/images/new/body/right_soulder.svg new file mode 100644 index 00000000..cb29dc98 --- /dev/null +++ b/assets/images/new/body/right_soulder.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/images/new/body/right_thigh.svg b/assets/images/new/body/right_thigh.svg new file mode 100644 index 00000000..8d9ef522 --- /dev/null +++ b/assets/images/new/body/right_thigh.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/new/body/right_wrist.svg b/assets/images/new/body/right_wrist.svg new file mode 100644 index 00000000..d54c14c8 --- /dev/null +++ b/assets/images/new/body/right_wrist.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/assets/images/pharmacy/offers_banner.png b/assets/images/pharmacy/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy/offers_banner.png differ diff --git a/assets/images/pharmacy/offers_banner_ar.png b/assets/images/pharmacy/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy/offers_banner_ar.png differ diff --git a/assets/images/pharmacy_module/offers_banner.png b/assets/images/pharmacy_module/offers_banner.png new file mode 100644 index 00000000..6eab63fb Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner.png differ diff --git a/assets/images/pharmacy_module/offers_banner_ar.png b/assets/images/pharmacy_module/offers_banner_ar.png new file mode 100644 index 00000000..d987d3c6 Binary files /dev/null and b/assets/images/pharmacy_module/offers_banner_ar.png differ diff --git a/assets/images/pharmacy_module/payment.png b/assets/images/pharmacy_module/payment.png new file mode 100644 index 00000000..275aa40a Binary files /dev/null and b/assets/images/pharmacy_module/payment.png differ diff --git a/assets/images/svg/tamara.svg b/assets/images/svg/tamara.svg new file mode 100644 index 00000000..acc21074 --- /dev/null +++ b/assets/images/svg/tamara.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index d070415c..53427e0c 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -e52eba3667a38bec777870899c15ae7d \ No newline at end of file +3f8c659591fcdd0e47e3895f74af395c \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 9fbc2933..46c98373 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -42,6 +42,7 @@ target 'Runner' do # Native Pods pod 'NVActivityIndicatorView' + pod 'OpenTok' # Flutter Pod diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2ce396c4..565b2db9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -370,6 +370,10 @@ PODS: - Flutter - flutter_tts (0.0.1): - Flutter + - flutter_webrtc (0.2.2): + - Flutter + - GoogleWebRTC (= 1.1.31999) + - Libyuv (= 1703) - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) @@ -410,6 +414,7 @@ PODS: - GoogleUtilities/Logger - GoogleUtilities/UserDefaults (6.7.2): - GoogleUtilities/Logger + - GoogleWebRTC (1.1.31999) - "gRPC-C++ (1.28.2)": - "gRPC-C++/Implementation (= 1.28.2)" - "gRPC-C++/Interface (= 1.28.2)" @@ -438,14 +443,21 @@ PODS: - Flutter - "huawei_location (5.0.0+301)": - Flutter + - "huawei_map (5.0.3+303)": + - Flutter - image_cropper (0.0.3): - Flutter - TOCropViewController (~> 2.5.4) - image_picker (0.0.1): - Flutter + - in_app_review (0.2.0): + - Flutter + - in_app_update (0.0.1): + - Flutter - just_audio (0.0.1): - Flutter - leveldb-library (1.22) + - Libyuv (1703) - local_auth (0.0.1): - Flutter - location (0.0.1): @@ -469,6 +481,7 @@ PODS: - NVActivityIndicatorView (5.1.1): - NVActivityIndicatorView/Base (= 5.1.1) - NVActivityIndicatorView/Base (5.1.1) + - OpenTok (2.20.0) - path_provider (0.0.1): - Flutter - path_provider_linux (0.0.1): @@ -562,12 +575,16 @@ DEPENDENCIES: - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) + - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`) - geolocator (from `.symlinks/plugins/geolocator/ios`) - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - huawei_location (from `.symlinks/plugins/huawei_location/ios`) + - huawei_map (from `.symlinks/plugins/huawei_map/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) + - in_app_review (from `.symlinks/plugins/in_app_review/ios`) + - in_app_update (from `.symlinks/plugins/in_app_update/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) - location (from `.symlinks/plugins/location/ios`) @@ -577,6 +594,7 @@ DEPENDENCIES: - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - nfc_in_flutter (from `.symlinks/plugins/nfc_in_flutter/ios`) - NVActivityIndicatorView + - OpenTok - path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) @@ -624,12 +642,15 @@ SPEC REPOS: - GoogleDataTransport - GoogleMaps - GoogleUtilities + - GoogleWebRTC - "gRPC-C++" - gRPC-Core - leveldb-library + - Libyuv - MTBBarcodeScanner - nanopb - NVActivityIndicatorView + - OpenTok - PromisesObjC - Protobuf - Reachability @@ -688,6 +709,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" flutter_tts: :path: ".symlinks/plugins/flutter_tts/ios" + flutter_webrtc: + :path: ".symlinks/plugins/flutter_webrtc/ios" geolocator: :path: ".symlinks/plugins/geolocator/ios" google_maps_flutter: @@ -696,10 +719,16 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/hexcolor/ios" huawei_location: :path: ".symlinks/plugins/huawei_location/ios" + huawei_map: + :path: ".symlinks/plugins/huawei_map/ios" image_cropper: :path: ".symlinks/plugins/image_cropper/ios" image_picker: :path: ".symlinks/plugins/image_picker/ios" + in_app_review: + :path: ".symlinks/plugins/in_app_review/ios" + in_app_update: + :path: ".symlinks/plugins/in_app_update/ios" just_audio: :path: ".symlinks/plugins/just_audio/ios" local_auth: @@ -808,6 +837,7 @@ SPEC CHECKSUMS: flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d + flutter_webrtc: 39898454258b54ba51996850d5da8d5d53bf1524 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a geolocator: f5e3de65e241caba7ce3e8a618803387bda73384 google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 @@ -815,14 +845,19 @@ SPEC CHECKSUMS: GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 + GoogleWebRTC: b39a78c4f5cc6b0323415b9233db03a2faa7b0f0 "gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2 gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5 hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 huawei_location: a1c3d2a029138b3d0b9a72ce910ffae3ff23c1aa + huawei_map: 34fbad9c274ea78a4151487c9ebe27f1887777e7 image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541 + in_app_update: 16e877e205f4360264cb536e3a6481f0d90299e1 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 + Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437 local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 @@ -833,6 +868,7 @@ SPEC CHECKSUMS: native_device_orientation: e24d00be281de72996640885d80e706142707660 nfc_in_flutter: c656fbfb1ec5b9d021da87b0c87629d62fd5264d NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 + OpenTok: 414c2c1dc6486f1897015e4d1703558d5eed48c3 path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 @@ -869,6 +905,6 @@ SPEC CHECKSUMS: webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: 900f7dc480de5b961c031ed418407e0e40ed455c +PODFILE CHECKSUM: df22e8ed6009dd48559053927dc365d6dad6c11f COCOAPODS: 1.10.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e4453fa6..6c02c983 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -8,6 +8,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 301C79AE27200D9F0016307B /* OpenTokRemoteVideoFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */; }; + 301C79B027200DED0016307B /* OpenTokLocalVideoFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */; }; + 306FE6C8271D790C002D6EFC /* OpenTokPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */; }; + 306FE6CB271D8B73002D6EFC /* OpenTok.swift in Sources */ = {isa = PBXBuildFile; fileRef = 306FE6CA271D8B73002D6EFC /* OpenTok.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 813F9CBA7DD5ED63B28B8BB6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 767C165F7ABF3BF1F829B9BF /* Pods_Runner.framework */; }; @@ -50,6 +54,10 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokRemoteVideoFactory.swift; sourceTree = ""; }; + 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokLocalVideoFactory.swift; sourceTree = ""; }; + 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTokPlatformBridge.swift; sourceTree = ""; }; + 306FE6CA271D8B73002D6EFC /* OpenTok.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenTok.swift; sourceTree = ""; }; 308FEC658188F7D588BE7580 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; @@ -99,6 +107,16 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 306FE6C9271D8B54002D6EFC /* OpenTok */ = { + isa = PBXGroup; + children = ( + 306FE6CA271D8B73002D6EFC /* OpenTok.swift */, + 301C79AF27200DED0016307B /* OpenTokLocalVideoFactory.swift */, + 301C79AD27200D9F0016307B /* OpenTokRemoteVideoFactory.swift */, + ); + path = OpenTok; + sourceTree = ""; + }; 555EAAA626EFB641859EF0BE /* Frameworks */ = { isa = PBXGroup; children = ( @@ -153,6 +171,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 306FE6C9271D8B54002D6EFC /* OpenTok */, E91B539E256AAC1400E96549 /* GuestPOC_Certificate.cer */, E91B539D256AAC1400E96549 /* GuestPOC_Certificate.p12 */, E91B5390256AAA6500E96549 /* Controllers */, @@ -182,6 +201,7 @@ E923EFD125863FDF00E3E751 /* GeoZoneModel.swift */, E923EFD3258645C100E3E751 /* HMG_Geofence.swift */, E923EFD52587443800E3E751 /* HMGPlatformBridge.swift */, + 306FE6C7271D790C002D6EFC /* OpenTokPlatformBridge.swift */, E9F7623A25922BCE00FB5CCF /* FlutterConstants.swift */, ); path = Helper; @@ -375,16 +395,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 306FE6C8271D790C002D6EFC /* OpenTokPlatformBridge.swift in Sources */, E923EFD225863FDF00E3E751 /* GeoZoneModel.swift in Sources */, E91B539A256AAA6500E96549 /* MainFlutterVC.swift in Sources */, E91B539C256AAA6500E96549 /* HMG_GUEST_bkp.swift in Sources */, E91B5396256AAA6500E96549 /* GlobalHelper.swift in Sources */, E923EFD4258645C100E3E751 /* HMG_Geofence.swift in Sources */, E923EFD62587443800E3E751 /* HMGPlatformBridge.swift in Sources */, + 301C79AE27200D9F0016307B /* OpenTokRemoteVideoFactory.swift in Sources */, E9F7623B25922BCE00FB5CCF /* FlutterConstants.swift in Sources */, + 306FE6CB271D8B73002D6EFC /* OpenTok.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, E9E27168256E3A4000F49B69 /* LocalizedFromFlutter.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 301C79B027200DED0016307B /* OpenTokLocalVideoFactory.swift in Sources */, E9C8C136256BACDA00EFFB62 /* HMG_Guest.swift in Sources */, E91B539B256AAA6500E96549 /* HMG_Internet.swift in Sources */, E91B5397256AAA6500E96549 /* Extensions.swift in Sources */, diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index c4a74c80..35a3c022 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -14,7 +14,7 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil GMSServices.provideAPIKey("AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw") GeneratedPluginRegistrant.register(with: self) - initializePlatformChannel() + initializePlatformChannels() if let _ = launchOptions?[.location] { HMG_Geofence.initGeofencing() @@ -25,14 +25,16 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil } - func initializePlatformChannel(){ + func initializePlatformChannels(){ if let mainViewController = window.rootViewController as? MainFlutterVC{ // platform initialization suppose to be in foreground flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) }else if let mainViewController = initialViewController(){ // platform initialization suppose to be in background flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) + OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) } } diff --git a/ios/Runner/Helper/HMGPlatformBridge.swift b/ios/Runner/Helper/HMGPlatformBridge.swift index f94f9b34..fd9fb401 100644 --- a/ios/Runner/Helper/HMGPlatformBridge.swift +++ b/ios/Runner/Helper/HMGPlatformBridge.swift @@ -10,7 +10,7 @@ import NetworkExtension import SystemConfiguration.CaptiveNetwork var flutterMethodChannel:FlutterMethodChannel? = nil -var mainViewController:MainFlutterVC! +fileprivate var mainViewController:MainFlutterVC! class HMGPlatformBridge{ private let channelName = "HMG-Platform-Bridge" diff --git a/ios/Runner/Helper/OpenTokPlatformBridge.swift b/ios/Runner/Helper/OpenTokPlatformBridge.swift new file mode 100644 index 00000000..38e826e1 --- /dev/null +++ b/ios/Runner/Helper/OpenTokPlatformBridge.swift @@ -0,0 +1,59 @@ +// +// HMGPlatformBridge.swift +// Runner +// +// Created by ZiKambrani on 14/12/2020. +// + +import UIKit +import NetworkExtension +import SystemConfiguration.CaptiveNetwork +import OpenTok + + +fileprivate var openTok:OpenTok? + +class OpenTokPlatformBridge : NSObject{ + private var methodChannel:FlutterMethodChannel? = nil + private var mainViewController:MainFlutterVC! + private static var shared_:OpenTokPlatformBridge? + + class func initialize(flutterViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ + shared_ = OpenTokPlatformBridge() + shared_?.mainViewController = flutterViewController + + shared_?.openChannel() + openTok = OpenTok(mainViewController: flutterViewController, registrar: registrar) + } + + func shared() -> OpenTokPlatformBridge{ + assert((OpenTokPlatformBridge.shared_ != nil), "OpenTokPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.") + return OpenTokPlatformBridge.shared_! + } + + private func openChannel(){ + methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) + methodChannel?.setMethodCallHandler { (call, result) in + print("Called function \(call.method)") + + switch(call.method) { + case "initSession": + openTok?.initSession(call: call, result: result) + + case "swapCamera": + openTok?.swapCamera(call: call, result: result) + + case "toggleAudio": + openTok?.toggleAudio(call: call, result: result) + + case "toggleVideo": + openTok?.toggleVideo(call: call, result: result) + + default: + result(FlutterMethodNotImplemented) + } + + print("") + } + } +} diff --git a/ios/Runner/OpenTok/OpenTok.swift b/ios/Runner/OpenTok/OpenTok.swift new file mode 100644 index 00000000..9cc0b79a --- /dev/null +++ b/ios/Runner/OpenTok/OpenTok.swift @@ -0,0 +1,179 @@ +// +// OpenTok.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 18/10/2021. +// + +import Foundation +import OpenTok +import UIKit + +enum SdkState: String { + case loggedOut = "LOGGED_OUT" + case loggedIn = "LOGGED_IN" + case wait = "WAIT" + case error = "ERROR" +} + +class OpenTok : NSObject{ + private var mainViewController:MainFlutterVC! + private var registrar:FlutterPluginRegistrar? + var methodChannel: FlutterMethodChannel? + + init(mainViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ + self.mainViewController = mainViewController + self.methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) + self.registrar = registrar + + let remoteVDOFactory = OpenTokRemoteVideoFactory(messenger: registrar!.messenger()) + registrar?.register(remoteVDOFactory, withId: "remote-video-container") + + let localVDOFactory = OpenTokLocalVideoFactory(messenger: registrar!.messenger()) + registrar?.register(localVDOFactory, withId: "local-video-container") + } + + var otSession: OTSession? + + var subscriber: OTSubscriber? + lazy var publisher: OTPublisher = { + let settings = OTPublisherSettings() + settings.name = UIDevice.current.name + return OTPublisher(delegate: self, settings: settings)! + }() + + func initSession(call:FlutterMethodCall, result: @escaping FlutterResult){ + if let arguments = call.arguments as? [String: String], + let apiKey = arguments["apiKey"], + let sessionId = arguments["sessionId"], + let token = arguments["token"]{ + + var error: OTError? + defer { + // todo + } + + notifyFlutter(state: SdkState.wait) + otSession = OTSession(apiKey: apiKey, sessionId: sessionId, delegate: self)! + otSession?.connect(withToken: token, error: &error) + + result("") + }else{ + + } + + } + + + func swapCamera(call:FlutterMethodCall, result: @escaping FlutterResult) { + if publisher.cameraPosition == .front { + publisher.cameraPosition = .back + } else { + publisher.cameraPosition = .front + } + result("") + } + + func toggleAudio(call:FlutterMethodCall, result: @escaping FlutterResult) { + if let arguments = call.arguments as? [String: Bool], + let publishAudio = arguments["publishAudio"] { + publisher.publishAudio = !publisher.publishAudio + } + result("") + } + + func toggleVideo(call:FlutterMethodCall, result: @escaping FlutterResult) { + if let arguments = call.arguments as? [String: Bool], + let publishVideo = arguments["publishVideo"] { + publisher.publishVideo = !publisher.publishVideo + } + result("") + } + + + func notifyFlutter(state: SdkState) { + methodChannel?.invokeMethod("updateState", arguments: state.rawValue) + } + +} + +extension OpenTok: OTSessionDelegate { + func sessionDidConnect(_ sessionDelegate: OTSession) { + print("The client connected to the session.") + notifyFlutter(state: SdkState.loggedIn) + + var error: OTError? + defer { + // todo + } + + self.otSession?.publish(self.publisher, error: &error) + + if let pubView = self.publisher.view { + pubView.frame = CGRect(x: 0, y: 0, width: 200, height: 300) + + if OpenTokLocalVideoFactory.view == nil { + OpenTokLocalVideoFactory.viewToAddPub = pubView + } else { + OpenTokLocalVideoFactory.view?.addPublisherView(pubView) + } + } + } + + func sessionDidDisconnect(_ session: OTSession) { + print("The client disconnected from the session.") + notifyFlutter(state: SdkState.loggedOut) + } + + func session(_ session: OTSession, didFailWithError error: OTError) { + print("The client failed to connect to the session: \(error).") + } + + func session(_ session: OTSession, streamCreated stream: OTStream) { + print("A stream was created in the session.") + var error: OTError? + defer { + // todo + } + subscriber = OTSubscriber(stream: stream, delegate: self) + + session.subscribe(subscriber!, error: &error) + } + + func session(_ session: OTSession, streamDestroyed stream: OTStream) { + print("A stream was destroyed in the session.") + } +} + +extension OpenTok: OTPublisherDelegate { + func publisher(_ publisher: OTPublisherKit, streamCreated stream: OTStream) { + } + + func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) { + } + + func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) { + print("Publisher failed: \(error.localizedDescription)") + } +} + +extension OpenTok: OTSubscriberDelegate { + func subscriberDidConnect(toStream subscriberKit: OTSubscriberKit) { + print("Subscriber connected") + + if let subView = self.subscriber?.view { + subView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) + + if OpenTokRemoteVideoFactory.view == nil { + OpenTokRemoteVideoFactory.viewToAddSub = subView + } else { + OpenTokRemoteVideoFactory.view?.addSubscriberView(subView) + } + } + } + + func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) { + print("Subscriber failed: \(error.localizedDescription)") + } + +} diff --git a/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift b/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift new file mode 100644 index 00000000..361b482d --- /dev/null +++ b/ios/Runner/OpenTok/OpenTokLocalVideoFactory.swift @@ -0,0 +1,91 @@ +// +// OpenTokLocalVideoFactory.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 20/10/2021. +// + +import Foundation + +class OpenTokLocalVideoFactory: NSObject, FlutterPlatformViewFactory { + static var view: LocalVideoPlatformView? + + static var viewToAddPub: UIView? + + static func getViewInstance( + frame: CGRect, + viewId: Int64, + args: Any?, + messenger: FlutterBinaryMessenger? + ) -> LocalVideoPlatformView{ + if(view == nil) { + view = LocalVideoPlatformView() + if viewToAddPub != nil { + view?.addPublisherView(viewToAddPub!) + } + } + + return view! + } + + private var messenger: FlutterBinaryMessenger + + init(messenger: FlutterBinaryMessenger) { + self.messenger = messenger + super.init() + } + + func create( + withFrame frame: CGRect, + viewIdentifier viewId: Int64, + arguments args: Any? + ) -> FlutterPlatformView { + return OpenTokLocalVideoFactory.getViewInstance( + frame: frame, + viewId: viewId, + args: args, + messenger: messenger) + } +} + +class LocalVideoPlatformView: NSObject, FlutterPlatformView { + private let videoContainer: LocalVideoContainer + + override init() { + videoContainer = LocalVideoContainer() + super.init() + } + + public func addPublisherView(_ view: UIView) { + videoContainer.addPublisherView(view) + } + + func view() -> UIView { + return videoContainer + } +} + +final class LocalVideoContainer: UIView { + private let publisherContainer = UIView() + + init() { + super.init(frame: .zero) + addSubview(publisherContainer) + } + + public func addPublisherView(_ view: UIView) { + publisherContainer.addSubview(view) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + let width = frame.width + let height = frame.height + + publisherContainer.frame = CGRect(x: 0, y: 0, width: width, height: height) + } +} diff --git a/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift b/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift new file mode 100644 index 00000000..50dcf695 --- /dev/null +++ b/ios/Runner/OpenTok/OpenTokRemoteVideoFactory.swift @@ -0,0 +1,91 @@ +// +// OpenTokRemoteVideoFactory.swift +// Runner +// +// Created by Zohaib Iqbal Kambrani on 20/10/2021. +// + +import Foundation + +class OpenTokRemoteVideoFactory: NSObject, FlutterPlatformViewFactory { + static var view: RemoteVideoPlatformView? + + static var viewToAddSub: UIView? + + static func getViewInstance( + frame: CGRect, + viewId: Int64, + args: Any?, + messenger: FlutterBinaryMessenger? + ) -> RemoteVideoPlatformView{ + if(view == nil) { + view = RemoteVideoPlatformView() + if viewToAddSub != nil { + view?.addSubscriberView(viewToAddSub!) + } + } + + return view! + } + + private var messenger: FlutterBinaryMessenger + + init(messenger: FlutterBinaryMessenger) { + self.messenger = messenger + super.init() + } + + func create( + withFrame frame: CGRect, + viewIdentifier viewId: Int64, + arguments args: Any? + ) -> FlutterPlatformView { + return OpenTokRemoteVideoFactory.getViewInstance( + frame: frame, + viewId: viewId, + args: args, + messenger: messenger) + } +} + +class RemoteVideoPlatformView: NSObject, FlutterPlatformView { + private let videoContainer: RemoteVideoContainer + + override init() { + videoContainer = RemoteVideoContainer() + super.init() + } + + public func addSubscriberView(_ view: UIView) { + videoContainer.addSubscriberView(view) + } + + func view() -> UIView { + return videoContainer + } +} + +final class RemoteVideoContainer: UIView { + private let subscriberContainer = UIView() + + init() { + super.init(frame: .zero) + addSubview(subscriberContainer) + } + + + public func addSubscriberView(_ view: UIView) { + subscriberContainer.addSubview(view) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + let width = frame.width + let height = frame.height + subscriberContainer.frame = CGRect(x: 0, y: 0, width: width, height: height) + } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index a6565ecf..4cbd2646 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,14 +6,19 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; const MAX_SMALL_SCREEN = 660; // PACKAGES and OFFERS -const EXA_CART_API_BASE_URL = 'http://10.50.100.217:1010/offersdiscounts'; // http://10.200.101.75:9000 +const EXA_CART_API_BASE_URL = 'https://mdlaboratories.com/offersdiscounts'; +// const EXA_CART_API_BASE_URL = 'http://10.200.101.75:9000'; const PACKAGES_CATEGORIES = '/api/categories'; +const PACKAGES_TOKEN = '/api/token'; 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 PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; +// 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/'; @@ -295,8 +300,8 @@ const UPLOAD_INSURANCE_CARD = 'Services/Patients.svc/REST/PatientER_PatientInfoF const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; -// const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_DWH"; -const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; +const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus_Async"; +// const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; const GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS"; @@ -322,6 +327,7 @@ const GET_COVID_DRIVETHRU_PROCEDURES_LIST = 'Services/Doctors.svc/REST/COVID19_G ///Smartwatch Integration Services const GET_PATIENT_LAST_RECORD = 'Services/Patients.svc/REST/Med_GetPatientLastRecord'; +const INSERT_PATIENT_HEALTH_DATA = 'Services/Patients.svc/REST/Med_InsertTransactions'; ///My Trackers const GET_DIABETIC_RESULT_AVERAGE = 'Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; @@ -420,8 +426,8 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHa const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; -const GET_MOST_VIEWED_PRODUCTS = "mostview"; -const GET_NEW_PRODUCTS = "newproducts"; +const GET_MOST_VIEWED_PRODUCTS = "mostview?"; +const GET_NEW_PRODUCTS = "newproducts?"; // Home Health Care const HHC_GET_ALL_SERVICES = "Services/Patients.svc/REST/PatientER_HHC_GetAllServices"; @@ -442,6 +448,7 @@ const ADD_USER_AGREEMENT_FOR_BLOOD_DONATION = 'Services/PatientVarification.svc/ const HHC_GET_ALL_SERVICES_RC = "rc/api/HHC/getallhhc"; const ADD_HHC_ORDER_RC = "rc/api/HHC/add"; const GET_ALL_HHC_ORDERS_RC = 'rc/api/hhc/list'; +const UPDATE_HHC_ORDER_RC = 'rc/api/hhc/update'; // CMC RC SERVICES const GET_ALL_CMC_SERVICES_RC = 'rc/api/cmc/getallcmc'; @@ -451,6 +458,14 @@ const UPDATE_CMC_ORDER_RC = 'rc/api/cmc/update'; // RRT RC SERVICES const ADD_RRT_ORDER_RC = "rc/api/rrt/add"; +const GET_ALL_RRT_ORDERS_RC = "rc/api/rrt/list"; +const UPDATE_RRT_ORDER_RC = 'rc/api/rrt/update'; + +// PRESCRIPTION RC SERVICES +const ADD_PRESCRIPTION_ORDER_RC = "rc/api/prescription/add"; +const GET_ALL_PRESCRIPTION_ORDERS_RC = "rc/api/prescription/list"; +const UPDATE_PRESCRIPTION_ORDER_RC = 'rc/api/prescription/update'; + //Pharmacy wishlist const GET_WISHLIST = "shopping_cart_items/"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7dd36894..c7c37bb7 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -396,8 +396,9 @@ const Map localizedValues = { "PaymentOnline": {"en": "Service", "ar": "الالكتروني"}, "OnlineCheckIn": {"en": "Online Check-In", "ar": "مدفوعات معلقة"}, "MyBalances": {"en": "My Balances", "ar": "رصيدي"}, + "MyWallet": {"en": "My Wallet", "ar": "محفظتى"}, "BalanceAmount": {"en": "Wallet Amount", "ar": "مبلغ المحفظة"}, - "TotalBalance": {"en": "Total Amount", "ar": "المبلغ الإجمالي"}, + "TotalBalance": {"en": "Total Balance", "ar": "إجمالي الرصيد"}, "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "شحن المحفظة"}, "AdvancePayment": {"en": "Advance Payment", "ar": "الدفع مقدما"}, "AdvancePaymentLabel": {"en": "You can create and add an Advanced Payment for your account or other accounts.", "ar": "يمكنك تحويل مبلغ لحسابك لدى المجموعة أو لحساب احد المراجعين"}, @@ -421,7 +422,7 @@ const Map localizedValues = { "country": {"en": "Country", "ar": "دولة"}, "Ok": {"en": "Ok", "ar": "موافق"}, "averageWaitingTime": {"en": "Average Waiting Time:", "ar": "متوسط ​​وقت الانتظار:"}, - "waitingTime": {"en": "Waiting Time:", "ar": "وقت الانتظار:"}, + "waitingTime": {"en": "Expected waiting time:", "ar": "وقت الانتظار المتوقع:"}, "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, "TheVerificationCodeExpiresIn": {"en": "The Verification Code Expires in", "ar": "تنتهي صلاحية رمز التحقق في"}, @@ -620,7 +621,7 @@ const Map localizedValues = { "reset": {"en": "Reset", "ar": "اعادة تعيين"}, "apply": {"en": "Apply", "ar": "تطبيق"}, "viewCategorise": {"en": "View All Categories", "ar": "عرض جميع الفئات"}, - "categorise": {"en": "Categories", "ar": "التطبيقات"}, + "categorise": {"en": "Categories", "ar": "الفئات"}, "wishList": {"en": "WishList", "ar": "المفضلة"}, "myAccount": {"en": "My Account", "ar": "حسابي"}, "cart": {"en": "Cart", "ar": "التسوق"}, @@ -633,7 +634,7 @@ const Map localizedValues = { "توفر هذه الخدمة مجموعه من خدمات الرعايه الصحيه المنزلية و متابعه مستمره وشامله للذين لا يستطيعون الوصول للمنشات الصحيه في اماكن اقامتهم (التحاليل المخبرية – الاشعة – التطعيمات – العلاج الطبيعي) ..." }, "email": {"en": "Email", "ar": "البريد الالكتروني"}, - "Book": {"en": "Book", "ar": "احجز"}, + "Book": {"en": "Book", "ar": "حجز"}, "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"}, @@ -759,6 +760,8 @@ const Map localizedValues = { "location-permission": {"en": "Location", "ar": "تحديد المواقع"}, "needPrescription": {"en": "This product requires a prescription", "ar": " هذا المنتج يتطلب وصفة طبية"}, "outOfStockMsg": {"en": "You have added product which is out of stock now, Please remove that!", "ar": "لقد قمت بإضافة المنتج الذي نفذ من المخزون الآن. يرجى إزالة ذلك"}, + "noArabicLetters": {"en": "It Is Not Allow to Use Arabic Letters", "ar": "غير مسموح باستخدام الحروف العربيه"}, + "noOffersAvailable": {"en": "No Offers Available!", "ar": "لايوجد عروض حاليا"}, "accessibility": {"en": "Accessibility Mode", "ar": "وضع امكانية الوصول"}, "orderStatus": {"en": "Order Status", "ar": "حالة الطلب"}, "CancelOrder": {"en": "Cancel Order", "ar": "الغاء الطلب"}, @@ -830,6 +833,10 @@ const Map localizedValues = { }, "failedToAccessHmgServices": {"en": "Connected with HMG Network,\n\nBut failed to access HMG services", "ar": "Connected with HMG Network,\n\nBut failed to access HMG services"}, "offerAndPackages": {"en": "Offers and Packages", "ar": "العروض والباقات"}, + "offerAndPackagesDetails": { + "en": "This service allows you to view all HMG Offers:", + "ar": "This service allows you to view all HMG Offers:" + }, "InvoiceNo": {"en": "Invoice No", "ar": "رقم الفاتورة"}, "InvoiceDate": {"en": "Invoice Date", "ar": "تاريخ الفاتورة"}, "SpecialResult": {"en": " Special Result", "ar": "نتيجة خاصة"}, @@ -1091,11 +1098,11 @@ const Map localizedValues = { "updated-email": {"en": "Updated email successfully", "ar": "تم تحديث البريد الالكتروني"}, "view-list-children": {"en": "View List of Children", "ar": "عرض قائمة الأطفال"}, "covidTest": {"en": "COVID-19 TEST", "ar": "فحص كورونا"}, - "driveThru": {"en": "Drive-Thru", "ar": "من السيارة"}, + "driveThru": {"en": "Drive-Thru", "ar": "من داخل السيارة"}, "trackDeliveryDriver": {"en": "Track Delivery Driver", "ar": "تتبع السائق"}, "NearestErDesc": { - "en": "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", - "ar": "\nتعرض هذه الخدمة أقرب فرع\n من بين جميع فروع مجموعة \nالحبيب الطبية بناءً على موقعك الحالي." + "en": "This service Displays nearest branch among all the branches of All Habib medical Group based on your current Location", + "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, "NearestEr": {"en": "Nearest ER", "ar": "اقرب طوارئ"}, "infoCMC": { @@ -1116,7 +1123,7 @@ const Map localizedValues = { "childName": {"en": "'CHILD NAME'", "ar": "إسم الطفل"}, "recordDeleted": {"en": "'Record Deleted'", "ar": "تم حذف السجل"}, "msg_email_address_up_to_date": { - "en": " Please ensure that the email address is up-to-date and proceed to view the schedule.", + "en": "Please ensure that the email address is up-to-date and proceed to view the schedule.", "ar": " يرجى التأكد من تحديث عنوان البريد الإلكتروني والمتابعة لعرض الجدول" }, "add-new-child": {"en": "ADD NEW CHILD", "ar": "إضافة طفل جديد"}, @@ -1140,7 +1147,7 @@ const Map localizedValues = { "ar": "تحويل مستوى السكر في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "convertCholesterolStatement": { - "en": "Convert blood cholesterol from\n mmol/l to mg/dlt and vice versa.", + "en": "Convert blood cholesterol from mmol/l to mg/dlt and vice versa.", "ar": "تحويل مستوى الكولسترول في الدم من مليمول/ لتر (مقياس المملكة المتحدة) الى ملغ/ ديسيلتر (مقياس الولايات المتحدة) والعكس" }, "triglyceridesConvertStatement": { @@ -1286,7 +1293,7 @@ const Map localizedValues = { "pay-options": {"en": "You can pay by the following Options:", "ar": "يمكنك الدفع عن طريق الخيارات التالية:"}, "livecare-service": {"en": "LiveCare Service", "ar": "خدمة لايف كير"}, "livecare-service-desc": {"en": "is to obtain medical advice with a specialist doctor Via a video call", "ar": "هي الحصول على استشارة طبية مع طبيب مختص عن طريق اتصال فيديو"}, - "why-livecare": {"en": "WHY LIVECARE", "ar": "لماذا خدمة اللايف كير"}, + "why-livecare": {"en": "Why LiveCare?", "ar": "?لماذا خدمة اللايف كير"}, "livecare-point-1": {"en": "No need to wait you will get Medical consultation immediately via Video call", "ar": "لا داعي للانتظار سوف تحصل على الاستشارة الطبية فورا عن طريق مكالمة الفيديو"}, "doc-virtual-appo-ins4": {"en": "The doctor will see your medical file", "ar": "سوف يتمكن الطبيب من الاطلاع على ملفك الطبي كامل"}, "doc-virtual-appo-ins5": {"en": "Free prescription delivery service", "ar": "خدمة توصيل الادوية مجانا"}, @@ -1294,7 +1301,7 @@ const Map localizedValues = { "en": "** The service is included with some insurance companies according to the terms and conditions with our best wishes for health and wellness", "ar": "** الخدمة مشمولة لدى بعض شركات التامين على حسب الشروط والاحكام مع تمنياتنا لكم بدوام الصحة والعافية" }, - "livecare-option-1": {"en": "Get Medical consultation immediately", "ar": "الحصول على الاستشارة فورا"}, + "livecare-option-1": {"en": "Get consultation immediately", "ar": "الحصول على الاستشارة فورا"}, "livecare-option-2": {"en": "Instant video call", "ar": "اتصال فيديو فوري"}, "livecare-option-3": {"en": "Book Appointment", "ar": "حجز موعد"}, "livecare-option-4": {"en": "Schedule video call", "ar": "اتصال فيديو مجدول"}, @@ -1490,7 +1497,7 @@ const Map localizedValues = { "RRTRequestSuccess": {"en": "Request has been sent successfully, you will be contacted soon.", "ar": "تم إرسال الطلب بنجاح ، وسيتم الاتصال بك باسرع وقت ممكن"}, "rateDoctorAppo": {"en": "Rate DR & Appointment", "ar": "تقييم الطبيب والموعد"}, "invoice": {"en": "Invoice", "ar": "الفاتورة"}, - "requestedDate": {"en": "Reqeusted Date", "ar": "التاريخ "}, + "requestedDate": {"en": "Req Date", "ar": "التاريخ "}, "callDuration": {"en": "Call Duration", "ar": "مدة الاتصال"}, "alreadyRated": {"en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً"}, "insuranceCompany": {"en": "Insurance Company", "ar": "شركة تأمين"}, @@ -1542,25 +1549,67 @@ const Map localizedValues = { "My_File_Details": {"en": "My File Details", "ar": "تفاصيل ملفي"}, "Ecommerce": {"en": "Ecommerce", "ar": "التجارة الإلكترونية"}, "Family_Files": {"en": "Family Files", "ar": "ملفات العائلة"}, - "My_Child": {"en": "My Child", "ar": "طفلي"}, - "Vaccines": {"en": "Vaccines", "ar": "اللقاحات"}, - "Todo": {"en": "Todo", "ar": "لكى يفعل"}, - "List": {"en": "List", "ar": "قائمة"}, - "Blood": {"en": "Blood", "ar": "دم"}, - "Donation": {"en": "Donation", "ar": "هبة"}, + "My_Child": {"en": "My Child", "ar": "تطعيمات"}, + "Vaccines": {"en": "Vaccines", "ar": "الأطفال"}, + "Todo": {"en": "Todo", "ar": "قائمة"}, + "List": {"en": "List", "ar": "المهام"}, + "Blood": {"en": "Blood", "ar": "التبرع"}, + "Donation": {"en": "Donation", "ar": "بالدم"}, "Health": {"en": "Health", "ar": "الصحة"}, "Calculator": {"en": "Calculator", "ar": "آلة حاسبة"}, "Converter": {"en": "Converter", "ar": "محول"}, "Smart": {"en": "Smart", "ar": "ذكي"}, "Watches": {"en": "Watches", "ar": "ساعات"}, - "Parking": {"en": "Parking", "ar": "موقف سيارات"}, + "parkingTitle2": {"en": "Car parking", "ar": "خدمة"}, + "ParkingSubtitle": {"en": "service", "ar": "مواقف السيارات"}, "Details": {"en": "Details", "ar": "تفاصيل"}, - "Virtual": {"en": "Virtual", "ar": "افتراضية"}, - "News": {"en": "News", "ar": "أخبار"}, - "Latest": {"en": "Latest", "ar": "أحدث"}, - "Tour": {"en": "Tour", "ar": "رحلة"}, + "News": {"en": "News", "ar": "أحدث"}, + "Latest": {"en": "Latest", "ar": "ألاخبار"}, + "Virtual": {"en": "Virtual", "ar": "جولة"}, + "Tour": {"en": "Tour", "ar": "افتراضية"}, "mostViewed": {"en": "Most Viewed", "ar": "الأكثر مشاهدة"}, "newProducts": {"en": "New Products", "ar": "منتجات جديدة"}, "paymentSelected": {"en": "Selected", "ar": "المحدد"}, + "moreNotifications": {"en": "More notifications", "ar": "الإشعارات المزيد"}, + "familyTitle": {"en": "My Family", "ar": "ملفات"}, + "familySubtitle": {"en": "Files", "ar": "العائلة"}, + "liveCareTitle": {"en": "LiveCare", "ar": "خدمة"}, + "liveCareSubtitle": {"en": "Service", "ar": "لايف كير"}, + "pharmacyTitle": {"en": "Al Habib", "ar": "الصيدليات"}, + "pharmacySubtitle": {"en": "Pharmacy", "ar": "الحبيب"}, + "healthCalculatorTitle": {"en": "Health", "ar": "الحاسبات"}, + "healthCalculatorSubtitle": {"en": "Calculators", "ar": "الصحية"}, + "waterTitle": {"en": "Water", "ar": "استهلاك"}, + "waterSubtitle": {"en": "Consumption", "ar": "الماء"}, + "medicalFileTitle2": {"en": "My Medical File", "ar": "تفاصيل"}, + "medicalFileSubtitle": {"en": "Details", "ar": "ملفي الطبي"}, + "healthConvertersTitle": {"en": "Health", "ar": "تحويل"}, + "healthConvertersSubtitle": {"en": "Converters", "ar": "القياسات"}, + "syncHealthData": { "en": "Sync Health Data", "ar": "مزامنة البيانات الصحية" }, + "steps": { "en": "Steps", "ar": "الخطوات" }, + "avgSteps": { "en": "Average Steps", "ar": "متوسط الخطوات" }, + "avgDistance": { "en": "Average Distance", "ar": "متوسط المسافة" }, "enterDetails": {"en": "Enter Details", "ar": "أدخل التفاصيل"}, + "avgHeartRate": { "en": "Average Heart Rate", "ar": "متوسط معدل ضربات القلب" }, + "alreadySynced": { "en": "Already Synced", "ar": "متزامنة" }, + "sync-instructions-intro1": { "en": "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", "ar": "يبدو أنك لم تقم بمزامنة بياناتك الصحية مع تطبيق Dr. Alhabib App من قبل. للمتابعة ، تحتاج إلى مزامنة بياناتك الصحية مع تطبيق Dr. Alhabib" }, + "sync-instructions-intro2": { "en": "Before syncing data, please make sure that you have followed the instructions properly", "ar": "قبل مزامنة البيانات ، يرجى التأكد من اتباع التعليمات بشكل صحيح." }, + "sync-instructions-intro3": { "en": "Before syncing data, please make sure that following instructions are met:", "ar": "قبل مزامنة البيانات ، يرجى التأكد من تلبية الإرشادات التالية:" }, + "ios-instructions-1": { "en": "Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.", "ar": "تأكد من أنك قمت بتثبيت تطبيق 'Health' App & 'Watch' من متجر Apple." }, + "ios-instructions-2": { "en": "Make sure that your Apple Watch is connected with the Watch & Health Apps.", "ar": "تأكد من اتصال Apple Watch بتطبيقات Watch & Health." }, + "ios-instructions-3": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق صحتك." }, + "supportedWatches": { "en": "Supported SmartWatches", "ar": "الساعات الذكية المدعومة" }, + "watchInstructions": { "en": "View watch instructions", "ar": "عرض تعليمات الساعة" }, + "monthlyTab": {"en": "Monthly", "ar": "شهري"}, + "moreSupportedWatches": {"en": "More Supported Smartwatches...", "ar": "المزيد من الساعات الذكية المدعومة..."}, + "android-instructions-1": { "en": "Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", "ar": "تأكد من تثبيت تطبيقات 'WearOS' و 'Google Fit' من متجر Google PlayStore." }, + "android-instructions-2": { "en": "Make sure that you have installed your watch related apps from Google PlayStore.", "ar": "تأكد من أنك قمت بتثبيت التطبيقات المتعلقة بالساعات من Google PlayStore." }, + "android-instructions-3": { "en": "Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", "ar": "تأكد من أن ساعتك الذكية متصلة بتطبيق WearOS وتطبيقات ساعتك." }, + "android-instructions-4": { "en": "Make sure that your smart watch apps are linked/associated with Google Fit App.", "ar": "تأكد من أن تطبيقات ساعتك الذكية مرتبطة / مرتبطة بتطبيق Google Fit." }, "android-instructions-5": { "en": "Make sure that data like heart rate, steps, distance etc. are being shown on your watch app & on Google Fit app & both are in sync.", "ar": "تأكد من عرض بيانات مثل معدل ضربات القلب والخطوات والمسافة وما إلى ذلك على تطبيق الساعة وعلى تطبيق Google Fit وكلاهما في حالة مزامنة." }, + "tamaraInstPlan" : { "en": "Select the tamara installment plan", "ar": "حدد خطة تقسيط تمارة" }, + "onlineTag": {"en": "Online", "ar": "متصل"}, + "offlineTag": {"en": "Offline", "ar": "غير متصل"}, + "viewDocList": {"en": "View List of Doctors", "ar": "عرض قائمة الأطباء"}, + "bodyFatTitle": {"en": "Body Fat", "ar": " الدهون في الجسم"}, + "cholesTitle": {"en": "Blood Cholesterol", "ar": " الكولسترول في الدم"}, }; diff --git a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart index 116545bd..9cc3d3b9 100644 --- a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart +++ b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart @@ -1,20 +1,41 @@ +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:flutter/cupertino.dart'; class PackagesCustomerRequestModel { + String username; + String first_name; + String last_name; String email; - String phoneNumber; + String phone; + String national_id; + String date_of_birth; - PackagesCustomerRequestModel({@required this.email, @required this.phoneNumber}); + + PackagesCustomerRequestModel.fromUser(AuthenticatedUser user){ + this.username = "${user.patientID}"; + this.first_name = user.firstName; + this.last_name = user.lastName; + this.email = user.emailAddress; + this.phone = user.mobileNumber; + this.national_id = user.patientIdentificationNo; + this.date_of_birth = user.dateofBirth; + } Map json() { return { "customer" : { - "email": email, - "addresses": [{ - "email": email, - "phone_number": phoneNumber - }] + "email": email ?? '', + "username": username ?? '', + "national_id": national_id ?? '', + "phone": phone ?? '', + "date_of_birth": date_of_birth ?? '', + "first_name": first_name ?? '', + "last_name": last_name ?? '', + // "addresses": [{ + // "email": email, + // "phone_number": phoneNumber + // }] } }; } diff --git a/lib/core/model/packages_offers/responses/tamara_payment_option.dart b/lib/core/model/packages_offers/responses/tamara_payment_option.dart new file mode 100644 index 00000000..ad79f5f3 --- /dev/null +++ b/lib/core/model/packages_offers/responses/tamara_payment_option.dart @@ -0,0 +1,35 @@ +class TamaraPaymentOption { + String name; + double minLimit; + double maxLimit; + int id; + + String fullName() => '$name Months'; + + TamaraPaymentOption({ + this.name, + this.minLimit, + this.maxLimit, + this.id}); + + + @override + String toString() => fullName(); + + TamaraPaymentOption.fromJson(dynamic json) { + name = json["name"]; + minLimit = json["min_limit"]; + maxLimit = json["max_limit"]; + id = json["id"]; + } + + Map toJson() { + var map = {}; + map["name"] = name; + map["min_limit"] = minLimit; + map["max_limit"] = maxLimit; + map["id"] = id; + return map; + } + +} \ No newline at end of file diff --git a/lib/core/model/pharmacies/PharmacyProduct.dart b/lib/core/model/pharmacies/PharmacyProduct.dart index dbef5737..8f846480 100644 --- a/lib/core/model/pharmacies/PharmacyProduct.dart +++ b/lib/core/model/pharmacies/PharmacyProduct.dart @@ -20,7 +20,7 @@ class PharmacyProduct { bool allowCustomerReviews; int approvedRatingSum; int notApprovedRatingSum; - int approvedTotalReviews; + dynamic approvedTotalReviews; int notApprovedTotalReviews; dynamic sku; bool isRx; diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index 0ad94767..cef20c30 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -24,7 +24,7 @@ class OrdersModel { class Orders { String id; int productCount; - double orderTotal; + dynamic orderTotal; String createdOnUtc; int orderStatusId; String orderStatus; @@ -32,9 +32,9 @@ class Orders { bool canCancel; bool canRefund; dynamic customerId; - double orderSubtotalExclTax; + dynamic orderSubtotalExclTax; dynamic orderShippingExclTax; - double orderTax; + dynamic orderTax; Orders( @@ -64,9 +64,9 @@ class Orders { canCancel = json['can_cancel']; canRefund = json['can_refund']; customerId = json['customer_id']; - orderSubtotalExclTax= json["order_subtotal_excl_tax"].toDouble(); + orderSubtotalExclTax= json["order_subtotal_excl_tax"]; orderShippingExclTax= json["order_shipping_excl_tax"]; - orderTax= json["order_tax"].toDouble(); + orderTax= json["order_tax"]; }catch(e){ print(e); } diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart index 7fcc5f19..f3791f4b 100644 --- a/lib/core/service/AlHabibMedicalService/e_referral_service.dart +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -22,9 +22,12 @@ class EReferralService extends BaseService { List get allReferral => _allReferral; String _activationCode; String _logInTokenID; + String _referralNumber; String get activationCode => _activationCode; + String get referralNumber => _referralNumber; + bool _isActivationCodeValid = false; bool get isActivationCodeValid => _isActivationCodeValid; @@ -106,6 +109,7 @@ class EReferralService extends BaseService { CREATE_E_REFERRAL /*'Services/Patients.svc/REST/CreateEReferral'*/, onSuccess: (dynamic response, int statusCode) { // TODO Waiting for fix service + _referralNumber = response['ReferralNumber'].toString(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart index c952a88f..139c251b 100644 --- a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart +++ b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart @@ -13,6 +13,9 @@ class BariatricsService extends BaseService { List doctorList = []; List doctorListByTime = []; + double lat; + double long; + Future getClinicCategory() async { hasError = false; Map body = Map(); @@ -104,12 +107,20 @@ class BariatricsService extends BaseService { } Future getCalculationDoctors({@required int calculationID}) async { + + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + hasError = false; var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Map body = Map(); body['CalculationID'] = calculationID; // hint: it is static depend on IONIC project body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['Latitude'] = lat != null ? lat.toString() : 0; + body['Longitude'] = long != null ? long.toString() : 0; dynamic localRes; diff --git a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart index 00d44f6a..cd90dae5 100644 --- a/lib/core/service/AlHabibMedicalService/home_health_care_service.dart +++ b/lib/core/service/AlHabibMedicalService/home_health_care_service.dart @@ -104,6 +104,16 @@ class HomeHealthCareService extends BaseService { }, body: updatePresOrderRequestModel.toJson()); } + Future updateHHCPresOrderRC(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { + hasError = false; + await baseAppClient.post(UPDATE_HHC_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + isOrderUpdated = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updatePresOrderRequestModel.toJson()); + } + Future insertPresPresOrder({PatientERInsertPresOrderRequestModel order}) async { hasError = false; await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index c36efe89..1d849755 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -2,13 +2,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class PrescriptionDeliveryService extends BaseService { - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { hasError = false; Map body = Map(); body['LineItemNo'] = lineItemNo; @@ -17,11 +11,26 @@ class PrescriptionDeliveryService extends BaseService { body['AppointmentNo'] = appointmentNo; body['CreatedBy'] = createdBy; body['DischargeID'] = dischargeID; - await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, - onSuccess: (dynamic response, int statusCode) { - var asd=""; - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_ER_INERT_PRES_ORDER, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { + hasError = true; + print(error); + super.error = error; + }, body: body); + } + + Future insertDeliveryOrderRC({double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { + hasError = false; + Map body = Map(); + body['latitude'] = latitude; + body['longitude'] = longitude; + body['AppointmentNo'] = appointmentNo.toString(); + // body['CreatedBy'] = createdBy; + body['DischargeID'] = dischargeID.toString(); + await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + var asd = ""; + }, onFailure: (String error, int statusCode) { hasError = true; print(error); super.error = error; diff --git a/lib/core/service/blood/blood_details_servies.dart b/lib/core/service/blood/blood_details_servies.dart index 644d96d9..589b8dda 100644 --- a/lib/core/service/blood/blood_details_servies.dart +++ b/lib/core/service/blood/blood_details_servies.dart @@ -22,7 +22,7 @@ class BloodDetailsService extends BaseService{ BloodModelList.add(List_BloodGroupDetailsModel.fromJson(vital)); }); }, onFailure: (String error, int statusCode) { - hasError = true; + // hasError = true; super.error = error; }, body: body); } diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 0dd5c750..19c8eac2 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -1,14 +1,15 @@ +import 'dart:async'; import 'dart:convert'; import 'dart:io' show Platform; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; +import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -29,8 +30,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = - locator(); +AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); class BaseAppClient { @@ -100,7 +100,7 @@ class BaseAppClient { ? body['PatientOutSA'] : PATIENT_OUT_SA : PATIENT_OUT_SA; - body['SessionID'] = SESSION_ID; //getSe + body['SessionID'] = getSessionId(body['TokenID']); //getSe headers = { 'Content-Type': 'application/json', @@ -114,9 +114,13 @@ class BaseAppClient { } } + // body['IdentificationNo'] = 1009199553; + // body['MobileNo'] = "966545156035"; // body['PatientID'] = 1018977; // body['TokenID'] = "@dm!n"; + body.removeWhere((key, value) => key == null || value == null); + print("URL : $url"); final jsonBody = json.encode(body); print(jsonBody); @@ -156,8 +160,8 @@ class BaseAppClient { // if (parsed != null) { // onSuccess(parsed, statusCode); // } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); - // logout(); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + // logout(); // } } } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { @@ -427,6 +431,7 @@ class BaseAppClient { } print("URL : $url"); + var ss = json.encode(queryParams); if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { @@ -461,6 +466,7 @@ class BaseAppClient { simplePost( String fullUrl, { Map body, + Map headers, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, }) async { @@ -468,14 +474,16 @@ class BaseAppClient { print("URL Query String: $url"); if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.post( url.trim(), body: json.encode(body), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -487,7 +495,8 @@ class BaseAppClient { } } - simpleGet(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams}) async { + simpleGet(String fullUrl, + {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, Map headers}) async { String url = fullUrl; print("URL Query String: $url"); @@ -499,13 +508,15 @@ class BaseAppClient { } if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.get( url.trim(), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleGet(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, queryParams: queryParams); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -517,19 +528,21 @@ class BaseAppClient { } } - simplePut(String fullUrl, {Map body, Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure}) async { + simplePut(String fullUrl, {Map body, Map headers, 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()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.put( url.trim(), body: json.encode(body), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePut(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, body: body); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -541,7 +554,8 @@ class BaseAppClient { } } - simpleDelete(String fullUrl, {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams}) async { + simpleDelete(String fullUrl, + {Function(dynamic response, int statusCode) onSuccess, Function(String error, int statusCode) onFailure, Map queryParams, Map headers}) async { String url = fullUrl; print("URL Query String: $url"); @@ -553,13 +567,15 @@ class BaseAppClient { } if (await Utils.checkConnection()) { + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.delete( url.trim(), - headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, + headers: headers, ); final int statusCode = response.statusCode; print("statusCode :$statusCode"); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleDelete(fullUrl, onFailure: onFailure, onSuccess: onSuccess, queryParams: queryParams, headers: headers); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); @@ -571,6 +587,15 @@ class BaseAppClient { } } + Future handleUnauthorized(int statusCode, {String forUrl}) async { + if (forUrl.startsWith(EXA_CART_API_BASE_URL) && statusCode == 401) { + final token = await generatePackagesToken(); + packagesAuthHeader['Authorization'] = 'Bearer $token'; + return token != null && (token is String); + } + return false; + } + logout() async { await sharedPref.remove(LOGIN_TOKEN_ID); await sharedPref.remove(PHARMACY_CUSTOMER_ID); @@ -699,7 +724,7 @@ class BaseAppClient { print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { var parsed = json.decode(utf8.decode(response.bodyBytes)); - onFailure(parsed['error']['ErrorEndUserMsg'] ??'Error While Fetching data', statusCode); + onFailure(parsed['error']['ErrorEndUserMsg'] ?? 'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); @@ -763,4 +788,24 @@ class BaseAppClient { onFailure(e.toString(), -1); } } + + Future generatePackagesToken() async { + var url = EXA_CART_API_BASE_URL + PACKAGES_TOKEN; + var body = { + "api_client": {"client_id": "a4ab6be4-424f-4836-b032-46caed88e184", "client_secret": "3c1a3e07-4a40-4510-9fb0-ee5f0a72752c"} + }; + String token; + final completer = Completer(); + simplePost(url, body: body, headers: {}, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + token = jsonResponse['auth_token']; + completer.complete(); + } + }, onFailure: (String error, int statusCode) { + completer.complete(); + }); + await completer.future; + return token; + } } diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index fa2a24c6..48c4f1bf 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; @@ -16,8 +17,9 @@ import 'package:flutter/cupertino.dart'; class PrescriptionsService extends BaseService { List prescriptionsList = List(); List prescriptionReportListINP = List(); - List prescriptionsOrderList = List(); + List prescriptionsOrderList = List(); var isMedDeliveryAllowed; + Future getPrescriptions() async { hasError = false; Map body = Map(); @@ -36,10 +38,24 @@ class PrescriptionsService extends BaseService { Future getPrescriptionsOrders() async { prescriptionsOrderList.clear(); Map body = Map(); - body['isDentalAllowedBackend'] = false; + // body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { - prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + // prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPrescriptionsOrdersRC() async { + prescriptionsOrderList.clear(); + Map body = Map(); + // body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + response['response'].forEach((prescriptionsOrder) { + prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart index 479f59d3..d05bc274 100644 --- a/lib/core/service/packages_offers/PackagesOffersServices.dart +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'dart:developer'; import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.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'; @@ -12,26 +13,34 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/Packag import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCustomerResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/order_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; +var packagesAuthHeader = {'Authorization' : ''}; class OffersAndPackagesServices extends BaseService { + AuthenticatedUser patientUser; List categoryList = List(); List productList = List(); List latestOffersList = List(); + List tamaraPaymentOptions = List(); List bestSellerList = List(); List bannersList = List(); List cartItemList = List(); String cartItemCount = ""; + PackagesCustomerResponseModel customer; Future> getAllCategories(OffersCategoriesRequestModel request) async { Future errorThrow; var url = EXA_CART_API_BASE_URL + PACKAGES_CATEGORIES; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['categories'].forEach((json) { @@ -39,7 +48,6 @@ class OffersAndPackagesServices extends BaseService { }); } }, onFailure: (String error, int statusCode) { - log(error); }, queryParams: request.toFlatMap()); return categoryList; @@ -52,7 +60,7 @@ class OffersAndPackagesServices extends BaseService { productList = List(); var url = EXA_CART_API_BASE_URL + PACKAGES_PRODUCTS; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -60,16 +68,34 @@ class OffersAndPackagesServices extends BaseService { }); } }, onFailure: (String error, int statusCode) { - log(error); }, queryParams: request.toFlatMap()); return productList; } + Future> getTamaraOptions({@required BuildContext context, @required bool showLoading = true}) async { + if(tamaraPaymentOptions != null && tamaraPaymentOptions.isNotEmpty) + return tamaraPaymentOptions; + + var url = EXA_CART_API_BASE_URL + PACKAGES_TAMARA_OPT; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { + if (statusCode == 200) { + var jsonResponse = json.decode(stringResponse); + jsonResponse['payment_option'].forEach((json) { + tamaraPaymentOptions.add(TamaraPaymentOption.fromJson(json)); + }); + } + }, onFailure: (String error, int statusCode) { + log(error); + }); + + return tamaraPaymentOptions; + } + Future> 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) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -86,7 +112,7 @@ class OffersAndPackagesServices extends BaseService { Future> 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) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -103,7 +129,7 @@ class OffersAndPackagesServices extends BaseService { Future> 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) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); jsonResponse['products'].forEach((json) { @@ -121,6 +147,7 @@ class OffersAndPackagesServices extends BaseService { var finished = 0; var totalCalls = 3; + completedAll(){ finished++; @@ -132,6 +159,21 @@ class OffersAndPackagesServices extends BaseService { _showLoading(context, showLoading); + final auth_token = await baseAppClient.generatePackagesToken(); + if(auth_token == null){ + throw 'Something went wrong while authentication, Please try again letter'; + } + packagesAuthHeader["Authorization"] = 'Bearer $auth_token'; + + + // Check and Create Customer + if(patientUser != null){ + customer = await getCurrentCustomer(context: context, showLoading: showLoading); + if(customer == null){ + createCustomer(PackagesCustomerRequestModel.fromUser(patientUser), context: context); + } + } + // Performing Parallel Request on same time // # 1 getBestSellers(request: OffersProductsRequestModel(), context: context, showLoading: false).then((value){ @@ -162,39 +204,58 @@ class OffersAndPackagesServices extends BaseService { _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); + await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){ 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); }); + _hideLoading(context, showLoading); await Future.delayed(Duration(seconds: 1)); return errorThrow ?? customer; } + Future getCurrentCustomer({@required BuildContext context, bool showLoading = true}) async{ + if(customer != null) + return Future.value(customer); + + _showLoading(context, showLoading); + var url = EXA_CART_API_BASE_URL + PACKAGES_CUSTOMER + "/username/${patientUser.patientID}"; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode){ + var jsonResponse = json.decode(stringResponse); + var customerJson = jsonResponse['customers'].first; + customer = PackagesCustomerResponseModel.fromJson(customerJson); + + }, onFailure: (String error, int statusCode){ + log(error); + }); + + _hideLoading(context, showLoading); + return customer; + } + // -------------------- // Shopping Cart // -------------------- - Future> cartItems({@required BuildContext context, bool showLoading = true}) async{ + Future> 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) { + Map jsonResponse; + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); - var jsonResponse = json.decode(stringResponse); + jsonResponse = json.decode(stringResponse); jsonResponse['shopping_carts'].forEach((json) { cartItemList.add(PackagesCartItemsResponseModel.fromJson(json)); }); @@ -205,7 +266,7 @@ class OffersAndPackagesServices extends BaseService { errorThrow = Future.error({"error":error, "statusCode":statusCode}); }, queryParams: null); - return errorThrow ?? cartItemList; + return errorThrow ?? jsonResponse; } Future> addProductToCart(AddProductToCartRequestModel request, {@required BuildContext context, bool showLoading = true}) async{ @@ -216,13 +277,13 @@ class OffersAndPackagesServices extends BaseService { _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){ + await baseAppClient.simplePost(url, headers: packagesAuthHeader, 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(); + cartItemCount = (jsonResponse['count'] ?? 0).toString(); }, onFailure: (String error, int statusCode){ _hideLoading(context, showLoading); @@ -237,7 +298,7 @@ class OffersAndPackagesServices extends BaseService { _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){ + await baseAppClient.simplePut(url, headers: packagesAuthHeader, body: request.json(), onSuccess: (dynamic stringResponse, int statusCode){ _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); @@ -257,7 +318,7 @@ class OffersAndPackagesServices extends BaseService { _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_SHOPPING_CART + '/$cartItemID'; - await baseAppClient.simpleDelete(url, onSuccess: (dynamic stringResponse, int statusCode){ + await baseAppClient.simpleDelete(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode){ _hideLoading(context, showLoading); // var jsonResponse = json.decode(stringResponse); @@ -273,25 +334,23 @@ class OffersAndPackagesServices extends BaseService { // -------------------- // Place Order // -------------------- - Future placeOrder({@required String paymentOption, @required BuildContext context, bool showLoading = true}) async{ + Future placeOrder({@required Map paymentParams, @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 - } + Map jsonBody = { + "customer_id" : customer.id, + "billing_address": { + "email": patientUser.emailAddress, + "phone_number": patientUser.mobileNumber + }, }; + jsonBody.addAll(paymentParams); + jsonBody = {'order' : jsonBody}; 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){ + await baseAppClient.simplePost(url, headers: packagesAuthHeader, body: jsonBody, onSuccess: (dynamic stringResponse, int statusCode){ _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); @@ -312,7 +371,7 @@ class OffersAndPackagesServices extends BaseService { _showLoading(context, showLoading); var url = EXA_CART_API_BASE_URL + PACKAGES_ORDERS + '/$id'; - await baseAppClient.simpleGet(url, onSuccess: (dynamic stringResponse, int statusCode) { + await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { _hideLoading(context, showLoading); var jsonResponse = json.decode(stringResponse); diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index d27827e4..09b2a73d 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -71,7 +71,8 @@ class HomeHealthCareViewModel extends BaseViewModel { Future updateHHCPresOrder(UpdatePresOrderRequestModel updatePresOrderRequestModel) async { setState(ViewState.Busy); - await _homeHealthCareService.updateHHCPresOrder(updatePresOrderRequestModel); + // await _homeHealthCareService.updateHHCPresOrder(updatePresOrderRequestModel); + await _homeHealthCareService.updateHHCPresOrderRC(updatePresOrderRequestModel); if (_homeHealthCareService.hasError) { error = _homeHealthCareService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart index b1a6441e..ee803b5e 100644 --- a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -21,7 +21,7 @@ class EReferralViewModel extends BaseViewModel { List get allCities => _eReferralService.allCities; List get allReferral => _eReferralService.allReferral; - + String get referralNumber => _eReferralService.referralNumber; void getRelationTypes() async { setState(ViewState.Busy); diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index 83732ebd..60411fab 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; @@ -17,8 +18,8 @@ import '../base_view_model.dart'; class RRTService extends BaseService {} class _RRTServiceData { - List pendingOrders = []; - List completedOrders = []; + List pendingOrders = []; + List completedOrders = []; ServicePrice servicePrice; } @@ -34,7 +35,8 @@ class RRTViewModel extends BaseViewModel { Future<_RRTServiceData> loadRequiredData() async { await getServicePrice(); - await getAllOrders(); + // await getAllOrders(); + await getAllOrdersRC(); return rrtServiceData; } @@ -79,9 +81,9 @@ class RRTViewModel extends BaseViewModel { if (json["ServiceID"] == 5) { if (json["Status"] == 1 || json["Status"] == 2) { // Pending - rrtServiceData.pendingOrders.add(PrescriptionsOrder.fromJson(json)); + rrtServiceData.pendingOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); } - rrtServiceData.completedOrders.add(PrescriptionsOrder.fromJson(json)); + rrtServiceData.completedOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); } }); } @@ -91,6 +93,26 @@ class RRTViewModel extends BaseViewModel { return rrtServiceData; } + Future<_RRTServiceData> getAllOrdersRC() async { + await _service.baseAppClient.post(GET_ALL_RRT_ORDERS_RC, body: {}, onSuccess: (response, statusCode) { + var data = response["response"]; + rrtServiceData.completedOrders.clear(); + rrtServiceData.pendingOrders.clear(); + if (data != null && data is List) { + data.forEach((json) { + if (json["StatusId"] == 1 || json["StatusId"] == 2) { + // Pending + rrtServiceData.pendingOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); + } + rrtServiceData.completedOrders.add(GetCMCAllOrdersResponseModel.fromJson(json)); + }); + } + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + }); + return rrtServiceData; + } + Future getOrderDetails() async { return null; } @@ -136,6 +158,19 @@ class RRTViewModel extends BaseViewModel { return Future.value(success); } + Future cancelOrderRC(GetCMCAllOrdersResponseModel order, {String reason = ""}) async { + Map body = {"Id": order.iD, "ClickButton": 16}; + var success = false; + await _service.baseAppClient.post(UPDATE_RRT_ORDER_RC, body: body, onSuccess: (response, statusCode) { + success = true; + rrtServiceData.pendingOrders.remove(order); + }, onFailure: (error, statusCode) { + AppToast.showErrorToast(message: error); + success = false; + }); + return Future.value(success); + } + Future> getAddresses() async { Object error; try { @@ -175,7 +210,6 @@ class RRTViewModel extends BaseViewModel { await getCustomerAddresses(); } - // setState(ViewState.Busy); // await _pharmacy_service.generatePharmacyToken(); // if (_customerAddressesService.hasError) { diff --git a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart index 424a4b20..ada4da78 100644 --- a/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart +++ b/lib/core/viewModels/medical/PrescriptionDeliveryViewModel.dart @@ -7,15 +7,11 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import '../../../locator.dart'; class PrescriptionDeliveryViewModel extends BaseViewModel { - CustomerAddressesService _customerAddressesService = - locator(); - PharmacyModuleService _pharmacyModuleService = - locator(); - PrescriptionDeliveryService _prescriptionDeliveryService = - locator(); + CustomerAddressesService _customerAddressesService = locator(); + PharmacyModuleService _pharmacyModuleService = locator(); + PrescriptionDeliveryService _prescriptionDeliveryService = locator(); - List get addressesList => - _customerAddressesService.addressesList; + List get addressesList => _customerAddressesService.addressesList; Future getCustomerInfo() async { setState(ViewState.Busy); @@ -27,28 +23,16 @@ class PrescriptionDeliveryViewModel extends BaseViewModel { if (_customerAddressesService.hasError) { error = _customerAddressesService.error; setState(ViewState.ErrorLocal); - } else { - } + } else {} await getCustomerAddresses(); } - Future insertDeliveryOrder( - {int lineItemNo, - double latitude, - double longitude, - int appointmentNo, - int createdBy, - int dischargeID}) async { - + Future insertDeliveryOrder({int lineItemNo, double latitude, double longitude, int appointmentNo, int createdBy, int dischargeID}) async { setState(ViewState.BusyLocal); - await _prescriptionDeliveryService.insertDeliveryOrder( - lineItemNo: lineItemNo, - latitude: latitude, - longitude: longitude, - appointmentNo: appointmentNo, - createdBy: createdBy, - dischargeID: dischargeID - ); + // await _prescriptionDeliveryService.insertDeliveryOrder( + // lineItemNo: lineItemNo, latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); + await _prescriptionDeliveryService.insertDeliveryOrderRC( + latitude: latitude, longitude: longitude, appointmentNo: appointmentNo, createdBy: createdBy, dischargeID: dischargeID); if (_prescriptionDeliveryService.hasError) { error = _prescriptionDeliveryService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index ce9f35fa..a92b6e16 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -32,7 +32,7 @@ class MyBalanceViewModel extends BaseViewModel { _bloodDonationService.CitiesModelList; BloodDetailsService _bloodDetailsService = locator(); - List get BloodDetailsModelList => + List get bloodDetailsModelList => _bloodDetailsService .BloodModelList; //_bloodDonationService.CitiesModelList; @@ -52,6 +52,9 @@ class MyBalanceViewModel extends BaseViewModel { PatientInfoAndMobileNumber get patientInfoAndMobileNumber => _myBalanceService.patientInfoAndMobileNumber; + List get bloodModelList => + _bloodDetailsService.BloodModelList; + String get logInTokenID => _myBalanceService.logInTokenID; String get verificationCode => _myBalanceService.verificationCode; diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 0c1fafdf..be6153bd 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; @@ -26,7 +27,7 @@ class PrescriptionsViewModel extends BaseViewModel { List get prescriptionsList => _prescriptionsService.prescriptionsList; - List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; + List get prescriptionsHistory => _prescriptionsService.prescriptionsOrderList; List get pharmacyPrescriptionsList => _prescriptionsService.pharmacyPrescriptionsList; @@ -77,10 +78,10 @@ class PrescriptionsViewModel extends BaseViewModel { } getPrescriptionsOrders({bool showLoading = false}) async { - // print(showLoading); setState(ViewState.Busy); Future.delayed(new Duration(milliseconds: 300)).then((value) async { - await _prescriptionsService.getPrescriptionsOrders(); + // await _prescriptionsService.getPrescriptionsOrders(); + await _prescriptionsService.getPrescriptionsOrdersRC(); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart index ad950b5d..1b68e9d7 100644 --- a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart +++ b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/Packag import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; class OfferCategoriesViewModel extends BaseViewModel{ OffersAndPackagesServices service = locator(); @@ -14,6 +15,7 @@ class OfferCategoriesViewModel extends BaseViewModel{ class PackagesViewModel extends BaseViewModel { OffersAndPackagesServices service = locator(); + List get categoryList => service.categoryList; List get productList => service.productList; List get latestOffersList => service.latestOffersList; diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index f2f87712..e64ab20c 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -228,4 +228,4 @@ class OrderPreviewViewModel extends BaseViewModel { } } -enum PaymentOption { meda, sadad, visa, mastercard, installments } +enum PaymentOption { meda, sadad, visa, mastercard, installments, applepay } diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 2f2d1467..b6420c9c 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -4,6 +4,8 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import '../../../locator.dart'; @@ -75,13 +77,17 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.createdOnUtc = DateTime.now().toString(); if (editedAddress == null) { + + ///TODO Fatima* await _pharmacyAddressService.addCustomerAddress(sendingAddress); + } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress); } if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; + Utils.showErrorToast(error); setState(ViewState.Error); } else { setState(ViewState.Idle); diff --git a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart index 86a320e6..420ec1fa 100644 --- a/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PrescriptionViewModel.dart @@ -14,7 +14,7 @@ class PrescriptionViewModel extends BaseViewModel { getPrescription() async { await getSavedLanguage(); - if(prescriptionsList.isNotEmpty){ + if(prescriptionsList.isEmpty){ setState(ViewState.Busy); await _prescriptionService.getPrescription(); if (_prescriptionService.hasError) { diff --git a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart index facccf1e..27fe3234 100644 --- a/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart @@ -1,16 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Manufacturer.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/recommendedProduct_model.dart'; -import 'package:diplomaticquarterapp/core/service/medical/prescriptions_service.dart'; //import 'package:diplomaticquarterapp/core/model/prescriptions/perscription_pharmacy.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/prescription_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/recommendedProduct_service.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; @@ -20,13 +16,11 @@ import '../../../locator.dart'; class PharmacyModuleViewModel extends BaseViewModel { PharmacyModuleService _pharmacyService = locator(); - RecommendedProductService _recommendedProductService = - locator(); + RecommendedProductService _recommendedProductService = locator(); List get bannerList => _pharmacyService.bannerItems; - List get recommendedProductList => - _recommendedProductService.recommendedList; + List get recommendedProductList => _recommendedProductService.recommendedList; Future generatePharmacyToken() async { setState(ViewState.Busy); @@ -40,8 +34,6 @@ class PharmacyModuleViewModel extends BaseViewModel { } Future verifyCustomer() async { - // if (authenticatedUserObject.isLogin) await generatePharmacyToken(); - var data = await sharedPref.getObject(USER_PROFILE); var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); @@ -70,11 +62,9 @@ class PharmacyModuleViewModel extends BaseViewModel { Future getBannerList() async { if (bannerList.isEmpty) { - GifLoaderDialogUtils.showMyDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); await _pharmacyService.getBannerListList(); - GifLoaderDialogUtils.hideDialog( - locator().navigatorKey.currentContext); + GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); if (_pharmacyService.hasError) { error = _pharmacyService.error; setState(ViewState.Error); @@ -83,9 +73,15 @@ class PharmacyModuleViewModel extends BaseViewModel { } } - List getBannerImagesUrl() { + List getBannerImagesUrl(ProjectViewModel projectViewModel) { List images = List(); images.add('assets/images/pharmacy_module/pharmacy_logo_green.png'); + + if (projectViewModel.isArabic) + images.add('assets/images/pharmacy_module/offers_banner_ar.png'); + else + images.add('assets/images/pharmacy_module/offers_banner.png'); + _pharmacyService.bannerItems.forEach((element) { images.add(element.src); }); diff --git a/lib/main.dart b/lib/main.dart index 71420951..99b7cefe 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -167,6 +167,7 @@ class _MyApp extends State { // ), // ), initialRoute: SPLASH, + // initialRoute: OPENTOK_CALL_PAGE, // initialRoute: PACKAGES_OFFERS, // initialRoute: PACKAGES_ORDER_COMPLETED, routes: routes, diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index f01c3bf8..d681f764 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -1,8 +1,37 @@ class healthData { int MedCategoryID; int MedSubCategoryID; - String Value; - String Notes; String MachineDate; + double Value; int TransactionsListID; -} + String Notes; + + healthData({ + this.MedCategoryID, + this.MedSubCategoryID, + this.MachineDate, + this.Value, + this.TransactionsListID, + this.Notes, + }); + + healthData.fromJson(Map json) { + MedCategoryID = json['MedCategoryID']; + MedSubCategoryID = json['MedSubCategoryID']; + MachineDate = json['MachineDate']; + Value = json['Value']; + TransactionsListID = json['TransactionsListID']; + Notes = json['Notes']; + } + + Map toJson() { + final Map data = new Map(); + data['MedCategoryID'] = this.MedCategoryID; + data['MedSubCategoryID'] = this.MedSubCategoryID; + data['MachineDate'] = this.MachineDate; + data['Value'] = this.Value; + data['TransactionsListID'] = this.TransactionsListID; + data['Notes'] = this.Notes; + return data; + } +} \ No newline at end of file diff --git a/lib/models/SmartWatch/WeeklyHeartRateResModel.dart b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart new file mode 100644 index 00000000..17dbb563 --- /dev/null +++ b/lib/models/SmartWatch/WeeklyHeartRateResModel.dart @@ -0,0 +1,26 @@ +class WeeklyHeartRateResModel { + num valueAvg; + String machineDate; + int medCategoryID; + int patientID; + + WeeklyHeartRateResModel( + {this.valueAvg, this.machineDate, this.medCategoryID, this.patientID}); + + WeeklyHeartRateResModel.fromJson(Map json) { + num value = json['ValueAvg']; + valueAvg = json['ValueAvg'] != null ? value.toInt() : 0; + machineDate = json['MachineDate']; + medCategoryID = json['MedCategoryID']; + patientID = json['PatientID']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueAvg'] = this.valueAvg; + data['MachineDate'] = this.machineDate; + data['MedCategoryID'] = this.medCategoryID; + data['PatientID'] = this.patientID; + return data; + } +} diff --git a/lib/models/SmartWatch/WeeklyStepsResModel.dart b/lib/models/SmartWatch/WeeklyStepsResModel.dart new file mode 100644 index 00000000..ceae9d3b --- /dev/null +++ b/lib/models/SmartWatch/WeeklyStepsResModel.dart @@ -0,0 +1,42 @@ +class WeeklyStepsResModel { + int iD; + int patientID; + int medCategoryID; + int medSubCategoryID; + num value; + String machineDate; + bool patientOutSA; + dynamic notes; + bool isActive; + String createdOn; + + WeeklyStepsResModel({this.iD, this.patientID, this.medCategoryID, this.medSubCategoryID, this.value, this.machineDate, this.patientOutSA, this.notes, this.isActive, this.createdOn}); + + WeeklyStepsResModel.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + medCategoryID = json['MedCategoryID']; + medSubCategoryID = json['MedSubCategoryID']; + value = json['Value'] != null ? num.tryParse(json['Value']).toInt() : 0; + machineDate = json['MachineDate']; + patientOutSA = json['PatientOutSA']; + notes = json['Notes']; + isActive = json['IsActive']; + createdOn = json['CreatedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['MedCategoryID'] = this.medCategoryID; + data['MedSubCategoryID'] = this.medSubCategoryID; + data['Value'] = this.value; + data['MachineDate'] = this.machineDate; + data['PatientOutSA'] = this.patientOutSA; + data['Notes'] = this.notes; + data['IsActive'] = this.isActive; + data['CreatedOn'] = this.createdOn; + return data; + } +} diff --git a/lib/models/SmartWatch/YearlyHeartRateResModel.dart b/lib/models/SmartWatch/YearlyHeartRateResModel.dart new file mode 100644 index 00000000..1d045b19 --- /dev/null +++ b/lib/models/SmartWatch/YearlyHeartRateResModel.dart @@ -0,0 +1,37 @@ +class YearlyHeartRateResModel { + num valueAvg; + int medCategoryID; + int month; + String monthName; + int patientID; + int year; + + YearlyHeartRateResModel( + {this.valueAvg, + this.medCategoryID, + this.month, + this.monthName, + this.patientID, + this.year}); + + YearlyHeartRateResModel.fromJson(Map json) { + num value = json['ValueAvg']; + valueAvg = json['ValueAvg'] != null ? value.toInt() : 0; + medCategoryID = json['MedCategoryID']; + month = json['Month']; + monthName = json['MonthName']; + patientID = json['PatientID']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueAvg'] = this.valueAvg; + data['MedCategoryID'] = this.medCategoryID; + data['Month'] = this.month; + data['MonthName'] = this.monthName; + data['PatientID'] = this.patientID; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/models/SmartWatch/YearlyStepsResModel.dart b/lib/models/SmartWatch/YearlyStepsResModel.dart index 728633d9..c98fff27 100644 --- a/lib/models/SmartWatch/YearlyStepsResModel.dart +++ b/lib/models/SmartWatch/YearlyStepsResModel.dart @@ -1,5 +1,5 @@ class YearlyStepsResModel { - double valueSum; + num valueSum; int medCategoryID; int month; String monthName; @@ -21,6 +21,7 @@ class YearlyStepsResModel { monthName = json['MonthName']; patientID = json['PatientID']; year = json['Year']; + valueSum = valueSum != null ? valueSum.toInt() : valueSum; } Map toJson() { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index a5c89c17..d3c7f970 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -51,36 +51,6 @@ class OrdersLogDetailsPage extends StatelessWidget { }, )); return; - - // todo 'sikander' remove useless code - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - Future.delayed(new Duration(milliseconds: 300)).then((value) async { - GifLoaderDialogUtils.showMyDialog(context); - await model.updateCmcPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - GifLoaderDialogUtils.hideDialog(context); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - await model.getCmcAllPresOrders(); - GifLoaderDialogUtils.hideDialog(context); - } - }); - // await model.updateCmcPresOrder(updatePresOrderRequestModel); - // if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - // } else { - // AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - // await model.getCmcAllPresOrders(); - // } - }, - ), - ); } return AppScaffold( diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart index 16f599d7..25efb016 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -36,6 +36,7 @@ class NewEReferralStepOnePage extends StatefulWidget { class _NewEReferralStepOnePageState extends State { TextEditingController _nameTextController = TextEditingController(); + TextEditingController _requesterRelationTextController = TextEditingController(); GetAllRelationshipTypeResponseModel _selectedRelation; String email; @@ -166,6 +167,11 @@ class _NewEReferralStepOnePageState extends State { ), ), ), + SizedBox( + height: 12, + ), + if (_selectedRelation != null && _selectedRelation.iD == 5) + inputWidget(TranslationBase.of(context).requesterRelationship, "", _requesterRelationTextController, isInputTypeNum: false), ], ), ), @@ -180,7 +186,7 @@ class _NewEReferralStepOnePageState extends State { width: double.infinity, child: DefaultButton( TranslationBase.of(context).next, - (_nameTextController.text.isEmpty || _selectedRelation == null || mobileNo.isEmpty) + (_nameTextController.text.isEmpty || _selectedRelation == null || mobileNo.isEmpty || (_selectedRelation.iD == 5 && _requesterRelationTextController.text.isEmpty)) ? null : () async { Future.delayed(new Duration(milliseconds: 300)).then((value) async { @@ -222,7 +228,8 @@ class _NewEReferralStepOnePageState extends State { Navigator.of(context).pop(); widget.changePageViewIndex(1); widget.createEReferralRequestModel.requesterName = _nameTextController.text; - widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1) + mobileNo; + widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString() + mobileNo; + widget.createEReferralRequestModel.otherRelationship = _requesterRelationTextController.text; widget.createEReferralRequestModel.requesterRelationship = _selectedRelation.iD; } }); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart index 164d7b50..439a9ec7 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -7,11 +7,11 @@ import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/Dialog/confirm_dialog.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -22,7 +22,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../dialogs/select_city_dialog.dart'; @@ -111,11 +110,10 @@ class _NewEReferralStepThreePageState extends State { fontWeight: FontWeight.w600, ), ), - ...List.generate( medicalReportImages.length, (index) => Container( - padding: EdgeInsets.only(top: 6,bottom: 6), + padding: EdgeInsets.only(top: 6, bottom: 6), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -154,7 +152,7 @@ class _NewEReferralStepThreePageState extends State { ); }, child: Padding( - padding: EdgeInsets.only(top: 12,bottom: 12), + padding: EdgeInsets.only(top: 12, bottom: 12), child: Text( TranslationBase.of(context).selectAttachment, style: TextStyle( @@ -257,10 +255,8 @@ class _NewEReferralStepThreePageState extends State { Padding( padding: const EdgeInsets.all(5.0), child: Text( - TranslationBase.of(context).insuredPatientReferral, style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600 - ), + TranslationBase.of(context).insuredPatientReferral, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600), ), ), ], @@ -297,11 +293,10 @@ class _NewEReferralStepThreePageState extends State { fontWeight: FontWeight.w600, ), ), - ...List.generate( insuredPatientImages.length, (index) => Container( - padding: EdgeInsets.only(top: 6,bottom: 6), + padding: EdgeInsets.only(top: 6, bottom: 6), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -339,7 +334,7 @@ class _NewEReferralStepThreePageState extends State { }); }, child: Padding( - padding: const EdgeInsets.only(top: 12,bottom: 12), + padding: const EdgeInsets.only(top: 12, bottom: 12), child: Text( TranslationBase.of(context).selectAttachment, style: TextStyle( @@ -378,16 +373,23 @@ class _NewEReferralStepThreePageState extends State { this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length != 0 ? insuredPatientImages[0] : null; this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; // ToDo make the preferred Branch info dynamic - this.widget.createEReferralRequestModel.preferredBranchCode = num.tryParse(projectDropdownValue.split(",")[0]); - this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue.split(",")[1]; - this.widget.createEReferralRequestModel.otherRelationship = ""; + this.widget.createEReferralRequestModel.preferredBranchCode = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? num.tryParse(projectDropdownValue.split(",")[0]) : 0; + this.widget.createEReferralRequestModel.preferredBranchName = projectDropdownValue != null && projectDropdownValue.isNotEmpty ? projectDropdownValue.split(",")[1] : ""; + // this.widget.createEReferralRequestModel.otherRelationship = ""; await model.createEReferral(this.widget.createEReferralRequestModel); if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.hideDialog(context); Utils.showErrorToast(model.error); } else { GifLoaderDialogUtils.hideDialog(context); - AppToast.showSuccessToast(message: TranslationBase.of(context).ereferralSaveSuccess); + // AppToast.showSuccessToast(message: TranslationBase.of(context).ereferralSaveSuccess); + showCMCConfirmDialog( + context, + model.referralNumber, + onClick: () { + Navigator.pop(context); + }, + ); } }); }, @@ -469,7 +471,6 @@ class _NewEReferralStepThreePageState extends State { ); } - String getRelationName() { if (_selectedCity != null) return _selectedCity.description; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart index 9135eda9..57341838 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -180,7 +180,7 @@ class _NewEReferralStepTowPageState extends State { this.widget.changePageViewIndex(2); this.widget.createEReferralRequestModel.identificationNo = int.parse(_patientIdentificationTextController.text); this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text; - this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString().substring(1) + mobileNo; + this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString() + mobileNo; this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString(); this.widget.createEReferralRequestModel.cityName = _selectedCity.description; }, diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart index d58fd29f..8046346f 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart @@ -4,6 +4,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // ignore: must_be_immutable + +// todo 'sikander' remove this file when usage known class SelectCountryDialog extends StatefulWidget { final Function(dynamic) onValueSelected; dynamic selectedCountry; diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart deleted file mode 100644 index e970f208..00000000 --- a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// ignore: must_be_immutable -class SelectSearchCriteriaDialog extends StatefulWidget { - List searchCriteria = [ - SearchCriteriaModel(name: "Identification Number",nameAr:"رقم الهوية",value: 1), - SearchCriteriaModel(name: "Referral Number",nameAr:"رقم الإحالة",value: 2), - ]; - final Function(SearchCriteriaModel) onValueSelected; - SearchCriteriaModel selectedCriteria; - ProjectViewModel projectViewModel; - - SelectSearchCriteriaDialog( - {Key key, this.onValueSelected, this.selectedCriteria, this.projectViewModel}); - - @override - _SelectSearchCriteriaDialogState createState() => _SelectSearchCriteriaDialogState(); -} - -class _SelectSearchCriteriaDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedCriteria = widget.selectedCriteria ?? widget.searchCriteria[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Text(TranslationBase.of(context).searchCriteria), - Divider(), - ...List.generate( - widget.searchCriteria.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedCriteria = widget.searchCriteria[index]; - }); - }, - child: ListTile( - title: Text(widget.projectViewModel.isArabic ? widget.searchCriteria[index].nameAr : widget.searchCriteria[index].name), - leading: Radio( - value: widget.searchCriteria[index], - groupValue: widget.selectedCriteria, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedCriteria = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedCriteria); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} - - - - diff --git a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart index fe920748..1baab531 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/referral_details.dart @@ -31,8 +31,7 @@ class _ReferralDetailsState extends State { width: double.infinity, child: Container( decoration: cardRadius(12), - margin: - EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -40,13 +39,7 @@ class _ReferralDetailsState extends State { children: [ Container( margin: EdgeInsets.only(bottom: 10.0), - child: Text( - TranslationBase.of(context).ereferral, - style: TextStyle( - letterSpacing: -0.64, - color: Colors.black, - fontSize: 18.0, - fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).ereferral, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( width: double.infinity, @@ -54,15 +47,10 @@ class _ReferralDetailsState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).referralStatus), + child: _getNormalText(TranslationBase.of(context).referralStatus), ), Expanded( - child: _getNormalText( - projectViewModel.isArabic - ? widget.referral.statusAr - : widget.referral.status, - isBold: true), + child: _getNormalText(projectViewModel.isArabic ? widget.referral.statusAr : widget.referral.status, isBold: true), ) ], ), @@ -74,13 +62,10 @@ class _ReferralDetailsState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).patientName), + child: _getNormalText(TranslationBase.of(context).patientName), ), Expanded( - child: _getNormalText( - widget.referral.patientName, - isBold: true), + child: _getNormalText(widget.referral.patientName, isBold: true), ) ], ), @@ -92,13 +77,10 @@ class _ReferralDetailsState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).referralNumber), + child: _getNormalText(TranslationBase.of(context).referralNumber), ), Expanded( - child: _getNormalText( - widget.referral.referralNumber.toString(), - isBold: true), + child: _getNormalText(widget.referral.referralNumber.toString(), isBold: true), ) ], ), @@ -110,15 +92,10 @@ class _ReferralDetailsState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).referralDate), + child: _getNormalText(TranslationBase.of(context).referralDate), ), Expanded( - child: _getNormalText( - DateUtil.getDayMonthYearDateFormatted( - DateUtil.convertStringToDateNoTimeZone( - widget.referral.referralDate)), - isBold: true), + child: _getNormalText(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(widget.referral.referralDate)), isBold: true), ) ], ), @@ -130,13 +107,10 @@ class _ReferralDetailsState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).hospital), + child: _getNormalText(TranslationBase.of(context).hospital), ), Expanded( - child: _getNormalText( - widget.referral.preferredBranchName, - isBold: true), + child: _getNormalText(widget.referral.preferredBranchName ?? "", isBold: true), ) ], ), diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart index b3fffa4b..5751dcfe 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -4,17 +4,17 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/ import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/referral_details.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; -import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -23,7 +23,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'dialogs/select_country_ingo_Dialog.dart'; -import 'dialogs/select_search_criteria_dialog.dart'; class SearchForReferralsPage extends StatefulWidget { SearchForReferralsPage({Key key}); @@ -79,74 +78,31 @@ class _SearchForReferralsPageState extends State { SizedBox( height: 10, ), - // InkWell( - // onTap: () => selectSearchCriteriaDialog(), - // child: Container( - // padding: EdgeInsets.all(12), - // width: double.infinity, - // height: 65, - // decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [Texts(getSearchCriteriaName()), Icon(Icons.arrow_drop_down)], - // ), - // ), - // ), - Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: InkWell( - onTap: () => selectSearchCriteriaDialog(projectViewModel), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).selectSearchCriteria, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - ), - Text( - getSearchCriteriaName(projectViewModel), - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - ), - ], - ), - ), - Icon(Icons.arrow_drop_down), - ], + CommonDropDownView(TranslationBase.of(context).selectSearchCriteria, getSearchCriteriaName(projectViewModel), () { + List searchCriteria = [ + SearchCriteriaModel(name: "Identification Number", nameAr: "رقم الهوية", value: 1), + SearchCriteriaModel(name: "Referral Number", nameAr: "رقم الإحالة", value: 2), + ]; + List list = []; + for (int i = 0; i < searchCriteria.length; i++) { + list.add(RadioSelectionDialogModel(projectViewModel.isArabic ? searchCriteria[i].nameAr : searchCriteria[i].name, searchCriteria[i].value)); + } + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: selectedCriteria.value, + onValueSelected: (index) { + selectedCriteria = searchCriteria[index - 1]; + setState(() {}); + }, ), - ), - ), - SizedBox( - height: 12, - ), - - inputWidget(selectedCriteria.value == 1 ? TranslationBase.of(context).enterIdentificationNumber : TranslationBase.of(context).referralNumber, "", _searchTextController, isInputTypeNum: true), - - SizedBox( - height: 12, - ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + inputWidget(selectedCriteria.value == 1 ? TranslationBase.of(context).enterIdentificationNumber : TranslationBase.of(context).referralNumber, "", _searchTextController, + isInputTypeNum: true), + SizedBox(height: 12), PhoneNumberSelectorWidget(onNumberChange: (value) { setState(() { mobileNo = value; @@ -179,9 +135,7 @@ class _SearchForReferralsPageState extends State { // }, // code: _selectedCountry == null ? "11" : _selectedCountry["code"], // ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), if ((model.state == ViewState.Idle && model.allReferral.length == 0)) Center(child: Text(TranslationBase.of(context).noSearchResult)), if ((model.state == ViewState.ErrorLocal)) AppEmbeddedError(error: model.error), model.allReferral.length > 0 @@ -293,92 +247,65 @@ class _SearchForReferralsPageState extends State { return "Country"; } - void selectSearchCriteriaDialog(ProjectViewModel projectViewModel) { - showDialog( - context: context, - child: SelectSearchCriteriaDialog( - selectedCriteria: selectedCriteria, - projectViewModel: projectViewModel, - onValueSelected: (value) { - setState(() { - selectedCriteria = value; - }); - }, - ), - ); - } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { - return Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: InkWell( - onTap: hasSelection ? () {} : null, - child: Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _labelText, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), + return InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - TextField( - enabled: isEnable, - scrollPadding: EdgeInsets.zero, - keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, - controller: _controller, - maxLines: lines, - onChanged: (value) => {setState(() {})}, - style: TextStyle( + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - decoration: InputDecoration( - isDense: true, - hintText: _hintText, - hintStyle: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - suffixIconConstraints: BoxConstraints(minWidth: 50), - suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, + color: Color(0xff575757), + letterSpacing: -0.56, ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), + ), + ], ), - if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), - ], - ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), - ); + ).withBorderedContainer; } String getSearchCriteriaName(ProjectViewModel projectViewModel) { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart index b401a127..f8e377b7 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_one_page.dart @@ -95,7 +95,7 @@ class _NewHomeHealthCareStepOnePageState extends State with Tick @override Widget build(BuildContext context) { - void showConfirmMessage(HomeHealthCareViewModel model, GetOrderDetailByOrderIDResponseModel order) { + void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmCancelOrderDialog( - model: model, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { model.setState(ViewState.Busy); - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.presOrderID, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); await model.updateHHCPresOrder(updatePresOrderRequestModel); if (model.state == ViewState.ErrorLocal) { @@ -89,236 +87,219 @@ class _NewHomeHealthCarePageState extends State with Tick ProjectViewModel projectViewModel = Provider.of(context); - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.8, - child: Column( - children: [ - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - widget.model.pendingOrder != null - ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ - (Container( - decoration: BoxDecoration( - color: Color(0xffCC9B14), - borderRadius: BorderRadius.all( - Radius.circular(10.0), + return PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + widget.model.pendingOrder != null + ? ListView(padding: EdgeInsets.symmetric(horizontal: 20, vertical: 15), children: [ + (Container( + decoration: BoxDecoration( + color: Color(0xffCC9B14), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + // decoration: containerColorRadiusLeft(Colors.white, 12), + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), + padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), + // clipBehavior: Clip.antiAlias, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.pendingOrder.statusText, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 6), + Text( + '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).serviceName + ": ", + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), + Column( + children: [ + ...List.generate( + widget.model.hhcAllOrderDetail.length, + (index) => Container( + child: Texts( + projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + fontSize: 13, + bold: false, + ), + ), + ) + ], + ) + ], + ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + SizedBox(height: 12), + if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) + InkWell( + onTap: () { + showConfirmMessage(widget.model, widget.model.pendingOrder); + }, child: Container( - // decoration: containerColorRadiusLeft(Colors.white, 12), - margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0), - padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: Colors.white, + color: Color(0xffD02127), border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.only( - bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), - ), + borderRadius: BorderRadius.circular(10), ), - // clipBehavior: Clip.antiAlias, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.model.pendingOrder.statusText, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xffCC9B14), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 6), - Text( - '${TranslationBase.of(context).requestID}: ${widget.model.pendingOrder.iD.toString()}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).serviceName + ": ", - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), - ), - Column( - children: [ - ...List.generate( - widget.model.hhcAllOrderDetail.length, - (index) => Container( - child: Texts( - projectViewModel.isArabic - ? widget.model.hhcAllOrderDetail[index].descriptionN - : widget.model.hhcAllOrderDetail[index].description.capitalize(), - fontSize: 13, - bold: false, - ), - ), - ) - ], - ) - ], - ) - ], - ), - ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.model.pendingOrder.created)), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), - ), - SizedBox(height: 12), - if (widget.model.pendingOrder.statusId == 1 || widget.model.pendingOrder.statusId == 2) - InkWell( - onTap: () { - showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), - decoration: BoxDecoration( - color: Color(0xffD02127), - border: Border.all(color: Colors.white, width: 1), - borderRadius: BorderRadius.circular(10), - ), - child: Text( - TranslationBase.of(context).cancel_nocaps, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), - ), - ), - ), - ], - ), - ], + child: Text( + TranslationBase.of(context).cancel_nocaps, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - )) - ]) - - // FractionallySizedBox( - // widthFactor: 0.9, - // child: SingleChildScrollView( - // child: Container( - // // margin: EdgeInsets.all(10), - // child: Container( - // width: double.infinity, - // padding: EdgeInsets.only(left: 12, right: 12, top: 12), - // child: Card( - // shape: cardRadius(12), - // elevation: 2, - // margin: EdgeInsets.zero, - // color: Color(0xffcd9e1b), - // clipBehavior: Clip.antiAlias, - // child: Container( - // // decoration: containerColorRadiusLeft(Colors.white, 12), - // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), - // padding: EdgeInsets.all(12), - // // color: Colors.white, - // decoration: BoxDecoration( - // shape: BoxShape.rectangle, - // color: Colors.white, - // borderRadius: BorderRadius.only( - // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), - // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, - // ), - // ), - // // clipBehavior: Clip.antiAlias, - // child: Row( - // children: [ - // Expanded( - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts( - // TranslationBase.of(context).OrderStatus + - // ' ' + - // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), - // bold: false, - // fontSize: 12, - // color: Color(0xffcd9e1b), - // fontWeight: FontWeight.bold, - // ), - // Texts( - // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), - // fontWeight: FontWeight.w600, - // fontSize: 18, - // ), - // Texts( - // TranslationBase.of(context).serviceName, - // fontSize: 12, - // fontWeight: FontWeight.w600, - // ), - // ...List.generate( - // widget.model.hhcAllOrderDetail.length, - // (index) => Container( - // child: Texts( - // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), - // fontSize: 13, - // bold: false, - // ), - // ), - // ), - // ], - // )), - // Column( - // children: [ - // Texts( - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), - // fontSize: 14, - // ), - // mHeight(8), - // // SecondaryButton( - // // onTap: () { - // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); - // // }, - // // label: TranslationBase.of(context).cancel, - // // color: Colors.red[900], - // // small: true, - // // ) - // ], - // ), - // ], - // ))), - // )))) - : NewHomeHealthCareStepOnePage( - changePageViewIndex: _changeCurrentTab, - patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, - model: widget.model, - ), - ], + ), + ], + ), + ], + ), ), - ), - ], - ), - ), - ), - ), + )) + ]) + + // FractionallySizedBox( + // widthFactor: 0.9, + // child: SingleChildScrollView( + // child: Container( + // // margin: EdgeInsets.all(10), + // child: Container( + // width: double.infinity, + // padding: EdgeInsets.only(left: 12, right: 12, top: 12), + // child: Card( + // shape: cardRadius(12), + // elevation: 2, + // margin: EdgeInsets.zero, + // color: Color(0xffcd9e1b), + // clipBehavior: Clip.antiAlias, + // child: Container( + // // decoration: containerColorRadiusLeft(Colors.white, 12), + // margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 8, right: projectViewModel.isArabic ? 8 : 0), + // padding: EdgeInsets.all(12), + // // color: Colors.white, + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // topRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // bottomLeft: projectViewModel.isArabic ? Radius.zero : Radius.circular(12.0), + // bottomRight: projectViewModel.isArabic ? Radius.circular(12.0) : Radius.zero, + // ), + // ), + // // clipBehavior: Clip.antiAlias, + // child: Row( + // children: [ + // Expanded( + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Texts( + // TranslationBase.of(context).OrderStatus + + // ' ' + + // (projectViewModel.isArabic ? widget.model.pendingOrder.descriptionN : widget.model.pendingOrder.description), + // bold: false, + // fontSize: 12, + // color: Color(0xffcd9e1b), + // fontWeight: FontWeight.bold, + // ), + // Texts( + // TranslationBase.of(context).requestID + ' ' + widget.model.pendingOrder.iD.toString(), + // fontWeight: FontWeight.w600, + // fontSize: 18, + // ), + // Texts( + // TranslationBase.of(context).serviceName, + // fontSize: 12, + // fontWeight: FontWeight.w600, + // ), + // ...List.generate( + // widget.model.hhcAllOrderDetail.length, + // (index) => Container( + // child: Texts( + // projectViewModel.isArabic ? widget.model.hhcAllOrderDetail[index].descriptionN : widget.model.hhcAllOrderDetail[index].description.capitalize(), + // fontSize: 13, + // bold: false, + // ), + // ), + // ), + // ], + // )), + // Column( + // children: [ + // Texts( + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.model.pendingOrder.createdOn)), + // fontSize: 14, + // ), + // mHeight(8), + // // SecondaryButton( + // // onTap: () { + // // showConfirmMessage(widget.model, widget.model.hhcAllOrderDetail[0]); + // // }, + // // label: TranslationBase.of(context).cancel, + // // color: Colors.red[900], + // // small: true, + // // ) + // ], + // ), + // ], + // ))), + // )))) + : NewHomeHealthCareStepOnePage( + changePageViewIndex: _changeCurrentTab, + patientERInsertPresOrderRequestModel: patientERInsertPresOrderRequestModel, + model: widget.model, + ), + ], ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index 919c566a..e14d07e8 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -45,27 +45,6 @@ class OrdersLogDetailsPage extends StatelessWidget { ), ); return; - - // todo 'sikander' remove useless code - - showDialog( - context: context, - child: ConfirmCancelOrderDialog( - model: model, - onTap: () async { - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - model.setState(ViewState.Busy); - await model.updateHHCPresOrder(updatePresOrderRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); - await model.getHHCAllPresOrders(); - // await model.getHHCAllServices(); - } - }, - ), - ); } return AppScaffold( @@ -90,7 +69,7 @@ class OrdersLogDetailsPage extends StatelessWidget { } else if (status == 3) { //completed _color = Color(0xff359846); - } else if (status == 4) { + } else if (status == 4 || status == 6 || status == 7) { //cancel // Rejected _color = Color(0xffD02127); } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 8f130d93..ffb974e1 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; @@ -278,7 +279,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(page: ChildVaccinePage()), + FadePage(page: ChildInitialPage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', title: TranslationBase.of(context).childVaccine, diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart index 6aff12d7..ac4c11e1 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; @@ -48,29 +49,29 @@ class _AllHabibMedicalSevicePage2State extends State initialiseHmgServices(bool isLogin) { hmgServices.clear(); - hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCareTitle, TranslationBase.of(context).liveCareSubtitle, "assets/images/new/Live_Care.svg", isLogin)); hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); - hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(7, TranslationBase.of(context).waterTitle, TranslationBase.of(context).waterSubtitle, "assets/images/new/h2o.svg", isLogin)); hmgServices.add(new HmgServices(8, TranslationBase.of(context).findUs, TranslationBase.of(context).reachUs, "assets/images/new/reach_us.svg", isLogin)); - hmgServices.add(new HmgServices(9, TranslationBase.of(context).medicalFile, TranslationBase.of(context).My_File_Details, "assets/images/new/medical file.svg", isLogin)); - hmgServices.add(new HmgServices(10, TranslationBase.of(context).book, TranslationBase.of(context).appointment, "assets/images/new/book appointment.svg", isLogin)); - hmgServices.add(new HmgServices(11, TranslationBase.of(context).online, TranslationBase.of(context).pharmacy, "assets/images/new/Pharmacy.svg", isLogin)); + hmgServices.add(new HmgServices(9, TranslationBase.of(context).medicalFileTitle2, TranslationBase.of(context).medicalFileSubtitle, "assets/images/new/medical file.svg", isLogin)); + hmgServices.add(new HmgServices(10, TranslationBase.of(context).book, TranslationBase.of(context).appointmentLabel, "assets/images/new/book appointment.svg", isLogin)); + hmgServices.add(new HmgServices(11, TranslationBase.of(context).pharmacyTitle, TranslationBase.of(context).pharmacySubtitle, "assets/images/new/Pharmacy.svg", isLogin)); hmgServices.add(new HmgServices(12, TranslationBase.of(context).updateInsurance, TranslationBase.of(context).updateInsuranceSubtitle, "assets/images/new/update insurance card.svg", isLogin)); - hmgServices.add(new HmgServices(13, TranslationBase.of(context).myFamily, TranslationBase.of(context).Family_Files, "assets/images/new/my family.svg", isLogin)); + hmgServices.add(new HmgServices(13, TranslationBase.of(context).familyTitle, TranslationBase.of(context).familySubtitle, "assets/images/new/my family.svg", isLogin)); hmgServices.add(new HmgServices(14, TranslationBase.of(context).My_Child, TranslationBase.of(context).Vaccines, "assets/images/new/child vaccines.svg", isLogin)); hmgServices.add(new HmgServices(15, TranslationBase.of(context).Todo, TranslationBase.of(context).list, "assets/images/new/todo.svg", isLogin)); hmgServices.add(new HmgServices(16, TranslationBase.of(context).Blood, TranslationBase.of(context).Donation, "assets/images/new/blood donation.svg", isLogin)); - hmgServices.add(new HmgServices(17, TranslationBase.of(context).Health, TranslationBase.of(context).Calculator, "assets/images/new/health calculator.svg", isLogin)); - hmgServices.add(new HmgServices(18, TranslationBase.of(context).Health, TranslationBase.of(context).Converter, "assets/images/new/health converter.svg", isLogin)); - hmgServices.add(new HmgServices(19, TranslationBase.of(context).Smart, TranslationBase.of(context).Watches, "assets/images/new/smart watch.svg", isLogin)); - hmgServices.add(new HmgServices(20, TranslationBase.of(context).Parking, TranslationBase.of(context).Details, "assets/images/new/parking details.svg", isLogin)); + hmgServices.add(new HmgServices(17, TranslationBase.of(context).healthCalculatorTitle, TranslationBase.of(context).healthCalculatorSubtitle, "assets/images/new/health calculator.svg", isLogin)); + hmgServices.add(new HmgServices(18, TranslationBase.of(context).healthConvertersTitle, TranslationBase.of(context).healthConvertersSubtitle, "assets/images/new/health converter.svg", isLogin)); + hmgServices.add(new HmgServices(19, TranslationBase.of(context).smartWatches.split(" ")[0], TranslationBase.of(context).smartWatches.split(" ")[1], "assets/images/new/smart watch.svg", isLogin)); + hmgServices.add(new HmgServices(20, TranslationBase.of(context).parkingTitle2, TranslationBase.of(context).parkingSubtitle, "assets/images/new/parking details.svg", isLogin)); hmgServices.add(new HmgServices(21, TranslationBase.of(context).Virtual, TranslationBase.of(context).Tour, "assets/images/new/virtual tour.svg", isLogin)); - hmgServices.add(new HmgServices(22, TranslationBase.of(context).News, TranslationBase.of(context).Latest, "assets/images/new/latest news.svg", isLogin)); + hmgServices.add(new HmgServices(22, TranslationBase.of(context).latestNews.split(" ")[0], TranslationBase.of(context).latestNews.split(" ")[1], "assets/images/new/latest news.svg", isLogin)); } @override @@ -89,28 +90,25 @@ class _AllHabibMedicalSevicePage2State extends State child: SingleChildScrollView( child: Column( children: [ - AspectRatio( - aspectRatio: 1.8, - child: Container( - width: double.infinity, - height: double.infinity, - decoration: containerRadiusWithGradient(0, - color1: timeCalculator(6, 0, 10, 59) - ? Color(0xFFB3E3FE) - : timeCalculator(11, 0, 15, 59) - ? Color(0xFFFF9E7E) - : Color(0xFF2E6686), - color2: timeCalculator(6, 0, 10, 59) - ? Color(0xFF9AC7FF) - : timeCalculator(11, 0, 15, 59) - ? Color(0xFFFECB50) - : Color(0xFF122F48)), - child: Padding( - padding: const EdgeInsets.all(30.0), - child: Stack( - alignment: projectViewModel.isArabic ? Alignment.centerLeft : Alignment.centerRight, - children: [ - Column( + Container( + width: double.infinity, + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Row( + children: [ + Expanded( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Directionality( @@ -118,7 +116,7 @@ class _AllHabibMedicalSevicePage2State extends State child: Text( weather, style: TextStyle( - fontSize: 30, + fontSize: 24, letterSpacing: -0.83, fontWeight: FontWeight.bold, color: Colors.white, @@ -134,11 +132,10 @@ class _AllHabibMedicalSevicePage2State extends State color: Colors.white, ), ), - mFlex(1), Text( TranslationBase.of(context).healthWeatherIndicators, style: TextStyle( - fontSize: 16, + fontSize: 12, letterSpacing: -0.96, fontWeight: FontWeight.bold, color: Colors.white, @@ -147,37 +144,40 @@ class _AllHabibMedicalSevicePage2State extends State Text( TranslationBase.of(context).healthTipsBasedOnCurrentWeather, style: TextStyle( - fontSize: 12, + fontSize: 10, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, ), ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HealthWeatherIndicator(), - ), - ); - }, - child: Padding( - padding: const EdgeInsets.only(top: 8, bottom: 8), - child: Text( - TranslationBase.of(context).moreDetails, - style: TextStyle(fontSize: 12, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, decoration: TextDecoration.underline), - ), - ), - ) ], ), - Image.asset( - "assets/images/Weather_ico.png", - color: Colors.white.withOpacity(0.5), - ), - ], - ), + ), + Column( + children: [ + SvgPicture.asset( + "assets/images/new/cloudy.svg", + ), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: HealthWeatherIndicator(), + ), + ); + }, + child: Padding( + padding: const EdgeInsets.only(top: 10, bottom: 0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 12, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, decoration: TextDecoration.underline), + ), + ), + ) + ], + ), + ], ), ), ), diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart deleted file mode 100644 index 0197873b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.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'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class ConfirmAddAmountDialog extends StatefulWidget { -// final int amount; -// final String unit; -// final H2OViewModel model; -// -// ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); -// -// @override -// _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); -// } -// -// class _ConfirmAddAmountDialogState extends State { -// @override -// void initState() { -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), -// titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// textAlign: TextAlign.center, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// children: [ -// Divider(), -// Center( -// child: Texts( -// "${TranslationBase.of(context).areyousure} ${widget.amount} ${widget.unit} ?", -// textAlign: TextAlign.center, -// color: Colors.grey, -// ), -// ), -// SizedBox( -// height: 16.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel.toUpperCase(), -// color: Colors.red, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () async { -// InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); -// await widget.model.insertUserActivity(insertUserActivityRequestModel); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok.toUpperCase(), -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart deleted file mode 100644 index 4d02c27b..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart +++ /dev/null @@ -1,166 +0,0 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.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'; -// todo 'sikander' remove useless code -// ignore: must_be_immutable -// class SelectAmountDialog extends StatefulWidget { -// final Function(AmountModel) onValueSelected; -// AmountModel selectedAmount; -// -// SelectAmountDialog({Key key, this.onValueSelected, this.selectedAmount}); -// -// @override -// _SelectAmountDialogState createState() => _SelectAmountDialogState(); -// } -// -// class _SelectAmountDialogState extends State { -// List searchAmount = [ -// AmountModel(name: "l", nameAr: "لتر", value: 1), -// AmountModel(name: "ml", nameAr: "مم لتر", value: 2), -// ]; -// @override -// void initState() { -// super.initState(); -// widget.selectedAmount = widget.selectedAmount ?? searchAmount[0]; -// getLanguage(); -// } -// -// String languageID = "en"; -// -// void getLanguage() async { -// languageID = await sharedPref.getString(APP_LANGUAGE); -// setState(() {}); -// } -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// children: [ -// Column( -// children: [ -// Texts( -// TranslationBase.of(context).preferredunit, -// fontSize: 20, -// ), -// Divider(), -// ...List.generate( -// searchAmount.length, -// (index) => Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// SizedBox( -// height: 2, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// setState(() { -// widget.selectedAmount = searchAmount[index]; -// }); -// }, -// child: ListTile( -// title: Text(languageID == "ar" ? searchAmount[index].nameAr : searchAmount[index].name), -// leading: Radio( -// value: searchAmount[index], -// groupValue: widget.selectedAmount, -// activeColor: Colors.red[800], -// onChanged: (value) { -// setState(() { -// widget.selectedAmount = value; -// }); -// }, -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// ], -// ), -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel.toUpperCase(), -// color: Colors.red, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// widget.onValueSelected(widget.selectedAmount); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok, -// fontWeight: FontWeight.w400, -// )), -// ), -// ), -// ), -// ], -// ) -// ], -// ) -// ], -// ); -// } -// } -// -// class AmountModel { -// String name; -// String nameAr; -// int value; -// -// AmountModel({this.name, this.nameAr, this.value}); -// -// AmountModel.fromJson(Map json) { -// name = json['name']; -// nameAr = json['nameAr']; -// value = json['value']; -// } -// -// Map toJson() { -// final Map data = new Map(); -// data['name'] = this.name; -// data['nameAr'] = this.nameAr; -// data['value'] = this.value; -// return data; -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart deleted file mode 100644 index 641f6df7..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.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/others/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import 'Dialog/select_amount_dialog.dart'; - -// todo 'sikander' remove useless code -// class AddCustomAmount extends StatefulWidget { -// final H2OViewModel model; -// final Function changePageViewIndex; -// -// const AddCustomAmount({Key key, this.model, this.changePageViewIndex}) -// : super(key: key); -// -// @override -// _AddCustomAmountState createState() => _AddCustomAmountState(); -// } -// -// class _AddCustomAmountState extends State { -// TextEditingController _nameTextController = TextEditingController(); -// AmountModel selectedAmount; -// -// @override -// void initState() { -// setState(() { -// _nameTextController.text = "0"; -// }); -// super.initState(); -// } -// -// @override -// Widget build(BuildContext context) { -// return AppScaffold( -// isShowAppBar: true, -// appBarTitle:TranslationBase.of(context).customLabel, -// body: SingleChildScrollView( -// physics: ScrollPhysics(), -// child: Container( -// margin: EdgeInsets.all(12), -// child: Center( -// child: FractionallySizedBox( -// widthFactor: 0.94, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// SizedBox( -// height: 12, -// ), -// NewTextFields( -// hintText: TranslationBase.of(context).h2oAmountOfWater, -// // type: "Number", -// controller: _nameTextController, -// ), -// SizedBox( -// height: 12, -// ), -// InkWell( -// onTap: () => confirmAmountTypeDialog(), -// child: Container( -// padding: EdgeInsets.all(12), -// width: double.infinity, -// height: 65, -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(12), -// color: Colors.white), -// child: Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Texts(getAmountName()), -// Icon(Icons.arrow_drop_down) -// ], -// ), -// ), -// ), -// SizedBox( -// height: 12, -// ), -// SecondaryButton( -// textColor: Colors.white, -// label: TranslationBase.of(context).ok, -// onTap: () async { -// Navigator.of(context).pop(); -// showConfirmMessage (int.parse(_nameTextController.text), widget.model); -// }, -// // loading: model.state == ViewState.BusyLocal, -// disabled: _nameTextController.text.isEmpty || selectedAmount == null), -// SizedBox( -// height: 12, -// ), -// ], -// ), -// ), -// ), -// ), -// ), -// ); -// } -// -// -// void confirmAmountTypeDialog() { -// showDialog( -// context: context, -// child: SelectAmountDialog( -// selectedAmount: selectedAmount, -// onValueSelected: (value) { -// setState(() { -// selectedAmount = value; -// }); -// }, -// ), -// ); -// } -// -// -// String getAmountName() { -// if (selectedAmount != null) -// return selectedAmount.name; -// else -// return TranslationBase.of(context).selectUnit; -// } -// -// -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index 904f4183..edc82034 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -126,7 +126,7 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget(inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController)), + inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController).withBorderedContainer, SizedBox(height: 16), Text( TranslationBase.of(context).preferredunit, @@ -210,80 +210,77 @@ class _H2oSettingState extends State { }, _weightPopupList), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { - showModalBottomSheet( - context: context, - builder: (context) { - return Container( - height: 250, - padding: EdgeInsets.all(8), - child: Column(children: [ - Container( - height: 40, - alignment: Alignment.centerRight, - child: Row(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - onTap: () => Navigator.pop(context), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).cancel), - ), + CommonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () { + showModalBottomSheet( + context: context, + builder: (context) { + return Container( + height: 250, + padding: EdgeInsets.all(8), + child: Column(children: [ + Container( + height: 40, + alignment: Alignment.centerRight, + child: Row(mainAxisSize: MainAxisSize.min, children: [ + InkWell( + onTap: () => Navigator.pop(context), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).cancel), ), - SizedBox(width: 8), - InkWell( - onTap: () { - Navigator.pop(context); - setState(() { - _dobDate = _tempDate; - }); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - child: Text(TranslationBase.of(context).ok), - ), - ) - ]), - ), - Expanded( - child: Container( - width: MediaQuery.of(context).size.width, - child: CupertinoDatePicker( - initialDateTime: _dobDate, - mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (_date) { - _tempDate = _date; - }, + ), + SizedBox(width: 8), + InkWell( + onTap: () { + Navigator.pop(context); + setState(() { + _dobDate = _tempDate; + }); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + child: Text(TranslationBase.of(context).ok), ), + ) + ]), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: CupertinoDatePicker( + initialDateTime: _dobDate, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (_date) { + _tempDate = _date; + }, ), - ) - ]), - ); - }); - }, iconData: Icons.calendar_today), - ), + ), + ) + ]), + ); + }); + }, iconData: Icons.calendar_today) + .withBorderedContainer, SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { - List list = [ - for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), - ]; + CommonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { + List list = [ + for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedActiveLevel, - onValueSelected: (index) { - _selectedActiveLevel = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedActiveLevel, + onValueSelected: (index) { + _selectedActiveLevel = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, SizedBox(height: 18), Text( TranslationBase.of(context).reminderLabel, @@ -296,25 +293,23 @@ class _H2oSettingState extends State { ), ), SizedBox(height: 12), - _containerWidget( - _commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { - List list = [ - for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), - ]; + CommonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { + List list = [ + for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i), + ]; - showDialog( - context: context, - child: RadioSelectionDialog( - listData: list, - selectedIndex: _selectedRemindedTime, - onValueSelected: (index) { - _selectedRemindedTime = index; - setState(() {}); - }, - ), - ); - }), - ), + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedRemindedTime, + onValueSelected: (index) { + _selectedRemindedTime = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, ], ), ), @@ -333,58 +328,6 @@ class _H2oSettingState extends State { ); } - Widget _containerWidget(Widget child) { - return Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: child, - ); - } - - Widget _commonDropDownView(String title, String value, VoidCallback callback, {IconData iconData}) { - return InkWell( - onTap: callback, - child: Row( - children: [ - Expanded( - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), - ), - Text( - value, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - ), - ]), - ), - Icon( - iconData ?? Icons.keyboard_arrow_down_sharp, - color: Color(0xff2E303A), - ) - ], - ), - ); - } - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { return InkWell( onTap: hasSelection ? () {} : null, @@ -501,81 +444,79 @@ class _H2oSettingState extends State { Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle, Function(bool) onUnitTap, _list) { - return _containerWidget( - Row( - children: [ - Expanded( - flex: 3, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _title, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - letterSpacing: -0.44, - ), + return Row( + children: [ + Expanded( + flex: 3, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, ), - TextField( - controller: _controller, - keyboardType: TextInputType.number, - onChanged: (value) { - double _value = double.parse(value); - if (_value > _maxValue) { - onTextValueChange(_maxValue.toStringAsFixed(0)); - onValueChange(_maxValue); - return; - } else if (_value < _minValue) { - onTextValueChange(_minValue.toStringAsFixed(0)); - onValueChange(_minValue); - return; - } else if (_value >= _minValue && _value <= _maxValue) { - onValueChange(_value); - return; - } - }, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), - ], - style: TextStyle( + ), + TextField( + controller: _controller, + keyboardType: TextInputType.number, + onChanged: (value) { + double _value = double.parse(value); + if (_value > _maxValue) { + onTextValueChange(_maxValue.toStringAsFixed(0)); + onValueChange(_maxValue); + return; + } else if (_value < _minValue) { + onTextValueChange(_minValue.toStringAsFixed(0)); + onValueChange(_minValue); + return; + } else if (_value >= _minValue && _value <= _maxValue) { + onValueChange(_value); + return; + } + }, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), + ], + style: TextStyle( + color: Color(0xff575757), + letterSpacing: -0.56, + ), + decoration: InputDecoration( + isDense: true, + hintText: "0", + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56, ), - decoration: InputDecoration( - isDense: true, - hintText: "0", - hintStyle: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), - ], - ), + ), + ], ), - Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), - Expanded( - flex: 1, - child: PopupMenuButton( - child: _commonDropDownView(TranslationBase.of(context).unit, unitTitle, null), - onSelected: (value) { - onUnitTap(value); - }, - itemBuilder: (context) => _list), - ) - ], - ), - ); + ), + Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)), + Expanded( + flex: 1, + child: PopupMenuButton( + child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, null), + onSelected: (value) { + onUnitTap(value); + }, + itemBuilder: (context) => _list), + ) + ], + ).withBorderedContainer; } void _updateUserDetails() async { @@ -627,3 +568,65 @@ class _H2oSettingState extends State { }); } } + +// todo 'sikander' move these to separate file once usability known +class CommonDropDownView extends StatelessWidget { + final String title; + final String value; + final VoidCallback callback; + final IconData iconData; + CommonDropDownView(this.title, this.value, this.callback, {Key key, this.iconData}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: callback, + child: Row( + children: [ + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + title, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.44, + ), + ), + Text( + value, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ]), + ), + Icon( + iconData ?? Icons.keyboard_arrow_down_sharp, + color: Color(0xff2E303A), + ) + ], + ), + ); + } +} + +extension BorderedContainer on Widget { + Widget get withBorderedContainer => Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: this, + ); +} diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index fe385ade..accd6887 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -1,7 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.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'; @@ -18,9 +17,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:wave/config.dart'; import 'package:wave/wave.dart'; -import 'Dialog/confirm_add_amount_dialog.dart'; -import 'add_custom_amount.dart'; - class TodayPage extends StatefulWidget { TodayPage({Key key}) : super(key: key); diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart deleted file mode 100644 index 9b876cc1..00000000 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'dart:math' as math; - -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; - -import '../add_custom_amount.dart'; - - -// todo 'sikander' remove useless code - - -// class H20FloatingActionButton extends StatefulWidget { -// const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); -// -// final H2OViewModel model; -// -// @override -// _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); -// } -// -// class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { -// AnimationController _controller; -// @override -// void initState() { -// _controller = new AnimationController( -// vsync: this, -// duration: const Duration(milliseconds: 500), -// ); -// super.initState(); -// } -// -// void showConfirmMessage(int amount, H2OViewModel model) { -// showDialog( -// context: context, -// child: ConfirmAddAmountDialog( -// model: model, -// amount: amount, -// ), -// ); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 20, right: 20), -// child: new Column(mainAxisSize: MainAxisSize.min, children: [ -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.end, -// children: [ -// ActionButton( -// controller: _controller, -// text: "600${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(600, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "330${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(330, widget.model); -// }, -// ), -// ActionButton( -// controller: _controller, -// text: "200${TranslationBase.of(context).ml}", -// onTap: () { -// showConfirmMessage(200, widget.model); -// }, -// ), -// ], -// ), -// ], -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.start, -// children: [ -// FloatingActionButton( -// heroTag: null, -// child: new AnimatedBuilder( -// animation: _controller, -// builder: (BuildContext context, Widget child) { -// return new Transform( -// transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), -// alignment: FractionalOffset.center, -// child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), -// ); -// }, -// ), -// onPressed: () { -// if (_controller.isDismissed) { -// _controller.forward(); -// } else { -// _controller.reverse(); -// } -// }, -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// // mini: true, -// child: Text( -// TranslationBase.of(context).custom, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12, color: Colors.grey), -// ), -// onPressed: () { -// Navigator.push( -// context, -// FadePage( -// page: AddCustomAmount( -// model: widget.model, -// ), -// ), -// ); -// }, -// ), -// ), -// ), -// new Container( -// margin: EdgeInsets.only(left: 8, bottom: 4), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// backgroundColor: Colors.white, -// heroTag: null, -// //mini: true, -// child: Text( -// TranslationBase.of(context).undo, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: undoVolume, -// ), -// ), -// ), -// ], -// ), -// ]), -// ); -// } -// -// void undoVolume() async { -// GifLoaderDialogUtils.showMyDialog(context); -// await widget.model.undoUserActivity(); -// GifLoaderDialogUtils.hideDialog(context); -// } -// } -// -// class ActionButton extends StatelessWidget { -// const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) -// : _controller = controller, -// super(key: key); -// -// final AnimationController _controller; -// final String text; -// final Function onTap; -// -// @override -// Widget build(BuildContext context) { -// return Container( -// margin: EdgeInsets.only(left: 4, bottom: 8), -// alignment: FractionalOffset.topCenter, -// child: new ScaleTransition( -// scale: new CurvedAnimation( -// parent: _controller, -// curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), -// ), -// child: new FloatingActionButton( -// heroTag: null, -// backgroundColor: Colors.white, -// //mini: true, -// child: Text( -// text, -// textAlign: TextAlign.center, -// style: TextStyle(fontSize: 12.0, color: Colors.grey), -// ), -// onPressed: onTap), -// ), -// ); -// } -// } diff --git a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart index b38e3f63..bbd73d64 100644 --- a/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart +++ b/lib/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class HealthWeatherIndicator extends StatefulWidget { @@ -26,6 +27,8 @@ class _HospitalsPageState extends State { LocationUtils locationUtils; var weather = '--'; + ProjectViewModel projectViewModel; + @override void initState() { locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); @@ -36,7 +39,7 @@ class _HospitalsPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getWeatherData(), allowAny: true, @@ -49,28 +52,25 @@ class _HospitalsPageState extends State { body: mode.weatherIndicatorData.length > 0 ? SingleChildScrollView( child: Column(children: [ - AspectRatio( - aspectRatio: 1.8, - child: Container( - width: double.infinity, - height: double.infinity, - decoration: containerRadiusWithGradient(0, - color1: timeCalculator(6, 0, 10, 59) - ? Color(0xFFB3E3FE) - : timeCalculator(11, 0, 15, 59) - ? Color(0xFFFF9E7E) - : Color(0xFF2E6686), - color2: timeCalculator(6, 0, 10, 59) - ? Color(0xFF9AC7FF) - : timeCalculator(11, 0, 15, 59) - ? Color(0xFFFECB50) - : Color(0xFF122F48)), - child: Padding( - padding: const EdgeInsets.all(30.0), - child: Stack( - alignment: projectViewModel.isArabic ? Alignment.centerLeft : Alignment.centerRight, - children: [ - Column( + Container( + width: double.infinity, + decoration: containerRadiusWithGradient(0, + color1: timeCalculator(6, 0, 10, 59) + ? Color(0xFFB3E3FE) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFF9E7E) + : Color(0xFF2E6686), + color2: timeCalculator(6, 0, 10, 59) + ? Color(0xFF9AC7FF) + : timeCalculator(11, 0, 15, 59) + ? Color(0xFFFECB50) + : Color(0xFF122F48)), + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Row( + children: [ + Expanded( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Directionality( @@ -78,7 +78,7 @@ class _HospitalsPageState extends State { child: Text( weather, style: TextStyle( - fontSize: 30, + fontSize: 24, letterSpacing: -0.83, fontWeight: FontWeight.bold, color: Colors.white, @@ -94,11 +94,10 @@ class _HospitalsPageState extends State { color: Colors.white, ), ), - mFlex(1), Text( TranslationBase.of(context).healthWeatherIndicators, style: TextStyle( - fontSize: 16, + fontSize: 12, letterSpacing: -0.96, fontWeight: FontWeight.bold, color: Colors.white, @@ -107,7 +106,7 @@ class _HospitalsPageState extends State { Text( TranslationBase.of(context).healthTipsBasedOnCurrentWeather, style: TextStyle( - fontSize: 12, + fontSize: 10, letterSpacing: -0.72, fontWeight: FontWeight.w600, color: Colors.white, @@ -115,12 +114,11 @@ class _HospitalsPageState extends State { ), ], ), - Image.asset( - "assets/images/Weather_ico.png", - color: Colors.white.withOpacity(0.5), - ), - ], - ), + ), + SvgPicture.asset( + "assets/images/new/cloudy.svg", + ), + ], ), ), ), @@ -135,7 +133,7 @@ class _HospitalsPageState extends State { padding: EdgeInsets.all(15), child: Column( children: mode.weatherIndicatorData.map((data) { - return WeatherSlider(data); + return WeatherSlider(data, projectViewModel); }).toList())) ])) : Center(child: AppCircularProgressIndicator())), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart index ae7a35a7..13de0140 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart @@ -1,9 +1,15 @@ +import 'dart:collection'; + import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -61,9 +67,7 @@ class _BariatricsPageState extends State { activeColor: Colors.blue.shade700, value: item.diseasesID, groupValue: _selectedDisease != null ? _selectedDisease.diseasesID : -1, - selected: _selectedDisease != null - ? item.diseasesID == _selectedDisease.diseasesID - : false, + selected: _selectedDisease != null ? item.diseasesID == _selectedDisease.diseasesID : false, onChanged: (val) { setState(() { _selectedDisease = item; @@ -95,10 +99,14 @@ class _BariatricsPageState extends State { radius: 8, fontWeight: FontWeight.bold, handler: () async { - Navigator.push( - context, - FadePage(page: DoctorList(diseaseByClinic: _selectedDisease,)), - ); + callDoctorsSearchAPI(); + // Navigator.push( + // context, + // FadePage( + // page: DoctorList( + // diseaseByClinic: _selectedDisease, + // )), + // ); }, ), ), @@ -116,10 +124,11 @@ class _BariatricsPageState extends State { borderColor: Color(0x00000000), fontWeight: FontWeight.bold, handler: () async { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + callDoctorsSearchAPI(); + // Navigator.push( + // context, + // FadePage(page: DoctorList()), + // ); }, ), ), @@ -129,6 +138,65 @@ class _BariatricsPageState extends State { ); } + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(108, 0, false, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err); + }); + } + + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) + .then((value) { + setState(() { + // dropdownValue = null; + }); + // getProjectsList(); + }); + } + _getImageName(int gender, double obeseResult, bool isArabic) { String path = "assets/images/BMI/"; double result = obeseResult; diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart index 0e22c7ae..ad35c61d 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -1,4 +1,5 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -123,7 +124,9 @@ class _BmrCalculatorState extends State { return AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: 'Bmr Calculator', + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bmr, showHomeAppBarIcon: false, appBarIcons: [ Padding( diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart index 6e7d6279..e1409ee5 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -1,4 +1,8 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -9,13 +13,17 @@ import 'package:percent_indicator/circular_percent_indicator.dart'; class BmrResultPage extends StatelessWidget { final double bmrResult; final double calories; + BmrResultPage({this.bmrResult, this.calories}); + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: 'BMR Calculator', + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bmr, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -58,16 +66,66 @@ class BmrResultPage extends StatelessWidget { Container( width: 350, child: Button( - label: 'See List Of Doctors', + label: TranslationBase.of(context).viewDocList, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }), ), ], ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 3).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart index afbc9f1c..7b32c840 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -210,8 +211,10 @@ class _BodyFatState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Body Fat', - showHomeAppBarIcon: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bodyFatTitle, appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart index f41f9598..9ba23a1e 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart @@ -1,4 +1,8 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -12,7 +16,9 @@ class FatResult extends StatelessWidget { final String textResult; FatResult({this.bodyFat, this.fat, this.textResult = ''}); + Color inductorColor; + Color colorInductor() { if (bodyFat >= 17) { inductorColor = Color(0xffC70D00); @@ -30,7 +36,10 @@ class FatResult extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Body Fat', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).bodyFatTitle, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -69,12 +78,9 @@ class FatResult extends StatelessWidget { Container( width: 350, child: Button( - label: 'See List Of Doctors', + label: TranslationBase.of(context).viewDocList, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), @@ -82,4 +88,57 @@ class FatResult extends StatelessWidget { ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 5).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart index ed3dd8f8..749bf241 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -1,4 +1,7 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -15,9 +18,11 @@ class CalorieResultPage extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - isShowDecPage: false, appBarTitle: "${TranslationBase.of(context).calories} ${TranslationBase.of(context).calculators}", isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -52,12 +57,9 @@ class CalorieResultPage extends StatelessWidget { Container( width: 350, child: Button( - label: 'See List Of Doctors', + label: TranslationBase.of(context).viewDocList, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), @@ -65,4 +67,57 @@ class CalorieResultPage extends StatelessWidget { ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 2).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart index 7d8f4655..4b68687a 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -81,8 +82,10 @@ class _CarbsState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Carb Protein Fat', - showHomeAppBarIcon: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).carbohydrate, appBarIcons: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart index 71055d7b..46c14ee0 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -1,5 +1,9 @@ -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -32,7 +36,10 @@ class CarbsResult extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Carb Protein Fat', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).carbohydrate, body: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -156,27 +163,68 @@ class CarbsResult extends StatelessWidget { Container( width: 350, child: Button( - label: 'See List Of Doctors', + label: TranslationBase.of(context).viewDocList, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), ], ), - - // Texts(pCal.ceil().toString()), - // Texts(cCal.ceil().toString()), - // Texts(fCal.ceil().toString()), - // Texts(pCalGram.ceil().toString()), - // Texts(cCalGram.ceil().toString()), - // Texts(fCalGram.ceil().toString()), - // Texts(pCalMeal.ceil().toString()), - // Texts(cCalMeal.ceil().toString()), - // Texts(fCalMeal.ceil().toString()), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 11).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + } diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart index 84f76153..e8d89b13 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -1,4 +1,5 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -100,7 +101,10 @@ class _IdealBodyState extends State { Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Ideal Body Weight', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).idealBody, showHomeAppBarIcon: false, appBarIcons: [ Padding( diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart index 311b423a..6a40bee7 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -1,5 +1,8 @@ - -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -14,11 +17,15 @@ class IdealBodyResult extends StatelessWidget { final String textResult; IdealBodyResult({this.idealBodyWeight, this.minRange, this.mixRange, this.overWeightBy, this.textResult}); + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: 'Ideal Body Weight', + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).idealBody, body: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -81,8 +88,7 @@ class IdealBodyResult extends StatelessWidget { children: [ Texts('This means that the weight is a little bit more than ideal weight by'), Texts(overWeightBy.toStringAsFixed(1)), - Texts( - 'May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + Texts('May wish to consult with the doctor for medical help. Click to view our list of Doctors'), ], ) : overWeightBy >= 18 @@ -104,8 +110,7 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 25.0, ), - Texts( - 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), ], ), ) @@ -148,20 +153,16 @@ class IdealBodyResult extends StatelessWidget { SizedBox( height: 25.0, ), - Texts( - 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + Texts('May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), ], ), ), Container( width: 350, child: Button( - label: 'See List Of Doctors', + label: TranslationBase.of(context).viewDocList, onTap: () { - Navigator.push( - context, - FadePage(page: DoctorList()), - ); + getDoctorsList(context); }, ), ), @@ -169,4 +170,57 @@ class IdealBodyResult extends StatelessWidget { ), ); } + + getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); + BariatricsService service = new BariatricsService(); + + List doctorsList = []; + List _patientDoctorAppointmentListHospital = List(); + + service.getCalculationDoctors(calculationID: 4).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['List_CalculationTable'].length); + if (res['MessageStatus'] == 1) { + if (res['List_CalculationTable'].length != 0) { + res['List_CalculationTable'].forEach((item) { + DoctorList docList = new DoctorList(); + docList.clinicID = item['ClinicID']; + docList.clinicName = item['ClinicName']; + docList.doctorID = item['DoctorID']; + docList.doctorImageURL = item['DoctorImageURL']; + docList.name = item['DoctorName']; + docList.doctorTitle = item['DoctorTitle']; + docList.gender = item['Gender']; + docList.genderDescription = item['GenderDescription']; + docList.nationalityName = item['Nationality']; + docList.nationalityFlagURL = item['NationalityFlagURL']; + docList.projectID = item['ProjectID']; + docList.projectName = item['ProjectName']; + docList.actualDoctorRate = 0; + doctorsList.add(docList); + }); + + doctorsList.forEach((element) { + List doctorByHospital = _patientDoctorAppointmentListHospital + .where( + (elementClinic) => elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element); + } else { + _patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: "0", patientDoctorAppointment: element)); + } + }); + + Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: doctorsList, patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital))); + } + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } } diff --git a/lib/pages/AlHabibMedicalService/health_converter.dart b/lib/pages/AlHabibMedicalService/health_converter.dart index 27c2a05c..c4ad7760 100644 --- a/lib/pages/AlHabibMedicalService/health_converter.dart +++ b/lib/pages/AlHabibMedicalService/health_converter.dart @@ -26,12 +26,8 @@ class _HealthConverterState extends State { appBarTitle: TranslationBase.of(context).converters, body: Column( children: [ - Container( - width: double.infinity, - height: 30, - ), Padding( - padding: EdgeInsets.only(left: 12, right: 12), + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), child: GridView.builder( shrinkWrap: true, primary: false, @@ -59,9 +55,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).bloodSugar, - imagePath: 'assets/images/new-design/blood_sugar_icon.png', + imagePath: 'sugar-blood-level.svg', subTitle: TranslationBase.of(context).sugar, - isPngImage: true, + isPngImage: false, ), )); @@ -72,9 +68,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).bloodCholesterol, - imagePath: 'assets/images/new-design/blood_cholesterol_icon.png', + imagePath: 'cholesterol.svg', subTitle: TranslationBase.of(context).cholesterol, - isPngImage: true, + isPngImage: false, ), )); @@ -85,9 +81,9 @@ class _HealthConverterState extends State { ), child: MedicalProfileItem( title: TranslationBase.of(context).triglycerides, - imagePath: 'assets/images/new-design/triglycerides_blood_icon.png', + imagePath: 'fat.svg', subTitle: TranslationBase.of(context).fatInBlood, - isPngImage: true, + isPngImage: false, ), )); return medical; diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index faa3af72..af93afa4 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -1,12 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xffD02127); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class BloodCholesterol extends StatefulWidget { @override @@ -18,7 +19,6 @@ class _BloodCholesterolState extends State { Color cardMMOLColor = inactiveCardColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -51,227 +51,246 @@ class _BloodCholesterolState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 38.67; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).bloodCholesterol, + appBarTitle: TranslationBase.of(context).cholesTitle, isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, body: Padding( padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 350.0, - child: Text( - TranslationBase.of(context).convertCholesterolStatement, - //textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0), - ), - ), - SizedBox( - height: 15.0, - ), - Container( - color: Colors.white, - height: 120.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - //crossAxisAlignment: CrossAxisAlignment.end, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).cholesTitle, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertCholesterolStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 13.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + inputValue = double.parse(textController.text); + inputValue = inputValue / conversionConst; + unit = 'mmol/l'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ], + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('MG/DLt to MMOL/L', + textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + ), ), ), SizedBox( - height: 9.0, + width: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - inputValue = - double.parse(textController.text); - inputValue = inputValue / conversionConst; - unit = 'mmol/l'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Texts('MG/DLt TO \nMMOL/L'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - inputValue = - double.parse(textController.text); - inputValue = inputValue * conversionConst; - unit = 'mg/dlt'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Texts('MG/DLt TO\n MMOL/L'), - ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text('MMOL/L to MG/DLt', + textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), ), ), - ], + ), ), ], ), - ), + ], ), - SizedBox( - height: 25.0, - ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController), + SizedBox( + height: 12.0, + ), + Visibility( + visible: _visible, + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), + ), + SizedBox( + height: 15.0, + ), + ], + ), + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate, + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateBloodCholesterol(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ":"), - Row( - children: [ - Text( - inputValue.toStringAsFixed(3).toString(), - style: TextStyle(fontSize: 35.0), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - Padding( - padding: EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - ], - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - Flexible( - child: Container( - height: 60.0, - width: 150.0, - child: SecondaryButton( - label: TranslationBase.of(context).calculate, - onTap: () { - setState(() { - _visible == false - ? _visible = !_visible - : _visible = _visible; - calculateBloodCholesterol(); - }); - }, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index ebc41150..4604c3df 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xffD02127); -const activeTextColor = Color(0xffFAFAFA); -const inactiveCardColor = Color(0xffFAFAFA); -const inactiveTextColor = Color(0xff60686B); +const activeCardColor = CustomColors.green; +const activeTextColor = CustomColors.black; +const inactiveCardColor = CustomColors.white; +const inactiveTextColor = CustomColors.black; class BloodSugar extends StatefulWidget { @override @@ -25,7 +25,6 @@ class _BloodSugarState extends State { Color textMMOLColor = inactiveTextColor; void updateColor(int type) { - //MG/DLT card if (type == 1) { if (cardMGColor == inactiveCardColor) { cardMGColor = activeCardColor; @@ -59,10 +58,12 @@ class _BloodSugarState extends State { inputValue = inputValue * 18; unit = 'mg/dlt'; } + setState(() {}); } bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0; @@ -90,210 +91,222 @@ class _BloodSugarState extends State { Expanded( child: SingleChildScrollView( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).bloodSugar, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.symmetric(horizontal: 8), - child: Text( - TranslationBase.of(context).convertBloodSugarStatement, - style: TextStyle(fontSize: 20.0), - ), + margin: EdgeInsets.only(top: 10.0), + child: Text(TranslationBase.of(context).convertBloodSugarStatement, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), ), SizedBox( height: 12.0, ), Container( - color: Colors.white, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8), - child: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( - children: [ - Texts( - TranslationBase.of(context).convertFrom, - ) - ], - ), - ), - SizedBox( - height: 8.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - width: 16.0, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColor(1); - calculateBloodSugar(); - }); - }, - child: Container( - height: 65.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 1, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: BorderRadius.circular(3.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 8.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 18.0), - child: Texts( - 'MG/DLt TO \nMMOL/L', - color: textMGColor, + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MG/DLt to MMOL/L', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), ), - SizedBox( - width: 12.0, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - updateColor(2); - calculateBloodSugar(); - }); - }, - child: Container( - height: 65.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], + ), + SizedBox( + width: 12.0, + ), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + calculateBloodSugar(); + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Texts( - 'MMOL/L TO MG/DLt ', - color: textMMOLColor, + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MMOL/L to MG/DLt', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), ), - SizedBox( - width: 16.0, - ), - ], - ), - ], - ), + ), + ], + ), + ], ), ), SizedBox( - height: 24.0, - ), - Container( - height: 65.0, - padding: EdgeInsets.symmetric(horizontal: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, - ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], - keyboardType: TextInputType.number, - decoration: InputDecoration( - labelText: TranslationBase.of(context).enterReadingValue, - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - disabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: Colors.white), - ), - border: UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)), - labelStyle: TextStyle( - color: Colors.black87, - ), - ), - ), + height: 12.0, ), + inputWidget(TranslationBase.of(context).enterReadingValue, '0.0', textController), SizedBox( - height: 24.0, + height: 12.0, ), Visibility( visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ": "), - Row( - children: [ - Text( - inputValue.toStringAsFixed(2), - style: TextStyle(fontSize: 35.0), - ), - Padding( - padding: EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - ], - ), - ), - ), + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), ), ], ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16), - child: DefaultButton(TranslationBase.of(context).calculate, () { - setState(() { - _visible == false ? _visible = !_visible : _visible = _visible; - calculateBloodSugar(); - }); - }), + ], + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate, + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateBloodSugar(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index b9571d2b..e441d935 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -1,13 +1,13 @@ +import 'package:diplomaticquarterapp/theme/colors.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/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -const activeCardColor = Color(0xff70777A); -const inactiveCardColor = Color(0xffFAFAFd); +const activeCardColor = CustomColors.green; +const inactiveCardColor = CustomColors.white; class Triglycerides extends StatefulWidget { @override @@ -18,6 +18,7 @@ class _TriglyceridesState extends State { Color cardMGColor = inactiveCardColor; Color cardMMOLColor = inactiveCardColor; int type; + void updateColor(type) { //MG/DLT card if (type == 1) { @@ -52,12 +53,20 @@ class _TriglyceridesState extends State { bool _visible = false; TextEditingController textController = new TextEditingController(); + TextEditingController resultTextController = new TextEditingController(); String finalValue; double inputValue = 0.0; String unit; double conversionConst = 88.57; + @override + void initState() { + updateColor(1); + unit = 'mmol/l'; + super.initState(); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -68,210 +77,226 @@ class _TriglyceridesState extends State { showNewAppBarTitle: true, body: Padding( padding: const EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 350.0, - child: Text( - TranslationBase.of(context).triglyceridesConvertStatement, - //textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0), - ), - ), - SizedBox( - height: 15.0, - ), - Container( - color: Colors.white, - height: 120.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - //crossAxisAlignment: CrossAxisAlignment.end, + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container(child: Text(TranslationBase.of(context).triglycerides, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: + Text(TranslationBase.of(context).triglyceridesConvertStatement, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 12.0, + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text(TranslationBase.of(context).convertFrom, style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + ), + SizedBox( + height: 9.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Row( - children: [ - Texts(TranslationBase.of(context).convertFrom) - ], + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(1); + inputValue = double.parse(textController.text); + inputValue = inputValue / conversionConst; + unit = 'mmol/l'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), + border: Border.all(width: 2, color: cardMGColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MG/DLt to MMOL/L', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), + ), + ), + ), ), ), SizedBox( - height: 9.0, + width: 12.0, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - GestureDetector( - onTap: () { - setState(() { - updateColor(1); - inputValue = - double.parse(textController.text); - inputValue = inputValue / conversionConst; - unit = 'mmol/l'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - color: cardMGColor, - borderRadius: BorderRadius.circular(3.0), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 0.0, horizontal: 18.0), - child: Texts('MG/DLt TO \nMMOL/L'), + Expanded( + child: GestureDetector( + onTap: () { + setState(() { + updateColor(2); + inputValue = double.parse(textController.text); + inputValue = inputValue * conversionConst; + unit = 'mg/dlt'; + }); + }, + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), + border: Border.all(width: 2, color: cardMMOLColor), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white, ), - ), - GestureDetector( - onTap: () { - setState(() { - updateColor(2); - inputValue = - double.parse(textController.text); - inputValue = inputValue * conversionConst; - unit = 'mg/dlt'; - }); - }, - child: Container( - height: 65.0, - width: 150.0, - decoration: BoxDecoration( - color: cardMMOLColor, - borderRadius: BorderRadius.circular(3.0), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 3, - blurRadius: 7, - offset: Offset( - 0, 3), // changes position of shadow - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0), - child: Texts('MG/DLt TO\n MMOL/L'), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'MMOL/L to MG/DLt', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 13.0, letterSpacing: -0.64, color: CustomColors.darkGrey), ), ), ), - ], + ), ), ], ), - ), - ), - SizedBox( - height: 25.0, + ], ), - Container( - height: 65.0, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Colors.white, + ), + SizedBox( + height: 12.0, + ), + inputWidget(TranslationBase.of(context).enterReadingValue, "0.0", textController), + SizedBox( + height: 12.0, + ), + Visibility( + visible: _visible, + child: inputWidget(TranslationBase.of(context).result, inputValue.toStringAsFixed(2) + " " + unit.toString(), resultTextController, isEnable: false), + ), + ], + ), + ), + ), + bottomSheet: Container( + color: CustomColors.white, + padding: EdgeInsets.fromLTRB(12.0, 1.0, 12.0, 25.0), + child: DefaultButton( + TranslationBase.of(context).calculate.toUpperCase(), + () { + setState(() { + _visible == false ? _visible = !_visible : _visible = _visible; + calculateTriglycerides(); + }); + }, + color: CustomColors.green, + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), ), - child: TextFormField( - controller: textController, - inputFormatters: [ -// FilteringTextInputFormatter.digitsOnly - ], + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: BorderSide(color: Colors.black45)), - labelText: TranslationBase.of(context).enterReadingValue, - labelStyle: TextStyle( - color: Colors.black87, + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, ), - ), - ), - ), - SizedBox( - height: 25.0, - ), - Visibility( - visible: _visible, - child: Container( - height: 115.0, - width: 350.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all(color: Colors.black), - borderRadius: BorderRadius.circular(15.0), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Texts(TranslationBase.of(context).result + ":"), - Row( - children: [ - Text( - inputValue.toStringAsFixed(2), - style: TextStyle(fontSize: 35.0), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - Padding( - padding: EdgeInsets.only(left: 4.0, top: 10.0), - child: Text( - unit.toString(), - style: TextStyle( - color: Color(0xffC5273A), - fontSize: 15.0, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - ), - ], - ), - ), - ), - ), - SizedBox( - height: 10.0, - ), - Flexible( - child: Container( - height: 60.0, - width: 250.0, - child: SecondaryButton( - label: - TranslationBase.of(context).calculate.toUpperCase(), - onTap: () { - setState(() { - _visible == false - ? _visible = !_visible - : _visible = _visible; - calculateTriglycerides(); - }); - }, + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, ), ), - ), - ], + ], + ), ), - ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], ), ), ); diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index 5dce5b15..341a298d 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -50,18 +50,23 @@ class _HealthCalculatorsState extends State with SingleTicker children: [ TabBar( controller: _tabController, - isScrollable: true, - indicatorWeight: 4.0, - indicatorColor: Colors.red, - labelColor: Theme.of(context).buttonColor, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - unselectedLabelColor: Colors.grey, labelStyle: TextStyle( fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ Container( width: MediaQuery.of(context).size.width * 0.35, @@ -83,11 +88,11 @@ class _HealthCalculatorsState extends State with SingleTicker controller: _tabController, children: [ Container( - margin: EdgeInsets.all(20.0), + // margin: EdgeInsets.all(20.0), child: Column( children: [ Padding( - padding: EdgeInsets.only(left: 12, right: 12), + padding: EdgeInsets.only(left: 12, right: 12, top: 20.0), child: GridView.builder( shrinkWrap: true, primary: false, diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index e3888240..8fb12f33 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -1,8 +1,8 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; + //import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; @@ -10,14 +10,15 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -25,12 +26,6 @@ import 'package:flutter/material.dart'; import 'package:giffy_dialog/giffy_dialog.dart'; import 'package:provider/provider.dart'; -import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectBloodDialog.dart'; -import 'dialogs/SelectGenderDialog.dart'; -import 'dialogs/SelectPatientFamilyDialog.dart'; -import 'dialogs/SelectPatientInfoDialog.dart'; - enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } enum Gender { Male, Female, NON } enum Blood { Oplus, Ominus, Aplus, Aminus, Bplus, Bminus, ABplus, ABminus, NON } @@ -44,11 +39,16 @@ class _BloodDonationPageState extends State { TextEditingController _fileTextController = TextEditingController(); TextEditingController _notesTextController = TextEditingController(); BeneficiaryType beneficiaryType = BeneficiaryType.NON; - Gender gender = Gender.Male; //Gender.NON; - Blood blood = Blood.Aminus; //Blood.NON; + + // Gender gender = Gender.Male; //Gender.NON; + // Blood blood = Blood.Aminus; //Blood.NON; //HospitalsModel _selectedHospital; CitiesModel _selectedHospital; + int _selectedHospitalIndex = 0; + int _selectedGenderIndex = 1; + int _selectedBloodTypeIndex = 0; + String amount = ""; String email; PatientInfo _selectedPatientInfo; @@ -69,7 +69,7 @@ class _BloodDonationPageState extends State { ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/blood/ar/0.png'), ); WidgetsBinding.instance.addPostFrameCallback((_) { - if (projectProvider.isLogin) getAuthUser(); + if (projectProvider.isLogin) authUser = projectProvider.user; }); super.initState(); } @@ -79,404 +79,241 @@ class _BloodDonationPageState extends State { projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCities(), //model.getHospitals(), + onModelReady: (model) { + model.getCities(); + model.getBlood(); + }, builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - baseViewModel: model, - imagesInfo: imagesInfo, - description: TranslationBase.of(context).bloodDonationInfo, - appBarTitle: TranslationBase.of(context).bloodD, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).bloodDEnterDesc - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.CitiesModelList), - //model.hospitals - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(getHospitalName(projectProvider, context), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectGenderDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(getGender(context), color: Colors.black), - Icon(Icons.arrow_drop_down) - ], - ), + isShowAppBar: true, + showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), + showNewAppBarTitle: true, + baseViewModel: model, + imagesInfo: imagesInfo, + description: TranslationBase.of(context).bloodDonationInfo, + appBarTitle: TranslationBase.of(context).bloodD, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).bloodDEnterDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), - ), - SizedBox( - height: 12, - ), - InkWell( - //======Gender======== - onTap: () => confirmSelectBloodDialog(), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(getBlood(), color: Colors.black), Icon(Icons.arrow_drop_down)], - ), - ), - ), - SizedBox( - height: 12, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: Text( + SizedBox(height: 12), + CommonDropDownView( + TranslationBase.of(context).city, + model.bloodModelList.isNotEmpty + ? model.bloodModelList[0].city + : projectProvider.isArabic + ? model.CitiesModelList[_selectedHospitalIndex].descriptionN + : model.CitiesModelList[_selectedHospitalIndex].description, () { + List list = [ + for (int i = 0; i < model.CitiesModelList.length; i++) + RadioSelectionDialogModel(projectProvider.isArabic ? model.CitiesModelList[i].descriptionN : model.CitiesModelList[i].description, i), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = model.CitiesModelList[index]; + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).gender, _selectedGenderIndex == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female, () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).male, 1), + RadioSelectionDialogModel(TranslationBase.of(context).female, 2), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedGenderIndex, + onValueSelected: (index) { + _selectedGenderIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + CommonDropDownView(TranslationBase.of(context).bloodType, model.bloodModelList.isNotEmpty ? model.bloodModelList[0].bloodGroup : getBlood(_selectedBloodTypeIndex), () { + List list = [ + RadioSelectionDialogModel("O+", 0), + RadioSelectionDialogModel("O-", 1), + RadioSelectionDialogModel("AB+", 2), + RadioSelectionDialogModel("AB-", 3), + RadioSelectionDialogModel("A+", 4), + RadioSelectionDialogModel("A-", 5), + RadioSelectionDialogModel("B+", 6), + RadioSelectionDialogModel("B-", 7), + ]; + + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedBloodTypeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedBloodTypeIndex = index; + setState(() {}); + }, + ), + ); + }).withBorderedContainer, + SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( TranslationBase.of(context).viewTermsConditions + ":", - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, color: Color(0xff2E303A), fontSize: 14, letterSpacing: -0.56), ), - ), - InkWell( - onTap: () { - Navigator.of(context).push(FadePage(page: UserAgreementPage())); - }, - child: Container( - child: Texts( + InkWell( + onTap: () { + Navigator.of(context).push(FadePage(page: UserAgreementPage())); + }, + child: Text( TranslationBase.of(context).clickHere, - color: Colors.blue, - fontSize: 14.0, + style: TextStyle(fontWeight: FontWeight.w600, color: Colors.blue, fontSize: 14, letterSpacing: -0.56), ), + ) + ], + ), + SizedBox(height: 12), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + value: checkedValue, + activeColor: Color(0xFFc5272d), + ), + Text( + TranslationBase.of(context).iAgreeToTheTermsAndConditions, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), ), - ) - ], - ), - SizedBox( - height: 12, - ), - Row( - children: [ - Checkbox( - onChanged: (bool value) { - setState(() { - checkedValue = value; - }); - }, - value: checkedValue, - activeColor: Color(0xFFc5272d), - ), - Text( - TranslationBase.of(context).iAgreeToTheTermsAndConditions, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ], - ), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Container( - color: Theme.of(context).primaryColor, - width: 350, - child: InkWell( - onTap: () { - showDialog( + ], + ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + color: Theme.of(context).primaryColor, + width: 350, + child: InkWell( + onTap: () { + showDialog( context: context, builder: (_) => AssetGiffyDialog( - title: Text( - "", - style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), - ), - image: Image.asset('assets/images/BloodChrt_EN.png'), - buttonCancelText: Text(TranslationBase.of(context).cancel), - buttonCancelColor: Colors.grey, - onlyCancelButton: true, - )); - }, - child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + title: Text( + "", + style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600), + ), + image: Image.asset('assets/images/BloodChrt_EN.png'), + buttonCancelText: Text(TranslationBase.of(context).cancel), + buttonCancelColor: Colors.grey, + onlyCancelButton: true, + ), + ); + }, + child: Container(width: 250, height: 200, child: Image.asset('assets/images/BloodChrt_EN.png'), color: Colors.white), + ), ), ), - ), - ], - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + ], + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(20), - child: DefaultButton(TranslationBase.of(context).save, () async { - if (_selectedHospital == null) { - AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); - return; - } - bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; - bloodDetails.cityCode = _selectedHospital.iD.toString(); - bloodDetails.gender = gender == Gender.Male ? 1 : 2; - await model.updateBloodGroup(bloodDetails); - if (model.state == ViewState.Idle) { - AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); - } else { - AppToast.showErrorToast(message: model.error); - } - }), - )), - ); - } - - void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { - showDialog( - context: context, - child: SelectBeneficiaryDialog( - beneficiaryType: beneficiaryType, - onValueSelected: (value) { - setState(() { - if (value == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - beneficiaryType = value; - }); - }, - ), - ); - } - - void confirmSelectBloodDialog() { - showDialog( - context: context, - child: SelectBloodDialog( - bloodType: blood, - onValueSelected: (value) { - setState(() { - if (value == Blood.Oplus) { - bloodDetails.bloodGroup = "O+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Ominus) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.bloodGroup = "O-"; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABplus) { - bloodDetails.bloodGroup = "AB+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.ABminus) { - bloodDetails.bloodGroup = "AB-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aplus) { - bloodDetails.bloodGroup = "A+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Aminus) { - bloodDetails.bloodGroup = "A-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bplus) { - bloodDetails.bloodGroup = "B+"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else if (value == Blood.Bminus) { - bloodDetails.bloodGroup = "B-"; - // _fileTextController.text = model.user.patientID.toString(); - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - // beneficiaryType = value; - blood = value; - }); - }, - ), - ); - } - - void confirmSelectGenderDialog() { - showDialog( - context: context, - child: SelectGenderDialog( - beneficiaryType: gender, - onValueSelected: (value) { - setState(() { - if (value == Gender.Male) { - // _fileTextController.text = model.user.patientID.toString(); - bloodDetails.patientType = 1; - // advanceModel.depositorName = - // model.user.firstName + " " + model.user.lastName; - } else - // _fileTextController.text = ""; - { - bloodDetails.gender = 2; - } - - // beneficiaryType = value; - gender = value; - }); - }, + DefaultButton( + TranslationBase.of(context).save, + checkedValue + ? () async { + if (_selectedHospital == null) { + AppToast.showErrorToast(message: TranslationBase.of(context).selectCity); + return; + } + bloodDetails.city = projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; + bloodDetails.cityCode = _selectedHospital.iD.toString(); + bloodDetails.gender = _selectedGenderIndex; + bloodDetails.bloodGroup = getBlood(_selectedBloodTypeIndex); + await model.updateBloodGroup(bloodDetails); + if (model.state == ViewState.Idle) { + AppToast.showSuccessToast(message: model.updatedRegisterBloodMessage); + } else { + AppToast.showErrorToast(message: model.error); + } + } + : null, + disabledColor: CustomColors.grey2, + ).insideContainer + ], + ), ), ); } -//void confirmSelectHospitalDialog(List hospitals) { - void confirmSelectHospitalDialog(List hospitals) { - showDialog( - context: context, - child: SelectCiteisDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); - }, - ), - ); - } - - void confirmSelectPatientDialog(List patientInfoList) { - showDialog( - context: context, - child: SelectPatientInfoDialog( - patientInfoList: patientInfoList, - selectedPatientInfo: _selectedPatientInfo, - onValueSelected: (value) { - setState(() { - advanceModel.depositorName = value.fullName; - _selectedPatientInfo = value; - }); - }, - ), - ); - } - - void confirmSelectFamilyDialog(List getAllSharedRecordsByStatusList) { - showDialog( - context: context, - child: SelectPatientFamilyDialog( - getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, - selectedPatientFamily: selectedPatientFamily, - onValueSelected: (value) { - setState(() { - selectedPatientFamily = value; - _fileTextController.text = selectedPatientFamily.patientID.toString(); - advanceModel.depositorName = value.patientName; - }); - }, - ), - ); - } - - String getBeneficiaryType() { - switch (beneficiaryType) { - case BeneficiaryType.MyAccount: - return TranslationBase.of(context).myAccount; - case BeneficiaryType.MyFamilyFiles: - return TranslationBase.of(context).myFamilyFiles; - break; - case BeneficiaryType.OtherAccount: - return TranslationBase.of(context).otherAccount; - break; - case BeneficiaryType.NON: - return TranslationBase.of(context).selectBeneficiary; - } - return TranslationBase.of(context).selectBeneficiary; - } - - String getGender(BuildContext context) { - switch (gender) { - case Gender.Male: - return TranslationBase.of(context).male; - case Gender.Female: - return TranslationBase.of(context).female; - break; - - case Gender.NON: - return TranslationBase.of(context).selectGender; - } - return TranslationBase.of(context).selectGender; - } - - String getBlood() { - switch (blood) { - case Blood.Oplus: + String getBlood(int index) { + switch (index) { + case 0: return "O+"; break; - case Blood.Ominus: + case 1: return "O-"; break; - case Blood.ABplus: + case 2: return "AB+"; break; - case Blood.ABminus: + case 3: return "AB-"; break; - case Blood.Aplus: + case 4: return "A+"; break; - case Blood.Aminus: + case 5: return "A-"; break; - case Blood.Bplus: + case 6: return "B-"; break; - case Blood.Bminus: + case 7: return "B-"; break; - case Blood.Bplus: + case 8: return "B+"; break; - case Blood.NON: - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; + default: + return ""; } - return "Select Blood Type"; //TranslationBase.of(context).selectBeneficiary; } String getHospitalName(ProjectViewModel projectProvider, BuildContext context) { @@ -484,32 +321,5 @@ class _BloodDonationPageState extends State { return projectProvider.isArabic ? _selectedHospital.descriptionN : _selectedHospital.description; else return TranslationBase.of(context).selectCity; - // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; - } - - String getPatientName() { - if (_selectedPatientInfo != null) - return _selectedPatientInfo.fullName; - else - return TranslationBase.of(context).selectPatientName; } - - getAuthUser() async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - } - - String getFamilyMembersName() { - if (selectedPatientFamily != null) - return selectedPatientFamily.patientName; - else - return TranslationBase.of(context).selectFamilyPatientName; - } - -//================ - } diff --git a/lib/pages/Blood/dialogs/SelectBloodDialog.dart b/lib/pages/Blood/dialogs/SelectBloodDialog.dart deleted file mode 100644 index 23e9e753..00000000 --- a/lib/pages/Blood/dialogs/SelectBloodDialog.dart +++ /dev/null @@ -1,328 +0,0 @@ -import 'package:diplomaticquarterapp/pages/Blood/blood_donation.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'; - - -class SelectBloodDialog extends StatefulWidget { - - final Blood bloodType; - final Function(Blood) onValueSelected; - - SelectBloodDialog({Key key, this.bloodType, this.onValueSelected}); - - - - @override - _SelectBloodDialogState createState() => _SelectBloodDialogState(this.bloodType); -} - -class _SelectBloodDialogState extends State { - _SelectBloodDialogState(this.bloodType); - Blood bloodType; - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Container( - child: Column( - children: [ - Divider(), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Oplus; - }); - }, - child: ListTile( - title: Text("O+"), - leading: Radio( - value: Blood.Oplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Ominus; - }); - }, - child: ListTile( - title: Text("O-"), - leading: Radio( - value: Blood.Ominus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.ABminus; - }); - }, - child: ListTile( - title: Text("AB-"), - leading: Radio( - value: Blood.ABminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.ABplus; - }); - }, - child: ListTile( - title: Text("AB+"), - leading: Radio( - value: Blood.ABplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Aplus; - }); - }, - child: ListTile( - title: Text("A+"), - leading: Radio( - value: Blood.Aplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Aminus; - }); - }, - child: ListTile( - title: Text("A-"), - leading: Radio( - value: Blood.Aminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Bplus; - }); - }, - child: ListTile( - title: Text("B+"), - leading: Radio( - value: Blood.Bplus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - bloodType = Blood.Bminus; - }); - }, - child: ListTile( - title: Text("B-"), - leading: Radio( - value: Blood.Bminus, - groupValue: bloodType, - activeColor: Colors.red[800], - onChanged: (Blood value) { - setState(() { - bloodType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(bloodType); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - ), - ], - ) - ], - ), - ) - ], - ); - } -} diff --git a/lib/pages/BookAppointment/LaserBooking.dart b/lib/pages/BookAppointment/LaserBooking.dart new file mode 100644 index 00000000..f1acaf2c --- /dev/null +++ b/lib/pages/BookAppointment/LaserBooking.dart @@ -0,0 +1,127 @@ +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class LaserBooking extends StatefulWidget { + @override + _LaserBookingState createState() => _LaserBookingState(); +} + +class _LaserBookingState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowDecPage: false, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: "Laser", + body: Container( + child: Column( + children: [ + HumanAnatomy(), + ], + ), + )); + } +} + +class HumanAnatomy extends StatefulWidget { + final ValueChanged onChanged; + + const HumanAnatomy({Key key, this.onChanged}) : super(key: key); + + @override + _HumanAnatomyState createState() => new _HumanAnatomyState(); +} + +class _HumanAnatomyState extends State { + var _bodyPartList = []; + + @override + void initState() { + super.initState(); + if (mounted) { + _publishSelection(_bodyPartList); + } + } + + @override + Widget build(BuildContext context) { + return humanAnatomy(); + } + + Widget humanAnatomy() { + return Container( + width: 320.0, + height: 560.0, + child: SizedBox( + child: Stack( + children: [ + bodyPart("assets/images/new/body/head.svg", "Head", 0.0, 0.0, 0.0, 70.0), + bodyPart("assets/images/new/body/left_ear.svg", "leftEar", 32.0, 50.0, 0.0, 20.0), + bodyPart("assets/images/new/body/right_ear.svg", "rightEar", 32.0, 0.0, 50.0, 20.0), + bodyPart("assets/images/new/body/left_eye.svg", "LeftEye", 22.0, 20.0, 0.0, 10.0), + bodyPart("assets/images/new/body/right_eye.svg", "rightEye", 22.0, 0.0, 20.0, 10.0), + bodyPart("assets/images/new/body/nose.svg", "Nose", 25.0, 0.0, 0.0, 20.0), + bodyPart("assets/images/new/body/mouth.svg", "Mouth", 48.0, 0.0, 0.0, 10.0), + bodyPart("assets/images/new/body/neck.svg", "Neck", 58.0, 0.0, 0.0, 40.0), + bodyPart("assets/images/new/body/chest.svg", "Chest", 93.0, 0.0, 0.0, 95.0), + bodyPart("assets/images/new/body/abdomin.svg", "Abdomin", 175.0, 0.0, 0.0, 65.0), + bodyPart("assets/images/new/body/pelvis.svg", "Pelvis", 225.0, 0.0, 0.0, 50.0), + bodyPart("assets/images/new/body/publs.svg", "Publs", 275.0, 0.0, 0.0, 15.0), + bodyPart("assets/images/new/body/left_soulder.svg", "leftSoulder", 90.0, 105.0, 0.0, 50.0), + bodyPart("assets/images/new/body/right_soulder.svg", "rightSoulder", 89.0, 0.0, 110.0, 50.0), + bodyPart("assets/images/new/body/left_arm.svg", "leftArm", 120.0, 145.0, 0.0, 70.0), + bodyPart("assets/images/new/body/right_arm.svg", "rightArm", 118.0, 0.0, 142.0, 70.0), + bodyPart("assets/images/new/body/left_elbow.svg", "leftElbow", 172.0, 172.0, 0.0, 39.0), + bodyPart("assets/images/new/body/right_elbow.svg", "rightElbow", 170.0, 0.0, 170.0, 40.0), + bodyPart("assets/images/new/body/left_forearm.svg", "leftForearm", 195.0, 190.0, 0.0, 54.0), + bodyPart("assets/images/new/body/right_forearm.svg", "rightForearm", 195.0, 0.0, 190.0, 54.0), + bodyPart("assets/images/new/body/left_wrist.svg", "leftWrist", 238.0, 220.0, 0.0, 23.0), + bodyPart("assets/images/new/body/right_wrist.svg", "rightWrist", 238.0, 0.0, 220.0, 23.0), + bodyPart("assets/images/new/body/left_hand.svg", "leftHand", 250.0, 250.0, 0.0, 60.0), + bodyPart("assets/images/new/body/right_hand.svg", "rightHand", 250.0, 0.0, 250.0, 60.0), + bodyPart("assets/images/new/body/left_thigh.svg", "leftThigh", 242.0, 63.0, 0.0, 138.0), + bodyPart("assets/images/new/body/right_thigh.svg", "rightThigh", 242.0, 0.0, 63.0, 138.0), + bodyPart("assets/images/new/body/left_knee.svg", "leftKnee", 360.0, 68.0, 0.0, 48.0), + bodyPart("assets/images/new/body/right_knee.svg", "rightKnee", 360.0, 0.0, 68.0, 48.0), + bodyPart("assets/images/new/body/left_leg.svg", "leftLeg", 395.0, 64.0, 0.0, 105.0), + bodyPart("assets/images/new/body/right_leg.svg", "rightLeg", 393.0, 0.0, 65.0, 106.0), + bodyPart("assets/images/new/body/left_ankle.svg", "leftAnkle", 495.0, 64.0, 0.0, 25.0), + bodyPart("assets/images/new/body/right_ankle.svg", "rightAnkle", 493.0, 0.0, 68.0, 25.0), + bodyPart("assets/images/new/body/left_foot.svg", "leftFoot", 510.0, 80.0, 0.0, 60.0), + bodyPart("assets/images/new/body/right_foot.svg", "rightFoot", 508.0, 0.0, 83.0, 56.0), + ], + ), + ), + ); + } + + Widget bodyPart(String svgPath, String svgName, double marginTop, double marginRight, double marginLeft, double height) { + Color _svgColor = _bodyPartList.contains(svgName) ? Colors.redAccent : null; + final Widget bodyPartSvg = new SvgPicture.asset(svgPath, semanticsLabel: svgName, color: _svgColor); + return Container( + margin: EdgeInsets.only(top: marginTop, right: marginRight, left: marginLeft), + height: height, + alignment: Alignment.topCenter, + child: GestureDetector( + onTap: () { + setState(() { + if (_bodyPartList.contains(svgName)) { + _bodyPartList.remove(svgName); + } else { + _bodyPartList.add(svgName); + } + }); + }, + child: bodyPartSvg), + ); + } + + void _publishSelection(List _bodyPartList) { + if (widget.onChanged != null) { + widget.onChanged(_bodyPartList); + } + } +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 147cb9f9..63e84e96 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -176,9 +177,10 @@ class _SearchByClinicState extends State { ), ], ), - - Container(child: inputWidget("Age", "", ageController),margin: EdgeInsets.only(left: 20, right: 20),), - + Container( + child: inputWidget("Age", "", ageController), + margin: EdgeInsets.only(left: 20, right: 20), + ), ], ), Padding( @@ -421,15 +423,15 @@ class _SearchByClinicState extends State { prefixIcon: prefix == null ? null : Text( - "+" + prefix, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, @@ -446,7 +448,6 @@ class _SearchByClinicState extends State { ); } - void openDropdown(GlobalKey key) { GestureDetector detector; void searchForGestureDetector(BuildContext element) { @@ -537,6 +538,9 @@ class _SearchByClinicState extends State { searchInfo.date = DateTime.now(); navigateToDentalComplaints(context, searchInfo); + } else if (dropdownValue.split("-")[0] == "253") { + // navigateToLaserClinic(context); + callDoctorsSearchAPI(); } else if (dropdownValue.split("-")[1] == "true" // && authProvider.isLogin && // authUser.patientType == 1 @@ -625,6 +629,19 @@ class _SearchByClinicState extends State { }); } + Future navigateToLaserClinic(BuildContext context) async { + Navigator.push( + context, + FadePage( + page: LaserBooking(), + ), + ).then((value) { + setState(() { + dropdownValue = null; + }); + }); + } + Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { isProjectLoaded = false; Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))) diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index dde431e6..6bfac9a7 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -46,17 +46,7 @@ class _SearchByDoctorState extends State { ), ), ), - // Container( - // decoration: BoxDecoration(color: Colors.white), - // child: TextField( - // controller: doctorNameController, - // onChanged: (content) { - // _onDocTextChanged(content); - // }, - // decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())), - // ), inputWidget(TranslationBase.of(context).enterDocName, '', doctorNameController), - ], ), ), @@ -193,7 +183,7 @@ class _SearchByDoctorState extends State { TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, + keyboardType: TextInputType.text, controller: _controller, onChanged: (value) => {_onDocTextChanged(value)}, style: TextStyle( diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index edbd0745..fa526360 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -4,14 +4,12 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model import 'package:diplomaticquarterapp/core/model/childvaccines/create_new_user_model.dart'; import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart'; -import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -27,15 +25,7 @@ class AddNewChildPage extends StatefulWidget { String dateAdd; List _scheduleList = List(); - List daysOfWeek = [ - DayOfWeek.Monday, - DayOfWeek.Tuesday, - DayOfWeek.Wednesday, - DayOfWeek.Thursday, - DayOfWeek.Friday, - DayOfWeek.Saturday, - DayOfWeek.Sunday - ]; + List daysOfWeek = [DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday]; DateTime startDay; DateTime endDay; @@ -43,13 +33,11 @@ class AddNewChildPage extends StatefulWidget { //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { startDay = DateTime.now(); - endDay = - DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); + endDay = DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); int hour = 24; //(24 / frequency).round(); int durations = 24 ~/ hour; for (int count = 0; count < durations; count++) { - _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, - DateTime.now().day, (hour * count))); + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, (hour * count))); } } @@ -81,197 +69,207 @@ class _AddNewChildPageState extends State { @override Widget build(BuildContext context) { - var size = MediaQuery.of(context).size; - return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).vaccination, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SizedBox( - height: 20, - ), - Texts( - TranslationBase.of(context).vaccinationAddChildMsg, - //+model.user.firstName, - textAlign: TextAlign.center, - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).firstName, - controller: _firstTextController, - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).middleName, - controller: _secondTextController, - ), - SizedBox( - height: 12, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).gender, - textAlign: TextAlign.end, - ), - ], - ), - Container( - width: double.infinity, - height: size.height * 0.12, + showNewAppBarTitle: true, + showNewAppBar: true, + body: Container( + child: Column( + children: [ + Expanded( + child: Padding( padding: EdgeInsets.all(12), - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisAlignment: MainAxisAlignment.center, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: Container( - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 1 ? Colors.white : Colors.black, - color: checkedValue == 1 ? Colors.red : Colors.white, - label: TranslationBase.of(context).male, - onTap: () { - setState(() { - checkedValue = 1; - print("checkedValue=" + checkedValue.toString()); - }); + Text( + TranslationBase.of(context).vaccinationAddChildMsg, + //+model.user.firstName, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).firstName, "", _firstTextController), + SizedBox( + height: 12, + ), + inputWidget(TranslationBase.of(context).middleName, "", _secondTextController), - // bloodDetails. - }, - ), + SizedBox( + height: 12, + ), + Text( + TranslationBase.of(context).selectGender, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), ), - Expanded( - child: Container( - color: Colors.white, - child: SecondaryButton( - textColor: - checkedValue == 2 ? Colors.white : Colors.black, - color: checkedValue == 2 ? Colors.red : Colors.white, - label: TranslationBase.of(context).female, - // - onTap: () { + Row( + children: [ + Expanded( + child: Row( + children: [ + Radio( + value: checkedValue, + groupValue: 1, + onChanged: (v) { + setState(() { + checkedValue = 1; + }); + }), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: checkedValue, + groupValue: 2, + onChanged: (v) { + setState(() { + checkedValue = 2; + }); + }), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ], + ), + + //========== + SizedBox( + height: 6, + ), + + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + // minTime: DateTime( + // DateTime.now().year, DateTime.now().month - 1, 1), + minTime: DateTime(1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { setState(() { - checkedValue = 2; - print("checkedValue=" + checkedValue.toString()); + widget.startDay = date; }); - // bloodDetails.city=_selectedHospital.toString(); - - // bloodDetails. }, + currentTime: widget.startDay, + // locale: projectViewModel.localeType + ); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).dob, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + Text( + //getStartDay() + // DateUtil.yearMonthDay(DateTime.now()) + getStartDay(), + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + Icon( + Icons.calendar_today, + color: Color(0xff575757), + size: 18, + ) + ], ), ), - ) + ), + SizedBox( + height: 12, + ), + + //========= ], ), ), - //========== - SizedBox( - height: 6, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).dob, - textAlign: TextAlign.end, - ), - ], - ), - InkWell( - onTap: () { - DatePicker.showDatePicker( - context, - showTitleActions: true, - // minTime: DateTime( - // DateTime.now().year, DateTime.now().month - 1, 1), - minTime: DateTime(1, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - setState(() { - widget.startDay = date; - }); - }, - currentTime: widget.startDay, - // locale: projectViewModel.localeType - ); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(//getStartDay() - // DateUtil.yearMonthDay(DateTime.now()) - getStartDay()), - Icon( - Icons.calendar_today, - color: Colors.black, - ) - ], - ), - ), - ), - SizedBox( - height: 12, - ), - Container( - height: MediaQuery.of(context).size.height * 0.12, - width: double.infinity, - padding: EdgeInsets.all(15), - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue == false - ? Colors.white24 - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: TranslationBase.of(context).add, - // - onTap: () async { - newChild.babyName = _firstTextController.text + - " " + - _secondTextController.text; - newChild.gender = checkedValue.toString(); - newChild.strDOB = getStartDay(); - newChild.tempValue = true; - newChild.isLogin = true; + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(16), + color: Colors.white, + child: DefaultButton( + TranslationBase.of(context).add, + () async { + newChild.babyName = _firstTextController.text + " " + _secondTextController.text; + newChild.gender = checkedValue.toString(); + newChild.strDOB = getStartDay(); + newChild.tempValue = true; + newChild.isLogin = true; - await model.createNewBabyOrders(newChild: newChild); - if (model.isAdded) { - AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully); - Navigator.pop(context, model.isAdded); - } else { - //TODO handling error - } - }, - ), + await model.createNewBabyOrders(newChild: newChild); + if (model.isAdded) { + AppToast.showSuccessToast(message: TranslationBase.of(context).childAddedSuccessfully); + Navigator.pop(context, model.isAdded); + } else { + //TODO handling error + } + }, ), - //========= - ], - ), + ), + ], ), ), // bottomSheet: @@ -313,4 +311,77 @@ class _AddNewChildPageState extends State { ), ); } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, + {VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: _controller, + maxLines: lines, + onChanged: (value) => {setState(() {})}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } } diff --git a/lib/pages/ChildVaccines/new/child_initial_page.dart b/lib/pages/ChildVaccines/new/child_initial_page.dart new file mode 100644 index 00000000..a0deec0c --- /dev/null +++ b/lib/pages/ChildVaccines/new/child_initial_page.dart @@ -0,0 +1,145 @@ +import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'child_vaccine_page.dart'; + +class ChildInitialPage extends StatefulWidget { + @override + _ChildVaccinesPageState createState() => _ChildVaccinesPageState(); +} + +class _ChildVaccinesPageState extends State with SingleTickerProviderStateMixin { + TextEditingController titleController = TextEditingController(); + var checkedValue = false; + String addEmail = ""; + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getUserInformationRequestOrders(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isShowDecPage: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).childVaccineInfo, + imagesInfo: [ + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/0.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/0.png'), + ImagesInfo( + imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/en/1.png', + imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/child-vaccines/ar/1.png') + ], + appBarTitle: TranslationBase.of(context).vaccination, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).welcomeBack, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 16, + ), + Text( + TranslationBase.of(context).msg_email_address_up_to_date, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: FontWeight.w600, + ), + ), + SizedBox( + height: 20, + ), + TextFields( + fillColor: Colors.red, + hintText: model.user != null ? model.user.emailAddress : "", + controller: titleController, + fontSize: 14, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + suffixIcon: checkedValue ? Icons.check_box : Icons.check_box_outline_blank, + onSuffixTap: () { + setState(() { + checkedValue = !checkedValue; + }); + }, + onChanged: (text) { + addEmail = text; + model.user.emailAddress == addEmail ? checkedValue = false : checkedValue = true; + }, + validator: (value) { + if (value == null) { + return model.user.emailAddress; + } else { + return model.user.emailAddress; + } + }, + ), + ], + ), + ), + mFlex(1), + Container( + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(16), + child: Column( + children: [ + if (checkedValue) + SecondaryButton( + textColor: Colors.white, + color: checkedValue == false ? Colors.white24 : CustomColors.green, + label: TranslationBase.of(context).updateEmail, + // + onTap: () { + model.user.emailAddress = addEmail.toString(); + AppToast.showSuccessToast(message: TranslationBase.of(context).updateEmailMsg); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + ), + if (checkedValue) mHeight(16), + DefaultButton( + TranslationBase.of(context).viewListChildren, + () => Navigator.push( + context, + FadePage( + page: ChildVaccinePage(), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/new/child_vaccine_page.dart b/lib/pages/ChildVaccines/new/child_vaccine_page.dart index 2a876cfa..4d8b878c 100644 --- a/lib/pages/ChildVaccines/new/child_vaccine_page.dart +++ b/lib/pages/ChildVaccines/new/child_vaccine_page.dart @@ -1,13 +1,11 @@ import 'package:diplomaticquarterapp/core/model/childvaccines/delete_baby_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -56,13 +54,13 @@ class _ChildPageState extends State with SingleTickerProviderS ); }, child: Container( - margin: EdgeInsets.only(left: 16, right: 16), + margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 0, bottom: index == model.babyInformationModelList.length - 1 ? 16 : 0), decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(12)), color: Colors.white, gradient: LinearGradient( - colors: model.babyInformationModelList[index].gender == 1 + colors: model.babyInformationModelList[index].gender == 2 ? [ Color(0xFFFDA4B0), Color(0xFFFBC8CC), @@ -96,7 +94,7 @@ class _ChildPageState extends State with SingleTickerProviderS ), ), Text( - model.babyInformationModelList[index].gender == 1 ? TranslationBase.of(context).female : TranslationBase.of(context).male, + model.babyInformationModelList[index].genderDescription, style: TextStyle( fontSize: 11, color: selectedColor, @@ -111,7 +109,7 @@ class _ChildPageState extends State with SingleTickerProviderS color: selectedColor, ), ), - Text(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB), + Text(" " + DateUtil.getDayMonthYearDateFormatted(model.babyInformationModelList[index].dOB), style: TextStyle( fontSize: 11, color: selectedColor, @@ -122,43 +120,54 @@ class _ChildPageState extends State with SingleTickerProviderS ], ), ), - InkWell( - onTap: () async { - await model.deleteBabyOrders(newChild: deleteBaby); + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Icon( + Icons.arrow_forward, + size: 18, + ), + mHeight(12), + InkWell( + onTap: () async { + await model.deleteBabyOrders(newChild: deleteBaby); - deleteBaby.babyID = model.babyInformationModelList[index].babyID; + deleteBaby.babyID = model.babyInformationModelList[index].babyID; - await model.deleteBabyOrders(newChild: deleteBaby); - if (model.isDeleted) { - AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); - Navigator.pop(context, model.isDeleted); - } else { - //TODO handling error - } - }, - child: Container( - decoration: containerRadius(Colors.black.withOpacity(0.2), 2000), - padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8), - child: Row( - children: [ - Image.asset( - 'assets/images/new-design/garbage.png', - width: 16, - color: selectedColor, - ), - mWidth(8), - Text( - TranslationBase.of(context).deleteView, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - letterSpacing: -0.33, - color: selectedColor, - ), + await model.deleteBabyOrders(newChild: deleteBaby); + if (model.isDeleted) { + AppToast.showSuccessToast(message: TranslationBase.of(context).recordDeleted); + Navigator.pop(context, model.isDeleted); + } else { + //TODO handling error + } + }, + child: Container( + decoration: containerRadius(Colors.grey.withOpacity(0.2), 2000), + padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8), + child: Row( + children: [ + Image.asset( + 'assets/images/new-design/garbage.png', + width: 16, + color: selectedColor, + ), + mWidth(8), + Text( + TranslationBase.of(context).deleteView, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + letterSpacing: -0.33, + color: selectedColor, + ), + ), + ], ), - ], + ), ), - ), + ], ), ], ), @@ -175,19 +184,9 @@ class _ChildPageState extends State with SingleTickerProviderS width: double.infinity, padding: EdgeInsets.all(16), color: Colors.white, - child: SecondaryButton( - textColor: Colors.white, - color: checkedValue - ? CustomColors.accentColor - : Color.fromRGBO( - 63, - 72, - 74, - 1, - ), - label: TranslationBase.of(context).addNewChild, - // - onTap: () { + child: DefaultButton( + TranslationBase.of(context).addNewChild, + () { Navigator.push( context, FadePage( diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index fb73280b..672dae53 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -23,7 +23,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -// import 'package:table_calendar/table_calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; @@ -262,7 +261,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat final List meetings = []; _events.forEach((key, value) { final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0); - final DateTime endTime = startTime.add(const Duration(hours: 2)); + final DateTime endTime = startTime.add(const Duration(minutes: 20)); meetings.add(Meeting("", startTime, endTime, CustomColors.green, false)); }); return meetings; diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 18450954..1d2b470b 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -26,6 +26,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -666,14 +667,15 @@ class _MyFamily extends State with TickerProviderStateMixin { } deleteFamily(family, context) { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).removeFamilyMember, - okText: TranslationBase.of(context).confirm, - cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {ConfirmDialog.closeAlertDialog(context), removeFamily(family, context)}, - cancelFunction: () => {}); - dialog.showAlertDialog(context); + showDialog( + context: context, + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).removeFamilyMember, + onTap: () { + removeFamily(family, context); + }, + ), + ); } removeFamily(GetAllSharedRecordsByStatusList family, context) { diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 7b699467..6ae318c3 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -56,7 +56,26 @@ class NotificationsPage extends StatelessWidget { GifLoaderDialogUtils.hideDialog(context); }, child: Center( - child: Image.asset('assets/images/notf.png'), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Image.asset('assets/images/notf.png'), + Icon( + Icons.notifications_active, + color: CustomColors.accentColor, + size: 40, + ), + Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).moreNotifications, style: TextStyle( + color: CustomColors.accentColor, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + decoration: TextDecoration.underline + )), + ), + ], + ), ), ); } @@ -154,91 +173,6 @@ class NotificationsPage extends StatelessWidget { ); }, itemCount: model.notifications.length + 1)), - // ListView( - // children: model.notifications - // .map( - // (notification) => InkWell( - // onTap: () async { - // if (!notification.isRead) { - // model.markAsRead(notification.id); - // } - // Navigator.push( - // context, - // FadePage( - // page: NotificationsDetailsPage( - // notification: notification, - // ))); - // }, - // child: Container( - // width: double.infinity, - // padding: EdgeInsets.all(8.0), - // decoration: BoxDecoration( - // color: notification.isRead ? CustomColors.white : CustomColors.accentColor.withOpacity(0.05), - // border: Border( - // left: BorderSide( - // color: notification.isRead ? Colors.grey[200] : CustomColors.accentColor, - // width: 5.0, - // ), - // ), - // ), - // child: Row( - // children: [ - // Expanded( - // child: Padding( - // padding: const EdgeInsets.all(8.0), - // child: Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false)), - // SizedBox( - // height: 5, - // ), - // Row( - // children: [ - // Expanded( - // child: Texts(notification.message)), - // if (notification.messageType == "image") - // Icon(FontAwesomeIcons.images, color: CustomColors.grey,) - // ], - // ), - // SizedBox( - // height: 5, - // ), - // Divider( - // height: 5.0, - // color: CustomColors.grey2, - // ), - // ], - // ), - // ), - // ), - // ], - // ), - // ), - // ), - // ) - // .toList() - // ..add( - // InkWell( - // onTap: () async { - // GifLoaderDialogUtils.showMyDialog(context); - // currentIndex++; - // GetNotificationsRequestModel - // getNotificationsRequestModel = - // new GetNotificationsRequestModel( - // currentPage: currentIndex, - // pagingSize: 14, - // notificationStatusID: 2); - // - // await model.getNotifications( - // getNotificationsRequestModel, context); - // GifLoaderDialogUtils.hideDialog(context); - // }, - // child: Center( - // child: Image.asset('assets/images/notf.png'), - // ), - // ), - // )), ); } } diff --git a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart b/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart deleted file mode 100644 index b31d4a38..00000000 --- a/lib/pages/ErService/EdOnline/ConfirmExitPageDialog.dart +++ /dev/null @@ -1,76 +0,0 @@ -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'; -// todo 'sikander' remove useless code -// class ConfirmExitPageDialog extends StatelessWidget { -// final GestureTapCallback onTapYes; -// final GestureTapCallback onTapNo; -// -// const ConfirmExitPageDialog({Key key, this.onTapYes, this.onTapNo}) -// : super(key: key); -// -// @override -// Widget build(BuildContext context) { -// return SimpleDialog( -// contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), -// title: Center( -// child: Texts( -// TranslationBase.of(context).confirm, -// color: Colors.black, -// ), -// ), -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// Texts( -// "Are you sure you want to exit this page ?", -// color: Colors.grey, -// ), -// SizedBox( -// height: 5, -// ), -// Divider(), -// SizedBox( -// height: 5.0, -// ), -// Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// InkWell( -// onTap: () { -// onTapNo(); -// }, -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).no, -// color: Colors.red, -// ), -// ), -// ), -// ), -// -// InkWell( -// onTap: () { -// Navigator.pop(context); -// onTapYes(); -// }, -// child: Container( -// child: Center( -// child: Texts(TranslationBase.of(context).yes), -// ), -// ), -// ), -// ], -// ), -// SizedBox( -// height: 20.0, -// ), -// ], -// ) -// ], -// ); -// } -// } diff --git a/lib/pages/ErService/EdOnline/DdServicesPage.dart b/lib/pages/ErService/EdOnline/DdServicesPage.dart index 457e199c..dc2e8d78 100644 --- a/lib/pages/ErService/EdOnline/DdServicesPage.dart +++ b/lib/pages/ErService/EdOnline/DdServicesPage.dart @@ -5,8 +5,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - -import 'ConfirmExitPageDialog.dart'; import 'EdOnlineAgreementPage.dart'; import 'EdOnlineNotesPage.dart'; import 'EdOnlineQuestionsPage.dart'; @@ -104,21 +102,4 @@ class _DdServicesPageState extends State { ), ); } - - // todo 'sikander' remove useless code - // void showConfirmMessage( - // BuildContext context, - // ) { - // showDialog( - // context: context, - // child: ConfirmExitPageDialog( - // onTapYes: () { - // Navigator.pop(context); - // }, - // onTapNo: () { - // Navigator.pop(context); - // }, - // ), - // ); - // } } diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart index c3c6564d..845a8fe7 100644 --- a/lib/pages/ErService/NearestEr.dart +++ b/lib/pages/ErService/NearestEr.dart @@ -1,8 +1,10 @@ +import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart'; import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/hospital_location.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -25,7 +27,7 @@ class NearestEr extends StatefulWidget { class _NearestErState extends State { List projectAvgERWaitingTimeModelList = List(); - bool isDataLoaded = false; + bool isDataLoaded; @override void initState() { @@ -45,47 +47,41 @@ class _NearestErState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).NearestEr, - body: isDataLoaded - ? Container( - child: ListView( - children: [ - Text(TranslationBase.of(context).NearestErDesc, - textAlign: TextAlign.center, style: TextStyle(fontSize: 18.0, letterSpacing: 1.0, fontWeight: FontWeight.w900, color: new Color(0xFF60686b))), - Container( - margin: EdgeInsets.fromLTRB(2.0, 10.0, 0.0, 10.0), - child: GridView.count( - crossAxisCount: 2, - childAspectRatio: (itemWidth / itemWidth), - crossAxisSpacing: 10, - mainAxisSpacing: 10, - controller: new ScrollController(keepScrollOffset: false), + body: isDataLoaded != null + ? isDataLoaded + ? ListView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + children: [ + Text( + TranslationBase.of(context).NearestErDesc, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), + ), + SizedBox(height: 21), + ListView.separated( + physics: NeverScrollableScrollPhysics(), shrinkWrap: true, - padding: const EdgeInsets.all(4.0), - children: List.generate(projectAvgERWaitingTimeModelList.length, (index) { - return Container( - child: CardPosition( - waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString(), - text: projectAvgERWaitingTimeModelList[index].projectName.toString(), - image: 'assets/images/new-design/find_us_icon.png', - subText: projectAvgERWaitingTimeModelList[index].distanceInKilometers.toString() + " " + TranslationBase.of(context).km, - type: projectAvgERWaitingTimeModelList[index].iD.toString(), - telephone: projectAvgERWaitingTimeModelList[index].phoneNumber.toString(), - networkImage: projectAvgERWaitingTimeModelList[index].projectImageURL.toString(), - latitude: projectAvgERWaitingTimeModelList[index].latitude, - longitude: projectAvgERWaitingTimeModelList[index].longitude, - projectname: projectAvgERWaitingTimeModelList[index].projectName, - cardSize: itemWidth, - ), - ); - }), + padding: EdgeInsets.zero, + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (context, index) { + GetHMGLocationsModel location = GetHMGLocationsModel(); + location.locationName = projectAvgERWaitingTimeModelList[index].projectName; + location.cityName = projectAvgERWaitingTimeModelList[index].projectName; + location.projectImageURL = projectAvgERWaitingTimeModelList[index].projectImageURL; + location.phoneNumber = projectAvgERWaitingTimeModelList[index].phoneNumber; + location.latitude = projectAvgERWaitingTimeModelList[index].latitude; + location.longitude = projectAvgERWaitingTimeModelList[index].longitude; + location.distanceInKilometers = projectAvgERWaitingTimeModelList[index].distanceInKilometers; + return HospitalLocation(location, waitingTime: projectAvgERWaitingTimeModelList[index].avgTimeInHHMM.toString()); + }, + itemCount: projectAvgERWaitingTimeModelList.length, ), - ), - ], - ), - ) - : Center( - child: Texts('No Data'), - ), + ], + ) + : Center( + child: Texts('No Data'), + ) + : SizedBox(), ); } diff --git a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart index c7c12a2d..2a1dd3c9 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-logs-page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; @@ -11,7 +12,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; class RRTLogPage extends StatefulWidget { - final List orders; + final List orders; const RRTLogPage({this.orders}); @@ -45,13 +46,13 @@ class RRTLogPageState extends State { }); } - deleteOrder(PrescriptionsOrder order) async { + deleteOrder(GetCMCAllOrdersResponseModel order) async { GifLoaderDialogUtils.showMyDialog(context); - var success = await viewModel.cancelOrder(order); + var success = await viewModel.cancelOrderRC(order); if (success) { viewModel.setState(ViewState.Busy); - await viewModel.getAllOrders(); + await viewModel.getAllOrdersRC(); viewModel.setState(ViewState.Idle); Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); Navigator.push(context, FadePage(page: RRTMainScreen())); diff --git a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart index 351c918a..62fa4745 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-logs-page.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-request-page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -7,10 +8,13 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class RRTMainScreen extends StatefulWidget { final index = 0; + RRTMainScreen({index}); + @override State createState() => RRTMainScreenState(); } @@ -25,6 +29,8 @@ class RRTMainScreenState extends State with SingleTickerProviderS List imagesInfo = List(); + ProjectViewModel projectViewModel; + @override void initState() { super.initState(); @@ -36,6 +42,7 @@ class RRTMainScreenState extends State with SingleTickerProviderS @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); localize = TranslationBase.of(context); return AppScaffold( @@ -80,20 +87,40 @@ class RRTMainScreenState extends State with SingleTickerProviderS margin: EdgeInsets.all(0.0), clipBehavior: Clip.hardEdge, decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)), - child: TabBar(onTap: onPageChanged, indicatorWeight: 3, indicatorColor: Color(0xFFc5272d), isScrollable: false, controller: tabController, indicatorSize: TabBarIndicatorSize.label, tabs: [ - Tab( - child: Text( - localize.rapidResponseTeam, - style: TextStyle(color: Theme.of(context).appBarTheme.color), + child: TabBar( + onTap: onPageChanged, + controller: tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 5, bottom: 5), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ), - Tab( - child: Text( - localize.orderLog, - style: TextStyle(color: Theme.of(context).appBarTheme.color), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 15, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ), - ]), + tabs: [ + Tab( + child: Text( + localize.rapidResponseTeam, + style: TextStyle(color: Theme.of(context).appBarTheme.color), + ), + ), + Tab( + child: Text( + localize.orderLog, + style: TextStyle(color: Theme.of(context).appBarTheme.color), + ), + ), + ]), ); Widget contentPager() => PageView( diff --git a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart index a2ef7cd0..8a4f1e18 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -16,8 +17,8 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5)); class RRTLogListItem extends StatefulWidget { - final PrescriptionsOrder order; - final Function(PrescriptionsOrder) onCancel; + final GetCMCAllOrdersResponseModel order; + final Function(GetCMCAllOrdersResponseModel) onCancel; RRTLogListItem(this.order, {this.onCancel}); @override @@ -34,8 +35,8 @@ class RRTLogListItemState extends State { ProjectViewModel projectViewModel = Provider.of(context); localize = TranslationBase.of(context); - int status = widget.order.status; - String _statusDisp = projectViewModel.isArabic ? widget.order.descriptionN : widget.order.description; + int status = widget.order.statusId; + String _statusDisp = widget.order.statusText; Color _color; if (status == 1) { //pending @@ -46,7 +47,7 @@ class RRTLogListItemState extends State { } else if (status == 3) { //completed _color = Color(0xff359846); - } else if (status == 4) { + } else if (status == 4 || status == 6 || status == 7) { //cancel // Rejected _color = Color(0xffD02127); } @@ -111,7 +112,7 @@ class RRTLogListItemState extends State { ), Expanded( child: Text( - !projectViewModel.isArabic ? widget.order.nearestProjectDescription.trim().toString() : widget.order.nearestProjectDescriptionN.toString(), + widget.order.projectName.toString(), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -126,7 +127,7 @@ class RRTLogListItemState extends State { ), Expanded( child: Text( - widget.order.getFormattedDateTime(), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.order.created)), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), ), @@ -140,11 +141,11 @@ class RRTLogListItemState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - DateUtil.getDayMonthYearDateFormattedLang(widget.order.createdOn, projectViewModel.isArabic), + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(widget.order.created)), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), - if (widget.order.status == 1 || widget.order.status == 2) + if (widget.order.statusId == 1 || widget.order.statusId == 2) InkWell( onTap: () { //onCancel(order); @@ -227,11 +228,11 @@ class RRTLogListItemState extends State { // ); cancelOrders(order) async { GifLoaderDialogUtils.showMyDialog(context); - var success = await viewModel.cancelOrder(order); + var success = await viewModel.cancelOrderRC(order); if (success) { viewModel.setState(ViewState.Busy); - await viewModel.getAllOrders(); + await viewModel.getAllOrdersRC(); viewModel.setState(ViewState.Idle); Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); Navigator.push(context, FadePage(page: RRTMainScreen())); diff --git a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart index 4e863bd1..938b0528 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-place-order.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-place-order.dart @@ -217,7 +217,7 @@ class RRTPlaceOrderPage extends StatelessWidget { gotoRRTRoot() async { viewModel.setState(ViewState.Busy); - await viewModel.getAllOrders(); + await viewModel.getAllOrdersRC(); viewModel.setState(ViewState.Idle); Navigator.popUntil(_context, (route) => Utils.route(route, equalsTo: RRTMainScreen)); Navigator.push(_context, FadePage(page: RRTMainScreen())); diff --git a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart index 28cd3cf4..1848f52c 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; @@ -15,7 +16,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class RRTRequestPage extends StatefulWidget { - final List pendingOrders; + final List pendingOrders; final ServicePrice servicePrice; RRTRequestPage({this.pendingOrders, this.servicePrice}); @@ -208,14 +209,14 @@ class RRTRequestPageState extends State { ))); } - deleteOrder(PrescriptionsOrder order) async { + deleteOrder(GetCMCAllOrdersResponseModel order) async { GifLoaderDialogUtils.showMyDialog(context); - var success = await viewModel.cancelOrder(order); + var success = await viewModel.cancelOrderRC(order); GifLoaderDialogUtils.hideDialog(context); if (success) setState(() { widget.pendingOrders.remove(order); }); - await viewModel.getAllOrders(); + await viewModel.getAllOrdersRC(); } } diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index ccee254b..1cccf517 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; class PaymentMethod extends StatefulWidget { Function onSelectedMethod; @@ -37,7 +36,6 @@ class _PaymentMethodState extends State { children: [ Container( margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0), - child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( @@ -70,15 +68,6 @@ class _PaymentMethodState extends State { padding: EdgeInsets.all(7.0), child: Image.asset("assets/images/new/payment/Mada.png"), ), - // mWidth(12), - // Text( - // "Mada", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "MADA") Container( @@ -128,16 +117,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/visa.png"), ), - // mWidth(12), - // Text( - // "VISA", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ) - // , mFlex(1), if (selectedPaymentMethod == "VISA") Container( @@ -187,15 +166,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/Mastercard.png"), ), - // mWidth(12), - // Text( - // "MasterCard", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "MASTERCARD") Container( @@ -245,15 +215,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/installments.png"), ), - // mWidth(12), - // Text( - // "Installments", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "Installment") Container( @@ -304,15 +265,6 @@ class _PaymentMethodState extends State { width: 60, child: Image.asset("assets/images/new/payment/Apple_Pay.png"), ), - // mWidth(12), - // Text( - // "Apple Pay", - // style: TextStyle( - // color: Colors.black, - // fontSize: 14, - // fontWeight: FontWeight.bold, - // ), - // ), mFlex(1), if (selectedPaymentMethod == "ApplePay") Container( @@ -332,40 +284,6 @@ class _PaymentMethodState extends State { ), ), ) - // Container( - // margin: EdgeInsets.only(top: 25.0), - // child: Flex( - // direction: Axis.horizontal, - // children: [ - // Expanded( - // child: Container( - // child: InkWell( - // onTap: () { - // updateSelectedPaymentMethod("ApplePay"); - // }, - // child: Card( - // elevation: 3.0, - // margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - // color: Colors.white, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: selectedPaymentMethod == "ApplePay" ? BorderSide(color: Colors.green, width: 5.0) : BorderSide(color: Colors.transparent, width: 0.0), - // ), - // child: Container( - // height: 120.0, - // padding: EdgeInsets.all(20.0), - // child: SvgPicture.asset("assets/images/new-design/applepay.svg"), - // ), - // ), - // ), - // ), - // ), - // Expanded( - // child: Container(), - // ), - // ], - // ), - // ) : Container(), SizedBox( height: 150.0, diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index dc1b47f7..298e617e 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -498,42 +498,6 @@ class _SendFeedbackPageState extends State { ); return; - // todo 'sikander' remove useless code - // showDialog( - // context: context, - // child: FeedbackTypeDialog( - // messageTypeDialog: messageType, - // onValueSelected: (MessageType value) { - // if (value == MessageType.ComplaintOnAnAppointment) { - // appoList.clear(); - // GifLoaderDialogUtils.showMyDialog(context); - // service.getPatientAppointmentHistory(false, context, isForCOC: true).then((res) { - // GifLoaderDialogUtils.hideDialog(context); - // setState(() { - // if (res['MessageStatus'] == 1) { - // if (res['AppoimentAllHistoryResultList'].length != 0) { - // res['AppoimentAllHistoryResultList'].forEach((v) { - // appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - // }); - // setState(() { - // appointHistory = null; - // isShowListAppointHistory = true; - // }); - // } else {} - // } else {} - // }); - // }).catchError((err) { - // GifLoaderDialogUtils.hideDialog(context); - // // print(err); - // // AppToast.showErrorToast(message: err); - // // Navigator.of(context).pop(); - // }); - // } else { - // isShowListAppointHistory = false; - // } - // setMessageType(value); - // }, - // )); } openSpeechReco() async { @@ -586,239 +550,4 @@ class _SendFeedbackPageState extends State { print(hasSpeech); if (!mounted) return; } -} -// todo 'sikander' remove useless code -// class FeedbackTypeDialog extends StatefulWidget { -// final Function(MessageType) onValueSelected; -// final MessageType messageTypeDialog; -// -// const FeedbackTypeDialog({Key key, this.onValueSelected, this.messageTypeDialog = MessageType.NON}) : super(key: key); -// -// @override -// State createState() => new FeedbackTypeDialogState(); -// } -// -// class FeedbackTypeDialogState extends State { -// MessageType messageTypeDialog = MessageType.NON; -// -// setMessageDialogType(MessageType messageType) { -// setState(() { -// messageTypeDialog = messageType; -// }); -// } -// -// @override -// void initState() { -// messageTypeDialog = widget.messageTypeDialog; -// -// super.initState(); -// } -// -// Widget build(BuildContext context) { -// return BaseView( -// builder: (_, model, widge) => SimpleDialog( -// title: Text( -// TranslationBase.of(context).messageType, -// textAlign: TextAlign.center, -// ), -// children: [ -// Container( -// // padding: const EdgeInsets.all(10.0), -// child: Column( -// children: [ -// Divider( -// height: 2.5, -// color: Colors.grey[500], -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.NON), -// child: ListTile( -// title: Texts(TranslationBase.of(context).notClassified), -// leading: Radio( -// value: MessageType.NON, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.ComplaintOnAnAppointment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).complainAppo), -// leading: Radio( -// value: MessageType.ComplaintOnAnAppointment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.ComplaintWithoutAppointment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).complainWithoutAppo), -// leading: Radio( -// value: MessageType.ComplaintWithoutAppointment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Question), -// child: ListTile( -// title: Texts(TranslationBase.of(context).question), -// leading: Radio( -// value: MessageType.Question, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Compliment), -// child: ListTile( -// title: Texts(TranslationBase.of(context).compliment), -// leading: Radio( -// value: MessageType.Compliment, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Row( -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () => setMessageDialogType(MessageType.Suggestion), -// child: ListTile( -// title: Texts(TranslationBase.of(context).suggestion), -// leading: Radio( -// value: MessageType.Suggestion, -// groupValue: messageTypeDialog, -// activeColor: CustomColors.accentColor, -// onChanged: (MessageType value) => setMessageDialogType(value), -// ), -// ), -// ), -// ) -// ], -// ), -// SizedBox( -// height: 5.0, -// ), -// Divider( -// height: 2.5, -// color: Colors.grey[500], -// ), -// SizedBox( -// height: 5, -// ), -// Row( -// // mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: Padding( -// padding: EdgeInsets.all(8.0), -// child: Container( -// child: Center( -// child: Texts( -// TranslationBase.of(context).cancel, -// color: CustomColors.accentColor, -// ), -// ), -// ), -// ), -// ), -// ), -// Container( -// width: 1, -// height: 30, -// color: Colors.grey[500], -// ), -// Expanded( -// flex: 1, -// child: InkWell( -// onTap: () { -// widget.onValueSelected(messageTypeDialog); -// Navigator.pop(context); -// }, -// child: Padding( -// padding: const EdgeInsets.all(8.0), -// child: Center( -// child: Texts( -// TranslationBase.of(context).ok, -// fontWeight: FontWeight.w400, -// )), -// ), -// )), -// ], -// ) -// ], -// ), -// ), -// ], -// ), -// ); -// } -// } +} \ No newline at end of file diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 7e8385f0..65adf282 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -198,7 +198,8 @@ class _FinalProductsPageState extends State { ), margin: EdgeInsets.symmetric( horizontal: 8, - vertical: 4, + vertical: 1, +// vertical: 2, ), child: Container( decoration: BoxDecoration( @@ -210,11 +211,17 @@ class _FinalProductsPageState extends State { color: Colors.white, ), padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, + horizontal: 4, + ), + width: MediaQuery.of(context).size.width / 3, +// width: MediaQuery.of(context) +// .size +// .width / +// 1, +// height: MediaQuery.of(context) +// .size +// .width / +// 1, child: Column( crossAxisAlignment: CrossAxisAlignment @@ -224,7 +231,7 @@ class _FinalProductsPageState extends State { children: [ Container( margin: EdgeInsets - .fromLTRB(0, 16, + .fromLTRB(0, 1, 0, 0), alignment: Alignment .center, @@ -242,10 +249,68 @@ class _FinalProductsPageState extends State { .thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.cover, - height: 80, + height: 70, ), ), - Container( +// Container( +// width: model +// .finalProducts[ +// index] +// .rxMessage != +// null +// ? MediaQuery.of( +// context) +// .size +// .width / +// 2.8 +// : 0, +// padding: +// EdgeInsets.all( +// 4), +// decoration: +// BoxDecoration( +// color: Color( +// 0xffb23838), +// borderRadius: BorderRadius.only( +// topLeft: Radius +// .circular( +// 6)), +// ), +// child: model +// .finalProducts[ +// index] +// .rxMessage != +// null +// ? Texts( +// languageID == +// 'ar' +// ? model +// .finalProducts[ +// index] +// .rxMessagen +// : model +// .finalProducts[index] +// .rxMessage, +// color: Colors +// .white, +// regular: +// true, +// fontSize: +// 10, +// fontWeight: +// FontWeight +// .w600, +// ) +// : Texts(""), +// ), + ], + ), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 0, + vertical: 2, + ), width: model .finalProducts[ index] @@ -255,19 +320,18 @@ class _FinalProductsPageState extends State { context) .size .width / - 2.8 + 2.0 : 0, padding: - EdgeInsets.all( - 4), + EdgeInsets.fromLTRB(8,4,8,4), decoration: BoxDecoration( color: Color( 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), +// borderRadius: BorderRadius.only( +// topLeft: Radius +// .circular( +// 6)), ), child: model .finalProducts[ @@ -296,8 +360,6 @@ class _FinalProductsPageState extends State { ) : Texts(""), ), - ], - ), Container( margin: EdgeInsets .symmetric( @@ -439,206 +501,268 @@ class _FinalProductsPageState extends State { (BuildContext context, int index) { return InkWell( child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: - BoxDecoration(), - child: Padding( - padding: - EdgeInsets - .only( - left: 9.0, - top: 8.0, - right: 10.0, + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + children: [ + Stack( + children: [ + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + left: 2.0, + top: 2.0, + right: 2.0, + ), ), ), - ), - Container( - margin: EdgeInsets - .fromLTRB( - 0, 0, 0, 0), - alignment: Alignment - .center, - child: - Image.network( - model - .finalProducts[ - index] - .images - .isNotEmpty - ? model - .finalProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit - .contain, - height: 80, + Container( +// margin: EdgeInsets +// .fromLTRB( +// 8, 0, 8, 0), + alignment: Alignment + .center, + child: + Image.network( + model + .finalProducts[ + index] + .images + .isNotEmpty + ? model + .finalProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit + .contain, + height: 70, + ), ), - ), - ], + ], + ), +// Column( +// children: [ +// Container( +// width: model +// .finalProducts[ +// index] +// .rxMessage != +// null +// ? MediaQuery.of( +// context) +// .size +// .width / +// 5.3 +// : 0, +// padding: +// EdgeInsets.all( +// 4), +// decoration: +// BoxDecoration( +// color: Color( +// 0xffb23838), +// borderRadius: BorderRadius.only( +// topLeft: Radius +// .circular( +// 6)), +// ), +// child: Texts( +// model +// .finalProducts[ +// index] +// .rxMessage != +// null +// ? model +// .finalProducts[ +// index] +// .rxMessage +// : "", +// color: +// Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: +// FontWeight +// .w600, +// ), +// ), +// ], +// ), + + + + ], + ), + Container( + height: 130.0, + margin: + EdgeInsets.symmetric( + horizontal: 0, + vertical: 6, ), - Column( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ + Container( + margin: EdgeInsets + .symmetric( + horizontal: 4, + vertical: 0, + ), width: model - .finalProducts[ - index] - .rxMessage != - null + .finalProducts[ + index] + .rxMessage != + null ? MediaQuery.of( - context) - .size - .width / - 5.3 + context) + .size + .width / + 2.0 : 0, padding: - EdgeInsets.all( - 4), + EdgeInsets.all( + 4), decoration: - BoxDecoration( + BoxDecoration( color: Color( 0xffb23838), - borderRadius: BorderRadius.only( - topLeft: Radius - .circular( - 6)), +// borderRadius: BorderRadius.only( +// topLeft: Radius +// .circular( +// 6)), ), + child: model + .finalProducts[ + index] + .rxMessage != + null + ? Texts( + languageID == + 'ar' + ? model + .finalProducts[ + index] + .rxMessagen + : model + .finalProducts[index] + .rxMessage, + color: Colors + .white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w600, + ) + : Texts(""), + ), + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.65, child: Texts( model - .finalProducts[ - index] - .rxMessage != - null - ? model - .finalProducts[ - index] - .rxMessage - : "", - color: - Colors.white, + .finalProducts[ + index] + .name, regular: true, - fontSize: 10, + fontSize: 13.2, fontWeight: - FontWeight - .w600, + FontWeight.w500, + maxLines: 5, ), ), - ], - ), - ], - ), - Container( - height: 100.0, - margin: - EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of( - context) - .size - .width * - 0.65, - child: Texts( - model - .finalProducts[ - index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: - FontWeight.w500, - maxLines: 5, + SizedBox( + height: 8.0, ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets - .only( - top: 4, - bottom: 4), - child: Texts( - "SAR ${model.finalProducts[index].price}", - bold: true, - fontSize: 14, + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.finalProducts[index].price}", + bold: true, + fontSize: 14, + ), ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .finalProducts[ - index] - .approvedRatingSum > - 0 - ? (model.finalProducts[index].approvedRatingSum.toDouble() / - model.finalProducts[index].approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: - true), - Texts( - "(${model.finalProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight - .w400, - ) - ], - ), - ], + Row( + children: [ + StarRating( + totalAverage: model + .finalProducts[ + index] + .approvedRatingSum > + 0 + ? (model.finalProducts[index].approvedRatingSum.toDouble() / + model.finalProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.finalProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], + ), ), - ), - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon(Icons.shopping_cart, - size: 18, - color: Colors.blue,), - onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - if(model.finalProducts[index].rxMessage == null){ - await addToCartFunction(1, model.finalProducts[index].id); -// GifLoaderDialogUtils.hideDialog(context); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); + widget.authenticatedUserObject.isLogin + ? Container( + child: IconButton( + icon: Icon(Icons.shopping_cart, + size: 18, + color: Colors.blue,), + onPressed: () async { + if(model.finalProducts[index].rxMessage == null){ + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, model.finalProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push( + context, + FadePage(page: CartOrderPage())); + } + else{ + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } +// } - else{ - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - GifLoaderDialogUtils.hideDialog(context); - } - ), - ):Container(), - ], + ), + ):Container(), + ], + ), ), ), onTap: () => { diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 9e95e0fe..b84b63d3 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -113,9 +114,7 @@ class _InsuranceCardState extends State { style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), ), Text( - convertDateFormat( - model.insurance[index].cardValidTo, - ), + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.insurance[index].cardValidTo)), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xFF575757)), ), ], diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index c6eccae1..f765d9b7 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -344,59 +345,6 @@ class InsuranceCardUpdateDetails extends StatelessWidget { ), ], ), - // bottomSheet: Container( - // width: double.infinity, - // height: insuranceCardDetailsModel.isEmpty ? MediaQuery.of(context).size.height * 0.14 : MediaQuery.of(context).size.height * 0.21, - // child: Container( - // margin: EdgeInsets.only(left: 8, right: 8), - // child: Column( - // children: [ - // SizedBox( - // height: 8, - // ), - // if (insuranceCardDetailsModel.isEmpty) - // SecondaryButton( - // textColor: Colors.white, - // label: TranslationBase.of(context).scanNow.toUpperCase(), - // color: Theme.of(context).primaryColor, - // small: true, - // onTap: () async { - // confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); - // }, - // ), - // if (insuranceCardDetailsModel.isNotEmpty) - // SecondaryButton( - // textColor: Colors.white, - // label: TranslationBase.of(context).agree.toUpperCase(), - // color: Theme.of(context).primaryColor, - // onTap: () async { - // GifLoaderDialogUtils.showMyDialog(context); - // await model.uploadInsuranceCard(patientIdentificationID: patientIdentificationID, patientID: patientID); - // GifLoaderDialogUtils.hideDialog(context); - // if (model.state == ViewState.ErrorLocal) { - // AppToast.showErrorToast(message: model.error); - // } else { - // AppToast.showSuccessToast(message: TranslationBase.of(context).requestSent); - // } - // }, - // ), - // if (insuranceCardDetailsModel.isNotEmpty) - // SizedBox( - // height: 12, - // ), - // if (insuranceCardDetailsModel.isNotEmpty) - // SecondaryButton( - // textColor: Colors.white, - // label: TranslationBase.of(context).disagree.toUpperCase(), - // color: Colors.grey[800], - // onTap: () async { - // confirmAttachInsuranceCardImageDialogDialog(context: context, name: name, fileNo: patientID.toString(), model: model); - // }, - // ) - // ], - // ), - // ), - // ), ), ); } diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index fb3271fd..22e1b03e 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -94,6 +94,7 @@ class InsurancePage extends StatelessWidget { }, child: Container( width: double.infinity, + margin: EdgeInsets.only(top: 12.0), child: Container( decoration: cardRadius(12), child: Padding( diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 08a7971e..4714c208 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -1,5 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -15,7 +16,6 @@ import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -55,13 +55,13 @@ class _HomePageFragment2State extends State { hmgServices.clear(); hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin)); - hmgServices.add(new HmgServices(2, TranslationBase.of(context).onlinePayment, TranslationBase.of(context).onlinePaymentSubtitle, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); - hmgServices.add(new HmgServices(4, TranslationBase.of(context).cmcTitle, TranslationBase.of(context).cmcSubtitle, "assets/images/new/comprehensive_checkup.svg", isLogin)); - hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); - hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergency, TranslationBase.of(context).services2, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Referral.svg", isLogin)); hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); - hmgServices.add(new HmgServices(8, TranslationBase.of(context).findUs, TranslationBase.of(context).reachUs, "assets/images/new/reach_us.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).reachUs, TranslationBase.of(context).findUs, "assets/images/new/reach_us.svg", isLogin)); } @override @@ -271,7 +271,7 @@ class _HomePageFragment2State extends State { ), ], ), - mHeight(60), + mHeight(140), ], ), ); @@ -282,8 +282,8 @@ class _HomePageFragment2State extends State { flex: 1, child: InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); - + final user = projectViewModel.user; + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(user))); }, child: Container( width: double.infinity, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 07958a7d..0882f361 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -421,7 +421,7 @@ class _HomePageState extends State { padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15), child: InkWell( onTap: () { - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage())); + Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(projectViewModel.user))); }, child: Container( decoration: BoxDecoration( diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 2245872b..9f395cad 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -66,7 +66,7 @@ class _HomePageState2 extends State { } else { GifLoaderDialogUtils.showMyDialog(context); await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { - if (pharmacyModuleViewModel.error.isNotEmpty) { + if (!pharmacyModuleViewModel.error.isNotEmpty) { await pharmacyModuleViewModel.createUser().then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 21160b61..7f4d8621 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -388,13 +388,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } - // todo 'sikander' remove useless code - // showDialogs(String message) { - // ConfirmDialog dialog = new ConfirmDialog( - // context: context, confirmMessage: message, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => {}, cancelFunction: () => {}); - // dialog.showAlertDialog(context); - // } - Future> requestPermissions() async { var permissionResults = [ Permission.location, @@ -512,9 +505,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { Widget build(BuildContext context) { projectViewModel = Provider.of(context); model = Provider.of(context); - + // currentTab == 0 ? 45 : 0.0 return Scaffold( - appBar: PreferredSize( + appBar: currentTab == 0 ? PreferredSize( preferredSize: Size.fromHeight(currentTab == 0 ? 45 : 0.0), child: AppBar( elevation: 0, @@ -598,7 +591,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ], centerTitle: true, ), - ), + ) : null, drawer: SafeArea(child: AppDrawer()), extendBody: false, body: WillPopScope( diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 6ae272e2..2e251f3b 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -4,10 +4,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/parmacyModule/parmacy_module_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; import 'package:diplomaticquarterapp/pages/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; @@ -146,9 +145,7 @@ class _LandingPagePharmacyState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient() - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", - onSuccess: (dynamic response, int statusCode) { + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -158,8 +155,7 @@ class _LandingPagePharmacyState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast( - message: "Something went wrong, please try again"); + AppToast.showErrorToast(message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 2eae79d3..b233c6a7 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.da import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_initial_page.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/new/child_vaccine_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; @@ -103,10 +104,10 @@ class ServicesView extends StatelessWidget { } else if (index == 14) { Navigator.push( context, - FadePage(page: ChildVaccinePage()), + FadePage(page: ChildInitialPage()), ); } else if (index == 15) { - Navigator.pop(context); + // Navigator.pop(context); LandingPage.shared.switchToDoFromHMGServices(); } else if (index == 16) { Navigator.push( diff --git a/lib/pages/livecare/clinic_timings_page.dart b/lib/pages/livecare/clinic_timings_page.dart new file mode 100644 index 00000000..cd1652f2 --- /dev/null +++ b/lib/pages/livecare/clinic_timings_page.dart @@ -0,0 +1,118 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class ClinicTimingsPage extends StatefulWidget { + final clinicName; + final List patientERGetClinicsServiceTimingsList; + + ClinicTimingsPage({@required this.clinicName, @required this.patientERGetClinicsServiceTimingsList}); + + @override + _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); +} + +class _LiveCarePatmentPageState extends State { + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).clinicSchedule, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).erConsultation, + body: Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: [ + Expanded( + child: ListView.separated( + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(top: index == 0 ? 12 : 0, bottom: (index == widget.patientERGetClinicsServiceTimingsList.length - 1) ? 12 : 0), + child: showItem(widget.patientERGetClinicsServiceTimingsList[index]), + ); + }, + separatorBuilder: (context, index) { + return mHeight(12); + }, + itemCount: widget.patientERGetClinicsServiceTimingsList.length, + ), + ), + Container( + width: double.infinity, + padding: EdgeInsets.all(12), + color: Colors.white, + child: DefaultButton( + TranslationBase.of(context).back, + () { + Navigator.pop(context); + }, + ), + ), + ], + ), + ), + ); + } + + Widget showItem(PatientERGetClinicsServiceTimingsList item) { + return Container( + width: double.infinity, + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 2, + child: Text( + item.dayOfWeekStr, + style: TextStyle( + fontSize: 18, + letterSpacing: -0.72, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + flex: 4, + child: Container( + width: double.infinity, + decoration: cardRadius(12), + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + for (int i = 0; i < item.shiftTimings.length; i++) + Text( + TranslationBase.of(context).from + " " + item.shiftTimings[i].startTime + " " + TranslationBase.of(context).to + " " + item.shiftTimings[i].endTime, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.42, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart new file mode 100644 index 00000000..3980c5a7 --- /dev/null +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -0,0 +1,316 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class LiveCarePatmentPage extends StatefulWidget { + GetERAppointmentFeesList getERAppointmentFeesList; + int waitingTime; + String clinicName; + + LiveCarePatmentPage({@required this.getERAppointmentFeesList, @required this.waitingTime, @required this.clinicName}); + + @override + _LiveCarePatmentPageState createState() => _LiveCarePatmentPageState(); +} + +class _LiveCarePatmentPageState extends State { + int _selected = 0; + + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemWidth = size.width / 2; + projectViewModel = Provider.of(context); + return AppScaffold( + appBarTitle: TranslationBase.of(context).livecare, + isShowAppBar: true, + showNewAppBarTitle: true, + showNewAppBar: true, + description: TranslationBase.of(context).erConsultation, + body: Container( + width: double.infinity, + + height: double.infinity, + child: Column( + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + widget.clinicName, + style: TextStyle( + fontSize: 19.0, + fontWeight: FontWeight.bold, + letterSpacing: -1.44, + ), + ), + mHeight(8), + Text( + TranslationBase.of(context).expectedWaiting, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: CustomColors.textColor, + ), + ), + Text( + widget.waitingTime.toString() + " " + TranslationBase.of(context).minute, + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: CustomColors.accentColor, + letterSpacing: -0.66, + ), + ), + mHeight(16), + Container( + decoration: cardRadius(12), + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).erConsultFee, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(10), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientShareToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.amount + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + mHeight(4), + mDivider(CustomColors.lightGreyColor), + mHeight(4), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientTaxToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.tax + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + mHeight(4), + mDivider(CustomColors.lightGreyColor), + mHeight(4), + Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).patientShareTotalToDo, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + color: CustomColors.textColor, + fontWeight: FontWeight.w600, + ), + ), + ), + Expanded( + child: Text( + widget.getERAppointmentFeesList.total + " " + widget.getERAppointmentFeesList.currency, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ], + ), + ), + mHeight(12), + Container( + padding: EdgeInsets.all(12), + decoration: cardRadius(12), + child: Row( + children: [ + SvgPicture.asset( + "assets/images/new/services/raise_comp.svg", + color: CustomColors.green, + width: 18, + height: 18, + ), + mWidth(10), + Expanded( + child: Text( + TranslationBase.of(context).insuredPatient, + style: TextStyle( + fontSize: 10.0, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Radio( + value: 1, + groupValue: _selected, + onChanged: onRadioChanged, + ), + Text( + TranslationBase.of(context).agreeTo, + style: new TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: CustomColors.textColor, + ), + ), + mWidth(4), + Text( + TranslationBase.of(context).termsConditoins, + style: new TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: CustomColors.accentColor, + ), + ), + ], + ), + ), + mFlex(1), + Text( + TranslationBase.of(context).upComingPayOption, + style: new TextStyle( + fontSize: 12.0, + letterSpacing: -0.36, + fontWeight: FontWeight.w600, + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), + child: getPaymentMethods(), + ), + + + ], + ), + ), + ), + Container( + padding: EdgeInsets.all(12), + color: Colors.white, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel, + () { + Navigator.pop(context, false); + }, + ), + ), + mWidth(12), + Expanded( + child: DefaultButton( + TranslationBase.of(context).next, + () { + if (_selected == 0) { + AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); + } else { + Navigator.pop(context, true); + } + }, + color: CustomColors.green, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } + + void onRadioChanged(int value) { + setState(() { + _selected = value; + }); + } + + _getNormalText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, color: Colors.black)), + ); + } + + _getMarginText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), + child: Text(text, textAlign: TextAlign.start, style: TextStyle(fontSize: 14, letterSpacing: 0.5, fontWeight: FontWeight.bold, color: Colors.black)), + ); + } +} diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index f91121e3..b0150c03 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -1,7 +1,5 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingRequest.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; @@ -62,7 +60,24 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt body: Container( child: Column(children: [ TabBar( - labelColor: Colors.black, + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), tabs: [ Tab( child: Text( @@ -87,7 +102,6 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt ), ), ], - controller: _tabController, ), Expanded( child: TabBarView( diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart index 72ca4ce9..7884b37e 100644 --- a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -1,15 +1,15 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class ScheduleClinicCard extends StatefulWidget { bool isSelected; final ClinicsHaveScheduleList clinicsHaveScheduleList; var languageID; - ScheduleClinicCard( - {this.isSelected, - this.languageID, - @required this.clinicsHaveScheduleList}); + ScheduleClinicCard({this.isSelected, this.languageID, @required this.clinicsHaveScheduleList}); @override _ScheduleClinicCardState createState() => _ScheduleClinicCardState(); @@ -18,29 +18,68 @@ class ScheduleClinicCard extends StatefulWidget { class _ScheduleClinicCardState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( - child: Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.transparent, + ), + child: Container( + decoration: BoxDecoration( + color: CustomColors.green, + borderRadius: BorderRadius.all( + Radius.circular(6.0), + ), ), child: Container( - width: MediaQuery.of(context).size.width * 0.8, - padding: EdgeInsets.all(12.0), + margin: EdgeInsets.only( + left: projectViewModel.isArabic + ? 0 + : widget.isSelected + ? 4 + : 6, + right: projectViewModel.isArabic + ? widget.isSelected + ? 4 + : 6 + : 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + ), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ Container( child: Text( - widget.languageID == 'ar' - ? widget.clinicsHaveScheduleList.clinicDescN != null ? widget.clinicsHaveScheduleList.clinicDescN: "" - : widget.clinicsHaveScheduleList.clinicDesc != null ? widget.clinicsHaveScheduleList.clinicDesc: "Test Clinic", - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), + widget.clinicsHaveScheduleList.clinicDesc, + style: TextStyle( + fontSize: 16.0, + color: Colors.black, + fontWeight: FontWeight.w600, + ), + ), ), ], ), diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart index 765d6383..e07c5615 100644 --- a/lib/pages/livecare/livecare_type_select.dart +++ b/lib/pages/livecare/livecare_type_select.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -28,188 +29,71 @@ class _LiveCareTypeSelectState extends State { showNewAppBarTitle: true, showNewAppBar: true, appBarTitle: TranslationBase.of(context).livecare.toUpperCase(), - // appBar: AppBar( - // leading: InkWell( - // onTap: () { - // Navigator.pop(context, null); - // }, - // child: Icon( - // Icons.close, - // color: Colors.white, - // ), - // ), - // title: Text(TranslationBase.of(context).bookAppo, - // style: TextStyle(color: Colors.white)), - // ), body: SingleChildScrollView( child: Container( - margin: EdgeInsets.only(left: 20.0, right: 20.0), + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container(child: Text(TranslationBase.of(context).livecareService, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 15.0, bottom: 10.0), - child: Image.asset( - languageID == 'ar' - ? "assets/images/new-design/liveCare_ar_bg.png" - : "assets/images/new-design/liveCare_en_bg.png", - width: 120), - ), - Container( - alignment: Alignment.center, - child: Text(TranslationBase.of(context).livecareService, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), - Container( - margin: EdgeInsets.only(top: 0.0), - alignment: Alignment.center, - child: Text( - TranslationBase.of(context).livecareServiceDesc, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 18.0))), + margin: EdgeInsets.only(top: 7.0), + child: Text(TranslationBase.of(context).livecareServiceDesc, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(TranslationBase.of(context).whyLivecare, - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 20.0))), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).whyLivecare, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0, letterSpacing: -0.64, color: CustomColors.darkGrey))), Container( - margin: EdgeInsets.only(top: 0.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), - child: Text( - TranslationBase.of(context).livecarePoint1, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(TranslationBase.of(context).livecarePoint1, + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns4, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 5.0, left: 20.0), child: Row( children: [ - SvgPicture.asset("assets/images/new-design/check_icon.svg", - width: 25), + SvgPicture.asset("assets/images/new-design/allow.svg", width: 20), Container( width: MediaQuery.of(context).size.width * 0.72, - margin: EdgeInsets.all(10.0), + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), child: Text(TranslationBase.of(context).docVirtualAppoIns5, - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 14.0)), + overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0, letterSpacing: -0.64, color: CustomColors.black, fontWeight: FontWeight.w600)), ) ], ), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Text( - TranslationBase.of(context).livecareSummary, - style: TextStyle(fontSize: 12.0))), - InkWell( - onTap: (){ - Navigator.pop(context, "immediate"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.red[900], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon_white.svg", - width: 80), - ), - Container( - width: MediaQuery.of(context).size.width * 0.56, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(TranslationBase.of(context).livecareOption1, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - Container( - margin: EdgeInsets.only(top: 0.0), - child: Text(TranslationBase.of(context).livecareOption2, textAlign: TextAlign.start, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), - ), - InkWell( - onTap: (){ - // Navigator.pop(context, "schedule"); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.grey[400], - borderRadius: BorderRadius.all(Radius.circular(10.0))), - height: 100.0, - margin: EdgeInsets.only(top: 20.0), - child: Row( - children: [ - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Image.asset( - "assets/images/new-design/calendar.png", - width: 60), - ), - Container( - width: MediaQuery.of(context).size.width * 0.53, - margin: EdgeInsets.fromLTRB(30.0, 10.0, 0.0, 0.0), - child: Column( - children: [ - Container( - child: Text(TranslationBase.of(context).livecareOption3, - overflow: TextOverflow.clip, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).livecareOption4, - style: TextStyle( - fontSize: 18.0, color: Colors.white)), - ) - ], - ), - ), - ], - )), + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).livecareSummary, style: TextStyle(fontSize: 14.0, letterSpacing: -0.64, color: CustomColors.textColor, fontWeight: FontWeight.w600))), + + GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, crossAxisSpacing: 13, mainAxisSpacing: 9), + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 40.0), + shrinkWrap: true, + children: [ + _loginOptionButton(TranslationBase.of(context).livecareOption1, 'assets/images/new/Live_Care.svg', 1), + _loginOptionButton(TranslationBase.of(context).livecareOption4, 'assets/images/new/book appointment.svg', 2), + ], ), SizedBox( height: 40.0, @@ -221,6 +105,44 @@ class _LiveCareTypeSelectState extends State { ); } + Widget _loginOptionButton(String _title, String _icon, int _loginIndex) { + return InkWell( + onTap: () { + if (_loginIndex == 1) { + Navigator.pop(context, "immediate"); + } else { + Navigator.pop(context, "schedule"); + } + }, + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + _icon, + height: _loginIndex == 1 ? 60 : 50, + width: _loginIndex == 1 ? 60 : 50, + ), + Text( + _title, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16), + ), + ], + ), + ), + ); + } + getLanguageID() async { var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); setState(() { diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index d3029f86..91659278 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -1,24 +1,29 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class LiveCareHistoryCard extends StatefulWidget { ErRequestHistoryList erRequestHistoryList; + int isFirstOrLast; - LiveCareHistoryCard({this.erRequestHistoryList}); + LiveCareHistoryCard({this.erRequestHistoryList, this.isFirstOrLast}); @override _LiveCareHistoryCardState createState() => _LiveCareHistoryCardState(); @@ -40,122 +45,179 @@ class _LiveCareHistoryCardState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); return Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + margin: EdgeInsets.only(left: 12, right: 12, top: widget.isFirstOrLast == 0 ? 12 : 6, bottom: widget.isFirstOrLast == 1 ? 12 : 6), + decoration: BoxDecoration( + color: CustomColors.accentColor, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - child: Container( - width: MediaQuery.of(context).size.width, - // height: MediaQuery.of(context).size.height * 0.22, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(TranslationBase.of(context).requestedDate, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), - Container( - margin: EdgeInsets.only(top: 0.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.erRequestHistoryList.arrivalTime)), style: TextStyle(fontSize: 14.0)), - Text(TranslationBase.of(context).callDuration + "\n" + getCallTime(widget.erRequestHistoryList.callDuration), textAlign: TextAlign.center, style: TextStyle(fontSize: 14.0, color: Colors.grey[600])), - ], - ), - ), - Container( - padding: EdgeInsets.all(7.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.green, - ), - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text(widget.erRequestHistoryList.stringCallStatus, style: TextStyle(fontSize: 14.0, color: Colors.white)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Container( + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 0, right: projectViewModel.isArabic ? 0 : 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: Colors.white, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(10), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(10), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + widget.erRequestHistoryList.stringCallStatus , + style: TextStyle( + fontSize: 10.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + color: CustomColors.green, + //color: widget.erRequestHistoryList.stringCallStatus == "Completed" ? CustomColors.green : CustomColors.orange, ), - Divider( - color: Colors.grey[500], + ), + mHeight(12), + Text( + TranslationBase.of(context).requestedDate + ": " + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.erRequestHistoryList.arrivalTime)), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, ), - Container( - margin: EdgeInsets.all(5.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: InkWell( - onTap: () { - openInvoice(); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.content_paste, color: Colors.red), - Container( - margin: EdgeInsets.only(left: 10.0), - child: Text(TranslationBase.of(context).invoice, textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + ), + mHeight(4), + Row( + children: [ + Text( + TranslationBase.of(context).callDuration + ": ", + style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), + ), + Text( + getCallTime(widget.erRequestHistoryList.callDuration), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12.0, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + ), + ), + ], + ),mHeight(12), + Container( + width: double.infinity, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + openInvoice(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset("assets/images/new/services/invoice_list.svg",width: 18,height: 18,), + mWidth(10), + Text( + TranslationBase.of(context).invoice, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, ), - ], - ), + ), + ], ), ), ), - Expanded( - child: InkWell( - onTap: () { - openComplaint(); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.add, size: 24.0, color: Colors.red), - Container( - margin: EdgeInsets.only(left: 10.0), - child: Text(TranslationBase.of(context).complaint, textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + ), + mWidth(12), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + openComplaint(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 7, bottom: 7), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset("assets/images/new/services/raise_comp.svg",width: 16,height: 16,), + mWidth(10), + Expanded( + child: AutoSizeText( + TranslationBase.of(context).complaint, + textAlign: TextAlign.center, + maxLines: 1,minFontSize: 8, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, + ), ), - ], - ), + ), + ], ), ), ), - Expanded( - child: InkWell( - onTap: () { - rateLiveCareAppo(); - }, - child: Container( - child: Row( - children: [ - Icon(Icons.star, size: 24.0, color: Colors.yellow[700]), - Container( - width: MediaQuery.of(context).size.width * 0.2, - margin: EdgeInsets.only(left: 9.0), - child: Text(TranslationBase.of(context).rateDoctorAppo, overflow: TextOverflow.clip, textAlign: TextAlign.center, style: TextStyle(fontSize: 11.0)), + ), + mWidth(12), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + rateLiveCareAppo(); + }, + child: Container( + padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + Icon( Icons.star,size: 18,), + mWidth(10), + Text( + TranslationBase.of(context).rate, + overflow: TextOverflow.clip, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11.0, + letterSpacing: -0.46, + fontWeight: FontWeight.w600, ), - ], - ), + ), + ], ), ), ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), ), ); } - rateLiveCareAppo() { - if(widget.erRequestHistoryList.isAppointmentHaveRating) { + if (widget.erRequestHistoryList.isAppointmentHaveRating) { AppToast.showErrorToast(message: TranslationBase.of(context).alreadyRated); - } else { - - } + } else {} } openInvoice() { diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart index a8950e5d..1e2eaa1b 100644 --- a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -40,6 +40,7 @@ class _LiveCarePaymentDialogState extends State { height: 600.0, margin: EdgeInsets.all(20.0), width: 500.0, + color: Colors.red, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart index 6a7573d7..0f534d98 100644 --- a/lib/pages/livecare/widgets/clinic_card.dart +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -1,10 +1,17 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:provider/provider.dart'; +import '../clinic_timings_page.dart'; import 'ClinicTimingsDialog.dart'; // ignore: must_be_immutable @@ -14,11 +21,7 @@ class ClinicCard extends StatefulWidget { var languageID; int isOnline; - ClinicCard( - {this.isSelected, - this.languageID, - this.isOnline, - @required this.patientERGetClinicsList}); + ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList}); @override _State createState() => _State(); @@ -35,99 +38,160 @@ class _State extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Card( - margin: EdgeInsets.fromLTRB(15.0, 10.0, 8.0, 8.0), - color: widget.isSelected ? Color(0xff06b806) : widget.patientERGetClinicsList.isOnline == 1 ? Colors.white : Colors.grey, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + ProjectViewModel projectViewModel = Provider.of(context); + return Container( + width: double.infinity, + margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0), + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), ), - child: Container( - width: MediaQuery.of(context).size.width * 0.75, - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - child: Text( - widget.languageID == 'ar' - ? widget.patientERGetClinicsList.serviceNameN - : widget.patientERGetClinicsList.serviceName, - style: TextStyle( - fontSize: 16.0, - color: - widget.isSelected ? Colors.white : Colors.black)), - ), - ], - ), + ], + color: Colors.transparent, + ), + child: Container( + decoration: BoxDecoration( + color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + borderRadius: BorderRadius.all( + Radius.circular(6.0), ), ), - InkWell( - onTap: () { - getClinicTimings(widget.patientERGetClinicsList); - }, - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 8.0), + child: Container( + margin: EdgeInsets.only( + left: projectViewModel.isArabic + ? 0 + : widget.isSelected + ? 4 + : 6, + right: projectViewModel.isArabic ? widget.isSelected + ? 4 + : 6: 0), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12), + decoration: BoxDecoration( color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.only( + bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), + topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0), ), - child: Container( - padding: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Icon(Icons.access_time, size: 26.0, color: Colors.red[800]), - ], + ), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Container( + width: 4, + height: 4, + decoration: containerRadius( + widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + 100, + ), + ), + mWidth(4), + Text( + widget.patientERGetClinicsList.isOnline == 1 ? TranslationBase.of(context).onlineTag : TranslationBase.of(context).offlineTag, + style: TextStyle( + fontSize: 10, + fontWeight: FontWeight.w600, + color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ), ), - ), + InkWell( + onTap: (){ getClinicTimings(widget.patientERGetClinicsList);}, + child: Container( + padding: EdgeInsets.only(left: 8,right: 8,top: 4,bottom: 4), + decoration: containerRadius(CustomColors.devider, 100), + child: Row( + children: [ + SvgPicture.asset( + "assets/images/new-design/ic_schedule.svg", + width: 16, + height: 16, + color: Colors.black, + ), + mWidth(4), + Text( + TranslationBase.of(context).schedule, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ) + ], + ), + ), + ), + ], ), ), - ], + ), ); } getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) - .then((res) { + service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { - clinicsServiceTimingsResponse = - ClinicsServiceTimingsResponse.fromJson(res); - print(clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList.length); + clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res); + print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length); - 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: ClinicTimingsDialog( - clinicName: patientERGetClinicsList.serviceName, - patientERGetClinicsServiceTimingsList: - clinicsServiceTimingsResponse - .patientERGetClinicsServiceTimingsList, - ), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); + navigateTo(context, ClinicTimingsPage( + clinicName: patientERGetClinicsList.serviceName, + patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, + )); + // 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: ClinicTimingsDialog( + // clinicName: patientERGetClinicsList.serviceName, + // patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList, + // ), + // ), + // ); + // }, + // transitionDuration: Duration(milliseconds: 500), + // barrierDismissible: true, + // barrierLabel: '', + // context: context, + // pageBuilder: (context, animation1, animation2) {}); }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index afb41ea2..988d102c 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -29,6 +30,8 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../live_care_payment_page.dart'; + class ClinicList extends StatefulWidget { final Function getLiveCareHistory; @@ -76,11 +79,8 @@ class _clinic_listState extends State { if (LiveCareHome.isLiveCareTypeSelected != true) { openLiveCareSelectionDialog(); } else { - print("LiveCare Type Selected"); setState(() { currentSelectedLiveCareType = "immediate"; - // isDataLoaded = true; - // print(liveCareOnlineClinicsListResponse.length); getLiveCareClinicsList(); }); } @@ -92,7 +92,9 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView(child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList()); + return Container( + child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), + ); } void startLiveCare() { @@ -175,32 +177,43 @@ class _clinic_listState extends State { } showLiveCarePaymentDialog(GetERAppointmentFeesList getERAppointmentFeesList, int waitingTime) { - 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: LiveCarePaymentDialog(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}) - .then((value) { - if (value) { - if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { - showLiveCareInfoDialog(getERAppointmentFeesList); - } else { - navigateToPaymentMethod(getERAppointmentFeesList, context); + navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then( + (value) { + if (value) { + if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + showLiveCareInfoDialog(getERAppointmentFeesList); + } else { + navigateToPaymentMethod(getERAppointmentFeesList, context); + } } - } - }); + }, + ); + // 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: LiveCarePaymentDialog(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName), + // ), + // ); + // }, + // transitionDuration: Duration(milliseconds: 500), + // barrierDismissible: true, + // barrierLabel: '', + // context: context, + // pageBuilder: (context, animation1, animation2) {}) + // .then((value) { + // if (value) { + // if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + // showLiveCareInfoDialog(getERAppointmentFeesList); + // } else { + // navigateToPaymentMethod(getERAppointmentFeesList, context); + // } + // } + // }); } showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { @@ -438,62 +451,63 @@ class _clinic_listState extends State { return Column( children: [ isDataLoaded - ? Container( - height: MediaQuery.of(context).size.height * 0.7, - child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); - }, - child: ScheduleClinicCard( - isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, - clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], - languageID: languageID, - ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - ): getNoDataWidget(context), - ) + ? Expanded( + child: Container( + child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + mHeight(10), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedScheduleIndex(liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index]); + }, + child: ScheduleClinicCard( + isSelected: selectedClinicID == liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index].serviceID ? true : false, + clinicsHaveScheduleList: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 10.0, + ), + ], + ) + : getNoDataWidget(context), + ), + ) : Container(), isDataLoaded - ? Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: startScheduleLiveCare, - child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), - ), - ), + ? Container( + width: double.infinity, + color: Colors.white, + padding: EdgeInsets.all(12), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), ), - ) + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: CustomColors.accentColor, + textColor: Colors.white, + elevation: 0, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startScheduleLiveCare, + child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), + ), + ), + ) : Container(), ], ); @@ -503,72 +517,67 @@ class _clinic_listState extends State { return Column( children: [ isDataLoaded - ? Container( - height: MediaQuery.of(context).size.height * 0.75, - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).onlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - // itemCount: liveCareClinicsListResponse.patientERGetClinicsList.length, - itemCount: liveCareOnlineClinicsListResponse.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); - }, - child: ClinicCard( - isSelected: selectedClinicID == liveCareOnlineClinicsListResponse[index].serviceID ? true : false, - patientERGetClinicsList: liveCareOnlineClinicsListResponse[index], + ? Expanded( + child: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: const EdgeInsets.only(top: 16.0), + itemCount: liveCareOnlineClinicsListResponse.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareOnlineClinicsListResponse[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == liveCareOnlineClinicsListResponse[index].serviceID ? true : false, + patientERGetClinicsList: liveCareOnlineClinicsListResponse[index], + languageID: languageID, + ), + ); + }, + ), + // Container( + // margin: EdgeInsets.all(15.0), + // child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareOfflineClinicsListResponse.length, + itemBuilder: (context, index) { + return ClinicCard( + isSelected: selectedClinicID == liveCareOfflineClinicsListResponse[index].serviceID ? true : false, + patientERGetClinicsList: liveCareOfflineClinicsListResponse[index], languageID: languageID, - ), - ); - }, - ), - Container( - margin: EdgeInsets.all(15.0), - child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareOfflineClinicsListResponse.length, - itemBuilder: (context, index) { - return ClinicCard( - isSelected: selectedClinicID == liveCareOfflineClinicsListResponse[index].serviceID ? true : false, - patientERGetClinicsList: liveCareOfflineClinicsListResponse[index], - languageID: languageID, - ); - }, - ), - Container( - height: 50.0, - ), - ], - )), + ); + }, + ), + Container( + height: 10.0, + ), + ], + )), + ), ) : Container(), isDataLoaded - ? Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - color: Colors.grey[100], - width: MediaQuery.of(context).size.width, - height: 50.0, - child: DefaultButton(TranslationBase.of(context).start, () { + ? Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(16), + child: DefaultButton( + TranslationBase.of(context).start, + () { startLiveCare(); - }), + }, ), ) : Container(), diff --git a/lib/pages/livecare/widgets/livecare_logs.dart b/lib/pages/livecare/widgets/livecare_logs.dart index 7b85afc2..8898faa6 100644 --- a/lib/pages/livecare/widgets/livecare_logs.dart +++ b/lib/pages/livecare/widgets/livecare_logs.dart @@ -30,7 +30,12 @@ class _LiveCareLogsState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.erRequestHistoryList.length, itemBuilder: (context, index) { - return widget.erRequestHistoryList[index].callStatus < 4 ? Container() : LiveCareHistoryCard(erRequestHistoryList: widget.erRequestHistoryList[index]); + return widget.erRequestHistoryList[index].callStatus < 4 + ? Container() + : LiveCareHistoryCard( + erRequestHistoryList: widget.erRequestHistoryList[index], + isFirstOrLast: index==0?0:(index==widget.erRequestHistoryList.length-1)?1:2, + ); }, ), ) diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 837e58ef..1903e561 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authent import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -21,6 +23,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -34,13 +37,12 @@ import 'package:intl/intl.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/pages/login/register_new.dart'; class ConfirmLogin extends StatefulWidget { final Function changePageViewIndex; + const ConfirmLogin({Key key, this.changePageViewIndex}) : super(key: key); + @override _ConfirmLogin createState() => _ConfirmLogin(); } @@ -621,6 +623,7 @@ class _ConfirmLogin extends State { GifLoaderDialogUtils.hideDialog(context), Future.delayed(Duration(seconds: 1), () { AppToast.showErrorToast(message: result); + startSMSService(tempType); }), } }) @@ -639,15 +642,14 @@ class _ConfirmLogin extends State { if (result.isNeedUserAgreement == true) { //move to agreement page. } else { - insertIMEI(); + goToHome(); } } insertIMEI() { - authService.insertDeviceImei(selectedOption).then((value) => {goToHome()}).catchError((err) { + authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { print(err); }); - // authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {}); } getToDoCount() { @@ -669,7 +671,7 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - getToDoCount(); + // getToDoCount(); appointmentRateViewModel .getIsLastAppointmentRatedList() @@ -693,13 +695,12 @@ class _ConfirmLogin extends State { page: LandingPage(), ), (r) => false) - } + }, + insertIMEI() }) .catchError((err) { print(err); - //GifLoaderDialogUtils.hideDialog(context); }); - // SMSOTP.showLoadingDialog(context, false), } loading(flag) { @@ -751,37 +752,6 @@ class _ConfirmLogin extends State { ), ), ); - - // return InkWell( - // onTap: () { - // if (_flag == 0) { - // setState(() { - // isMoreOption = true; - // }); - // } else { - // authenticateUser(4, isActive: _loginIndex); - // } - // }, - // child: RoundedContainer( - // height: 150, - // borderColor: Colors.grey, - // showBorder: true, - // child: Padding( - // padding: EdgeInsets.fromLTRB(30, 15, 30, 15), - // child: Column( - // children: [ - // Image.asset( - // _icon, - // height: SizeConfig.imageSizeMultiplier * 13, - // width: SizeConfig.imageSizeMultiplier * 16, - // ), - // SizedBox( - // height: 20, - // ), - // Texts(_title, fontSize: SizeConfig.textMultiplier * 2, color: Colors.black) - // ], - // ), - // ))); } // todo 'sikander' optimize this after knowing usage diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index a978ffaa..86acac5c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -283,7 +283,7 @@ class _Login extends State { ConfirmDialog.closeAlertDialog(context), Navigator.of(context).push(FadePage(page: RegisterNew())), }, - cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); + cancelFunction: () => {}); dialog.showAlertDialog(context); }); // SMSOTP.showLoadingDialog(context, false), diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index b0b94cfc..5cf76e4f 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -151,7 +151,9 @@ class _Register extends State { )), bottomSheet: Container( width: double.maxFinite, - height: 80.0, + // height: 80.0, + color: Colors.white, + margin: EdgeInsets.only(bottom: 50.0), child: Row( children: [ Expanded( diff --git a/lib/pages/login/welcome.dart b/lib/pages/login/welcome.dart index 26b6421c..8688fec3 100644 --- a/lib/pages/login/welcome.dart +++ b/lib/pages/login/welcome.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; +import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; @@ -78,7 +79,7 @@ class _WelcomeLogin extends State { child: DefaultButton( TranslationBase.of(context).no, () => { - Navigator.of(context).push(FadePage(page: Register())), + Navigator.of(context).push(FadePage(page: RegisterNew())), }, color: CustomColors.accentColor, textColor: Colors.white, diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 389baf24..877c52fc 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -111,15 +111,6 @@ class AskDoctorPage extends StatelessWidget { ); } - // todo 'sikander' remove this later - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); return DateUtil.getWeekDay(dateObj.weekday) + diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 338aff23..6ade52bd 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -8,7 +8,6 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -16,7 +15,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -24,9 +23,6 @@ import 'package:flutter/material.dart'; import '../../../core/model/my_balance/AdvanceModel.dart'; import 'confirm_payment_page.dart'; -import 'dialogs/SelectBeneficiaryDialog.dart'; -import 'dialogs/SelectPatientFamilyDialog.dart'; -import 'dialogs/SelectPatientInfoDialog.dart'; import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } @@ -87,16 +83,48 @@ class _AdvancePaymentPageState extends State { Text( TranslationBase.of(context).advancePaymentLabel, style: TextStyle( - fontSize: 14, + fontSize: 16, fontWeight: FontWeight.w600, - letterSpacing: -0.46, + letterSpacing: -0.64, ), ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), InkWell( - onTap: () => confirmSelectBeneficiaryDialog(model), + onTap: () { + List list = [ + RadioSelectionDialogModel(TranslationBase.of(context).myAccount, 0), + RadioSelectionDialogModel(TranslationBase.of(context).myFamilyFiles, 1), + RadioSelectionDialogModel(TranslationBase.of(context).otherAccount, 2), + ]; + showDialog( + context: context, + child: RadioSelectionDialog( + listData: list, + selectedIndex: + beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)), + onValueSelected: (index) { + var type; + if (index == 0) { + type = BeneficiaryType.MyAccount; + } else if (index == 1) { + type = BeneficiaryType.MyFamilyFiles; + } else { + type = BeneficiaryType.OtherAccount; + } + + setState(() { + if (type == BeneficiaryType.MyAccount) { + _fileTextController.text = model.user.patientID.toString(); + advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; + } else + _fileTextController.text = ""; + + beneficiaryType = type; + }); + }, + ), + ); + }, child: Container( padding: EdgeInsets.all(8), width: double.infinity, @@ -118,10 +146,7 @@ class _AdvancePaymentPageState extends State { ), ), ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) - SizedBox( - height: 12, - ), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) SizedBox(height: 12), if (beneficiaryType == BeneficiaryType.MyFamilyFiles) InkWell( onTap: () { @@ -152,18 +177,13 @@ class _AdvancePaymentPageState extends State { ), ), ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).fileNumber, controller: _fileTextController, readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, ), - if (beneficiaryType == BeneficiaryType.OtherAccount) - SizedBox( - height: 12, - ), + if (beneficiaryType == BeneficiaryType.OtherAccount) SizedBox(height: 12), if (beneficiaryType == BeneficiaryType.OtherAccount) InkWell( onTap: () { @@ -197,9 +217,7 @@ class _AdvancePaymentPageState extends State { ), ), ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), InkWell( onTap: () => confirmSelectHospitalDialog(model.hospitals), child: Container( @@ -223,9 +241,7 @@ class _AdvancePaymentPageState extends State { ), ), ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).amount, keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), @@ -235,9 +251,7 @@ class _AdvancePaymentPageState extends State { }); }, ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), if (model.user != null) NewTextFields( hintText: TranslationBase.of(context).depositorEmail, @@ -246,9 +260,7 @@ class _AdvancePaymentPageState extends State { email = value; }, ), - SizedBox( - height: 12, - ), + SizedBox(height: 12), NewTextFields( hintText: TranslationBase.of(context).notes, controller: _notesTextController, @@ -334,73 +346,70 @@ class _AdvancePaymentPageState extends State { ); } - void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { - showDialog( - context: context, - child: SelectBeneficiaryDialog( - beneficiaryType: beneficiaryType, - onValueSelected: (value) { - setState(() { - if (value == BeneficiaryType.MyAccount) { - _fileTextController.text = model.user.patientID.toString(); - advanceModel.depositorName = model.user.firstName + " " + model.user.lastName; - } else - _fileTextController.text = ""; - - beneficiaryType = value; - }); - }, - ), - ); - } + int _selectedHospitalIndex = -1; void confirmSelectHospitalDialog(List hospitals) { + List list = [ + for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i), + ]; showDialog( context: context, - child: SelectHospitalDialog( - hospitals: hospitals, - selectedHospital: _selectedHospital, - onValueSelected: (value) { - setState(() { - _selectedHospital = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedHospitalIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedHospitalIndex = index; + _selectedHospital = hospitals[index]; + setState(() {}); }, ), ); } + int _selectedPatientIndex = -1; + void confirmSelectPatientDialog(List patientInfoList) { + List list = [ + for (int i = 0; i < patientInfoList.length; i++) RadioSelectionDialogModel(patientInfoList[i].fullName, i), + ]; showDialog( context: context, - child: SelectPatientInfoDialog( - patientInfoList: patientInfoList, - selectedPatientInfo: _selectedPatientInfo, - onValueSelected: (value) { - setState(() { - advanceModel.depositorName = value.fullName; - _selectedPatientInfo = value; - }); + child: RadioSelectionDialog( + listData: list, + isScrollable: true, + selectedIndex: _selectedPatientIndex, + onValueSelected: (index) { + _selectedPatientIndex = index; + _selectedPatientInfo = patientInfoList[index]; + advanceModel.depositorName = _selectedPatientInfo.fullName; + setState(() {}); }, ), ); } + int _selectedFamilyMemberIndex = -1; + void confirmSelectFamilyDialog(List getAllSharedRecordsByStatusList) { - if (getAllSharedRecordsByStatusList.isNotEmpty) + if (getAllSharedRecordsByStatusList.isNotEmpty) { + List list = [ + for (int i = 0; i < getAllSharedRecordsByStatusList.length; i++) RadioSelectionDialogModel(getAllSharedRecordsByStatusList[i].patientName, i), + ]; showDialog( context: context, - child: SelectPatientFamilyDialog( - getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, - selectedPatientFamily: selectedPatientFamily, - onValueSelected: (value) { - setState(() { - selectedPatientFamily = value; - _fileTextController.text = selectedPatientFamily.responseID.toString(); - advanceModel.depositorName = value.patientName; - }); + child: RadioSelectionDialog( + listData: list, + isScrollable: true, + selectedIndex: _selectedFamilyMemberIndex, + onValueSelected: (index) { + _selectedFamilyMemberIndex = index; + selectedPatientFamily = getAllSharedRecordsByStatusList[index]; + setState(() {}); }, ), ); + } } String getBeneficiaryType() { diff --git a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart deleted file mode 100644 index 526ffaf6..00000000 --- a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart +++ /dev/null @@ -1,204 +0,0 @@ -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; -import '../advance_payment_page.dart'; - -class SelectBeneficiaryDialog extends StatefulWidget { - final BeneficiaryType beneficiaryType; - final Function(BeneficiaryType) onValueSelected; - - SelectBeneficiaryDialog({Key key, this.beneficiaryType, this.onValueSelected}); - - @override - _SelectBeneficiaryDialogState createState() => _SelectBeneficiaryDialogState(this.beneficiaryType); -} - -class _SelectBeneficiaryDialogState extends State { - _SelectBeneficiaryDialogState(this.beneficiaryType); - - BeneficiaryType beneficiaryType; - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Container( - child: Column( - children: [ - Divider(), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.MyAccount; - }); - }, - child: ListTile( - title: Text( - TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: BeneficiaryType.MyAccount, - groupValue: beneficiaryType, - activeColor: secondaryColor, - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.MyFamilyFiles; - }); - }, - child: ListTile( - title: Text( - TranslationBase.of(context).myFamilyFiles, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: BeneficiaryType.MyFamilyFiles, - groupValue: beneficiaryType, - activeColor: Color(0xffC5272D), - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - beneficiaryType = BeneficiaryType.OtherAccount; - }); - }, - child: ListTile( - title: Text( - TranslationBase.of(context).otherAccount, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: BeneficiaryType.OtherAccount, - groupValue: beneficiaryType, - activeColor: Color(0xffC5272D), - onChanged: (BeneficiaryType value) { - setState(() { - beneficiaryType = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Text( - TranslationBase.of(context).cancel.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - color: Color(0xffC5272D), - ), - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(beneficiaryType); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - TranslationBase.of(context).ok.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - ), - ), - ), - ), - ], - ) - ], - ), - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart index 19e4fea4..d0f991ac 100644 --- a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart +++ b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart @@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +// todo 'sikander' remove this file when usage known class SelectCiteisDialog extends StatefulWidget { final List hospitals; final Function(CitiesModel) onValueSelected; diff --git a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart deleted file mode 100644 index fd47ea1b..00000000 --- a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart +++ /dev/null @@ -1,145 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectHospitalDialog extends StatefulWidget { - final List hospitals; - final Function(HospitalsModel) onValueSelected; - HospitalsModel selectedHospital; - - SelectHospitalDialog({Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); - - @override - _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); -} - -class _SelectHospitalDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.hospitals.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedHospital = widget.hospitals[index]; - }); - }, - child: ListTile( - title: Text( - widget.hospitals[index].name + ' ${widget.hospitals[index].distanceInKilometers} ' + TranslationBase.of(context).km, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: widget.hospitals[index], - groupValue: widget.selectedHospital, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedHospital = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Text( - TranslationBase.of(context).cancel.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - color: Colors.red - ), - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedHospital); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - TranslationBase.of(context).ok, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - ), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart deleted file mode 100644 index d4b2e8fb..00000000 --- a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart +++ /dev/null @@ -1,152 +0,0 @@ -import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectPatientFamilyDialog extends StatefulWidget { - final List getAllSharedRecordsByStatusList; - final Function(GetAllSharedRecordsByStatusList) onValueSelected; - GetAllSharedRecordsByStatusList selectedPatientFamily; - - List getAllSharedRecordsByStatusApprovedList = new List(); - - SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected, this.selectedPatientFamily}); - - @override - _SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState(); -} - -class _SelectPatientFamilyDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedPatientFamily = widget.selectedPatientFamily ?? widget.getAllSharedRecordsByStatusList[0]; - - if (widget.getAllSharedRecordsByStatusList.isNotEmpty) - widget.getAllSharedRecordsByStatusList.forEach((element) { - if (element.status == 3) widget.getAllSharedRecordsByStatusApprovedList.add(element); - }); - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.getAllSharedRecordsByStatusApprovedList.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusApprovedList[index]; - }); - }, - child: ListTile( - title: Text( - widget.getAllSharedRecordsByStatusApprovedList[index].patientName, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: widget.getAllSharedRecordsByStatusApprovedList[index], - groupValue: widget.selectedPatientFamily, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedPatientFamily = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Text( - TranslationBase.of(context).cancel.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - color: Colors.red, - ), - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedPatientFamily); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - TranslationBase.of(context).ok, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - ), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart deleted file mode 100644 index 759a6874..00000000 --- a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart +++ /dev/null @@ -1,146 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../../../Constants.dart'; - -class SelectPatientInfoDialog extends StatefulWidget { - final List patientInfoList; - - final Function(PatientInfo) onValueSelected; - PatientInfo selectedPatientInfo; - - SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected, this.selectedPatientInfo}); - - @override - _SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState(); -} - -class _SelectPatientInfoDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedPatientInfo = widget.selectedPatientInfo ?? widget.patientInfoList[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - children: [ - Column( - children: [ - Divider(), - ...List.generate( - widget.patientInfoList.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 2, - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedPatientInfo = widget.patientInfoList[index]; - }); - }, - child: ListTile( - title: Text( - widget.patientInfoList[index].fullName, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - leading: Radio( - value: widget.patientInfoList[index], - groupValue: widget.selectedPatientInfo, - activeColor: secondaryColor, - onChanged: (value) { - setState(() { - widget.selectedPatientInfo = value; - }); - }, - ), - ), - ), - ) - ], - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Text( - TranslationBase.of(context).cancel.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - color: Colors.red, - ), - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedPatientInfo); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - TranslationBase.of(context).ok.toUpperCase(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - ), - ), - ), - ), - ], - ) - ], - ) - ], - ); - } -} diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart index 8c98ebc8..e4ff9581 100644 --- a/lib/pages/medical/balance/my_balance_page.dart +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -1,14 +1,16 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_svg/svg.dart'; import 'advance_payment_page.dart'; @@ -24,118 +26,156 @@ class MyBalancePage extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: TranslationBase.of(context).myBalances, + appBarTitle: TranslationBase.of(context).myWallet, imagesInfo: imagesInfo, description: TranslationBase.of(context).infoMyBalance, showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: CustomColors.appBackgroudGreyColor, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).balanceAmount, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - SizedBox( - height: 15, - ), - Container( - padding: EdgeInsets.all(8), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - color: Colors.red[700], - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(7), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${model.totalAdvanceBalanceAmount ?? 0} ' + TranslationBase.of(context).sar, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - color: Colors.white, - ), - ), - Text( - TranslationBase.of(context).totalBalance, - style: TextStyle( - fontSize: 14, - letterSpacing: -0.46, - color: Colors.white, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.fromLTRB(14, 12, 10, 12), + decoration: BoxDecoration( + color: Color(0xff2B353E), + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), ), - ], - ), - ), - SizedBox( - height: 9, - ), - ...List.generate( - model.patientAdvanceBalanceAmountList.length, - (index) => Container( - padding: EdgeInsets.all(8), - height: 65, - margin: EdgeInsets.only(top: 8), - decoration: BoxDecoration( - color: Colors.white, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} ' + TranslationBase.of(context).sar, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + "assets/images/new/services/balance_credit.svg", + height: 40, + width: 40, + color: Colors.white, + ), + SizedBox(height: 6), + Text( + TranslationBase.of(context).totalBalance, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.96, + fontWeight: FontWeight.bold, + color: Colors.white, + //height: 16/22 + ), + ), + ], + ), ), - ), - Text( - model.patientAdvanceBalanceAmountList[index].projectDescription, - style: TextStyle( - fontSize: 14, - letterSpacing: -0.46, + Container( + padding: EdgeInsets.fromLTRB(14, 10, 12, 10), + decoration: BoxDecoration( + color: Color(0xff3f4850), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + double.parse(model.totalAdvanceBalanceAmount?.toString() ?? "0").toStringAsFixed(2), + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + letterSpacing: -1.44, + height: 24 / 23, + color: Colors.white, + ), + ), + Text( + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + letterSpacing: -0.96, + color: Colors.white, + ), + ), + ], + ), ), - ), - ], + ], + ), ), - ), + SizedBox(height: 12), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (cxt, index) { + PatientAdvanceBalanceAmount balanceAmount = model.patientAdvanceBalanceAmountList[index]; + double amount = double.parse(balanceAmount.patientAdvanceBalanceAmount?.toString() ?? "0"); + return Container( + padding: EdgeInsets.fromLTRB(14, 18, 14, 18), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + balanceAmount.projectDescription, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, + color: Color(0xff2E303A), + ), + ), + ), + Text( + amount.toStringAsFixed(2) + " " + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 16, + letterSpacing: -0.64, + fontWeight: amount > 0 ? FontWeight.bold : FontWeight.w500, + color: Color(0xff2E303A), + ), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => SizedBox(height: 12), + itemCount: model.patientAdvanceBalanceAmountList.length), + ], ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.13, - ) - ], + ), ), - ), - ), - bottomSheet: Container( - // height: MediaQuery.of(context).size.height * 0.12, - height: 70.0, - color: Colors.white, - width: double.infinity, - padding: EdgeInsets.all(12), - child: DefaultButton( - // textColor: Colors.white, - // color: CustomColors.accentColor, - TranslationBase.of(context).createAdvancedPayment, - () { - Navigator.push(context, FadePage(page: AdvancePaymentPage())); - }, - ), + DefaultButton( + TranslationBase.of(context).createAdvancedPayment, + () { + Navigator.push(context, FadePage(page: AdvancePaymentPage())); + }, + ).insideContainer, + ], ), ), ); diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 7c96dc3e..5ef8c69c 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; + import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -216,30 +216,6 @@ class _AddWeightPageState extends State { ), ); return; - - // todo 'sikander' remove useless code - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: TranslationBase.of(context).removeMeasure, - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - GifLoaderDialogUtils.showMyDialog(context); - widget.model.deleteWeightResult(lineItemNo: widget.lineItemNo).then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.model.state == ViewState.ErrorLocal) - AppToast.showErrorToast(message: widget.model.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.model.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); }) ], ), @@ -304,24 +280,6 @@ class _AddWeightPageState extends State { return " ${timeWeightDate.hour}:${timeWeightDate.minute}"; } - void confirmSelectMeasureTimeDialog(List list) { - showDialog( - context: context, - child: RadioStringDialog( - radioList: list, - title: TranslationBase.of(context).measureUnit, - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - weightUnit = list.indexOf(value); - validateForm(); - }); - }, - ), - ); - } - void validateForm() { if (_weightValueController.text.length > 0 && measureTimeSelectedType != null) { setState(() { diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index 77bb45b7..a4c0b943 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -6,10 +6,8 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -119,9 +117,6 @@ class _AddBloodPressurePageState extends State { }, ), ); - return; - - confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); }, child: Container( padding: EdgeInsets.all(12), @@ -277,24 +272,6 @@ class _AddBloodPressurePageState extends State { return " ${timeSugarDate.hour}:${timeSugarDate.minute}"; } - void confirmSelectMeasureTimeDialog(List list) { - showDialog( - context: context, - child: RadioStringDialog( - radioList: list, - title: TranslationBase.of(context).selectArm, - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - measuredArm = list.indexOf(value); - validateForm(); - }); - }, - ), - ); - } - void validateForm() { print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString()); if (_bloodSystolicValueController.text.length > 0 && _bloodDiastolicValueController.text.length > 0) { diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 82375322..8e47e4e8 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -8,8 +8,8 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -41,6 +41,8 @@ class _AddBloodSugarPageState extends State { String measureUnitSelectedType = 'mg/dlt'; int measuredTime = 1; bool isButtonDisabled = true; + + int _selectedMeasureUnitIndex = 0; final List measureUnitList = ['mg/dlt', 'mol/L']; final List measureTimeEnList = [ 'Before Breakfast', @@ -66,6 +68,7 @@ class _AddBloodSugarPageState extends State { "صائم", "آخر", ]; + int _selectedMeasureTimeIndex; String measureTimeSelectedType; @override @@ -88,212 +91,198 @@ class _AddBloodSugarPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - margin: EdgeInsets.all(15), - child: Column( - children: [ - SizedBox( - height: 15, - ), - NewTextFields( - hintText: TranslationBase.of(context).sugarAdd, - controller: _bloodSugarValueController, - keyboardType: TextInputType.number, - onChanged: (value) => validateForm(), - fontWeight: FontWeight.normal, - fontSize: 14, - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureUnitDialog(); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureUnitSelectedType), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + child: Column( + children: [ + NewTextFields( + hintText: TranslationBase.of(context).sugarAdd, + controller: _bloodSugarValueController, + keyboardType: TextInputType.number, + onChanged: (value) => validateForm(), + fontWeight: FontWeight.normal, + fontSize: 14, + ), + SizedBox(height: 12), + InkWell( + onTap: () { + confirmSelectMeasureUnitDialog(); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureUnitSelectedType), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { - setState(() { - bloodSugarDate = date; - }); - }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(TranslationBase.of(context).date), - Texts(getDate()), - ], + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) { + setState(() { + bloodSugarDate = date; + }); + }, currentTime: bloodSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(TranslationBase.of(context).date), + Texts(getDate()), + ], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { - setState(() { - timeSugarDate = date; - }); - }, currentTime: timeSugarDate, locale: projectViewModel.localeType); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + SizedBox(height: 12), + InkWell( + onTap: () { + DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) { + setState(() { + timeSugarDate = date; + }); + }, currentTime: timeSugarDate, locale: projectViewModel.localeType); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Texts(TranslationBase.of(context).time), Texts(getTime())], + ), ), ), - ), - SizedBox( - height: 8, - ), - InkWell( - onTap: () { - confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); - }, - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), - Icon( - Icons.arrow_drop_down, - color: Colors.grey, - ) - ], + SizedBox(height: 12), + InkWell( + onTap: () { + confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(measureTimeSelectedType ?? TranslationBase.of(context).other), + Icon( + Icons.arrow_drop_down, + color: Colors.grey, + ) + ], + ), ), ), - ), - widget.isUpdate - ? Container( - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - InkWell( - child: Texts( - TranslationBase.of(context).delete, - decoration: TextDecoration.underline, - fontWeight: FontWeight.bold, - color: Colors.red[900], - ), - onTap: () { - ConfirmDialog dialog = new ConfirmDialog( + widget.isUpdate + ? Container( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + InkWell( + child: Texts( + TranslationBase.of(context).delete, + decoration: TextDecoration.underline, + fontWeight: FontWeight.bold, + color: Colors.red[900], + ), + onTap: () { + showDialog( context: context, - confirmMessage: TranslationBase.of(context).removeMeasure, - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () async { - ConfirmDialog.closeAlertDialog(context); - - GifLoaderDialogUtils.showMyDialog(context); - widget.bloodSugarViewMode.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + child: ConfirmWithMessageDialog( + message: TranslationBase.of(context).removeMeasure, + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + widget.bloodSugarViewMode.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + }).catchError((e) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - }).catchError((e) { - GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - }); - }, - cancelFunction: () => {}); - dialog.showAlertDialog(context); - }, - ) - ], - )) - : Container() - ], + }); + }, + ), + ); + }, + ) + ], + ), + ) + : Container() + ], + ), ), ), - ), - bottomSheet: Container( - color: Theme.of(context).scaffoldBackgroundColor, - child: Padding( - padding: const EdgeInsets.all(20.0), - child: DefaultButton( - TranslationBase.of(context).save.toUpperCase(), - isButtonDisabled - ? null - : () async { - if (_bloodSugarValueController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - if (widget.isUpdate) { - await widget.bloodSugarViewMode.updateDiabtecResult( - month: bloodSugarDate, - hour: timeSugarDate, - diabtecUnit: measureUnitSelectedType, - measuredTime: measuredTime, - lineItemNo: widget.lineItemNo, - bloodSugerResult: _bloodSugarValueController.text.toString()); - - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) - AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - } else { - await widget.bloodSugarViewMode.addDiabtecResult( + DefaultButton( + TranslationBase.of(context).save, + isButtonDisabled + ? null + : () async { + if (_bloodSugarValueController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + if (widget.isUpdate) { + await widget.bloodSugarViewMode.updateDiabtecResult( + month: bloodSugarDate, + hour: timeSugarDate, diabtecUnit: measureUnitSelectedType, measuredTime: measuredTime, - bloodSugerResult: _bloodSugarValueController.text.toString(), - bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', - ); + lineItemNo: widget.lineItemNo, + bloodSugerResult: _bloodSugarValueController.text.toString()); - GifLoaderDialogUtils.hideDialog(context); - if (widget.bloodSugarViewMode.state == ViewState.Error) - AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); - else - Navigator.pop(context); - } + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); + } else { + await widget.bloodSugarViewMode.addDiabtecResult( + diabtecUnit: measureUnitSelectedType, + measuredTime: measuredTime, + bloodSugerResult: _bloodSugarValueController.text.toString(), + bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00', + ); + + GifLoaderDialogUtils.hideDialog(context); + if (widget.bloodSugarViewMode.state == ViewState.Error) + AppToast.showErrorToast(message: widget.bloodSugarViewMode.error); + else + Navigator.pop(context); } - }, - disabledColor: Colors.grey, - ), - ), - )); + } + }, + disabledColor: Colors.grey, + ).insideContainer, + ], + ), + ); } String getDate() { @@ -305,33 +294,41 @@ class _AddBloodSugarPageState extends State { } void confirmSelectMeasureUnitDialog() { + List list = [ + RadioSelectionDialogModel("mg/dlt", 0), + RadioSelectionDialogModel("mol/L", 1), + ]; + showDialog( context: context, - child: RadioStringDialog( - radioList: measureUnitList, - title: TranslationBase.of(context).measureUnit, - selectedValue: measureUnitSelectedType, - onValueSelected: (value) { - setState(() { - measureUnitSelectedType = value; - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedMeasureUnitIndex, + onValueSelected: (index) { + _selectedMeasureUnitIndex = index; + measureUnitSelectedType = list[index].title; + setState(() {}); }, ), ); } - void confirmSelectMeasureTimeDialog(List list) { + void confirmSelectMeasureTimeDialog(List dataList) { + List list = [ + for (int i = 0; i < dataList.length; i++) RadioSelectionDialogModel(dataList[i], i), + ]; + showDialog( context: context, - child: RadioStringDialog( - radioList: list, - title: TranslationBase.of(context).measureTime, - selectedValue: measureTimeSelectedType, - onValueSelected: (value) { - setState(() { - measureTimeSelectedType = value; - measuredTime = list.indexOf(value); - }); + child: RadioSelectionDialog( + listData: list, + selectedIndex: _selectedMeasureTimeIndex, + isScrollable: true, + onValueSelected: (index) { + _selectedMeasureTimeIndex = index; + measureTimeSelectedType = list[index].title; + measuredTime = index; + setState(() {}); }, ), ); diff --git a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart index d4dd6efe..719b2196 100644 --- a/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart +++ b/lib/pages/medical/prescriptions/PrescriptionOrderOverveiw.dart @@ -9,9 +9,10 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -101,23 +102,43 @@ class PrescriptionOrderOverview extends StatelessWidget { prescriptionReportEnhList.length, (index) => Container( margin: EdgeInsets.all(0.0), - decoration: cardRadius(0), + // decoration: cardRadius(0), child: Row( children: [ - Container( - margin: EdgeInsets.only(bottom: 10.0), - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(30)), - child: Image.network( - prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 48, - height: 48, - ), + InkWell( + onTap: () { + showZoomImageDialog(context, prescriptionReportEnhList[index].imageSRCUrl); + }, + child: Stack( + alignment: Alignment.center, + children: [ + Container( + margin: EdgeInsets.only(bottom: 10.0), + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(3), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), ), SizedBox(width: 14), @@ -153,15 +174,14 @@ class PrescriptionOrderOverview extends StatelessWidget { ), ), Container( - decoration: cardRadius(0), + // decoration: cardRadius(0), margin: EdgeInsets.zero, child: Container( width: double.infinity, margin: EdgeInsets.all(12), - child: SecondaryButton( - label: TranslationBase.of(context).submit.toUpperCase(), - color: CustomColors.accentColor, - onTap: () async { + child: DefaultButton( + TranslationBase.of(context).submit.toUpperCase(), + () async { showDialog( context: context, child: ConfirmWithMessageDialog( @@ -171,7 +191,7 @@ class PrescriptionOrderOverview extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(context); await model .insertDeliveryOrder( - lineItemNo: 0, + lineItemNo: 1, longitude: longitude, latitude: latitude, appointmentNo: prescriptions.appointmentNo, diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index ebc3c241..5a47ec3b 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -10,9 +10,11 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -21,6 +23,7 @@ import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override @@ -78,20 +81,50 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ Row( children: [ - Container( - decoration: BoxDecoration( - border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), - borderRadius: BorderRadius.all(Radius.circular(30.0)), - ), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(30)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 48, - height: 48, - ), + // Container( + // decoration: BoxDecoration( + // border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + // borderRadius: BorderRadius.all(Radius.circular(30.0)), + // ), + // child: ClipRRect( + // borderRadius: BorderRadius.all(Radius.circular(30)), + // child: Image.network( + // prescriptionReport.imageSRCUrl, + // fit: BoxFit.cover, + // width: 48, + // height: 48, + // ), + // ), + // ), + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 49, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon( + Icons.search, + size: 18, + color: Colors.white, + ), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), + onTap: () { + showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + }, ), SizedBox(width: 12), Expanded( diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 6e30a3f7..4611eed1 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -37,7 +38,6 @@ class PrescriptionItemsPage extends StatelessWidget { appBarTitle: prescriptions.doctorName, baseViewModel: model, showNewAppBar: true, - backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, body: Column( children: [ @@ -108,20 +108,31 @@ class PrescriptionItemsPage extends StatelessWidget { mHeight(10), Row( children: [ - Container( - child: Container( - child: Image.network( - model.prescriptionReportListINP[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 60, - ), - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - decoration: cardRadius(2000), + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportListINP[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon(Icons.search,size: 18,color: Colors.white,), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), - clipBehavior: Clip.antiAlias, - decoration: containerColorRadiusBorderWidth(Colors.white, 200, Colors.grey[200], 1), + onTap: (){ + showZoomImageDialog(context, model.prescriptionReportListINP[index].imageSRCUrl,); + }, ), mWidth(12), Column( @@ -269,16 +280,31 @@ class PrescriptionItemsPage extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Image.network( - model.prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 48, - height: 48, + InkWell( + child: Stack( + alignment: Alignment.center, + children: [ + Container( + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + width: 60, + height: 60, + ), + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + decoration: cardRadius(2000), + ), + Container( + child: Icon(Icons.search,size: 18,color: Colors.white,), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - decoration: cardRadius(2000), + onTap: (){ + showZoomImageDialog(context, model.prescriptionReportEnhList[index].imageSRCUrl,); + }, ), mWidth(12), Expanded( diff --git a/lib/pages/medical/prescriptions/prescriptions_history_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_page.dart index 1da0adb6..adce13bb 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_page.dart @@ -1,12 +1,11 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_details_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -25,126 +24,130 @@ class PrescriptionsHistoryPage extends StatelessWidget { onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true), builder: (_, model, widget) => AppScaffold( baseViewModel: prescriptionsViewModel, - body: ListView.separated( - physics: BouncingScrollPhysics(), - padding: EdgeInsets.all(21), - separatorBuilder: (context, index) { - return SizedBox(height: 12); - }, - itemBuilder: (context, index) { - int status = prescriptionsViewModel.prescriptionsHistory[index].status; - String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; - Color _color; - if (status == 1) { - //pending - _color = Color(0xffCC9B14); - } else if (status == 2) { - //processing - _color = Color(0xff2E303A); - } else if (status == 3) { - //completed - _color = Color(0xff359846); - } else if (status == 4) { - //cancel // Rejected - _color = Color(0xffD02127); - } + body: model.state != ViewState.Busy + ? prescriptionsViewModel.prescriptionsHistory.length > 0 + ? ListView.separated( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + separatorBuilder: (context, index) { + return SizedBox(height: 12); + }, + itemBuilder: (context, index) { + int status = prescriptionsViewModel.prescriptionsHistory[index].statusId; + String _statusDisp = prescriptionsViewModel.prescriptionsHistory[index].statusText; + Color _color; + if (status == 1) { + //pending + _color = Color(0xffCC9B14); + } else if (status == 2) { + //processing + _color = Color(0xff2E303A); + } else if (status == 3) { + //completed + _color = Color(0xff359846); + } else if (status == 4 || status == 6 || status == 7) { + //cancel // Rejected + _color = Color(0xffD02127); + } - return InkWell( - onTap: () async { - final result = await Navigator.push( - context, - FadePage( - page: PrescriptionsHistoryDetailsPage( - prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], - ), - ), - ); - if (result != null) { - showOrderLog(); - } - }, - child: Container( - height: 65, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - width: 6, - decoration: BoxDecoration( - color: _color, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), - topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), - ), - ), - ), - Expanded( - child: Padding( - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _statusDisp, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), - ), - Text( - '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), - ), - ], - ), + return InkWell( + onTap: () async { + // final result = await Navigator.push( + // context, + // FadePage( + // page: PrescriptionsHistoryDetailsPage( + // prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], + // ), + // ), + // ); + // if (result != null) { + // showOrderLog(); + // } + }, + child: Container( + height: 65, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + width: 6, + decoration: BoxDecoration( + color: _color, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0), + topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0), + ), ), - Text( - DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + Expanded( + child: Padding( + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _statusDisp, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), + ), + Text( + '${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ], + ), + ), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created)), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), + ), + Text( + DateUtil.formatDateToTimeLang(DateTime.tryParse(prescriptionsViewModel.prescriptionsHistory[index].created), false), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), + ], + ) + ], + ), ), - ], - ) - ], - ), - ), - ), - Icon( - Icons.arrow_forward, - size: 16, - ), - mWidth(6), - ], - ), - )); - }, - itemCount: prescriptionsViewModel.prescriptionsHistory.length, - ), + ), + Icon( + Icons.arrow_forward, + size: 16, + ), + mWidth(6), + ], + ), + )); + }, + itemCount: prescriptionsViewModel.prescriptionsHistory.length, + ) + : getNoDataWidget(context) + : Container(), )); } } diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 26c8dc22..d5efa38b 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -90,7 +90,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), @@ -99,7 +99,7 @@ class _HomePrescriptionsPageState extends State with Sing prescriptionsViewModel: model, showOrderLog: () async { _tabController.animateTo(2); - await model.getPrescriptionsOrders(showLoading: true); + // await model.getPrescriptionsOrders(showLoading: true); setState(() {}); }, ), diff --git a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart new file mode 100644 index 00000000..cceb8b1e --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart @@ -0,0 +1,571 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyStepsResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class DistanceTracker extends StatefulWidget { + @override + _DistanceTrackerState createState() => _DistanceTrackerState(); +} + +class _DistanceTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + num weeklyStatsAvgValue = 0; + num monthlyStatsAvgValue = 0; + num yearlyStatsAvgValue = 0; + + num avgWeeklyStepsValue = 0; + num avgMonthlyStepsValue = 0; + num avgYearlyStepsValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyStepsList = List(); + List monthlyStepsList = List(); + List yearlyStepsList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyDistanceData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).distance, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + print(value); + if (value == 0) { + getWeeklyDistanceData(); + } else if (value == 1) { + getMonthlyDistanceData(); + } else { + getYearlyDistanceData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded ? getWeeklyDistanceDetails() : Container(), + isMonthlyDataLoaded ? getMonthlyDistanceDetails() : Container(), + isYearlyDataLoaded ? getYearlyDistanceDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyDistanceData() { + avgWeeklyStepsValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyStepsList.clear(); + res['Med_GetWeekStepsTransactionsStsList'].forEach((element) { + weekyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgWeeklyStepsValue += value; + weeklyDataLength++; + } + }); + generateWeekData(); + setState(() { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyDistanceData() { + avgMonthlyStepsValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyStepsList.clear(); + res['Med_GetMonthStepsTransactionsStsList'].forEach((element) { + monthlyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgMonthlyStepsValue += value; + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyDistanceData() { + avgYearlyStepsValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(7, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + num value = element['ValueSum']; + avgYearlyStepsValue += value; + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyStepsList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyStepsList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? (element.value.toDouble() / 1000) : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyStepsList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyStepsList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() / 1000 : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? element.valueSum.toDouble() / 1000 : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyDistanceDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgDistance, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).km_, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + weekyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue((step.value / 1000).toString() + " " + TranslationBase.of(context).km_, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + monthlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue((step.value / 1000).toString() + " " + TranslationBase.of(context).km_, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + yearlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_ , isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + +} diff --git a/lib/pages/medical/smart_watch_health_data/health_data_list.dart b/lib/pages/medical/smart_watch_health_data/health_data_list.dart index cbfc1c5c..80a12cca 100644 --- a/lib/pages/medical/smart_watch_health_data/health_data_list.dart +++ b/lib/pages/medical/smart_watch_health_data/health_data_list.dart @@ -1,6 +1,12 @@ -import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/stepsTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/Steps/stepsTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/distance/distanceTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart'; +import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/syncHealthData.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; + // import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; @@ -10,7 +16,6 @@ class HealthDataList extends StatefulWidget { } class _HealthDataListState extends State { - // List dataTypes = List(); @override @@ -26,192 +31,108 @@ class _HealthDataListState extends State { @override Widget build(BuildContext context) { + List myMedicalList = myOptionsList(context); return AppScaffold( - appBarTitle: "Smartwatches", - isShowAppBar: true, - body: Container( - height: MediaQuery - .of(context) - .size - .height, - margin: EdgeInsets.all(20.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Heart Rate", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/sleep_data.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Sleep Data", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: StepsTracker(), - ), - ); + appBarTitle: TranslationBase.of(context).smartWatches, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + body: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + height: 20, + ), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; }, - child: Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Steps", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Distance", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - Divider( - color: Colors.grey[500], - ), - Row( - children: [ - Container( - child: Image.asset( - "assets/images/SmartWatches/heartrate_icon.png", - width: 60.0, - height: 60.0), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 0.0), - child: Text("Energy", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], ), - Divider( - color: Colors.grey[500], - ), - ], - ), - ), - ), - bottomSheet: Container( - width: double.infinity, - height: MediaQuery - .of(context) - .size - .height * 0.1, - color: Colors.grey[100], - child: Column( - children: [ - Divider( - color: Colors.transparent, ), - InkWell( - onTap: () { - print("ReadLast"); - // readLast(); - }, - child:Container( - height: (MediaQuery - .of(context) - .size - .height/2)*0.12, - width: MediaQuery - .of(context) - .size - .width * 0.8, - decoration: BoxDecoration( - color: Colors.grey[800], - borderRadius: BorderRadius.circular(6.0), - ), - child: Container( - padding: EdgeInsets.only(top: 10.0), - child: Text( - 'Sync Health Data' , textAlign: TextAlign.center,style: TextStyle( - color: Colors.white , fontSize: 18.0 - ), - ), - ),),), ], ), - )); + ), + ), + bottomSheet: syncHealthDataButton(), + ); } + List myOptionsList(BuildContext context) { + List medical = List(); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: HeartRateTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).heart, + imagePath: 'assets/images/SmartWatches/heartrate_icon.png', + subTitle: null, + isPngImage: true, + ), + )); - // void readLast() async { - // print("ReadLast"); - // final result = await FitKit.readLast(DataType.DISTANCE); - // print(result); - // print(result); - // } - // - // void readAll() async { - // if (await FitKit.requestPermissions(dataTypes)) { - // for (DataType type in dataTypes) { - // final results = await FitKit.read( - // type, - // dateFrom: DateTime.now().subtract(Duration(days: 7)), - // dateTo: DateTime.now(), - // limit: 100, - // ); - // print(results); - // print(results.length); - // } - // readLast(); - // } - // } -} \ No newline at end of file + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: StepsTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).steps, + imagePath: 'assets/images/SmartWatches/steps.png', + subTitle: null, + isPngImage: true, + ), + )); + + medical.add(InkWell( + onTap: () => Navigator.push( + context, + FadePage(page: DistanceTracker()), + ), + child: MedicalProfileItem( + title: TranslationBase.of(context).distance, + imagePath: 'assets/images/SmartWatches/distance.png', + subTitle: null, + isPngImage: true, + ), + )); + + return medical; + } + +// void readLast() async { +// print("ReadLast"); +// final result = await FitKit.readLast(DataType.DISTANCE); +// print(result); +// print(result); +// } +// +// void readAll() async { +// if (await FitKit.requestPermissions(dataTypes)) { +// for (DataType type in dataTypes) { +// final results = await FitKit.read( +// type, +// dateFrom: DateTime.now().subtract(Duration(days: 7)), +// dateTo: DateTime.now(), +// limit: 100, +// ); +// print(results); +// print(results.length); +// } +// readLast(); +// } +// } +} diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart new file mode 100644 index 00000000..077ed4bf --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -0,0 +1,574 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyHeartRateResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyHeartRateResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class HeartRateTracker extends StatefulWidget { + @override + _HeartRateTrackerState createState() => _HeartRateTrackerState(); +} + +class _HeartRateTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + num weeklyStatsAvgValue = 0; + num monthlyStatsAvgValue = 0; + num yearlyStatsAvgValue = 0; + + num avgWeeklyHearRateValue = 0; + num avgMonthlyHearRateValue = 0; + num avgYearlyHearRateValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyHearRateList = List(); + List monthlyHearRateList = List(); + List yearlyHearRateList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyHeartRateData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).heart, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + print(value); + if (value == 0) { + getWeeklyHeartRateData(); + } else if (value == 1) { + getMonthlyHeartRateData(); + } else { + getYearlyHeartRateData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded + ? avgWeeklyHearRateValue != 0 + ? getWeeklyHeartRateDetails() + : getNoDataWidget(context) + : Container(), + isMonthlyDataLoaded ? getMonthlyHeartRateDetails() : Container(), + isYearlyDataLoaded ? getYearlyHeartRateDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyHeartRateData() { + avgWeeklyHearRateValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyHearRateList.clear(); + res['Med_GetAvgWeekTransactionsStsList'].forEach((element) { + weekyHearRateList.add(new WeeklyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgWeeklyHearRateValue += value.toInt(); + weeklyDataLength++; + } + }); + if (weekyHearRateList.isNotEmpty) generateWeekData(); + setState(() { + if (avgWeeklyHearRateValue != 0) { + weeklyStatsAvgValue = avgWeeklyHearRateValue ~/ weeklyDataLength; + } + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyHeartRateData() { + avgMonthlyHearRateValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyHearRateList.clear(); + print(res['Med_GetAvgMonthTransactionsStsList'].length); + res['Med_GetAvgMonthTransactionsStsList'].forEach((element) { + monthlyHearRateList.add(new WeeklyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgMonthlyHearRateValue += value.toInt(); + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyHeartRateData() { + avgYearlyHearRateValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(3, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyHearRateList.clear(); + res['Med_GetYearTransactionsStsList'].forEach((element) { + yearlyHearRateList.add(new YearlyHeartRateResModel.fromJson(element)); + if (element['ValueAvg'] != null) { + num value = element['ValueAvg']; + avgYearlyHearRateValue += value; + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyHearRateList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyHearRateList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyHearRateList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyHearRateList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyHearRateList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyHearRateList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueAvg != null ? element.valueAvg.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyHeartRateDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgHeartRate, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).bpm, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyHearRateList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).heart), + ], + ), + ); + weekyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).heart), + ], + ), + ); + monthlyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).distance), + ], + ), + ); + yearlyHearRateList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueAvg.toString() + " " + TranslationBase.of(context).bpm, isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } +} diff --git a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart index eb8e916e..17d9d8a8 100644 --- a/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart +++ b/lib/pages/medical/smart_watch_health_data/smart_watch_instructions.dart @@ -6,9 +6,12 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/medical/smart_watch_health_data/health_data_list.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/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:url_launcher/url_launcher.dart'; @@ -23,13 +26,12 @@ class _SmartWatchInstructionsState extends State { bool hasAlreadySynced = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - if(authenticatedUserObject.isLogin) getLastPatientRecord(context); + if (authenticatedUserObject.isLogin) getLastPatientRecord(context); }); super.initState(); } @@ -37,396 +39,233 @@ class _SmartWatchInstructionsState extends State { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: "Sync Health Data", - isShowAppBar: true, - isShowDecPage: true, - description: TranslationBase.of(context).infoHealthData, - imagesInfo: [ - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), - ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') - ], - body: Container( - child: Platform.isIOS - ? _getAppleWatchInstructions() - : _getGoogleWatchInstructions(), - )); + appBarTitle: TranslationBase.of(context).smartWatches, + isShowAppBar: true, + isShowDecPage: true, + showNewAppBar: true, + showNewAppBarTitle: true, + description: TranslationBase.of(context).infoHealthData, + imagesInfo: [ + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), + ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') + ], + body: Container( + child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 30.0), + child: DefaultButton( + TranslationBase.of(context).continues, + () { + _openHealthDataList(); + }, + color: Color(0xff359846), + ), + ), + ); } _getAppleWatchInstructions() { return SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: CarouselSlider( - carouselController: buttonCarouselController, - options: CarouselOptions( - enableInfiniteScroll: false, - viewportFraction: 0.95, - height: MediaQuery.of(context).size.height * 0.9), - items: [1, 2].map((i) { - return Builder( - builder: (BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.symmetric(horizontal: 5.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white.withOpacity(1.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-1.jpeg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 1", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], ), - child: i == 1 - ? Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Supported Smartwatches", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-1.jpeg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 1", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-2.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 4", overflow: TextOverflow.clip , - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/apple-watch-5.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 5", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/Apple-Watch-6.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Apple Watch Series 6", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 30.0, 10.0, 10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that you have followed the instructions properly", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("CONTINUE", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - ], - ) - : Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Watch Instructions:", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 20.0, 10.0, 10.0), - child: Text( - "Before syncing data, please make sure that following instructions are met: ", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 10.0, 20.0, 10.0, 10.0), - child: Text( - "1. Make sure that you have installed 'Health' App & 'Watch' App from Apple Store.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "2. Make sure that your Apple Watch is connected with the Watch & Health Apps.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "3. Make sure that data like heart rate, steps, distance etc. are being shown on your health app.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 15.0, 110.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("SYNC HEALTH DATA", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - hasAlreadySynced ? Container( - margin: EdgeInsets.fromLTRB( - 15.0, 0.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - _openHealthDataList(); - }, - child: Text("ALREADY SYNCED", - style: TextStyle(fontSize: 18.0)), - ), - ), - ): Container(), - ], + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-2.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-4.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/apple-watch-5.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 5", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/Apple-Watch-6.png", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 6", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), ), - )); + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand3.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand4.jpg", width: 70.0, height: 70.0), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 30.0, 10.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); }, - ); - }).toList(), + child: Padding( + padding: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], ), - ) + ), ], ), ); @@ -434,402 +273,283 @@ class _SmartWatchInstructionsState extends State { _getGoogleWatchInstructions() { return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(top: 10.0), - child: CarouselSlider( - carouselController: buttonCarouselController, - options: CarouselOptions( - // enableInfiniteScroll: true, - viewportFraction: 0.99, - height: MediaQuery.of(context).size.height*1.02 ), - items: [1, 2].map((i) { - return Builder( - builder: (BuildContext context) { - return Container( - width: MediaQuery.of(context).size.width, - margin: EdgeInsets.symmetric(horizontal: 5.0), - child: Card( - margin: EdgeInsets.only(top:16.0 , bottom: 8.0), - // fromLTRB(8.0, 16.0, 8.0, 8.0), - color: Colors.white.withOpacity(1.0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + child: Container( + width: double.infinity, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), + ), + Container( + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/huawei-watch-2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/ticwatche2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mobovi TicWatch E2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/huawei-watch-2-classic.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Huawei Watch", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/ticwatche2.png", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Fossil Sport", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/misfit-vapor-2.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("MisFit Vapor 2", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/lg-watch-sport.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("LG Watch Sport", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand3.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 3", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(top: 15.0), + child: Row( + children: [ + Image.asset("assets/images/SmartWatches/miBand4.jpg", width: 70.0, height: 70.0), + Container( + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Mi Band 4", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ], + ), + ), + InkWell( + onTap: () { + launch("https://wearos.google.com/#find-your-watch"); + }, + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Text(TranslationBase.of(context).moreSupportedWatches, style: TextStyle(fontSize: 14.0, color: Colors.blue, decoration: TextDecoration.underline, letterSpacing: -0.36)), + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + Container( + margin: EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + InkWell( + onTap: () { + showInstructionsDialog(); + }, + child: Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), + ), + ], + ), + ), + ); + } + + showInstructionsDialog() { + 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: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 350.0, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(20.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(TranslationBase.of(context).smartWatches, style: TextStyle(fontSize: 22.0, color: Colors.black, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + IconButton( + icon: Icon( + Icons.close, + color: Colors.black, + ), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), - child: i == 1 + Platform.isIOS ? Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Supported Smartwatches", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/huawei-watch-2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Huawei Watch 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/ticwatche2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "Mobovi TicWatch E2", - overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).iosInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/huawei-watch-2-classic.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Huawei Watch", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/ticwatche2.png", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Fossil Sport", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/misfit-vapor-2.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "MisFit Vapor 2", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/lg-watch-sport.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text( - "LG Watch Sport", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Row( - children: [ - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand3.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 3", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - Expanded( - child: Container( - margin: - EdgeInsets.only(top: 15.0), - child: Row( - children: [ - Image.asset( - "assets/images/SmartWatches/miBand4.jpg", - width: 70.0, - height: 70.0), - Container( - width: MediaQuery.of(context).size.width*0.22, - child: Text("Mi Band 4", overflow: TextOverflow.clip, - style: TextStyle( - fontSize: 12.0)), - ) - ], - ), - ), - ), - ], - ), - ), - InkWell( - onTap: () { - launch( - "https://wearos.google.com/#find-your-watch"); - }, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Text( - "More Supported Smartwatches...", - style: TextStyle( - fontSize: 17.0, - color: Colors.blue, - decoration: - TextDecoration.underline)), - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that you have followed the instructions properly", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("CONTINUE", - style: TextStyle(fontSize: 18.0)), - ), - ), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 21.0), + child: Text(TranslationBase.of(context).iosInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), ], ) : Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("Watch Instructions:", - style: TextStyle( - fontSize: 22.0, - fontWeight: FontWeight.bold, - fontFamily: "WorkSans")), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "It Seems like you haven't synced your health data with the Dr. Alhabib App before. To proceed further, you need to sync your health data with the Dr. Alhabib App", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "Before syncing data, please make sure that following instructions are met: ", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "1. Make sure that you have installed 'WearOS' & 'Google Fit' apps from Google PlayStore.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), Container( - margin: EdgeInsets.all(10.0), - child: Text( - "2. Make sure that you have installed your watch related apps from Google PlayStore.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), + margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), + child: Text(TranslationBase.of(context).androidInstructions4, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "3. Make sure that your Smart Watch is connected with the WearOS app & your watch apps.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Text( - "4. Make sure that your smart watch apps are linked/associated with Google Fit App.", - textAlign: TextAlign.center, - style: TextStyle(fontSize: 17.0)), - ), - Container( - margin: EdgeInsets.fromLTRB( - 15.0, 75.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - buttonCarouselController.nextPage(); - }, - child: Text("SYNC HEALTH DATA", - style: TextStyle(fontSize: 18.0)), - ), - ), - ), - hasAlreadySynced ? Container( - margin: EdgeInsets.fromLTRB( - 15.0, 0.0, 15.0, 15.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), - minWidth: - MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - _openHealthDataList(); - }, - child: Text("ALREADY SYNCED", - style: TextStyle(fontSize: 18.0)), - ), - ), - ) : Container(), ], ), - )); - }, - ); - }).toList(), + ], + ), + ), + ], + ), + ), ), - ) - ], - ), - ); + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); } getLastPatientRecord(BuildContext context) { @@ -854,6 +574,10 @@ class _SmartWatchInstructionsState extends State { _openHealthDataList() { Navigator.push( - context, MaterialPageRoute(builder: (context) => HealthDataList())); + context, + FadePage( + page: HealthDataList(), + ), + ); } } diff --git a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart new file mode 100644 index 00000000..5f63c2ad --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart @@ -0,0 +1,566 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/WeeklyStepsResModel.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsTracker extends StatefulWidget { + @override + _StepsTrackerState createState() => _StepsTrackerState(); +} + +class _StepsTrackerState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + + ProjectViewModel projectViewModel; + + int weeklyStatsAvgValue = 0; + int monthlyStatsAvgValue = 0; + int yearlyStatsAvgValue = 0; + + int avgWeeklyStepsValue = 0; + int avgMonthlyStepsValue = 0; + int avgYearlyStepsValue = 0; + + int weeklyDataLength = 0; + int monthlyDataLength = 0; + int yearlyDataLength = 0; + + List weekyStepsList = List(); + List monthlyStepsList = List(); + List yearlyStepsList = List(); + + List weeklyTimeSeriesData = []; + List monthlyTimeSeriesData = []; + List yearlyTimeSeriesData = []; + + bool isWeeklyDataLoaded = false; + bool isMonthlyDataLoaded = false; + bool isYearlyDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getWeeklyStepsData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).steps, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + body: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthlyTab), + Tab(text: TranslationBase.of(context).yearly), + ], + onTap: (value) { + if (value == 0) { + getWeeklyStepsData(); + } else if (value == 1) { + getMonthlyStepsData(); + } else { + getYearlyStepsData(); + } + }, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isWeeklyDataLoaded ? getWeeklyStepsDetails() : Container(), + isMonthlyDataLoaded ? getMonthlyStepsDetails() : Container(), + isYearlyDataLoaded ? getYearlyStepsDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ); + } + + getWeeklyStepsData() { + avgWeeklyStepsValue = 0; + weeklyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 1, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + weekyStepsList.clear(); + res['Med_GetWeekStepsTransactionsStsList'].forEach((element) { + weekyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgWeeklyStepsValue += value.toInt(); + weeklyDataLength++; + } + }); + generateWeekData(); + setState(() { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + isWeeklyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getMonthlyStepsData() { + avgMonthlyStepsValue = 0; + monthlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 2, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + monthlyStepsList.clear(); + res['Med_GetMonthStepsTransactionsStsList'].forEach((element) { + monthlyStepsList.add(new WeeklyStepsResModel.fromJson(element)); + if (element['Value'] != null) { + num value = num.tryParse(element['Value'] ?? "0"); + avgMonthlyStepsValue += value.toInt(); + monthlyDataLength++; + } + }); + generateMonthData(); + setState(() { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + isMonthlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + getYearlyStepsData() { + avgYearlyStepsValue = 0; + yearlyDataLength = 0; + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + num value = element['ValueSum']; + avgYearlyStepsValue += value.toInt(); + yearlyDataLength++; + } + }); + generateYearData(); + setState(() { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + isYearlyDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + generateWeekData() { + if (weekyStepsList.length > 0) { + weeklyTimeSeriesData.clear(); + weekyStepsList.forEach( + (element) { + weeklyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateMonthData() { + if (monthlyStepsList.length > 0) { + monthlyTimeSeriesData.clear(); + monthlyStepsList.forEach( + (element) { + monthlyTimeSeriesData.add( + TimeSeriesSales2( + DateUtil.convertStringToDate(element.machineDate), + element.value != null ? element.value.toDouble() : 0.0, + ), + ); + }, + ); + } + } + + generateYearData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales2( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? double.tryParse(element.valueSum.toString()) : 0.0, + ), + ); + }, + ); + } + } + + getWeeklyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: weeklyTimeSeriesData, + indexes: weeklyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(weeklyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + weekyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataWeekly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getMonthlyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: monthlyTimeSeriesData, + indexes: monthlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + isWeeklyOrMonthly: true, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(monthlyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + monthlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullDataMonthly(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + getYearlyStepsDetails() { + return SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: ShowChart( + title: "", + timeSeries: yearlyTimeSeriesData, + indexes: yearlyTimeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + ), + Container( + child: Container( + decoration: cardRadius(12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 5.0), + child: Text(TranslationBase.of(context).avgSteps, style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " " + TranslationBase.of(context).steps, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + decoration: cardRadius(12), + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).details, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + )), + ), + Container( + padding: EdgeInsets.all(10), + color: Colors.transparent, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + yearlyStepsList.isEmpty + ? Container( + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) + : Table( + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), + ], + ), + ) + ], + ), + ), + ], + ), + ); + } + + List fullData(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + yearlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + new DateTime(step.year, step.month, 1), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataWeekly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + weekyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.value.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } + + List fullDataMonthly(BuildContext context) { + List tableRow = []; + tableRow.add( + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).date), + Utils.tableColumnTitle(TranslationBase.of(context).steps), + ], + ), + ); + monthlyStepsList.forEach( + (step) { + tableRow.add( + TableRow( + children: [ + Utils.tableColumnValue( + '${DateUtil.getDayMonthYearDateFormatted( + DateUtil.convertStringToDate(step.machineDate), + )} ', + isCapitable: false, + mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.value.toString(), isCapitable: false, mProjectViewModel: projectViewModel), + ], + ), + ); + }, + ); + return tableRow; + } +} diff --git a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart deleted file mode 100644 index 3fe1a4ba..00000000 --- a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart +++ /dev/null @@ -1,249 +0,0 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; -import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class StepsTracker extends StatefulWidget { - @override - _StepsTrackerState createState() => _StepsTrackerState(); -} - -class _StepsTrackerState extends State - with SingleTickerProviderStateMixin { - TabController _tabController; - - int weeklyStatsAvgValue = 0; - int monthlyStatsAvgValue = 0; - int yearlyStatsAvgValue = 0; - - int avgStepsValue = 0; - int dataLength = 0; - - List yearlyStepsList = List(); - - List yearlyTimeSeriesData = []; - - bool isDataLoaded = false; - - @override - void initState() { - _tabController = new TabController(length: 3, vsync: this); - WidgetsBinding.instance.addPostFrameCallback((_) { - getYearlyStepsData(); - }); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: true, - appBarTitle: "Steps", - isShowDecPage: false, - body: Container( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TabBar( - tabs: [ - Tab(text: TranslationBase.of(context).weekly), - Tab(text: TranslationBase.of(context).monthly), - Tab(text: TranslationBase.of(context).yearly), - ], - controller: _tabController, - ), - Expanded( - child: new TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - isDataLoaded ? getWeeklyStepsDetails() : Container(), - isDataLoaded ? getMonthlyStepsDetails() : Container(), - isDataLoaded ? getYearlyStepsDetails() : Container() - ], - controller: _tabController, - ), - ), - ], - ), - ), - ); - } - - getYearlyStepsData() { - avgStepsValue = 0; - dataLength = 0; - - DoctorsListService service = new DoctorsListService(); - GifLoaderDialogUtils.showMyDialog(context); - service.getPatientHealthDataStats(6, 3, context).then((res) { - GifLoaderDialogUtils.hideDialog(context); - print(res['Med_GetYearStepsTransactionsStsList']); - yearlyStepsList.clear(); - res['Med_GetYearStepsTransactionsStsList'].forEach((element) { - print('in forEach'); - yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); - if (element['ValueSum'] != null) { - double value = element['ValueSum']; - avgStepsValue += value.toInt(); - dataLength++; - } - }); - print("innnnnnnnnnnnnnnnn"); - print(avgStepsValue); - print(dataLength); - setState(() { - yearlyStatsAvgValue = avgStepsValue ~/ dataLength; - isDataLoaded = true; - }); - }).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - // AppToast.showErrorToast(message: err); - print(err); - }); - } - - generateData() { - if (yearlyStepsList.length > 0) { - yearlyTimeSeriesData.clear(); - yearlyStepsList.forEach( - (element) { - yearlyTimeSeriesData.add( - TimeSeriesSales( - new DateTime(element.year, element.month, 1), - element.valueSum != null ? element.valueSum.toInt() : 0, - ), - ); - }, - ); - yearlyTimeSeriesData.forEach((element) { - print(element.sales); - print(element.time); - }); - } - return [ - new charts.Series( - id: 'Sales', - colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, - domainFn: (TimeSeriesSales sales, _) => sales.time, - measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: yearlyTimeSeriesData, - ) - ]; - } - - getWeeklyStepsDetails() { - return Container( - child: Text("Weekly"), - ); - } - - getMonthlyStepsDetails() { - return Container( - child: Text("Monthly"), - ); - } - - getYearlyStepsDetails() { - return Container( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - child: AppTimeSeriesChart( - seriesList: generateData(), - chartName: "Steps", - startDate: DateTime( - yearlyStepsList[0].year, yearlyStepsList[0].month, 1), - endDate: DateTime( - yearlyStepsList[yearlyStepsList.length - 1].year, - yearlyStepsList[yearlyStepsList.length - 1].month, - 1), - ), - ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), - child: - Text("Average Steps", style: TextStyle(fontSize: 18.0)), - ), - Container( - margin: EdgeInsets.only(bottom: 10.0), - child: Text(yearlyStatsAvgValue.toString() + " Steps", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ], - ), - ), - ), - Container( - margin: EdgeInsets.all(10.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Container( - transform: Matrix4.translationValues(0.0, -10.0, 0.0), - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text("History", style: TextStyle(fontSize: 14.0)), - Row( - children: [ - Text("view more", style: TextStyle(fontSize: 14.0)), - Container( - margin: EdgeInsets.only(left: 3.0, right: 3.0), - transform: Matrix4.translationValues(0.0, 1.5, 0.0), - width: 30.0, - height: 30.0, - child: Image.asset( - "assets/images/new-design/view_more.png", - fit: BoxFit.contain), - ), - ], - ), - ], - ), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - side: BorderSide(color: Colors.grey[400], width: 0.6)), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), - child: Text("Date", - style: TextStyle( - fontSize: 18.0, fontWeight: FontWeight.bold)), - ), - Container( - padding: EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 0.0), - child: Text("Steps", style: TextStyle(fontSize: 18.0)), - ), - ], - ), - ), - ), - ], - ), - ); - } -} diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart new file mode 100644 index 00000000..47be3c5f --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -0,0 +1,274 @@ +import 'package:collection/collection.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; +import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:fit_kit/fit_kit.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; + +class syncHealthDataButton extends StatefulWidget { + double marginTop; + + double hight; + + double minWidth; + + syncHealthDataButton({this.marginTop, this.hight, this.minWidth}); + + @override + _syncHealthDataButtonState createState() => _syncHealthDataButtonState(); +} + +class _syncHealthDataButtonState extends State { + List dataTypes = List(); + + List Med_InsertTransactionsInputsList = new List(); + List Med_InsertTransactionsInputsList2 = new List(); + + List sleepDataList = new List(); + + List healthDataList = new List(); + + int TransactionsListID = 1; + + int MedCategoryID = 0; + + @override + void initState() { + dataTypes.add(DataType.DISTANCE); + dataTypes.add(DataType.STEP_COUNT); + dataTypes.add(DataType.HEART_RATE); + // dataTypes.add(DataType.SLEEP); + // dataTypes.add(DataType.ENERGY); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.all(20.0), + child: DefaultButton(TranslationBase.of(context).syncHealthData, () { + print("ReadAll"); + readAll(); + }), + ), + ); + } + + void readAll() async { + TransactionsListID = 1; + var MedSubCategoryID = 0; + double value = 0.0; + + GifLoaderDialogUtils.showMyDialog(context); + Med_InsertTransactionsInputsList.clear(); + var date; + var differenceInHours; + String strDifferenceInHours; + var differenceInMinutes; + String strDifferenceInMinutes; + var today = DateTime.now(); + var yearNum = DateFormat('y').format(today).toString(); + + var firstDayOfTheYear = DateTime.parse(yearNum + "-" + "01" + "-" + "01"); + + if (await FitKit.requestPermissions(dataTypes)) { + for (DataType type in dataTypes) { + final results = await FitKit.read( + type, + dateFrom: firstDayOfTheYear, + dateTo: DateTime.now(), + limit: 1000500, + ); + + if (type == DataType.DISTANCE) { + MedCategoryID = 7; + } else if (type == DataType.STEP_COUNT) { + MedCategoryID = 6; + } else if (type == DataType.HEART_RATE) { + MedCategoryID = 3; + } + + results.forEach((result) { + // print("in forEach"); + date = result.dateTo; + if (result.value.runtimeType.toString() == "int") { + value = double.parse(result.value.toString()); + } else { + value = result.value; + } + + MedSubCategoryID = 0; + + if (MedCategoryID == 4) { + differenceInHours = null; + var sleepDate = result.dateFrom.toString().substring(0, 10); + + DateTime dateFrom = result.dateFrom; + DateTime dateTo = result.dateTo; + + differenceInMinutes = dateTo.difference(dateFrom).inMinutes; + differenceInMinutes > 59 ? differenceInHours = differenceInMinutes / 60 : differenceInMinutes = differenceInMinutes; + + if (differenceInHours != null && differenceInHours != 0) { + differenceInHours = differenceInHours.toInt(); + differenceInMinutes = differenceInMinutes % 60; + + differenceInHours < 10 ? strDifferenceInHours = "0" + differenceInHours.toString() : strDifferenceInHours = differenceInHours.toString(); + } else { + strDifferenceInHours = "00"; + differenceInHours = 00; + } + differenceInMinutes < 10 ? strDifferenceInMinutes = "0" + differenceInMinutes.toString() : strDifferenceInMinutes = differenceInMinutes.toString(); + + sleepDate = DateTime.parse(sleepDate + " " + strDifferenceInHours + ":" + strDifferenceInMinutes + ":" + "00.00").toString(); + String hours = sleepDate.substring(11, sleepDate.indexOf(":")); + print(hours); + + String minutes = sleepDate.substring(sleepDate.indexOf(":") + 1, sleepDate.indexOf(":") + 3); + print(minutes); + + if (value == 0 || value == 109) { + print("in Bed"); + MedSubCategoryID = 1; + value = double.parse(hours + "." + minutes); + print("value"); + print(value); + } else if (value == 1 || value == 110) { + print("Sleep"); + MedSubCategoryID = 2; + value = double.parse(hours + "." + minutes); + print("value"); + print(value); + } + } + date = DateUtil.convertDateToString(date); + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++, Notes: "")); + }); + } + } + getAllHealthDataLists(); + } + + void getAllHealthDataLists() { + var totalSteps = 0.0; + var totalDistance = 0.0; + // double totalCalories = 0.0 ; + double totalHeartRate = 0.0; + double avgTotalHeartRate = 0.0; + var counter = 0; + List data = []; + TransactionsListID = 1; + + DateTime date; + sleepDataList.clear(); + + Med_InsertTransactionsInputsList.forEach((result) { + data.add(result.toJson()); + }); + + Med_InsertTransactionsInputsList2.clear(); + + var newMap = groupBy(data, (obj) => DateUtil.convertStringToDate(obj['MachineDate']).toString().substring(0, 10)); + + newMap.forEach((key, value) { + totalSteps = 0.0; + totalDistance = 0.0; + totalHeartRate = 0.0; + avgTotalHeartRate = 0.0; + counter = 0; + + date = DateTime.parse(key); + + value.forEach((element) { + if (element['MedCategoryID'] == 6) { + MedCategoryID = 6; + + totalSteps += element['Value']; + } else if (element['MedCategoryID'] == 7) { + MedCategoryID = 7; + // to convert from meter to km + totalDistance += (element['Value'] * 0.001); + } else if (element['MedCategoryID'] == 3) { + print("HeartRate"); + MedCategoryID = 3; + counter++; + totalHeartRate += element['Value']; + } else if (element['MedCategoryID'] == 4) { + print("sleeeeep"); + sleepDataList.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + + Med_InsertTransactionsInputsList2.add(new healthData( + MedCategoryID: 4, + MedSubCategoryID: element['MedSubCategoryID'], + MachineDate: DateUtil.convertDateToString(date), + Value: element['Value'], + TransactionsListID: TransactionsListID++, + Notes: "")); + } + // else if(element['MedCategoryID'] == 8){ + // + // totalCalories += element['Value'] ; + // } + }); + + if (counter == 0) { + counter = 1; + } + if (totalHeartRate == 0) { + avgTotalHeartRate = 0; + } else { + avgTotalHeartRate = totalHeartRate / counter; + } + + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList2.add( + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + + // Med_InsertTransactionsInputsList2.add(new healthData(MedCategoryID: 8 , MedSubCategoryID: 0 , MachineDate: DateUtil.convertDateToStringWithBackSlash(date) , Value: totalCalories , TransactionsListID: TransactionsListID++ , Notes: "")); + }); + + GifLoaderDialogUtils.hideDialog(context); + + AlertDialogBox dialog = new AlertDialogBox( + context: context, + confirmMessage: TranslationBase.of(context).alreadySynced, + okText: TranslationBase.of(context).ok, + okFunction: () => { + AlertDialogBox.closeAlertDialog(context), + }, + ); + + dialog.showAlertDialog(context); + } + + addInsertTransactionsInputsList() { + if (Med_InsertTransactionsInputsList2.isNotEmpty) { + SmartWatchIntegrationService service = new SmartWatchIntegrationService(); + service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { + print(res); + }).catchError((err) { + print(err); + }); + } else { + return; + } + } +} diff --git a/lib/pages/offers_categorise_page.dart b/lib/pages/offers_categorise_page.dart index a95cd263..2715b2b0 100644 --- a/lib/pages/offers_categorise_page.dart +++ b/lib/pages/offers_categorise_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/viewModels/offers_Categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; @@ -698,9 +699,31 @@ class _OffersCategorisePageState extends State { ), ) : Center( - child: Texts( - "SORRY , there's no listed offers now :(", - color: Colors.green, - )))); + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text(TranslationBase.of(context).noOffersAvailable, +// 'There is no data', + style: TextStyle(fontSize: 30), + ), + ) + ], + ), +// child: Texts( +// "SORRY , there's no listed offers now :(", +// color: Colors.green, +// ) + ))); } } diff --git a/lib/pages/packages_offers/CreateCustomerDailogPage.dart b/lib/pages/packages_offers/CreateCustomerDailogPage.dart index d7a98a64..70291a88 100644 --- a/lib/pages/packages_offers/CreateCustomerDailogPage.dart +++ b/lib/pages/packages_offers/CreateCustomerDailogPage.dart @@ -152,12 +152,12 @@ class _CreateCustomerDialogPageState extends State wit 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)); + // 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)); } diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 727cea23..d1219541 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -2,6 +2,7 @@ import 'package:after_layout/after_layout.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.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/responses/tamara_payment_option.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; @@ -12,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesCartItemCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/single_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -36,6 +38,8 @@ class _PackagesCartPageState extends State languageID = await sharedPref.getString(APP_LANGUAGE); } + double subtotal,tax, total; + @override void initState() { _agreeTerms = false; @@ -68,7 +72,7 @@ class _PackagesCartPageState extends State await viewModel.service .placeOrder( context: context, - paymentOption: _selectedPaymentMethod.toUpperCase()) + paymentParams: _selectedPaymentParams) .then((orderId) { if (orderId.runtimeType == int) { // result == order_id @@ -83,7 +87,7 @@ class _PackagesCartPageState extends State 'Failed to place order, please try again later'); } }).catchError((error) { - utils.Utils.showErrorToast(error); + utils.Utils.showErrorToast(error.toString()); }); } @@ -145,6 +149,9 @@ class _PackagesCartPageState extends State .catchError((error) { utils.Utils.showErrorToast(error); }); + if(response.status){ + fetchData(); + } return response.status ?? false; }, )); @@ -172,7 +179,7 @@ class _PackagesCartPageState extends State ), _paymentOptions(context, (paymentMethod) { setState(() => _selectedPaymentMethod = paymentMethod); - }), + }, viewModel: viewModel), Container( height: 0.25, color: Colors.grey[300], @@ -186,7 +193,7 @@ class _PackagesCartPageState extends State height: 0.25, color: Colors.grey[300], ), - _payNow(context, onPayNowClick: onPayNowClick) + _payNow(context, subtotal: subtotal, tax: tax, total: total, onPayNowClick: onPayNowClick) ], ), ) @@ -197,7 +204,12 @@ class _PackagesCartPageState extends State } fetchData() async { - await viewModel.service.cartItems(context: context).catchError((error) {}); + await viewModel.service.cartItems(context: context).then((value){ + subtotal = value['subtotal'] ?? 0.0; + tax = value['tax'] ?? 0.0; + total = value['total'] ?? 0.0; + }).catchError((error) {}); + setState(() {}); } @@ -205,7 +217,7 @@ class _PackagesCartPageState extends State {@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 title = withStatus ? "Your order has been placed successfully" : "Failed to place your order"; var subTitle = "Order# ${value.data.customOrderNumber}"; Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (context) => PackageOrderCompletedPage( @@ -219,7 +231,8 @@ class _PackagesCartPageState extends State // /* Payment Footer Widgets */ // --------------------------- String _selectedPaymentMethod; -Widget _paymentOptions(BuildContext context, Function(String) onSelected) { +Map _selectedPaymentParams; +Widget _paymentOptions(BuildContext context, Function(String) onSelected, {PackagesViewModel viewModel}) { double height = 30; Widget buttonContent(bool isSelected, String imageName) { @@ -242,6 +255,12 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) { child: Image.asset('assets/images/new-design/$imageName'), )); } + + Future selectTamaraPaymentOption() async{ + final tamara_options = await viewModel.service.getTamaraOptions(context: context, showLoading: true); + final selected = await SingleSelectionDialog(tamara_options, icon: Image.asset('assets/images/new-design/tamara.png'), title: TranslationBase.of(context).tamaraInstPlan).show(context); + return selected.name; + } return Padding( padding: const EdgeInsets.all(5), @@ -252,40 +271,54 @@ Widget _paymentOptions(BuildContext context, Function(String) onSelected) { mainAxisAlignment: MainAxisAlignment.center, children: [ InkWell( - child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'), - onTap: () { - onSelected("mada"); + child: buttonContent(_selectedPaymentMethod == "tamara", 'tamara.png'), + onTap: () async{ + final tamara_option = await selectTamaraPaymentOption(); + _selectedPaymentParams = {"channel" : "Web", "payment_method_system_name" : "Payments.Tamara", "payment_option" : tamara_option}; + onSelected("tamara"); }, ), SizedBox( width: 5, ), InkWell( - child: buttonContent(_selectedPaymentMethod == "visa", 'visa.png'), + child: buttonContent(_selectedPaymentMethod == "mada", 'mada.png'), onTap: () { - onSelected("visa"); + _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "MADA"}; + onSelected("mada"); }, ), SizedBox( width: 5, ), InkWell( - child: buttonContent( - _selectedPaymentMethod == "mastercard", 'mastercard.png'), + child: buttonContent(_selectedPaymentMethod == "visa", 'visa.png'), onTap: () { - onSelected("mastercard"); + _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "VISA"}; + onSelected("visa"); }, ), SizedBox( width: 5, ), InkWell( - child: buttonContent( - _selectedPaymentMethod == "installment", 'installment.png'), + child: buttonContent(_selectedPaymentMethod == "mastercard", 'mastercard.png'), onTap: () { - onSelected("installment"); + _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "MASTERCARD"}; + onSelected("mastercard"); }, ), + // SizedBox( + // width: 5, + // ), + // InkWell( + // child: buttonContent( + // _selectedPaymentMethod == "installment", 'installment.png'), + // onTap: () { + // _selectedPaymentParams = {"payment_method_system_name" : "Payments.PayFort", "payment_option" : "INSTALLMENT"}; + // onSelected("installment"); + // }, + // ), ], ), ), @@ -335,9 +368,13 @@ Widget _termsAndCondition(BuildContext context, ); } -Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { +Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) { bool isPayNowAQctive = (_agreeTerms && (_selectedPaymentMethod != null)); + String _subtotal = (subtotal ?? 0.0).toStringAsFixed(2); + String _tax = (tax ?? 0.0).toStringAsFixed(2); + String _total = (total ?? 0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(5), child: Container( @@ -350,13 +387,13 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - '${TranslationBase.of(context).subtotal}: ${'999.9'} ${TranslationBase.of(context).sar}', + '${TranslationBase.of(context).subtotal}: $_subtotal ${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}', + '${TranslationBase.of(context).vat}: $_tax ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.grey, @@ -370,7 +407,7 @@ Widget _payNow(BuildContext context, {@required VoidCallback onPayNowClick}) { ), ), Texts( - '${TranslationBase.of(context).total}: 999.99 ${TranslationBase.of(context).sar}', + '${TranslationBase.of(context).total}: $_total ${TranslationBase.of(context).sar}', heightFactor: 1.5, fontWeight: FontWeight.bold, color: Colors.black54, diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index b3b0605d..dc5b6584 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -1,16 +1,22 @@ import 'package:after_layout/after_layout.dart'; import 'package:carousel_slider/carousel_slider.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/ImagesInfo.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/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.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/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' as auth; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils; @@ -26,8 +32,8 @@ import 'package:flutter_material_pickers/flutter_material_pickers.dart'; dynamic languageID; class PackagesHomePage extends StatefulWidget { - dynamic offersModel; - PackagesHomePage({@required this.offersModel}); + final AuthenticatedUser user; + PackagesHomePage(this.user); @override _PackagesHomePageState createState() => _PackagesHomePageState(); @@ -47,6 +53,7 @@ class _PackagesHomePageState extends State with AfterLayoutMix @override void afterFirstLayout(BuildContext context) async{ + viewModel.service.patientUser = widget.user; viewModel.service.loadOffersPackagesDataForMainPage(context: context, completion: (){ setState((){}); }); @@ -81,15 +88,17 @@ class _PackagesHomePageState extends State with AfterLayoutMix } onProductCartClick(PackagesResponseModel product) async { - if(viewModel.service.customer == null) - viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); - + if(viewModel.service.customer == null) { + // viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + loginCheck(context); + } + 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); + utils.Utils.showErrorToast(error.toString()); }); } } @@ -104,6 +113,8 @@ class _PackagesHomePageState extends State with AfterLayoutMix return appScaffold = AppScaffold( + description: TranslationBase.of(context).offerAndPackagesDetails, + imagesInfo: [ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png')], appBarTitle: TranslationBase.of(context).offerAndPackages, isShowAppBar: true, isPharmacy: false, @@ -409,4 +420,33 @@ class _PackagesHomePageState extends State with AfterLayoutMix )), ); } + + + + loginCheck(context) async { + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + + auth.AuthProvider().selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + sharedPref.setObject(IMEI_USER_DATA, value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } + } } diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 1ac20946..b63319f5 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -1031,7 +1031,7 @@ class _ParentCategorisePageState extends State { .thumb : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', fit: BoxFit.contain, - height: 80, + height: 70, ), ), ], @@ -1086,7 +1086,7 @@ class _ParentCategorisePageState extends State { ), Container( margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 0, vertical: 0, ), child: Column( @@ -1175,18 +1175,18 @@ class _ParentCategorisePageState extends State { size: 18, color: Colors.blue,), onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); if(model.parentProducts[index].rxMessage == null){ + GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.parentProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, - FadePage(page: CartOrderPage()), - ); + FadePage(page: CartOrderPage())); } else{ AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } - GifLoaderDialogUtils.hideDialog(context); + } ), diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index aac971a0..2b88d30a 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -32,6 +32,7 @@ class _ProductCheckTypeWidgetState extends State { : widget.model.wishListList[index].product.name, productPrice: widget.model.wishListList[index].subtotal, productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + approvedTotalReviews:widget.model.wishListList[index].product.approvedTotalReviews, productImage: widget.model.wishListList[index].product.images[0].src, productID: widget.model.wishListList[index].product.id, onDelete: deleteWishListItem, diff --git a/lib/pages/pharmacies/screens/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-order-page.dart deleted file mode 100644 index 13dec0c3..00000000 --- a/lib/pages/pharmacies/screens/cart-order-page.dart +++ /dev/null @@ -1,455 +0,0 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/material.dart'; -import 'package:http/http.dart'; -import 'package:provider/provider.dart'; - -import 'cart-page/cart-order-preview.dart'; - -class CartOrderPage extends StatefulWidget { - - - const CartOrderPage({ Key key}) - : super(key: key); - - - @override - _CartOrderPageState createState() => _CartOrderPageState(); -} - -class _CartOrderPageState extends State { - bool isLoading = true; - - @override - void initState() { - super.initState(); - getData(); - - } - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context); - OrderPreviewViewModel model = Provider.of(context); - - final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - AppScaffold appScaffold; - return NetworkBaseView( - // baseViewModel: model, - isLoading: isLoading, - isLocalLoader: true, - child: AppScaffold( - appBarTitle: TranslationBase.of(context).shoppingCart, - isShowAppBar: true, - isPharmacy: true, - showHomeAppBarIcon: false, - isShowDecPage: true, - baseViewModel: model, - backgroundColor: Colors.white, - body: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? Container( - height: height * 0.85, - width: double.infinity, - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureIconButton( - TranslationBase.of(context).deleteAllItems, - Icon( - Icons.delete_outline_sharp, - color: Colors.grey.shade700, - ), - onTap: () => {model.deleteShoppingCart()}, - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () { - print(model.cartResponse - .shoppingCarts[index].quantity); - model - .changeProductQuantity(model - .cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - }); - }, () { - model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state != ViewState.Error) { - appScaffold.appBar.badgeUpdater( - '${value.quantityCount ?? 0}'); - } - }); - })) - ], - ), - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 2, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).subtotal, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).vat}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.w500, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), - const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Image.asset( - "assets/images/pharmacy_module/payment_image.png", - width: mediaQuery.size.width - 20, - height: 30.0, - fit: BoxFit.scaleDown, - ), - SizedBox( - height: 120, - ) - ], - ), - ), - ), - ) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, -// 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, - color: Colors.white, - child: OrderBottomWidget(model.addresses, height), - ), - ), - ); - } - - void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); - setState(() { - isLoading = false; - }); - } -} - -class OrderBottomWidget extends StatefulWidget { - final List addresses; - final double height; - - OrderBottomWidget(this.addresses, this.height); - - @override - _OrderBottomWidgetState createState() => _OrderBottomWidgetState(); -} - -class _OrderBottomWidgetState extends State { - bool isAgree = false; - - @override - Widget build(BuildContext context) { - ProjectViewModel projectProvider = Provider.of(context); - OrderPreviewViewModel cart = Provider.of(context); - return !(cart.cartResponse.shoppingCarts == null || - cart.cartResponse.shoppingCarts.length == 0) - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Divider( - color: Color(0xFFD6D6D6), - height: 1, - thickness: 1, - indent: 0, - endIndent: 0, - ), - Container( - height: widget.height * 0.070, - color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), - child: Row( - children: [ - InkWell( - onTap: () { - setState(() { - isAgree = !isAgree; - }); - }, - child: Container( - width: 25.0, - height: widget.height * 0.070, - decoration: new BoxDecoration( - color: !isAgree ? Color(0xffeeeeee) : Colors.green, - shape: BoxShape.circle, - ), - child: !isAgree - ? null - : Padding( - padding: const EdgeInsets.all(0.0), - child: Icon( - Icons.check, - color: Colors.white, - size: 25, - ), - ), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(horizontal: 4), - margin: const EdgeInsets.symmetric(vertical: 4), - child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, - fontSize: 13, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ), - ), - InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, - child: Container( - child: Icon( - Icons.info, - size: 25, - color: Color(0xff005aff), - ), - ), - ), - ], - ), - ), - Container( - height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), - child: Row( - children: [ - Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}", - fontSize: projectProvider.isArabic ? 12 : 14, - fontWeight: FontWeight.bold, - ), - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), - child: Texts( - "${TranslationBase.of(context).inclusiveVat}", - fontSize: 8, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - ), - Texts( - "${cart.cartResponse.quantityCount} ${TranslationBase.of(context).items}", - fontSize: 10, - color: Colors.grey, - fontWeight: FontWeight.bold, - ), - ], - ), - ), - RaisedButton( - onPressed: isAgree -// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 - ? () => { - if(cart.isCartItemsOutOfStock()){ - // Toast msg - AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) - }else { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } - } - : null, - child: new Text( - "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), - ), - color: Color(0xff005aff), - elevation: 0, - disabledColor: Color(0xff005aff), - ) -// RaisedButton( -// onPressed: isAgree -//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 -// ? () => { -// Navigator.push( -// context, -// FadePage( -// page: -// OrderPreviewPage(widget.addresses))) -// } -// : null, -// child: new Text( -// "${TranslationBase.of(context).checkOut}", -// style: new TextStyle( -// color: -// isAgree ? Colors.white : Colors.grey.shade300, -// fontSize: 14), -// ), -// color: Color(0xff005aff), -// disabledColor: Color(0xff005aff), -// ) - ], - ), - ), - ], - ) - : Container(); - } -} diff --git a/lib/pages/pharmacies/screens/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-order-preview.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 44eb3e09..79165766 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -1,10 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; +import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; @@ -13,9 +16,13 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:http/http.dart'; import 'package:provider/provider.dart'; +import 'cart-order-preview.dart'; + class CartOrderPage extends StatefulWidget { + final Function(int) changeTab; const CartOrderPage({Key key, this.changeTab}) : super(key: key); @@ -31,6 +38,7 @@ class _CartOrderPageState extends State { void initState() { super.initState(); getData(); + } @override @@ -41,18 +49,15 @@ class _CartOrderPageState extends State { final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; AppScaffold appScaffold; return NetworkBaseView( - // baseViewModel: model, isLoading: isLoading, isLocalLoader: true, - child: AppScaffold( + child: appScaffold = AppScaffold( appBarTitle: TranslationBase.of(context).shoppingCart, isShowAppBar: true, isPharmacy: true, showHomeAppBarIcon: false, isShowDecPage: true, baseViewModel: model, - backButtonTab: - widget.changeTab != null ? () => widget.changeTab(0) : null, backgroundColor: Colors.white, body: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) @@ -185,7 +190,7 @@ class _CartOrderPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -200,7 +205,7 @@ class _CartOrderPageState extends State { endIndent: 0, ), Image.asset( - "assets/images/pharmacy_module/payment_image.png", + "assets/images/pharmacy_module/payment.png", width: mediaQuery.size.width - 20, height: 30.0, fit: BoxFit.scaleDown, @@ -290,7 +295,7 @@ class _OrderBottomWidgetState extends State { Container( height: widget.height * 0.070, color: Color(0xffe6ffe0), - padding: EdgeInsets.symmetric(horizontal: 4), + padding: EdgeInsets.only(left: 15.0, right: 15.0), child: Row( children: [ InkWell( @@ -341,6 +346,7 @@ class _OrderBottomWidgetState extends State { Icons.info, size: 25, color: Color(0xff005aff), +// color: Color(0xff005aff), ), ), ), @@ -349,7 +355,8 @@ class _OrderBottomWidgetState extends State { ), Container( height: widget.height * 0.065, - margin: EdgeInsets.symmetric(vertical: 2), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + padding: EdgeInsets.only(left: 20.0, right: 20.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -364,7 +371,7 @@ class _OrderBottomWidgetState extends State { child: Row( children: [ Texts( - "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotal).toStringAsFixed(2)}", + "${TranslationBase.of(context).sar} ${(cart.cartResponse.subtotalWithVat).toStringAsFixed(2)}", fontSize: projectProvider.isArabic ? 12 : 14, fontWeight: FontWeight.bold, ), @@ -392,25 +399,52 @@ class _OrderBottomWidgetState extends State { ), RaisedButton( onPressed: isAgree +// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { - Navigator.push( - context, - FadePage( - page: - OrderPreviewPage(widget.addresses))) - } + if(cart.isCartItemsOutOfStock()){ + // Toast msg + AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg) + }else { + Navigator.push( + context, + FadePage( + page: + OrderPreviewPage(widget.addresses))) + } + } : null, child: new Text( "${TranslationBase.of(context).checkOut}", style: new TextStyle( color: - isAgree ? Colors.white : Colors.grey.shade300, + isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), - elevation: 0, - color: Color(0xff005aff), - disabledColor: Color(0xff005aff), - ), + color: Color(0xFF4CAF50), + disabledColor:Color(0xFF848484), +// disabledColor: Color(0xff005aff), + ) +// RaisedButton( +// onPressed: isAgree +//// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 +// ? () => { +// Navigator.push( +// context, +// FadePage( +// page: +// OrderPreviewPage(widget.addresses))) +// } +// : null, +// child: new Text( +// "${TranslationBase.of(context).checkOut}", +// style: new TextStyle( +// color: +// isAgree ? Colors.white : Colors.grey.shade300, +// fontSize: 14), +// ), +// color: Color(0xff005aff), +// disabledColor: Color(0xff005aff), +// ) ], ), ), diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 25c02dd0..4f5ab14e 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -63,11 +63,11 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(model, widget.addresses), + SelectAddressWidget(model, widget.addresses,changeMainState), SizedBox( height: 10, ), - SelectPaymentOptionWidget(model), + SelectPaymentOptionWidget(model, changeMainState), SizedBox( height: 10, ), @@ -235,4 +235,9 @@ class _OrderPreviewPageState extends State { ), ); } + changeMainState(){ + setState(() { + + }); + } } diff --git a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart index bf958a36..d6182b9a 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -25,39 +26,35 @@ import 'package:provider/provider.dart'; class SelectAddressWidget extends StatefulWidget { final OrderPreviewViewModel model; final List addresses; + final Function changeMainState; - SelectAddressWidget(this.model, this.addresses); + SelectAddressWidget(this.model, this.addresses, this.changeMainState); @override _SelectAddressWidgetState createState() => _SelectAddressWidgetState(); } class _SelectAddressWidgetState extends State { - Addresses address; + AddressInfo address; _navigateToAddressPage() { Navigator.push(context, FadePage(page: PharmacyAddressesPage())) .then((result) { if (result != null) { address = result; - widget.model.paymentCheckoutData.address = address; + widget.model.paymentCheckoutData.address = + Addresses.fromJson(address.toJson()); widget.model.getInformationsByAddress(); + widget.changeMainState(); } - - /* setState(() { - if (result != null) { - address = result; - widget.model.paymentCheckoutData.address = address; - widget.model.getInformationsByAddress(); - } - })*/ }); } @override void initState() { if (widget.model.paymentCheckoutData.address != null) { - address = widget.model.paymentCheckoutData.address; + address = AddressInfo.fromJson( + widget.model.paymentCheckoutData.address.toJson()); } super.initState(); } diff --git a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart index 9234bb38..825e2577 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart @@ -1,35 +1,19 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class SelectPaymentOptionWidget extends StatefulWidget { final OrderPreviewViewModel model; + final Function changeMainState; - SelectPaymentOptionWidget(this.model); + SelectPaymentOptionWidget(this.model, this.changeMainState); @override - _SelectPaymentOptionWidgetState createState() => - _SelectPaymentOptionWidgetState(); + _SelectPaymentOptionWidgetState createState() => _SelectPaymentOptionWidgetState(); } class _SelectPaymentOptionWidgetState extends State { @@ -44,6 +28,7 @@ class _SelectPaymentOptionWidgetState extends State { widget.model.paymentCheckoutData.paymentOption = paymentOption; } + widget.changeMainState(); }) }); } @@ -75,8 +60,7 @@ class _SelectPaymentOptionWidgetState extends State { ), Expanded( child: Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 6), + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6), child: Texts( TranslationBase.of(context).selectPaymentOption, fontSize: 14, diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 8cdbaf3c..92065102 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -1,14 +1,16 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; class PaymentMethodSelectPage extends StatefulWidget { @override - _PaymentMethodSelectPageState createState() => - _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -20,8 +22,9 @@ class _PaymentMethodSelectPageState extends State { double cardWidth = screenSize.width / 2 - 32; return AppScaffold( - title: "Payment method", + appBarTitle: TranslationBase.of(context).paymentMethod, isShowAppBar: true, + isPharmacy: true, isShowDecPage: false, body: Container( width: double.infinity, @@ -30,72 +33,65 @@ class _PaymentMethodSelectPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Center( - child: Texts( + child: Text( TranslationBase.of(context).selectPaymentOption, - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.black, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.black, + ), ), ), Container( margin: EdgeInsets.symmetric(horizontal: 0, vertical: 16), child: Column( children: [ - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.meda, - () => { - setState(() { - selectedPaymentOption = PaymentOption.meda; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.sadad, - () => { - setState(() { - selectedPaymentOption = PaymentOption.sadad; - }) - }), - ], - ), - Row( - children: [ - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.visa, - () => { - setState(() { - selectedPaymentOption = PaymentOption.visa; - }) - }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.mastercard, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.mastercard; - }) - }), - ], - ), PaymentMethodCard( - (cardWidth * 2 + 32), + cardWidth, + selectedPaymentOption, + PaymentOption.meda, + () => { + setState(() { + selectedPaymentOption = PaymentOption.meda; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.visa, + () => { + setState(() { + selectedPaymentOption = PaymentOption.visa; + }) + }), + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.mastercard, + () => { + setState(() { + selectedPaymentOption = PaymentOption.mastercard; + }) + }), + PaymentMethodCard( + cardWidth, selectedPaymentOption, PaymentOption.installments, () => { setState(() { - selectedPaymentOption = - PaymentOption.installments; + selectedPaymentOption = PaymentOption.installments; }) }), + if (Platform.isIOS) + PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.applepay, + () => { + setState(() { + selectedPaymentOption = PaymentOption.applepay; + }) + }), ], ), ), @@ -103,18 +99,12 @@ class _PaymentMethodSelectPageState extends State { ), ), bottomSheet: Container( - height: screenSize.height * 0.08, - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: BorderedButton( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), + child: DefaultButton( TranslationBase.of(context).next, - backgroundColor: Color(0xff5AB154), - textColor: Colors.white, - fontSize: 16, - hPadding: 8, - vPadding: 12, - handler: selectedPaymentOption != null - ? () => {Navigator.pop(context, selectedPaymentOption)} - : null, + selectedPaymentOption != null ? () => {Navigator.pop(context, selectedPaymentOption)} : null, + color: Color(0xff5AB154), ), ), ); @@ -127,61 +117,102 @@ class PaymentMethodCard extends StatelessWidget { final PaymentOption paymentOption; final Function selectMethod; - PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, - this.paymentOption, this.selectMethod); + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod); @override Widget build(BuildContext context) { bool isSelected = false; - if (selectedPaymentOption != null && - selectedPaymentOption == paymentOption) { + if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) { isSelected = true; } - return InkWell( - onTap: selectMethod, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), - child: Stack( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), - margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), - decoration: new BoxDecoration( - color: Colors.grey.shade100, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(8), - border: Border.fromBorderSide(BorderSide( - color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, - width: 0.8, - )), - ), - width: cardWidth, - child: Image.asset( - getPaymentOptionImage(paymentOption), - fit: BoxFit.cover, - ), - ), - if (isSelected) - Positioned( - right: 1, - child: Icon( - Icons.check_circle, - color: Color(0xff20BC11), - size: 30, + return Container( + width: MediaQuery.of(context).size.width * 0.99, + child: InkWell( + onTap: selectMethod, + child: Card( + elevation: 0.0, + margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + children: [ + Container( + width: 24, + height: 24, + decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), - ), - ], + mWidth(12), + Container( + height: 70.0, + width: 70.0, + child: Image.asset(getPaymentOptionImage(paymentOption)), + ), + mFlex(1), + if (isSelected) + Container( + decoration: containerRadius(CustomColors.green, 200), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + child: Text( + TranslationBase.of(context).paymentSelected, + style: TextStyle( + color: Colors.white, + fontSize: 11, + ), + ), + ), + ], + ), + ), ), + // Container( + // margin: EdgeInsets.symmetric(horizontal: 2, vertical: 0), + // child: Stack( + // children: [ + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8, vertical: 8), + // margin: EdgeInsets.symmetric(horizontal: 14, vertical: 8), + // decoration: new BoxDecoration( + // color: Colors.grey.shade100, + // shape: BoxShape.rectangle, + // borderRadius: BorderRadius.circular(8), + // border: Border.fromBorderSide(BorderSide( + // color: isSelected ? Color(0xff20BC11) : Colors.grey.shade300, + // width: 0.8, + // )), + // ), + // width: cardWidth, + // child: Image.asset( + // getPaymentOptionImage(paymentOption), + // fit: BoxFit.cover, + // ), + // ), + // if (isSelected) + // Positioned( + // right: 1, + // child: Icon( + // Icons.check_circle, + // color: Color(0xff20BC11), + // size: 30, + // ), + // ), + // ], + // ), + // ), ), ); } String getPaymentOptionImage(PaymentOption paymentOption) { - String assetFile = "assets/images/pharmacy_module/payment/"; + String assetFile = "assets/images/new/payment/"; switch (paymentOption.index) { case 0: - return "${assetFile}mada.png"; + return "${assetFile}Mada.png"; break; case 1: return "${assetFile}sadad.png"; @@ -190,10 +221,13 @@ class PaymentMethodCard extends StatelessWidget { return "${assetFile}visa.png"; break; case 3: - return "${assetFile}mastercard.png"; + return "${assetFile}Mastercard.png"; break; case 4: - return "${assetFile}installment.png"; + return "${assetFile}installments.png"; + break; + case 5: + return "${assetFile}Apple_Pay.png"; break; default: return ""; diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 454b391c..7656922a 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -50,14 +50,13 @@ class _PharmacyPageState extends State { width: double.infinity, child: SingleChildScrollView( child: Column( - //crossAxisAlignment: CrossAxisAlignment.start, children: [ BannerPager(model), - GridViewButtons(model), PrescriptionsWidget(), - ShopByBrandWidget(), +// ShopByBrandWidget(), RecentlyViewedWidget(), BestSellerWidget(), + ShopByBrandWidget(), ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 3a3eba23..b8bc5808 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -10,8 +11,6 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../../locator.dart'; import '../../../../../routes.dart'; -import '../../cart-page/cart-order-page.dart'; -import '../product-detail.dart'; class FooterWidget extends StatefulWidget { final bool isAvailable; @@ -20,17 +19,14 @@ class FooterWidget extends StatefulWidget { final int quantityLimit; final PharmacyProduct item; final Function addToCartFunction; + final Function addToShoppingCartFunction; final ProductDetailViewModel model; int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, - {this.quantity, - this.isOverQuantity = false, - this.addToCartFunction, - this.model}); + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, + {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -39,8 +35,7 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { @@ -75,8 +70,7 @@ class _FooterWidgetState extends State { padding: const EdgeInsets.all(8.0), child: Text( "Quantity", - style: TextStyle( - fontSize: 15, fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), ), ), InkWell( @@ -99,11 +93,7 @@ class _FooterWidgetState extends State { SizedBox( width: 5, ), - for (int i = 1; i <= 10; i++) - QuantityBox( - label: i, - onTapFunc: onChangeValue, - isSelected: widget.quantity == i), + for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), Container( width: 100, decoration: BoxDecoration( @@ -111,16 +101,14 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + decoration: InputDecoration(labelText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; } else { setState(() { widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { + if (widget.quantity >= widget.quantityLimit) { widget.isOverQuantity = true; } else { widget.isOverQuantity = false; @@ -140,107 +128,104 @@ class _FooterWidgetState extends State { : Container( height: 20, ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 70, - height: 50, - child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 4, - child: Text( - widget.quantity.toString(), - style: TextStyle(fontSize: 20), + Container( + height: 58, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 90, + height: 60, + child: FlatButton( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Text( + widget.quantity.toString(), + style: TextStyle(fontSize: 20), + ), ), - ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), + Expanded( + flex: 5, + child: Text( + TranslationBase.of(context).quantityShortcut, + style: TextStyle(fontSize: 16), + ), ), - ), - ], + ], + ), + onPressed: () { + setState(() { + if (showUI) { + quantityUI = 80; + showUI = false; + } else { + quantityUI = 160; + showUI = true; + } + }); + }, ), - onPressed: () { - setState(() { - if (showUI) { - quantityUI = 80; - showUI = false; - } else { - quantityUI = 160; - showUI = true; - } - }); - }, ), - ), - Container( - width: MediaQuery.of(context).size.width * 0.45, - child: SecondaryButton( - label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity == 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - disableColor: Color(0xFF4CAF50), - onTap: () async { - if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); - } else - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); - }, - fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50), - borderRadius: 3, - color: Color(0xFF4CAF50), + SizedBox( + width: 10, ), - ), - SizedBox( - width: 5, - ), - Container( - width: MediaQuery.of(context).size.width * 0.35, - child: SecondaryButton( - label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null, - onTap: () async { - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); - Navigator.push( - context, - FadePage(page: CartOrderPage()), - ); - }, - fontWeight: FontWeight.w600, - borderColor: Colors.grey[800], - borderRadius: 3, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.rxMessage != null - ? Colors.grey - : Colors.grey[800], + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).addToCart.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + }, + fontWeight: FontWeight.w600, + borderColor: Color(0xFF4CAF50), + borderRadius: 3, + color: Color(0xFF4CAF50), + ), + ), + SizedBox( + width: 5, + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: SecondaryButton( + label: TranslationBase.of(context).buyNow.toUpperCase(), + disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, + onTap: () async { + if (!authenticatedUserObject.isLogin) { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } else { + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + Navigator.push( + context, + FadePage(page: CartOrderPage()), + );} + }, + fontWeight: FontWeight.w600, + borderColor: Colors.grey[800], + borderRadius: 3, + disableColor: Colors.grey[700], + color: !widget.isAvailable && widget.quantity > 0 || widget.quantity > widget.quantityLimit || widget.item.rxMessage != null ? Colors.grey : Colors.grey[800], + ), ), - ), - ], + ], + ), ), ], ), + ); } diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 83a76a19..cb38ca4f 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; @@ -13,6 +14,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'availability_info.dart'; @@ -331,6 +333,7 @@ class __ProductDetailPageState extends State { quantity: quantity, isOverQuantity: isOverQuantity, addToCartFunction: addToCartFunction, + addToShoppingCartFunction: addToShoppingCartFunction, model: model, ), )); @@ -355,6 +358,18 @@ class __ProductDetailPageState extends State { await model.addToCartData(quantity, itemID); GifLoaderDialogUtils.hideDialog(context); } + + addToShoppingCartFunction( + {quantity, + itemID, + ProductDetailViewModel model}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.addToCartData(quantity, itemID); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push( + context, + FadePage(page: CartOrderPage())); + } } diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index b9612925..25be1775 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart' import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -12,7 +13,6 @@ import 'package:provider/provider.dart'; import '../../../../../locator.dart'; import '../../../compare-list.dart'; -import '../../cart-page/cart-order-page.dart'; import 'icon_with_bg.dart'; class ProductAppBar extends StatelessWidget with PreferredSizeWidget { @@ -25,22 +25,13 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { final bool isInWishList; final Function addToCartFunction; + ProductAppBar({Key key, this.product, this.model, this.addToWishlistFunction, this.quantity, this.deleteFromWishlistFunction, this.isInWishList, this.addToCartFunction}) : super(key: key); - ProductAppBar( - {Key key, - this.product, - this.model, - this.addToWishlistFunction, - this.quantity, - this.deleteFromWishlistFunction, - this.isInWishList, this.addToCartFunction}) - : super(key: key); - - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override Widget build(BuildContext context) { + OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); return Container( color: Colors.white, child: FractionallySizedBox( @@ -75,25 +66,29 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { onPress: () { Navigator.push( context, - MaterialPageRoute( - builder: (context) => CartOrderPage()), + MaterialPageRoute(builder: (context) => CartOrderPage()), ); }), - - if(Provider.of(context, listen: false).cartResponse.quantityCount !=0) - Positioned( - top:0, right: -1.0, - child: Container( - decoration: BoxDecoration( - color: Colors.red[800], - borderRadius: BorderRadius.circular(15), - + if (Provider.of(context, listen: false).cartResponse.quantityCount != 0) + Positioned( + top: 0, + right: -1.0, + child: Container( + decoration: BoxDecoration( + color: Colors.red[800], + borderRadius: BorderRadius.circular(15), + ), + padding: EdgeInsets.only(left: 5, right: 4.5), + height: 19, + child: Center( + child: Texts( + orderPreviewViewModel.cartResponse.quantityCount.toString(), + style: "caption", + medium: true, + color: Colors.white, + )), ), - padding: EdgeInsets.only(left: 5, right: 4.5), - height: 18, - child: Center(child: Texts(Provider.of(context, listen: false).cartResponse.quantityCount.toString(), style: "caption", medium: true, color: Colors.white,)), - ), - ) + ) ], ), SizedBox( @@ -135,16 +130,12 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { onTap: () async { if (quantity > 0) { { - await addToCartFunction( - quantity: quantity, - itemID: itemID, - model: model); + await addToCartFunction(quantity: quantity, itemID: itemID, model: model); Navigator.of(context).pop(); } } else { - AppToast.showErrorToast( - message: "you should add quantity"); + AppToast.showErrorToast(message: "you should add quantity"); } }), ListTile( @@ -153,9 +144,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { color: !isInWishList ? Colors.white : Colors.red[800], ), title: Text( - isInWishList - ? TranslationBase.of(context).removeFromWishlist - : TranslationBase.of(context).addToWishlist, + isInWishList ? TranslationBase.of(context).removeFromWishlist : TranslationBase.of(context).addToWishlist, ), onTap: () async { if (isInWishList) @@ -170,8 +159,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { TranslationBase.of(context).compare, ), onTap: () { - Provider.of(context, listen: false) - .addItem(specificationData); + Provider.of(context, listen: false).addItem(specificationData); Navigator.of(context).pop(); }, ), diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index d993ecdf..cb1281ff 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -1,11 +1,14 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/brand_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class SearchBrandsPage extends StatefulWidget { @override @@ -23,7 +26,7 @@ class _SearchBrandsPageState extends State { onModelReady: (model) => model.searchProducts(), builder: (BuildContext context, model, Widget child) => PharmacyAppScaffold( - appBarTitle: 'Search', + appBarTitle: TranslationBase.of(context).search, isBottomBar: false, isShowAppBar: true, backgroundColor: Colors.white, @@ -44,24 +47,36 @@ class _SearchBrandsPageState extends State { key: _formKey, child: TextFields( autoFocus: true, - hintText: 'Search', + hintText: TranslationBase.of(context).search, fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.deny(RegExp("[\u0621-\u064a-\ ]")) + ], + validator: (value) { + RegExp regExp = RegExp('[\u0621-\u064a-\ ]'); + if (value.isEmpty) { + TranslationBase.of(context).pleaseEnterProductName; + }else if (regExp.hasMatch(value)){ + AppToast.showErrorToast(message: TranslationBase.of(context).noArabicLetters); + } + return null; + }, onSaved: (value) { //searchMedicine(model, context); }, onSubmit: (value) { searchMedicine(model, context); - msg = 'No Result Found'; + msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { - return 'please Enter Product Name'; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +// return 'please Enter Product Name'; +// } +// return null; +// }, ), ), ), @@ -70,7 +85,7 @@ class _SearchBrandsPageState extends State { ), InkWell( child: Texts( - 'Cancel', + TranslationBase.of(context).cancel, fontSize: 17.0, fontWeight: FontWeight.w500, ), diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index cb7c59fd..11976175 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -4,6 +4,7 @@ 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:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; class ProductOrderItem extends StatefulWidget { @@ -39,7 +40,7 @@ class _ProductOrderItemState extends State { leading: InkWell( onTap: () => {widget.deleteCartItems()}, child: Icon( - Icons.delete_outline_sharp, + FontAwesomeIcons.trashAlt,size: 15, color: Colors.grey.shade700, ), ), diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 92ad8d1a..a24531a5 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -2,8 +2,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/phramacy-product-detail-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; @@ -88,7 +86,7 @@ class ProductTileItem extends StatelessWidget { Stack( children: [ Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), alignment: Alignment.center, child: (item.images != null && item.images.length > 0) ? Image.network( @@ -102,17 +100,42 @@ class ProductTileItem extends StatelessWidget { height: itemHeight / 2, ), ), - Container( - width: item.rxMessage != null - ? MediaQuery.of(context).size.width / 5 - : 0, - padding: EdgeInsets.all(4), +// Container( +// width: item.rxMessage != null +// ? MediaQuery.of(context).size.width / 5 +// : 0, +// padding: EdgeInsets.all(4), +// decoration: BoxDecoration( +// color: Color(0xffb23838), +// borderRadius: +// BorderRadius.only(topLeft: Radius.circular(6)), +// ), +// child: item.rxMessage != null +// ? Texts( +// projectProvider.isArabic +// ? item.rxMessagen +// : item.rxMessage, +// color: Colors.white, +// regular: true, +// fontSize: 10, +// fontWeight: FontWeight.w400, +// ) +// : Texts(""), +// ) + ], + ), + Padding( + padding: EdgeInsets.fromLTRB(4,2,4,2), + child: Container( +// width: item.rxMessage != null +// ? MediaQuery.of(context).size.width / 5 +// : 0, + // padding: EdgeInsets.fromLTRB(6,4,6,4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: - BorderRadius.only(topLeft: Radius.circular(6)), + ), - child: item.rxMessage != null + child: item.rxMessage != null ? Texts( projectProvider.isArabic ? item.rxMessagen @@ -123,12 +146,11 @@ class ProductTileItem extends StatelessWidget { fontWeight: FontWeight.w400, ) : Texts(""), - ) - ], - ), - SizedBox(height: 8,), + ), + ), + // SizedBox(height: 4,), Padding( - padding: const EdgeInsets.symmetric(horizontal: 6.0), + padding: const EdgeInsets.symmetric(horizontal: 4.0), child: Texts( projectProvider.isArabic ? item.namen : item.name, regular: true, @@ -139,7 +161,7 @@ class ProductTileItem extends StatelessWidget { Expanded( child: Container( margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 4, vertical: 0, ), child: Column( @@ -147,7 +169,7 @@ class ProductTileItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), + padding: const EdgeInsets.only(top: 2, bottom: 2), child: Texts( "SAR ${item.price}", fontWeight: FontWeight.w600, diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6f1155dd..6302f263 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -1,10 +1,15 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class BannerPager extends StatefulWidget { final PharmacyModuleViewModel _model; @@ -20,14 +25,16 @@ class _BannerPagerState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( child: Column( children: [ CarouselSlider( options: CarouselOptions( - aspectRatio: 7 / 2, + aspectRatio: 5 / 2, enlargeCenterPage: true, enableInfiniteScroll: false, + viewportFraction: 1.0, initialPage: 0, autoPlay: true, autoPlayInterval: Duration(seconds: 3), @@ -39,53 +46,44 @@ class _BannerPagerState extends State { }); }, ), - items: widget._model - .getBannerImagesUrl() - .mapIndexed( - (item, index) => InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: OffersCategorisePage())); - }, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 1.0), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5.0)), - child: Center( - child: index == 0 - ? Image.asset( - item, - fit: BoxFit.cover, - ) - : CachedNetworkImage( - imageUrl: item, - fit: BoxFit.fitWidth, - errorWidget: (context, url, error) => - SizedBox()), - ), + items: widget._model.getBannerImagesUrl(projectViewModel).mapIndexed( + (item, index) { + return InkWell( + onTap: () { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + }, + child: Container( + margin: EdgeInsets.symmetric(horizontal: 1.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Center( + child: index == 0 || index == 1 + ? Image.asset( + item, + fit: BoxFit.cover, + ) + : CachedNetworkImage(imageUrl: item, fit: BoxFit.fitWidth, errorWidget: (context, url, error) => SizedBox()), ), ), ), - ) - .toList(), + ); + }, + ).toList(), ), Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: widget._model - .getBannerImagesUrl() + .getBannerImagesUrl(projectViewModel) .mapIndexed( (item, index) => Container( width: 12.0, height: 4.0, - margin: - EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), + margin: EdgeInsets.symmetric(vertical: 0.0, horizontal: 2.0), decoration: BoxDecoration( shape: BoxShape.rectangle, - color: _current == index - ? Color.fromRGBO(0, 250, 0, 0.9) - : Color.fromRGBO(0, 0, 0, 0.4), + color: _current == index ? Color.fromRGBO(0, 250, 0, 0.9) : Color.fromRGBO(0, 0, 0, 0.4), ), ), ) diff --git a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart index 5d979136..8a549b48 100644 --- a/lib/pages/pharmacies/widgets/home/GridViewButtons.dart +++ b/lib/pages/pharmacies/widgets/home/GridViewButtons.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/search_products_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -38,41 +39,44 @@ class GridViewButtons extends StatelessWidget { Navigator.push(context, FadePage(page: OffersCategorisePage())); }), ), - DashboardItem( - imageName: 'pharmacy_module/bg_2.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).medicationRefill, - 'assets/images/pharmacy_module/medication_icon.png', () { - // model.checkUserIsActivated().then((isActivated) { - // if (isActivated) { - // Navigator.push(context, FadePage(page: LakumMainPage())); - // } else { - // Navigator.push( - // context, FadePage(page: LakumActivationVidaPage())); - // } - // }); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_3.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard(TranslationBase.of(context).myPrescriptions, - 'assets/images/pharmacy_module/prescription_icon.png', () { - Navigator.push( - context, FadePage(page: HomePrescriptionsPage())); - }), - ), - DashboardItem( - imageName: 'pharmacy_module/bg_4.png', - opacity: 0, - hasColorFilter: false, - child: GridViewCard( - TranslationBase.of(context).searchAndScanMedication, - 'assets/images/pharmacy_module/search_scan_icon.png', - () {}), - ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_2.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).medicationRefill, + // 'assets/images/pharmacy_module/medication_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // + // // model.checkUserIsActivated().then((isActivated) { + // // if (isActivated) { + // // Navigator.push(context, FadePage(page: LakumMainPage())); + // // } else { + // // Navigator.push( + // // context, FadePage(page: LakumActivationVidaPage())); + // // } + // // }); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_3.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard(TranslationBase.of(context).myPrescriptions, + // 'assets/images/pharmacy_module/prescription_icon.png', () { + // Navigator.push( + // context, FadePage(page: HomePrescriptionsPage())); + // }), + // ), + // DashboardItem( + // imageName: 'pharmacy_module/bg_4.png', + // opacity: 0, + // hasColorFilter: false, + // child: GridViewCard( + // TranslationBase.of(context).searchAndScanMedication, + // 'assets/images/pharmacy_module/search_scan_icon.png', + // () {Navigator.push(context, FadePage(page: SearchProductsPage()));}), + // ), ], ), ), diff --git a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart index 28556679..261f4e99 100644 --- a/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart +++ b/lib/pages/pharmacies/widgets/home/PrescriptionsWidget.dart @@ -1,18 +1,22 @@ +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PrescriptionViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class PrescriptionsWidget extends StatelessWidget { + + AuthenticatedUserObject authenticatedUserObject = + locator(); + @override Widget build(BuildContext context) { return BaseView( @@ -22,35 +26,26 @@ class PrescriptionsWidget extends StatelessWidget { } }, allowAny: true, - builder: (_, model, wi) => model.prescriptionsList.length > 0 + builder: (_, model, wi) => model.prescriptionsList.length > 0 && authenticatedUserObject.isLogin ? NetworkBaseView( isLocalLoader: true, baseViewModel: model, child: Container( - height: model.prescriptionsList.length > 0 - ? MediaQuery.of(context).size.height * 0.28 - : 0, child: Column( children: [ - ViewAllHomeWidget( - TranslationBase.of(context).myPrescription, - HomePrescriptionsPage()), + ViewAllHomeWidget(TranslationBase.of(context).myPrescription, HomePrescriptionsPage()), Container( - padding: EdgeInsets.symmetric( - horizontal: 18.0, vertical: 14.0), - margin: EdgeInsets.only(left: 10), + margin: EdgeInsets.only(right: 10.0, left: 10.0), + height: MediaQuery.of(context).size.height * 0.28, child: ListView.builder( scrollDirection: Axis.horizontal, shrinkWrap: true, physics: ScrollPhysics(), - // physics: NeverScrollableScrollPhysics(), itemCount: model.prescriptionsList.length, itemBuilder: (context, index) { return Container( - height: MediaQuery.of(context).size.height * 0.3, - padding: EdgeInsets.only( - bottom: 5.0, left: 5.0, right: 8.0), - margin: EdgeInsets.only(right: 10.0), + padding: EdgeInsets.only(left: 8.0, right: 8.0), + margin: EdgeInsets.only(right: 5.0, left: 5.0), decoration: BoxDecoration( border: Border.all( color: Colors.grey, @@ -59,167 +54,130 @@ class PrescriptionsWidget extends StatelessWidget { ), color: Colors.white, borderRadius: BorderRadius.circular(10.0)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( children: [ - Row( - children: [ - Column(children: [ - Container( - padding: EdgeInsets.only( - top: 10.0, - left: 10.0, - right: 10.0, - bottom: 15.0, - ), - child: CircleAvatar( - radius: 30, - backgroundColor: - Colors.transparent, - child: Image.network( - model.prescriptionsList[index] - .doctorImageURL, - width: 60, - height: 60, - ), - ), + Column(children: [ + Container( + padding: EdgeInsets.only( + top: 10.0, + left: 10.0, + right: 10.0, + bottom: 10.0, + ), + child: CircleAvatar( + radius: 30, + backgroundColor: Colors.transparent, + child: Image.network( + model.prescriptionsList[index].doctorImageURL, + width: 60, + height: 60, ), - ]), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 1), - padding: EdgeInsets.only( - left: 15.0, right: 15.0), - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 4.0, - ), - color: Colors.green, - borderRadius: - BorderRadius.circular( - 30.0)), - child: Text( - model.languageID == "ar" - ? model - .prescriptionsList[ - index] - .isInOutPatientDescriptionN - .toString() - : model - .prescriptionsList[ - index] - .isInOutPatientDescription - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 15.0, - ), - )), - Row(children: [ - Image.asset( - 'assets/images/Icon-awesome-calendar.png', - width: 30, - height: 30, - ), - Text( - DateUtil.convertStringToDate( - model - .prescriptionsList[ - index] - .appointmentDate - .toString()) - .toString() - .substring(0, 10), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - ), - ) - ]), - ], ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ + ), + ]), + Column( + children: [ Container( - margin: EdgeInsets.only(left: 5), - child: Row(children: [ - Text( - model.prescriptionsList[index] - .doctorTitle - .toString(), - style: TextStyle( - color: Colors.black, - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ), - Text( - model.prescriptionsList[index] - .doctorName - .toString(), + margin: EdgeInsets.only(left: 1), + padding: EdgeInsets.only(left: 15.0, right: 15.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 3.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0)), + child: Text( + model.languageID == "ar" + ? model.prescriptionsList[index].isInOutPatientDescriptionN.toString() + : model.prescriptionsList[index].isInOutPatientDescription.toString(), style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 15.0, - fontWeight: FontWeight.bold, ), - ), - ]), - ), - ], - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Text( - model.prescriptionsList[index] - .clinicDescription - .toString(), + )), + Row(children: [ + Image.asset( + 'assets/images/Icon-awesome-calendar.png', + width: 30, + height: 30, + ), + Text( + DateUtil.convertStringToDate(model.prescriptionsList[index].appointmentDate.toString()).toString().substring(0, 10), style: TextStyle( - color: Colors.green, + color: Colors.black, fontSize: 15.0, -// fontWeight: FontWeight.bold, ), + ) + ]), + ], + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Row(children: [ + Text( + model.prescriptionsList[index].doctorTitle.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, ), ), - ], + Text( + model.prescriptionsList[index].doctorName.toString(), + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ]), ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: model - .prescriptionsList[index] - .actualDoctorRate - .toDouble(), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text( + model.prescriptionsList[index].clinicDescription.toString(), + style: TextStyle( + color: Colors.green, + fontSize: 15.0, +// fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(), // initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ) - ]), - ]), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + ]), + ]), ); }), ), @@ -227,7 +185,8 @@ class PrescriptionsWidget extends StatelessWidget { ), ), ) - : Container(), + : Container( + ), ); } } diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 6cc0961e..04f644b9 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -69,6 +69,7 @@ class _OrderPageState extends State TabBar( labelPadding: EdgeInsets.only(left: 3.0, right: 3.0), labelColor: Colors.black, + indicatorColor: Colors.green, tabs: [ Tab(text: TranslationBase.of(context).delivered), Tab(text: TranslationBase.of(context).processing), @@ -126,86 +127,86 @@ class _OrderPageState extends State return Container( child: Column( children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderNumber, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + deliveredOrderList[ + index]), + )); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - child: Text( - deliveredOrderList[index] - .id - .toString(), - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + Container( + child: Text( + deliveredOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderDate, - style: TextStyle( - fontSize: 14.0, + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - Container( - child: Text( - deliveredOrderList[index] - .createdOnUtc - .toString() - .substring(0, 10), - style: TextStyle( - fontSize: 14.0, + Container( + child: Text( + deliveredOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - deliveredOrderList[ - index]), - )); - }, + Container( + margin: EdgeInsets.all(8.0), child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -214,8 +215,8 @@ class _OrderPageState extends State width: 20, ), ), - ), - ], + ], + ), ), Divider( color: Colors.grey[350], @@ -393,85 +394,85 @@ class _OrderPageState extends State return Container( child: Column( children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderNumber, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + processingOrderList[ + index]))); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - child: Text( - processingOrderList[index] - .id - .toString(), - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + Container( + child: Text( + processingOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderDate, - style: TextStyle( - fontSize: 14.0, + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - Container( - child: Text( - processingOrderList[index] - .createdOnUtc - .toString() - .substring(0, 10), - style: TextStyle( - fontSize: 14.0, + Container( + child: Text( + processingOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - processingOrderList[ - index]))); - }, + Container( + margin: EdgeInsets.all(8.0), child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -480,8 +481,8 @@ class _OrderPageState extends State width: 20, ), ), - ), - ], + ], + ), ), Divider( color: Colors.grey[350], @@ -836,87 +837,87 @@ class _OrderPageState extends State child: SingleChildScrollView( child: Column( children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: - EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderNumber, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + pendingOrderList[ + index]))); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - child: Text( - pendingOrderList[index] - .id - .toString(), - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + Container( + child: Text( + pendingOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - Container( - margin: - EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderDate, - style: TextStyle( - fontSize: 14.0, + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - Container( - child: Text( - pendingOrderList[index] - .createdOnUtc - .toString() - .substring(0, 10), - style: TextStyle( - fontSize: 14.0, + Container( + child: Text( + pendingOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - pendingOrderList[ - index]))); - }, + Container( + margin: EdgeInsets.all(8.0), child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -925,8 +926,8 @@ class _OrderPageState extends State width: 20, ), ), - ), - ], + ], + ), ), Divider( color: Colors.grey[350], @@ -1105,87 +1106,87 @@ class _OrderPageState extends State child: SingleChildScrollView( child: Column( children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - margin: - EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderNumber, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: OrderDetailsPage( + orderModel: + cancelledOrderList[ + index]))); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderNumber, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - Container( - child: Text( - cancelledOrderList[index] - .id - .toString(), - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, + Container( + child: Text( + cancelledOrderList[index] + .id + .toString(), + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), ), ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - Container( - margin: - EdgeInsets.only(right: 5), - child: Text( - TranslationBase.of(context) - .orderDate, - style: TextStyle( - fontSize: 14.0, + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + Container( + margin: + EdgeInsets.only(right: 5), + child: Text( + TranslationBase.of(context) + .orderDate, + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - Container( - child: Text( - cancelledOrderList[index] - .createdOnUtc - .toString() - .substring(0, 10), - style: TextStyle( - fontSize: 14.0, + Container( + child: Text( + cancelledOrderList[index] + .createdOnUtc + .toString() + .substring(0, 10), + style: TextStyle( + fontSize: 14.0, + ), ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - Container( - margin: EdgeInsets.all(8.0), - child: InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - cancelledOrderList[ - index]))); - }, + Container( + margin: EdgeInsets.all(8.0), child: SvgPicture.asset( languageID == "ar" ? 'assets/images/pharmacy/arrow_left.svg' @@ -1194,8 +1195,8 @@ class _OrderPageState extends State width: 20, ), ), - ), - ], + ], + ), ), Divider( color: Colors.grey[350], diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 0a0a131d..fc77beb5 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -321,8 +321,7 @@ class _OrderDetailsPageState extends State { margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: Text( model.orderListModel[0].paymentName - .toString() - .substring(12), + .toString(), style: TextStyle( fontSize: 13.0, fontWeight: FontWeight.bold, diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 0aac68a0..954546d7 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product-brands.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +// import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'base/base_view.dart'; @@ -57,6 +58,22 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, + inputFormatters: [ + FilteringTextInputFormatter.deny( + RegExp("[\u0621-\u064a-\ ]")) + ], + validator: (value) { + RegExp regExp = RegExp('[\u0621-\u064a-\ ]'); + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + } else if (regExp.hasMatch(value)) { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .noArabicLetters); + } + return null; + }, onSaved: (value) { //searchMedicine(model, context); }, @@ -66,13 +83,13 @@ class _SearchProductsPageState extends State { msg = TranslationBase.of(context).noResultFound; }, controller: textController, - validator: (value) { - if (value.isEmpty) { -// return 'please Enter Product Name'; - return TranslationBase.of(context).pleaseEnterProductName; - } - return null; - }, +// validator: (value) { +// if (value.isEmpty) { +//// return 'please Enter Product Name'; +// return TranslationBase.of(context).pleaseEnterProductName; +// } +// return null; +// }, ), ), ), diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index 3fb1574f..49ebf48d 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -987,9 +987,9 @@ class _SubCategorisePageState extends State { ], ), Container( - height: 100.0, + height: 130.0, margin: EdgeInsets.symmetric( - horizontal: 6, + horizontal: 0, vertical: 0, ), child: Column( @@ -1072,18 +1072,17 @@ class _SubCategorisePageState extends State { size: 18, color: Colors.blue,), onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); if(model.subProducts[index].rxMessage == null){ + GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.subProducts[index].id); -// GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); Navigator.push( context, - FadePage(page: CartOrderPage()), - );} + FadePage(page: CartOrderPage()));} else{ AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); } - GifLoaderDialogUtils.hideDialog(context); + } ), diff --git a/lib/pages/webRTC/OpenTok/OpenTok.dart b/lib/pages/webRTC/OpenTok/OpenTok.dart new file mode 100644 index 00000000..7abcfca5 --- /dev/null +++ b/lib/pages/webRTC/OpenTok/OpenTok.dart @@ -0,0 +1,180 @@ +import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; + +import 'OpenTokPlatformBridge.dart'; + + +class OpenTokConnectCallPage extends StatefulWidget{ + final String sessionId; + final String token; + final String apiKey; + OpenTokConnectCallPage({@required this.sessionId, @required this.token, @required this.apiKey}); + + @override + State createState() => OpenTokState(); + +} + +class OpenTokState extends State{ + OpenTokPlatformBridge openTokPlatform; + OpenTokSDKState sdkState = OpenTokSDKState.LOGGED_OUT; + + initOpenTok(){ + openTokPlatform = OpenTokPlatformBridge.init( + apiKey: widget.apiKey, + sessionID: widget.sessionId, + token: widget.token, + onStateChange: (state) { + setState(() => sdkState = state); + } + ); + } + + @override + void initState() { + initOpenTok(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + extendBodyBehindAppBar: true, + appBar: AppBar( + backgroundColor: Colors.transparent, + actions: [ + TextButton(onPressed: (){ + initOpenTok(); + }, child: Icon(Icons.connect_without_contact_outlined, color: Colors.green,)) + ], + ), + body: Column( + children: [ + Expanded( + child: Stack( + children: [ + if(sdkState == OpenTokSDKState.LOGGED_IN) + ...platformVideoViews(), + + + if(sdkState == OpenTokSDKState.LOGGED_OUT) + Center(child: Text("Logged Out"),), + + if(sdkState == OpenTokSDKState.ERROR) + Center(child: Text("Error opening session"),), + + if(sdkState == OpenTokSDKState.WAIT) + Center(child: CircularProgressIndicator(),), + + if(sdkState == OpenTokSDKState.ON_CALL) + Container(), + ], + ), + ), + Row( + children: [ + Expanded( + child: ElevatedButton( + child: Text('Mute Video') ,onPressed: () => openTokPlatform.toggleVideo() + ), + ), + SizedBox(width: 20,), + Expanded( + child: ElevatedButton( + child: Text('Mute Audio') ,onPressed: () => openTokPlatform.toggleAudio() + ), + ), + SizedBox(width: 20,), + Expanded( + child: ElevatedButton( + child: Text('Change Camera') ,onPressed: () => openTokPlatform.swapCamera() + ), + ), + ], + ) + ], + ), + ); + } + + bool remoteVideoOnFull = true; + List platformVideoViews(){ + return [ + SizedBox( + width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, + child: remoteVideoOnFull ? remotePlatformVideoView() : localPlatformVideoView() + ), + + DraggablePublisher( + onButtonBarHeight: ((double)async*{}(50)), + onButtonBarVisible: ((bool)async*{}(true)), + availableScreenSize: MediaQuery.of(context).size, + child: InkWell( + child: (remoteVideoOnFull ? localPlatformVideoView() : remotePlatformVideoView()), + onTap: (){ + print(''); + }, + ), + ) + ]; + } + + Widget localPlatformVideoView(){ + return PlatformViewLink( + viewType: 'local-video-container', // custom platform-view-type + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller, + gestureRecognizers: const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + + onCreatePlatformView: (PlatformViewCreationParams params) { + return PlatformViewsService.initSurfaceAndroidView( + id: params.id, + viewType: 'local-video-container', + // custom platform-view-type, + layoutDirection: TextDirection.ltr, + creationParams: {}, + creationParamsCodec: StandardMessageCodec(), + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + + Widget remotePlatformVideoView(){ + return PlatformViewLink( + viewType: 'remote-video-container', // custom platform-view-type + surfaceFactory: + (BuildContext context, PlatformViewController controller) { + return AndroidViewSurface( + controller: controller, + gestureRecognizers: const >{}, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return PlatformViewsService.initSurfaceAndroidView( + id: params.id, + viewType: 'remote-video-container', + // custom platform-view-type, + layoutDirection: TextDirection.ltr, + creationParams: {}, + creationParamsCodec: StandardMessageCodec(), + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); + }, + ); + } + +} \ No newline at end of file diff --git a/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart b/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart new file mode 100644 index 00000000..bfdb8fb4 --- /dev/null +++ b/lib/pages/webRTC/OpenTok/OpenTokPlatformBridge.dart @@ -0,0 +1,86 @@ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:permission_handler/permission_handler.dart'; + +enum OpenTokSDKState{ LOGGED_OUT, LOGGED_IN, WAIT, ON_CALL, ERROR } +final _platformMethodChannel = const MethodChannel('OpenTok-Platform-Bridge'); + +class OpenTokPlatformBridge{ + + + OpenTokSDKState _sdkState = OpenTokSDKState.LOGGED_OUT; + bool _publishAudio = true; + bool _publishVideo = true; + + final void Function(OpenTokSDKState) onStateChange; + + OpenTokPlatformBridge.init({@required String sessionID, @required String token, @required String apiKey, this.onStateChange}){ + _initSession({'apiKey':apiKey, 'sessionId':sessionID, 'token':token, }); + _platformMethodChannel.setMethodCallHandler(incomingMethodHadler); + } + + Future incomingMethodHadler(MethodCall methodCall) async { + switch (methodCall.method) { + case 'updateState': + { + var arguments = 'OpenTokSDKState.${methodCall.arguments}'; + _sdkState = OpenTokSDKState.values.firstWhere((v) { + return v.toString() == arguments; + }); + onStateChange(_sdkState); + } + break; + default: + throw MissingPluginException('notImplemented'); + } + } + + + Future _initSession(Map openTokCredentials) async { + await requestPermissions(); + try { + await _platformMethodChannel.invokeMethod('initSession', openTokCredentials); + } on PlatformException catch (e) { + print(e); + } + } + + Future makeCall() async { + try { + await requestPermissions(); + + await _platformMethodChannel.invokeMethod('makeCall'); + } on PlatformException catch (e) { + print(e); + } + } + + Future requestPermissions() async { + await [Permission.microphone, Permission.camera].request(); + } + + Future swapCamera() async { + try { + await _platformMethodChannel.invokeMethod('swapCamera'); + } on PlatformException catch (e) {} + } + + Future toggleAudio() async { + _publishAudio = !_publishAudio; + dynamic params = {'publishAudio': _publishAudio}; + + try { + await _platformMethodChannel.invokeMethod('publishAudio', params); + } on PlatformException catch (e) {} + } + + Future toggleVideo() async { + _publishVideo = !_publishVideo; + dynamic params = {'publishVideo': _publishVideo}; + + try { + await _platformMethodChannel.invokeMethod('toggleVideo', params); + } on PlatformException catch (e) {} + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 5d4ebea4..a8d850e1 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -20,6 +20,7 @@ import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; import 'package:diplomaticquarterapp/splashPage.dart'; const String INIT_ROUTE = '/'; @@ -45,6 +46,7 @@ const String PACKAGES_OFFERS = 'packages-offers'; const String PACKAGES_OFFERS_CART = 'packages-offers-cart'; const String PACKAGES_ORDER_COMPLETED = 'packages-offers-cart'; const String TEST_PAGE = 'test-page'; +const String OPENTOK_CALL_PAGE = 'OPENTOK_CALL_PAGE'; const String HEALTH_WEATHER = 'health-weather'; const APP_UPDATE = 'app-update'; @@ -66,11 +68,15 @@ var routes = { SYMPTOM_CHECKER_INFO: (_) => SymptomInfo(), SELECT_GENDER: (_) => SelectGender(), SETTINGS: (_) => Settings(), - PACKAGES_OFFERS: (_) => PackagesHomePage(), PACKAGES_OFFERS_CART: (_) => PackagesCartPage(), PACKAGES_ORDER_COMPLETED: (_) => PackageOrderCompletedPage(), TEST_PAGE: (_) => TestPage(), HEALTH_WEATHER: (_) => HealthWeatherIndicator(), APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), + OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( + apiKey: '46209962', + sessionId: '1_MX40NjIwOTk2Mn5-MTYzNDY0ODM3NDY2Nn5PcnpnNGM0R1Q3ODZ6UXlFQ01lMDF5YWJ-fg', + token: 'T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9Y2ZhZjMzZjA3MWFkMjkxN2JmYjEwZDkxYTRkOTdhN2NmNWE4YjMyYTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXpORFkwT0RNM05EWTJObjVQY25wbk5HTTBSMVEzT0RaNlVYbEZRMDFsTURGNVlXSi1mZyZjcmVhdGVfdGltZT0xNjM0NjQ4Mzc1Jm5vbmNlPTAuNzczMzcxNDUxMDgzMjQyMyZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjM0NzM0Nzc1JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9' + ), }; diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index a71bd5c9..6553da40 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -25,18 +25,7 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -60,18 +49,7 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -95,19 +73,8 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, - "TokenID": "", - "DeviceTypeID": req.DeviceTypeID, "ServiceID": serviceID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -154,18 +121,8 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, - "DeviceTypeID": req.DeviceTypeID, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -189,21 +146,9 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -227,21 +172,9 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ServiceID": serviceID, "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 @@ -271,15 +204,7 @@ class LiveCareService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "VersionID": req.VersionID, - "Channel": req.Channel, - "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, "ErServiceID": serviceID, "ClientRequestID": clientRequestID, "DeviceToken": deviceToken, @@ -287,9 +212,6 @@ class LiveCareService extends BaseService { "Latitude": "24.708488", "Longitude": "46.665925", "DeviceType": Platform.isIOS ? 'iOS' : 'Android', - "PatientType": authUser.patientType != null ? authUser.patientType : 0, - "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, - "SessionID": "YckwoXhUmWBsnHKEKig", "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Gender": authUser.gender != null ? authUser.gender : 0 diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart index 3bfe62e3..459c0e83 100644 --- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; @@ -18,8 +19,7 @@ class SmartWatchIntegrationService extends BaseService { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } @@ -42,13 +42,29 @@ class SmartWatchIntegrationService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_PATIENT_LAST_RECORD, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_PATIENT_LAST_RECORD, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); + } + Future insertPatientHealthData(List healthData, BuildContext context) async { + Map request; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { + "Med_InsertTransactionsInputsList": healthData, + }; + dynamic localRes; + await baseAppClient.post(INSERT_PATIENT_HEALTH_DATA, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); } } diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 337d4af0..a11b85e6 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -395,6 +395,15 @@ class DateUtil { return ""; } + /// get data formatted like 26/4/2020 + /// [dateTime] convert DateTime to data formatted + static String getDayMonthDateFormatted(DateTime dateTime) { + if (dateTime != null) + return DateFormat('dd/MM').format(dateTime); + else + return ""; + } + /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted according to language static String getDayMonthYearDateFormattedLang(DateTime dateTime, bool isArabic) { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 78eed667..5c32aaa7 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -795,6 +795,8 @@ class TranslationBase { String get myBalances => localizedValues['MyBalances'][locale.languageCode]; + String get myWallet => localizedValues['MyWallet'][locale.languageCode]; + String get balanceAmount => localizedValues['BalanceAmount'][locale.languageCode]; String get totalBalance => localizedValues['TotalBalance'][locale.languageCode]; @@ -1395,6 +1397,7 @@ class TranslationBase { String get enablingWifi => localizedValues['enablingWifi'][locale.languageCode]; String get offerAndPackages => localizedValues['offerAndPackages'][locale.languageCode]; + String get offerAndPackagesDetails => localizedValues['offerAndPackagesDetails'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; @@ -1761,7 +1764,13 @@ class TranslationBase { String get referralNumber => localizedValues['referralNumber'][locale.languageCode]; String get needPrescription => localizedValues['needPrescription'][locale.languageCode]; + String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; + + String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode]; + + String get noOffersAvailable => localizedValues['noOffersAvailable'][locale.languageCode]; + String get requestID => localizedValues['requestID'][locale.languageCode]; String get OrderStatus => localizedValues['OrderStatus'][locale.languageCode]; @@ -1799,8 +1808,11 @@ class TranslationBase { String get quantitySize => localizedValues['quantitySize'][locale.languageCode]; String get addToCart => localizedValues['addToCart'][locale.languageCode]; + String get addToWishlist => localizedValues['addToWishlist'][locale.languageCode]; + String get removeFromWishlist => localizedValues['removeFromWishlist'][locale.languageCode]; + String get buyNow => localizedValues['buyNow'][locale.languageCode]; String get quantityShortcut => localizedValues['quantityShortcut'][locale.languageCode]; @@ -2475,10 +2487,101 @@ class TranslationBase { String get Latest => localizedValues["Latest"][locale.languageCode]; String get Tour => localizedValues["Tour"][locale.languageCode]; + String get mostViewed => localizedValues["mostViewed"][locale.languageCode]; + String get newProducts => localizedValues["newProducts"][locale.languageCode]; + String get enterDetails => localizedValues["enterDetails"][locale.languageCode]; + String get paymentSelected => localizedValues["paymentSelected"][locale.languageCode]; + + String get moreNotifications => localizedValues["moreNotifications"][locale.languageCode]; + + String get familyTitle => localizedValues["familyTitle"][locale.languageCode]; + + String get familySubtitle => localizedValues["familySubtitle"][locale.languageCode]; + + String get liveCareTitle => localizedValues["liveCareTitle"][locale.languageCode]; + + String get liveCareSubtitle => localizedValues["liveCareSubtitle"][locale.languageCode]; + + String get pharmacyTitle => localizedValues["pharmacyTitle"][locale.languageCode]; + + String get pharmacySubtitle => localizedValues["pharmacySubtitle"][locale.languageCode]; + + String get parkingTitle2 => localizedValues["parkingTitle2"][locale.languageCode]; + + String get parkingSubtitle => localizedValues["ParkingSubtitle"][locale.languageCode]; + + String get healthCalculatorTitle => localizedValues["healthCalculatorTitle"][locale.languageCode]; + + String get healthCalculatorSubtitle => localizedValues["healthCalculatorSubtitle"][locale.languageCode]; + + String get waterTitle => localizedValues["waterTitle"][locale.languageCode]; + + String get waterSubtitle => localizedValues["waterSubtitle"][locale.languageCode]; + + String get medicalFileTitle2 => localizedValues["medicalFileTitle2"][locale.languageCode]; + + String get medicalFileSubtitle => localizedValues["medicalFileSubtitle"][locale.languageCode]; + + String get healthConvertersTitle => localizedValues["healthConvertersTitle"][locale.languageCode]; + + String get healthConvertersSubtitle => localizedValues["healthConvertersSubtitle"][locale.languageCode]; + + String get syncHealthData => localizedValues["syncHealthData"][locale.languageCode]; + + String get steps => localizedValues["steps"][locale.languageCode]; + + String get avgSteps => localizedValues["avgSteps"][locale.languageCode]; + + String get avgDistance => localizedValues["avgDistance"][locale.languageCode]; + + String get avgHeartRate => localizedValues["avgHeartRate"][locale.languageCode]; + + String get alreadySynced => localizedValues["alreadySynced"][locale.languageCode]; + + String get syncInstructionsIntro1 => localizedValues["sync-instructions-intro1"][locale.languageCode]; + + String get syncInstructionsIntro2 => localizedValues["sync-instructions-intro2"][locale.languageCode]; + + String get syncInstructionsIntro3 => localizedValues["sync-instructions-intro3"][locale.languageCode]; + + String get iosInstructions1 => localizedValues["ios-instructions-1"][locale.languageCode]; + + String get iosInstructions2 => localizedValues["ios-instructions-2"][locale.languageCode]; + + String get iosInstructions3 => localizedValues["ios-instructions-3"][locale.languageCode]; + + String get supportedWatches => localizedValues["supportedWatches"][locale.languageCode]; + + String get watchInstructions => localizedValues["watchInstructions"][locale.languageCode]; + + String get monthlyTab => localizedValues["monthlyTab"][locale.languageCode]; + + String get moreSupportedWatches => localizedValues["moreSupportedWatches"][locale.languageCode]; + + String get androidInstructions1 => localizedValues["android-instructions-1"][locale.languageCode]; + + String get androidInstructions2 => localizedValues["android-instructions-2"][locale.languageCode]; + + String get androidInstructions3 => localizedValues["android-instructions-3"][locale.languageCode]; + + String get androidInstructions4 => localizedValues["android-instructions-4"][locale.languageCode]; + + String get tamaraInstPlan => localizedValues["tamaraInstPlan"][locale.languageCode]; + + String get onlineTag => localizedValues["onlineTag"][locale.languageCode]; + + String get offlineTag => localizedValues["offlineTag"][locale.languageCode]; + + String get viewDocList => localizedValues["viewDocList"][locale.languageCode]; + + String get bodyFatTitle => localizedValues["bodyFatTitle"][locale.languageCode]; + + String get cholesTitle => localizedValues["cholesTitle"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/avatar/large_avatar.dart b/lib/widgets/avatar/large_avatar.dart index e1f395d8..131a2820 100644 --- a/lib/widgets/avatar/large_avatar.dart +++ b/lib/widgets/avatar/large_avatar.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../show_zoom_image_dialog.dart'; + /// LargeAvatar /// [name] the user name /// [url] the image url @@ -11,20 +14,12 @@ import 'package:flutter/material.dart'; /// [height] the avatar height /// [onTap] on tap function class LargeAvatar extends StatelessWidget { - LargeAvatar( - {Key key, - @required this.name, - this.url, - this.disableProfileView: false, - this.radius = 70.0, - this.width = 70, - this.height = 60, - this.onTap}) - : super(key: key); + LargeAvatar({Key key, @required this.name, this.url, this.disableProfileView: false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar: false}) : super(key: key); final String name; final String url; final bool disableProfileView; + final bool isAppointmentAvatar; final double radius; final double width; final double height; @@ -35,11 +30,22 @@ class LargeAvatar extends StatelessWidget { return Center( child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(radius)), - child: Image.network( - url.trim(), - fit: BoxFit.fill, - width: width, - height: height, + child: Stack( + alignment: Alignment.center, + children: [ + Image.network( + url.trim(), + fit: BoxFit.fill, + width: width, + height: height, + ), + if (!disableProfileView && !isAppointmentAvatar) + Container( + child: Icon(Icons.search,size: 18,color: Colors.white,), + padding: EdgeInsets.all(6), + decoration: containerRadius(Colors.black.withOpacity(0.3), 200), + ) + ], ), ), ); @@ -55,7 +61,12 @@ class LargeAvatar extends StatelessWidget { @override Widget build(BuildContext context) { return InkWell( - onTap: disableProfileView ? null : onTap, + onTap: disableProfileView + ? null + : isAppointmentAvatar ? onTap : () { + print("ssssss " + url.trim()); + showZoomImageDialog(context, url.trim() ?? ""); + }, child: Container( decoration: BoxDecoration( // gradient: LinearGradient( diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index 7bbadd8c..f0016fc5 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -23,7 +23,7 @@ class ImageOptions { icon: FeatherIcons.image, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.gallery); + await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 50); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); @@ -37,7 +37,7 @@ class ImageOptions { icon: FeatherIcons.camera, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.camera); + await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 50); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 22430242..274ef651 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,5 +1,9 @@ import 'package:flutter/material.dart'; +extension WithContainer on DefaultButton { + Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); +} + class DefaultButton extends StatelessWidget { final String text; final VoidCallback onPress; diff --git a/lib/widgets/charts/show_chart.dart b/lib/widgets/charts/show_chart.dart index 86c83f5b..301d45ff 100644 --- a/lib/widgets/charts/show_chart.dart +++ b/lib/widgets/charts/show_chart.dart @@ -10,8 +10,9 @@ class ShowChart extends StatelessWidget { final List timeSeries; final int indexes; final double horizontalInterval; + final bool isWeeklyOrMonthly; - ShowChart({this.title, this.timeSeries, this.indexes, this.horizontalInterval = 8.0}); + ShowChart({this.title, this.timeSeries, this.indexes, this.horizontalInterval = 8.0, this.isWeeklyOrMonthly = false}); List xAxixs = List(); List yAxixs = List(); @@ -115,19 +116,23 @@ class ShowChart extends StatelessWidget { rotateAngle: -65, margin: 22, getTitles: (value) { - if (timeSeries.length < 15) { - if (timeSeries.length > value.toInt()) { - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - } else - return ''; + if(isWeeklyOrMonthly) { + return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.month}'; } else { - if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; - if (xAxixs.contains(value.toInt())) { - return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (timeSeries.length < 15) { + if (timeSeries.length > value.toInt()) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } else + return ''; + } else { + if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + if (xAxixs.contains(value.toInt())) { + return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; + } } + return ''; } - return ''; }, ), leftTitles: SideTitles( diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 4c7656f6..f4081c21 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/core/model/labs/lab_result.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; @@ -7,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/medical/labs/passport_update_page.dar import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -14,9 +14,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; -import '../../text.dart'; import 'FlowChartPage.dart'; class LabResultWidget extends StatelessWidget { @@ -81,6 +79,14 @@ class LabResultWidget extends StatelessWidget { ), ) : Container(), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Divider( + height: 1, + color: Color(0xff2E303A), + thickness: 1, + ), + ), ], ), ); @@ -152,10 +158,10 @@ class LabResultWidget extends StatelessWidget { tableRow.add( TableRow( children: [ - Utils.tableColumnTitle(TranslationBase.of(context).description), - Utils.tableColumnTitle(TranslationBase.of(context).value), - Utils.tableColumnTitle(TranslationBase.of(context).range), - Utils.tableColumnTitle(""), + Utils.tableColumnTitle(TranslationBase.of(context).description, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).value, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).range, showDivider: false), + Utils.tableColumnTitle("", showDivider: false), ], ), ); diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index a7d180c5..4d38de2e 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -35,6 +35,7 @@ class _TimeLineViewState extends State { List dateObjs = []; DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); + @override void initState() { super.initState(); @@ -347,13 +348,15 @@ class TimelineNewWidget extends StatelessWidget { FadePage( page: AppointmentDetails( appo: appoitmentAllHistoryResul, - parentIndex: 2, + parentIndex: 2, ))); }, name: appoitmentAllHistoryResul.doctorNameObj, + disableProfileView: false, url: appoitmentAllHistoryResul.doctorImageURL, width: 30, height: 30, + isAppointmentAvatar: true, ), mHeight(6), Text( diff --git a/lib/widgets/dialogs/RadioStringDialog.dart b/lib/widgets/dialogs/RadioStringDialog.dart deleted file mode 100644 index 49a16142..00000000 --- a/lib/widgets/dialogs/RadioStringDialog.dart +++ /dev/null @@ -1,139 +0,0 @@ -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'; - -class RadioStringDialog extends StatefulWidget { - final List radioList; - final Function(String) onValueSelected; - final String title; - String selectedValue; - - RadioStringDialog({Key key, this.radioList, this.onValueSelected, this.selectedValue, this.title}); - - @override - _RadioStringDialogState createState() => _RadioStringDialogState(); -} - -class _RadioStringDialogState extends State { - @override - void initState() { - super.initState(); - widget.selectedValue = widget.selectedValue ?? widget.radioList[0]; - } - - @override - Widget build(BuildContext context) { - return SimpleDialog( - title: Container( - width: double.infinity, - child: Center( - child: Texts( - widget.title, - textAlign: TextAlign.center, - ))), - children: [ - Container( - height: widget.radioList.length > 3 ? MediaQuery.of(context).size.height * 0.6 : null, - child: SingleChildScrollView( - child: Column( - children: [ - Divider(), - ...List.generate( - widget.radioList.length, - (index) => Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // SizedBox( - // height: 2, - // ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - setState(() { - widget.selectedValue = widget.radioList[index]; - }); - }, - child: ListTile( - title: Texts( - widget.radioList[index], - fontSize: 14, - ), - leading: Radio( - value: widget.radioList[index], - groupValue: widget.selectedValue, - activeColor: Colors.red[800], - onChanged: (value) { - setState(() { - widget.selectedValue = value; - }); - }, - ), - ), - ), - ) - ], - ), - ], - ), - ), - SizedBox( - height: 5.0, - ), - ], - ), - ), - ), - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Center( - child: Texts( - TranslationBase.of(context).cancel.toUpperCase(), - color: Colors.red, - ), - ), - ), - ), - ), - ), - Container( - width: 1, - height: 30, - color: Colors.grey[500], - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () { - widget.onValueSelected(widget.selectedValue); - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - ), - ), - ), - ), - ), - ], - ) - ], - ); - } -} diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 198e25de..7175d6dc 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -13,8 +13,9 @@ class RadioSelectionDialog extends StatefulWidget { final Function(int) onValueSelected; final List listData; final int selectedIndex; + final bool isScrollable; - const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex}) : super(key: key); + const RadioSelectionDialog({Key key, this.onValueSelected, this.listData, this.selectedIndex, this.isScrollable = false}) : super(key: key); @override State createState() => new RadioSelectionDialogState(); @@ -68,43 +69,48 @@ class RadioSelectionDialogState extends State { TranslationBase.of(context).pleaseSelectFromBelowOptions, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56), ), - ListView.separated( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.only(bottom: 42, top: 10), - itemBuilder: (context, index) { - return Row( - children: [ - SizedBox( - width: 22, - height: 22, - child: Radio( - value: widget.listData[index].value, - groupValue: selectedIndex, - onChanged: (value) { - setState(() { - selectedIndex = value; - }); - }, + SizedBox(height: widget.isScrollable ? 12 : 0), + SizedBox( + height: widget.isScrollable ? MediaQuery.of(context).size.height * .4 : null, + child: ListView.separated( + physics: widget.isScrollable ? BouncingScrollPhysics() : NeverScrollableScrollPhysics(), + shrinkWrap: !widget.isScrollable, + padding: EdgeInsets.only(bottom: widget.isScrollable ? 21 : 42, top: 10), + itemBuilder: (context, index) { + return Row( + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: widget.listData[index].value, + groupValue: selectedIndex, + onChanged: (value) { + setState(() { + selectedIndex = value; + }); + }, + ), ), - ), - SizedBox(width: 8), - Text( - widget.listData[index].title, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), - ), - ], - ); - }, - separatorBuilder: (context, index) => SizedBox(height: 10), - itemCount: widget.listData.length), + SizedBox(width: 8), + Text( + widget.listData[index].title, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), + ], + ); + }, + separatorBuilder: (context, index) => SizedBox(height: 10), + itemCount: widget.listData.length), + ), + SizedBox(height: widget.isScrollable ? 12 : 0), Row( mainAxisSize: MainAxisSize.min, children: [ Expanded( child: DefaultButton( TranslationBase.of(context).save, - () { + (){ Navigator.pop(context); widget.onValueSelected(selectedIndex); }, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 6209f52d..affcb02a 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -34,8 +32,8 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../config/size_config.dart'; import '../../locator.dart'; @@ -47,6 +45,7 @@ class AppDrawer extends StatefulWidget { } class _AppDrawerState extends State { + final InAppReview _inAppReview = InAppReview.instance; @override void initState() { @@ -377,11 +376,12 @@ class _AppDrawerState extends State { InkWell( child: DrawerItem(TranslationBase.of(context).rateApp, Icons.star, bottomLine: false, letterSpacing: -0.84, fontSize: 14, projectProvider: projectProvider), onTap: () { - if (Platform.isIOS) { - launch("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); - } else { - launch("https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); - } + openAppReviewDialog(); + // if (Platform.isIOS) { + // launch("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + // } else { + // launch("https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + // } }, ), InkWell( @@ -607,6 +607,12 @@ class _AppDrawerState extends State { }); } + openAppReviewDialog() async { + if (await _inAppReview.isAvailable()) { + _inAppReview.requestReview(); + } + } + void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index dd70d06f..401d62ef 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -6,13 +6,15 @@ import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'avatar/large_avatar.dart'; import 'my_rich_text.dart'; class HospitalLocation extends StatelessWidget { final GetHMGLocationsModel location; final bool showCity; + final String waitingTime; - HospitalLocation(this.location, {Key key, this.showCity = false}) : super(key: key); + HospitalLocation(this.location, {Key key, this.showCity = false, this.waitingTime}) : super(key: key); @override Widget build(BuildContext context) { @@ -46,14 +48,12 @@ class HospitalLocation extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ClipRRect( - borderRadius: BorderRadius.circular(30), - child: Image.network( - location?.projectImageURL?.toString() ?? 'https://hmgwebservices.com/Images/Hospitals/15.jpg', - width: 48, - height: 48, - fit: BoxFit.cover, - ), + LargeAvatar( + name: "", + url: location?.projectImageURL?.toString() ?? 'https://hmgwebservices.com/Images/Hospitals/15.jpg', + width: 48, + height: 48, + radius: 30, ), SizedBox(width: 10), Expanded( @@ -62,6 +62,7 @@ class HospitalLocation extends StatelessWidget { children: [ if (showCity) MyRichText(TranslationBase.of(context).city + ":", location.cityName?.trim().toString(), projectViewModel.isArabic), MyRichText(TranslationBase.of(context).distance + ":", location.distanceInKilometers.toString() + " " + TranslationBase.of(context).km_ ?? "", projectViewModel.isArabic), + if (waitingTime != null) MyRichText(TranslationBase.of(context).waitingTime, waitingTime, projectViewModel.isArabic), ], ), ) diff --git a/lib/widgets/offers_packages/PackagesCartItemCard.dart b/lib/widgets/offers_packages/PackagesCartItemCard.dart index 3ae405c6..ddca9d90 100644 --- a/lib/widgets/offers_packages/PackagesCartItemCard.dart +++ b/lib/widgets/offers_packages/PackagesCartItemCard.dart @@ -77,16 +77,16 @@ class PackagesCartItemCardState extends State { ), ), - Positioned( - bottom: 8, - left: 10, - child: Row( - children: [ - _totalPrice((widget.itemModel.product.price * widget.itemModel.quantity), context: context), - _totalLabel(context: context), - ], - ), - ) + // Positioned( + // bottom: 8, + // left: 10, + // child: Row( + // children: [ + // _totalLabel(context: context), + // _totalPrice((widget.itemModel.product.price * widget.itemModel.quantity), context: context), + // ], + // ), + // ) ], ) ) @@ -136,15 +136,18 @@ Widget _itemName(String name) => Padding( ); -Widget _itemPrice(double price, {@required BuildContext context}) => Padding( +Widget _itemPrice(double price, {@required BuildContext context}) { + final prc = (price ?? 0.0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(0), child: Texts( - '${price} ${TranslationBase.of(context).sar}', + '${prc} ${TranslationBase.of(context).sar}', fontWeight: FontWeight.bold, color: Colors.green, fontSize: 15 ) ); +} // -------------------- @@ -159,16 +162,19 @@ Widget _priceSeperator() => Padding( // -------------------- // Product Price // -------------------- -Widget _itemOldPrice(double oldPrice, {@required BuildContext context}) => Padding( +Widget _itemOldPrice(double oldPrice, {@required BuildContext context}) { + final prc = (oldPrice ?? 0.0).toStringAsFixed(2); + return Padding( padding: const EdgeInsets.all(0), child: Texts( - '${oldPrice} ${TranslationBase.of(context).sar}', + '${prc} ${TranslationBase.of(context).sar}', fontWeight: FontWeight.normal, decoration: TextDecoration.lineThrough, color: Colors.grey, fontSize: 10 ) ); +} // -------------------- // Product Price diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 735eb9af..c93ac267 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -197,12 +197,16 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { return AppBar( elevation: 0, backgroundColor: showTitle ? Colors.white : Colors.transparent, - automaticallyImplyLeading: false, + // backgroundColor: Colors.red, + // automaticallyImplyLeading: false, + leading: ArrowBack( + onTap: onTap, + ), + titleSpacing: -8, + // centerTitle: false, title: Row( children: [ - ArrowBack( - onTap: onTap, - ), + if (showTitle) Expanded( child: Text( @@ -342,7 +346,7 @@ class AppBarWidgetState extends State { actions: [ (widget.isPharmacy && widget.showPharmacyCart) ? IconButton( - icon: Badge(badgeContent: Text(_badgeText), child: Icon(Icons.shopping_cart)), + icon: Badge(badgeContent: Text(orderPreviewViewModel.cartResponse.quantityCount.toString()), child: Icon(Icons.shopping_cart)), color: Colors.white, onPressed: () { Navigator.of(context).popUntil(ModalRoute.withName('/')); @@ -353,7 +357,7 @@ class AppBarWidgetState extends State { icon: Badge( position: BadgePosition.topStart(top: -15, start: -10), badgeContent: Text( - orderPreviewViewModel.cartResponse.quantityCount.toString() /*_badgeText*/, + _badgeText, style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), ), child: Icon(Icons.shopping_cart)), diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 12fb9d3e..6fccaec4 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -17,7 +17,7 @@ class SMSOTP { final Function onFailure; final context; - int remainingTime = 600; + int remainingTime = 120; Future timer; @@ -225,34 +225,6 @@ class SMSOTP { }); } - - // todo 'sikander' remove useless code - // static void showLoadingDialog(BuildContext context, bool _loading) async { - // _context = context; - // //setSignature(); - // if (_loading == false) { - // Navigator.of(context).pop(); - // return; - // } - // _loading = true; - // await showDialog( - // context: _context, - // barrierDismissible: false, - // builder: (BuildContext context) { - // return SimpleDialog( - // elevation: 0.0, - // backgroundColor: Colors.transparent, - // children: [ - // Center( - // child: CircularProgressIndicator( - // valueColor: AlwaysStoppedAnimation(Colors.black), - // ), - // ) - // ], - // ); - // }); - // } - static void hideSMSBox(context) { Navigator.pop(context); } diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart index f26c4917..4c5b9d96 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_home_item.dart @@ -45,9 +45,9 @@ class BottomNavHomeItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - SizedBox( - height: 15, - ), +// SizedBox( +// height: 15, +// ), currentIndex == index ? Divider( // color: Color(0xff5AB145), @@ -57,19 +57,24 @@ class BottomNavHomeItem extends StatelessWidget { thickness: 0, ), Container( + margin: EdgeInsets.only(bottom: 5.0), child: Image.asset( 'assets/images/habib-logo.png', ), height: 22.0, + ), SizedBox( - height: 9, + height: 5, ), - Texts( - title, - textAlign: TextAlign.start, - color: currentIndex == index ? Colors.grey : Colors.grey, - fontSize: 11, + Container( + margin: EdgeInsets.only(bottom: 7.0), + child: Texts( + title, + textAlign: TextAlign.start, + color: currentIndex == index ? Colors.grey : Colors.grey, + fontSize: 11, + ), ), // Added TextAlign Property ], diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index ff0cac32..6e6a5f53 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -39,7 +39,7 @@ class BottomNavPharmacyItem extends StatelessWidget { return Expanded( child: SizedBox( - // height: 72.0, + height: 66.0, child: Stack( clipBehavior: Clip.none, children: [ @@ -63,17 +63,18 @@ class BottomNavPharmacyItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - SizedBox( - height: 15, - ), +// SizedBox( +// height: 15, +// ), currentIndex == index ? Divider( - color: Color(0xff5AB145), + color: Color(0xff5AB133), thickness: 3.5, ) : Divider( thickness: 0, ), + Container( child: Icon(currentIndex == index ? activeIcon : icon, color: isHome @@ -81,7 +82,7 @@ class BottomNavPharmacyItem extends StatelessWidget { : currentIndex == index ? Colors.grey : Colors.grey, - size: 22.0), + size: 20.0), ), SizedBox( height: 11, @@ -93,7 +94,7 @@ class BottomNavPharmacyItem extends StatelessWidget { textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, fontWeight: currentIndex == index - ? FontWeight.bold + ? FontWeight.normal : FontWeight.w400, fontSize: currentIndex == index ? 13 : 11, ), @@ -108,13 +109,13 @@ class BottomNavPharmacyItem extends StatelessWidget { 0) Positioned( top: 11.5, - right: -4.5, + right: -3.5, child: Container( decoration: BoxDecoration( color: Colors.red, borderRadius: BorderRadius.circular(15), ), - padding: EdgeInsets.only(left: 7, right: 6.5), + padding: EdgeInsets.only(left: 6.5, right: 6.5), height: 18, child: Center( child: Texts( diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 405a417c..af1e75ec 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -25,25 +25,28 @@ class productTile extends StatelessWidget { final PharmacyProduct product; final dynamic productID; final Function onDelete; + final dynamic approvedTotalReviews; + // final VoidCallback deleteWishlistItems; - productTile( - {this.productName, - this.productPrice, - this.productRate, - this.productReviews, - this.qyt, - this.totalPrice, - this.isOrderDetails = false, - this.productImage, - this.showLine = true, - this.img, - this.imgs, - this.status, - this.product, - this.productID, - this.onDelete, - }); + productTile({ + this.productName, + this.productPrice, + this.productRate, + this.productReviews, + this.qyt, + this.totalPrice, + this.isOrderDetails = false, + this.productImage, + this.showLine = true, + this.img, + this.imgs, + this.status, + this.product, + this.productID, + this.onDelete, + this.approvedTotalReviews, + }); @override Widget build(BuildContext context) { @@ -88,10 +91,7 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: productName, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), ), ), ), @@ -103,30 +103,36 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: 'SAR $productPrice', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ), ), ), ), this.isOrderDetails == false - ? Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + ? Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), ), - ), + Text( + '$approvedTotalReviews', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + ), + ], ) : Container(), ], @@ -150,7 +156,11 @@ class productTile extends StatelessWidget { height: 50, ), IconButton( - icon: Icon(FontAwesomeIcons.shoppingCart, size: 15), + icon: Icon( + Icons.shopping_cart, + size: 18, + color: Colors.blue, + ), onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, productID); @@ -176,13 +186,8 @@ class productTile extends StatelessWidget { margin: EdgeInsets.only(bottom: 5.0), child: RichText( text: TextSpan( - text: TranslationBase.of(context).quantity + - "" + - '$qyt', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + text: TranslationBase.of(context).quantity + "" + '$qyt', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), @@ -208,10 +213,7 @@ class productTile extends StatelessWidget { RichText( text: TextSpan( text: ' $totalPrice SAR', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 15), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 15), ), ), ], @@ -252,30 +254,19 @@ class productTile extends StatelessWidget { child: RichText( text: TextSpan( text: '($productReviews reviews)', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), ), ), ), ), InkWell( onTap: () { - Navigator.push( - context, FadePage(page: ProductReviewPage(product))); + Navigator.push(context, FadePage(page: ProductReviewPage(product))); }, child: Container( - padding: - EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), height: 30.0, - decoration: BoxDecoration( - border: Border.all( - color: Colors.orange, - style: BorderStyle.solid, - width: 1.0), - color: Colors.transparent, - borderRadius: BorderRadius.circular(5.0)), + decoration: BoxDecoration(border: Border.all(color: Colors.orange, style: BorderStyle.solid, width: 1.0), color: Colors.transparent, borderRadius: BorderRadius.circular(5.0)), child: Text( TranslationBase.of(context).writeReview, style: TextStyle( diff --git a/lib/widgets/show_zoom_image_dialog.dart b/lib/widgets/show_zoom_image_dialog.dart new file mode 100644 index 00000000..2340c259 --- /dev/null +++ b/lib/widgets/show_zoom_image_dialog.dart @@ -0,0 +1,48 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:progress_hud_v2/generated/i18n.dart'; + +showZoomImageDialog(BuildContext context, String url) { + showDialog( + context: context, + builder: (BuildContext context) => Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12.0), + ), //this right here + child: ShowZoomImage(url), + ), + ); +} + +class ShowZoomImage extends StatelessWidget { + String url; + + ShowZoomImage(this.url); + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + IconButton( + icon: Icon(Icons.close), + onPressed: () { + Navigator.pop(context); + }, + ), + CachedNetworkImage( + imageUrl: url, + height: MediaQuery.of(context).size.width / 1.4, + width: double.infinity, + ), + mHeight(12), + ], + ), + ); + } +} diff --git a/lib/widgets/single_selection_dialog.dart b/lib/widgets/single_selection_dialog.dart new file mode 100644 index 00000000..155f6394 --- /dev/null +++ b/lib/widgets/single_selection_dialog.dart @@ -0,0 +1,130 @@ +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; +import 'package:manage_calendar_events/manage_calendar_events.dart'; +import 'package:permission_handler/permission_handler.dart'; + + +class SingleSelectionDialog extends StatefulWidget { + final List items; + final String title; + final Widget icon; + + SingleSelectionDialog(this.items, {@required this.icon, @required this.title}); + + Future show(BuildContext context) async { + return showDialog( + context: context, + barrierDismissible: true, // user must tap button! + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0.0)), + insetPadding: EdgeInsets.all(21), + child: this, + ); + }, + ); + } + + @override + _SingleSelectionDialogState createState() => _SingleSelectionDialogState(); + +} + +class _SingleSelectionDialogState extends State { + int i = 0; + + @override + Widget build(BuildContext context) { + return Container( + //width: MediaQuery.of(context).size.width / 0.8, + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 40, + child: widget.icon, + ), + + IconButton( + icon: Icon(Icons.clear), + color: Color(0xff2B353E), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + mHeight(20), + Text( + widget.title, + style: TextStyle( + fontSize: 16, + color: Color(0xff2B353E), + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + + Padding( + padding: const EdgeInsets.symmetric(vertical: 20), + child: optionList(widget.items), + ), + + mHeight(12), + DefaultButton( + TranslationBase.of(context).done, + () { + Navigator.pop(context, widget.items[i]); + }, + color: CustomColors.green, + ), + ], + ), + ); + } + + Widget optionList(List options){ + return ListView.builder( + shrinkWrap: true, + itemCount: options.length, + itemBuilder: (ctx,idx){ + final opt = options[idx]; + return Row( + children: [ + Radio( + value: idx, + groupValue: i, + onChanged: (int value) { + setState(() { + i = value; + }); + }, + ), + Text( + opt.toString(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + ], + ); + } + ); + } +} diff --git a/lib/widgets/weather_slider/weather_slider.dart b/lib/widgets/weather_slider/weather_slider.dart index fe82cf49..0e784a05 100644 --- a/lib/widgets/weather_slider/weather_slider.dart +++ b/lib/widgets/weather_slider/weather_slider.dart @@ -1,47 +1,29 @@ import 'package:diplomaticquarterapp/core/model/weahter/weather_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class WeatherSlider extends StatelessWidget { - // final width; - // final LinearGradient color; final GetCityInfoList data; - WeatherSlider(this.data); - LinearGradient red = LinearGradient( - colors: [ - Colors.redAccent[100], - Colors.redAccent - ]); - LinearGradient green = LinearGradient( - colors: [ - Colors.greenAccent[100], - Colors.greenAccent - ]); - LinearGradient grey = LinearGradient( - colors: [ - Colors.grey[100], - Colors.grey - ]); - LinearGradient orange = LinearGradient( - colors: [ - Colors.orangeAccent[100], - Colors.orange - ]); - LinearGradient yellow = LinearGradient( - colors: [ - Colors.yellow[100], - Colors.yellow[600] - ]); + + final ProjectViewModel projectViewModel; + + WeatherSlider(this.data, this.projectViewModel); + + LinearGradient red = LinearGradient(colors: [Colors.redAccent[100], Colors.redAccent]); + LinearGradient green = LinearGradient(colors: [Colors.greenAccent[100], Colors.greenAccent]); + LinearGradient grey = LinearGradient(colors: [Colors.grey[100], Colors.grey]); + LinearGradient orange = LinearGradient(colors: [Colors.orangeAccent[100], Colors.orange]); + LinearGradient yellow = LinearGradient(colors: [Colors.yellow[100], Colors.yellow[600]]); + @override Widget build(BuildContext context) { // TODO: implement build return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.only(top:10), - child: AppText(data.name)), + Padding(padding: EdgeInsets.only(top: 10), child: AppText(data.name)), AppText( data.category, fontSize: 24, @@ -51,11 +33,8 @@ class WeatherSlider extends StatelessWidget { child: Stack( children: [ Container( - margin: EdgeInsets.only(bottom:10), - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Colors.grey[100], Colors.grey[400]]), - borderRadius: BorderRadius.circular(10)), + margin: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.grey[100], Colors.grey[400]]), borderRadius: BorderRadius.circular(10)), height: 15, width: MediaQuery.of(context).size.width, child: SizedBox(), @@ -64,110 +43,200 @@ class WeatherSlider extends StatelessWidget { top: 0, child: Container( decoration: BoxDecoration( - gradient: data.colorName =='red' ? red : data.colorName =='orange' ? orange : data.colorName =='green' ? green : data.colorName == 'yellow' ? yellow : grey, + gradient: data.colorName == 'red' + ? red + : data.colorName == 'orange' + ? orange + : data.colorName == 'green' + ? green + : data.colorName == 'yellow' + ? yellow + : grey, borderRadius: BorderRadius.circular(10)), height: 15, width: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), padding: EdgeInsets.all(15), child: SizedBox(), )), - Positioned(child: Container( - height: 0, - width:0, - decoration: ShapeDecoration( - color:data.colorName =='red' ? Colors.redAccent : data.colorName =='orange' ? Colors.orangeAccent : data.colorName =='green' ? Colors.greenAccent : data.colorName == 'yellow' ? Colors.yellowAccent : Colors.grey, - shape: MessageBorder(), - - )),top:25, left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)),) - + projectViewModel.isArabic + ? Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + right: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) + : Positioned( + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: data.colorName == 'red' + ? Colors.redAccent + : data.colorName == 'orange' + ? Colors.orangeAccent + : data.colorName == 'green' + ? Colors.greenAccent + : data.colorName == 'yellow' + ? Colors.yellowAccent + : Colors.grey, + shape: MessageBorder(), + )), + top: 25, + left: (MediaQuery.of(context).size.width * (double.parse(data.value) / 10)), + ) ], ), - ), Padding( - padding: EdgeInsets.only(top:10), - child: data.isValuesReversed == false ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - ) : Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - data.categoriesNames.category5, - fontSize: 12, - color: data.categoriesNames.category5== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category5== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category5== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category5== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - ), - AppText( - data.categoriesNames.category4, - fontSize: 12, - color: data.categoriesNames.category4== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category4== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category4== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category4== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category3, - fontSize: 12, - color: data.categoriesNames.category3== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category3== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category3== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category3== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category2, - fontSize: 12, - color: data.categoriesNames.category2== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category2== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category2== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category2== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - AppText( - data.categoriesNames.category1, - fontSize: 12, - color: data.categoriesNames.category1== data.category && data.colorName=='red' ? Colors.redAccent : data.categoriesNames.category1== data.category && data.colorName=='orange' ? Colors.orangeAccent : data.categoriesNames.category1== data.category && data.colorName=='green' ? Colors.greenAccent : data.categoriesNames.category1== data.category && data.colorName=='yellow' ? Colors.yellow[900] : Colors.black - - ), - ], - )), - Padding( - padding: EdgeInsets.all(15), - child:Divider()) + padding: EdgeInsets.only(top: 10), + child: data.isValuesReversed == false + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(data.categoriesNames.category5, + fontSize: 12, + color: data.categoriesNames.category5 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category5 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category4, + fontSize: 12, + color: data.categoriesNames.category4 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category4 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category3, + fontSize: 12, + color: data.categoriesNames.category3 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category3 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category2, + fontSize: 12, + color: data.categoriesNames.category2 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category2 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + AppText(data.categoriesNames.category1, + fontSize: 12, + color: data.categoriesNames.category1 == data.category && data.colorName == 'red' + ? Colors.redAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'orange' + ? Colors.orangeAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'green' + ? Colors.greenAccent + : data.categoriesNames.category1 == data.category && data.colorName == 'yellow' + ? Colors.yellow[900] + : Colors.black), + ], + )), + Padding(padding: EdgeInsets.all(15), child: Divider()) ], ); - } } + class MessageBorder extends ShapeBorder { final bool usePadding; final bool reverse; - MessageBorder({this.usePadding = true, this.reverse =false}); + + MessageBorder({this.usePadding = true, this.reverse = false}); @override - EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding? 0 : 0); + EdgeInsetsGeometry get dimensions => EdgeInsets.only(bottom: usePadding ? 0 : 0); @override Path getInnerPath(Rect rect, {TextDirection textDirection}) => null; @@ -175,17 +244,16 @@ class MessageBorder extends ShapeBorder { @override Path getOuterPath(Rect rect, {TextDirection textDirection}) { rect = Rect.fromPoints(rect.bottomRight, rect.bottomLeft - Offset(0, 0)); - if(!reverse) { + if (!reverse) { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx - 10, rect.topCenter.dy) - ..relativeLineTo(10, -10)..relativeLineTo(10, 10) + ..relativeLineTo(10, -10) + ..relativeLineTo(10, 10) ..close(); - }else{ + } else { return Path() - ..addRRect( - RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) + ..addRRect(RRect.fromRectAndRadius(rect, Radius.circular(rect.height / 2))) ..moveTo(rect.topCenter.dx, rect.topCenter.dy) ..relativeLineTo(10, 20) ..relativeLineTo(20, -20) @@ -198,4 +266,4 @@ class MessageBorder extends ShapeBorder { @override ShapeBorder scale(double t) => this; -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index 15c10362..c871fdb2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,6 +30,8 @@ dependencies: #Dependency Injection get_it: ^4.0.2 + #Google Fit & Apple HealthKit + fit_kit: ^1.1.2 #chart fl_chart: ^0.12.3 @@ -189,6 +191,8 @@ dependencies: in_app_update: ^1.1.15 + in_app_review: ^1.0.4 + badges: ^1.1.4 # open_settings: ^2.0.1 # Dep by Zohaib @@ -248,6 +252,7 @@ flutter: - assets/images/new/services/ - assets/images/new/appointment-rating/ - assets/images/new/payment/ + - assets/images/new/body/ fonts: - family: WorkSans