diff --git a/android/CustomFlutterFirebaseMessagingService.java b/android/CustomFlutterFirebaseMessagingService.java index 0a4d83be..113f256f 100644 --- a/android/CustomFlutterFirebaseMessagingService.java +++ b/android/CustomFlutterFirebaseMessagingService.java @@ -2,14 +2,33 @@ package io.flutter.plugins.firebasemessaging; import android.content.Intent; +import java.util.concurrent.TimeUnit; + import com.google.firebase.messaging.RemoteMessage; +//public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { +// @Override +// public void onMessageReceived(RemoteMessage remoteMessage) { +// if (remoteMessage.getData().containsKey("is_call")) { +// Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); +// startActivity(intent); +// super.onMessageReceived(remoteMessage); +// } else +// super.onMessageReceived(remoteMessage); +// } +//} + public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { if (remoteMessage.getData().containsKey("is_call")) { Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); + try { + TimeUnit.SECONDS.sleep(5); + } catch (Exception e) { + } super.onMessageReceived(remoteMessage); } else super.onMessageReceived(remoteMessage); diff --git a/android/app/agconnect-services.json b/android/app/agconnect-services.json index cfdaf83b..91aad2c7 100644 --- a/android/app/agconnect-services.json +++ b/android/app/agconnect-services.json @@ -1,6 +1,21 @@ { + "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":{ - "appType":"1", "cp_id":"2640966000002322881", "product_id":"736430079244816567", "client_id":"563735388191982656", @@ -10,5 +25,50 @@ "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", "package_name":"com.ejada.hmg" }, - "configuration_version":"1.0" -} \ No newline at end of file + "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" + } + } + ] +} diff --git a/android/app/build.gradle b/android/app/build.gradle index 25230849..65bb55fe 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,7 +28,7 @@ apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -67,6 +67,7 @@ android { } release { signingConfig signingConfigs.config + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } staging { // Specifies a sorted list of fallback build types that the @@ -77,6 +78,15 @@ android { matchingFallbacks = ['debug', 'qa', 'release'] } } + + packagingOptions { + exclude 'META-INF/proguard/androidx-annotations.pro' + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } flutter { @@ -112,7 +122,7 @@ dependencies { implementation "com.opentok.android:opentok-android-sdk:2.19.1" - compile 'com.facebook.stetho:stetho:1.5.1' + implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 4ace459d..cfab1fd6 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -1,4 +1,27 @@ -keep class tvi.webrtc.** { *; } -keep class com.twilio.video.** { *; } -keep class com.twilio.common.** { *; } --keepattributes InnerClasses \ No newline at end of file +-keepattributes InnerClasses + +-keep class com.ejada.** { *; } +-keep class org.webrtc.** { *; } + +-ignorewarnings +-keepattributes *Annotation* +-keepattributes Exceptions +-keepattributes InnerClasses +-keepattributes Signature +-keep class com.hianalytics.android.**{*;} +-keep class com.huawei.updatesdk.**{*;} +-keep class com.huawei.hms.**{*;} + +## Flutter wrapper +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } +-dontwarn io.flutter.embedding.** +-keep class com.huawei.hms.flutter.** { *; } +-repackageclasses \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 61472941..ebc7cc88 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> - + @@ -13,6 +13,7 @@ + @@ -20,6 +21,7 @@ + @@ -29,7 +31,7 @@ - + @@ -41,7 +43,11 @@ android:name=".Application" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true" + android:showOnLockScreen="true" + android:screenOrientation="sensorPortrait" android:label="Dr. Alhabib"> + + + + + + + + + + + + + + + + + + + @@ -116,7 +150,7 @@ - - - + + + 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 a9c5ea88..e179bc6a 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/Application.kt @@ -5,12 +5,12 @@ 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.firebasemessaging.FlutterFirebaseMessagingService +//import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService class Application : FlutterApplication(), PluginRegistrantCallback { override fun onCreate() { super.onCreate() - FlutterFirebaseMessagingService.setPluginRegistrant(this) + // FlutterFirebaseMessagingService.setPluginRegistrant(this) // Stetho.initializeWithDefaults(this); // Create an InitializerBuilder @@ -38,7 +38,7 @@ class Application : FlutterApplication(), PluginRegistrantCallback { } override fun registerWith(registry: PluginRegistry) { - io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); + // io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")); } } diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt index 9ac064cb..4e9e8ce1 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/FirebaseCloudMessagingPluginRegistrant.kt @@ -2,14 +2,14 @@ package com.ejada.hmg import io.flutter.plugin.common.PluginRegistry -import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin +//import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin object FirebaseCloudMessagingPluginRegistrant { fun registerWith(registry: PluginRegistry?) { if (alreadyRegisteredWith(registry)) { return } - FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) + // FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin")) } private fun alreadyRegisteredWith(registry: PluginRegistry?): Boolean { 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 e754e44c..957262c3 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -1,6 +1,8 @@ package com.ejada.hmg import android.os.Bundle import android.util.Log +import android.os.Build +import android.view.WindowManager import androidx.annotation.NonNull; import com.ejada.hmg.utils.* import io.flutter.embedding.android.FlutterFragmentActivity @@ -12,6 +14,9 @@ class MainActivity: FlutterFragmentActivity() { override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { GeneratedPluginRegistrant.registerWith(flutterEngine); // Create Flutter Platform Bridge + this.window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or + WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) + PlatformBridge(flutterEngine, this).create() OpenTokPlatformBridge(flutterEngine, this).create() diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java new file mode 100644 index 00000000..c96a60af --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java @@ -0,0 +1,56 @@ +/* +* --------------- +* Note: Todo +* --------------- +* Need to be place in huawei_push (package com.huawei.hms.flutter.push.hms) and define in huawei_push manifest.xml +* */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.util.Log; + +import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService; +import com.huawei.hms.flutter.push.utils.ApplicationUtils; + +import org.json.JSONObject; + +//package com.huawei.hms.flutter.push.hms +// +// +//import android.content.Context; +//import android.content.Intent; +//import android.content.SharedPreferences; +// +//import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService; +//import com.huawei.hms.flutter.push.utils.ApplicationUtils; +//import com.huawei.hms.push.RemoteMessage; +// +//import org.json.JSONObject; +// +//public class CustomFlutterHmsMessageService extends FlutterHmsMessageService { +// @Override +// public void onMessageReceived(RemoteMessage remoteMessage) { +// super.onMessageReceived(remoteMessage); +// try { +// String jsonStr = remoteMessage.getData(); +// JSONObject json_data = new JSONObject(jsonStr); +// JSONObject json_data_data = new JSONObject(json_data.getString("data")); +// if(json_data_data.getString("is_call").equalsIgnoreCase("true")){ +// boolean isApplicationInForeground = ApplicationUtils.isApplicationInForeground(this); +// if(!isApplicationInForeground){ +// SharedPreferences preferences = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE); +// preferences.edit().putString("flutter.call_data", json_data.getString("data")).apply(); +// +// Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); +// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); +// startActivity(intent); +// Log.v("onMessageReceived", "startActivity(intent) called"); +// } +// } +// +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} 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 003b9e24..be127a54 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 @@ -1,6 +1,14 @@ package com.ejada.hmg.utils import android.content.Context +import android.content.Intent +import android.content.Intent.getIntent +import android.net.Uri +import android.os.Build +import android.os.Bundle +import android.provider.Settings +import android.widget.Toast +import androidx.core.app.ActivityCompat.startActivityForResult import android.net.wifi.WifiManager import android.util.Log import com.ejada.hmg.MainActivity @@ -24,48 +32,56 @@ class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainA private const val ENABLE_WIFI_IF_NOT = "enableWifiIfNot" private const val REGISTER_HMG_GEOFENCES = "registerHmgGeofences" private const val UN_REGISTER_HMG_GEOFENCES = "unRegisterHmgGeofences" + private const val IS_DRAW_OVER_APPS_PERMISSION_ALLOWED = "isDrawOverAppsPermissionAllowed" + private const val ASK_DRAW_OVER_APPS_PERMISSION = "askDrawOverAppsPermission" + private const val GET_INTENT = "getIntent" } - fun create(){ + fun create() { channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) HMGUtils.setPlatformChannel(channel) channel.setMethodCallHandler { methodCall: MethodCall, result: MethodChannel.Result -> if (methodCall.method == HMG_INTERNET_WIFI_CONNECT_METHOD) { - connectHMGInternetWifi(methodCall,result) - - }else if (methodCall.method == HMG_GUEST_WIFI_CONNECT_METHOD) { - connectHMGGuestWifi(methodCall,result) - - }else if (methodCall.method == ENABLE_WIFI_IF_NOT) { - enableWifiIfNot(methodCall,result) - }else if (methodCall.method == REGISTER_HMG_GEOFENCES) { - registerHmgGeofences(methodCall,result) - }else if (methodCall.method == UN_REGISTER_HMG_GEOFENCES) { - unRegisterHmgGeofences(methodCall,result) - }else{ - + connectHMGInternetWifi(methodCall, result) + + } else if (methodCall.method == HMG_GUEST_WIFI_CONNECT_METHOD) { + connectHMGGuestWifi(methodCall, result) + + } else if (methodCall.method == ENABLE_WIFI_IF_NOT) { + enableWifiIfNot(methodCall, result) + } else if (methodCall.method == REGISTER_HMG_GEOFENCES) { + registerHmgGeofences(methodCall, result) + } else if (methodCall.method == UN_REGISTER_HMG_GEOFENCES) { + unRegisterHmgGeofences(methodCall, result) + } else if (methodCall.method == IS_DRAW_OVER_APPS_PERMISSION_ALLOWED) { + isDrawOverAppsPermissionAllowed(methodCall, result) + } else if (methodCall.method == ASK_DRAW_OVER_APPS_PERMISSION) { + askDrawOverAppsPermission(methodCall, result) + } else if (methodCall.method == GET_INTENT) { + getIntentData(methodCall, result) + } else { result.notImplemented() } } - val res = channel.invokeMethod("localizedValue","errorConnectingHmgNetwork") + val res = channel.invokeMethod("localizedValue", "errorConnectingHmgNetwork") } - private fun connectHMGInternetWifi(methodCall: MethodCall, result: MethodChannel.Result){ + private fun connectHMGInternetWifi(methodCall: MethodCall, result: MethodChannel.Result) { (methodCall.arguments as ArrayList<*>).let { - require(it.size > 0 && (it[0] is String),lazyMessage = { + require(it.size > 0 && (it[0] is String), lazyMessage = { "Missing or invalid arguments (Must have one argument 'String at 0'" }) val patientId = it[0].toString() HMG_Internet(mainActivity) - .connectToHMGGuestNetwork(patientId){ status, message -> + .connectToHMGGuestNetwork(patientId) { status, message -> mainActivity.runOnUiThread { - result.success(if(status) 1 else 0) + result.success(if (status) 1 else 0) HMGUtils.popFlutterText(mainActivity, message) Log.v(this.javaClass.simpleName, "$status | $message") @@ -76,10 +92,10 @@ class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainA } - private fun connectHMGGuestWifi(methodCall: MethodCall, result: MethodChannel.Result){ + private fun connectHMGGuestWifi(methodCall: MethodCall, result: MethodChannel.Result) { HMG_Guest(mainActivity).connectToHMGGuestNetwork { status, message -> mainActivity.runOnUiThread { - result.success(if(status) 1 else 0) + result.success(if (status) 1 else 0) HMGUtils.popFlutterText(mainActivity, message) Log.v(this.javaClass.simpleName, "$status | $message") @@ -89,38 +105,76 @@ class PlatformBridge(private var flutterEngine: FlutterEngine, private var mainA private fun enableWifiIfNot(methodCall: MethodCall, result: MethodChannel.Result) { val wm = mainActivity.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager? - if (wm != null){ + if (wm != null) { if (!wm.isWifiEnabled) wm.isWifiEnabled = true result.success(true) - }else - result.error("101","Error while opening wifi, Please try to open wifi yourself and try again","'WifiManager' service failed"); + } else + result.error("101", "Error while opening wifi, Please try to open wifi yourself and try again", "'WifiManager' service failed"); } private fun registerHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { - channel.invokeMethod("getGeoZones",null, object : MethodChannel.Result{ + channel.invokeMethod("getGeoZones", null, object : MethodChannel.Result { override fun success(result: Any?) { - if(result is String) { + if (result is String) { val geoZones = GeoZoneModel().listFrom(result) - HMG_Geofence.shared(mainActivity).register(){ s, e -> } + HMG_Geofence.shared(mainActivity).register() { s, e -> } } } - override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) { } - override fun notImplemented() { } + override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) {} + override fun notImplemented() {} }) } - + private fun unRegisterHmgGeofences(methodCall: MethodCall, result: MethodChannel.Result) { HMG_Geofence.shared(mainActivity).unRegisterAll { status, exception -> - if(status) + if (status) result.success(true) else result.error("101", exception?.localizedMessage, exception); } } - + + private fun isDrawOverAppsPermissionAllowed(methodCall: MethodCall, result: MethodChannel.Result) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if ( + Settings.canDrawOverlays(mainActivity) + ) { + result.success(true) + } else { + result.success(false) + } + } else { + result.success(false) + } + } + + private fun askDrawOverAppsPermission(methodCall: MethodCall, result: MethodChannel.Result) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION) + val uri = Uri.parse("package:" + mainActivity.getPackageName()) + intent.setData(uri) + startActivityForResult(mainActivity, intent, 102, null) + result.success(true) + } else { + result.success(false) + } + } + + private fun getIntentData(methodCall: MethodCall, result: MethodChannel.Result) { + + val bundle: Bundle? = getIntent("").extras + if (bundle != null) { + val message = bundle.getString("notification") // 1 + System.out.println("BundleExtra:" + message) + Toast.makeText(this.mainActivity, message + "", Toast.LENGTH_SHORT).show() + } else { + Toast.makeText(this.mainActivity, "Bundle Null", Toast.LENGTH_SHORT).show(); + } + result.success(true); + } } diff --git a/android/build.gradle b/android/build.gradle index ecb1ed70..e4985a55 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.0' repositories { google() jcenter() @@ -11,10 +11,11 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.4' + classpath 'com.android.tools.build:gradle:7.0.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.8' - classpath 'com.huawei.agconnect:agcp:1.4.2.301' + classpath 'com.huawei.agconnect:agcp:1.5.2.300' + classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12' } } @@ -26,7 +27,7 @@ allprojects { maven { url 'https://developer.huawei.com/repo/' } - maven{ + maven { url "https://artifactory.ess-dev.com/artifactory/gradle-dev-local" } } diff --git a/android/gradle.properties b/android/gradle.properties index a5965ab8..c5ccb9b6 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx2048m android.enableR8=true android.useAndroidX=true android.enableJetifier=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6fdb0e44..6e8ae021 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip diff --git a/assets/images/new/add_to_cart.svg b/assets/images/new/add_to_cart.svg new file mode 100644 index 00000000..f01f6033 --- /dev/null +++ b/assets/images/new/add_to_cart.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/new/body_parts/female/abdomin.png b/assets/images/new/body_parts/female/abdomin.png new file mode 100644 index 00000000..f4918d71 Binary files /dev/null and b/assets/images/new/body_parts/female/abdomin.png differ diff --git a/assets/images/new/body_parts/female/abdomin.svg b/assets/images/new/body_parts/female/abdomin.svg deleted file mode 100644 index cc1dd1d0..00000000 --- a/assets/images/new/body_parts/female/abdomin.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/anal.png b/assets/images/new/body_parts/female/anal.png new file mode 100644 index 00000000..d96ef288 Binary files /dev/null and b/assets/images/new/body_parts/female/anal.png differ diff --git a/assets/images/new/body_parts/female/anal.svg b/assets/images/new/body_parts/female/anal.svg deleted file mode 100644 index 96c9734d..00000000 --- a/assets/images/new/body_parts/female/anal.svg +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/axilla.png b/assets/images/new/body_parts/female/axilla.png new file mode 100644 index 00000000..f38be6b3 Binary files /dev/null and b/assets/images/new/body_parts/female/axilla.png differ diff --git a/assets/images/new/body_parts/female/axilla.svg b/assets/images/new/body_parts/female/axilla.svg deleted file mode 100644 index 257b1c08..00000000 --- a/assets/images/new/body_parts/female/axilla.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/back.png b/assets/images/new/body_parts/female/back.png new file mode 100644 index 00000000..65d9ef19 Binary files /dev/null and b/assets/images/new/body_parts/female/back.png differ diff --git a/assets/images/new/body_parts/female/back.svg b/assets/images/new/body_parts/female/back.svg deleted file mode 100644 index 96eba049..00000000 --- a/assets/images/new/body_parts/female/back.svg +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/bikini.png b/assets/images/new/body_parts/female/bikini.png new file mode 100644 index 00000000..a1a68423 Binary files /dev/null and b/assets/images/new/body_parts/female/bikini.png differ diff --git a/assets/images/new/body_parts/female/bikini.svg b/assets/images/new/body_parts/female/bikini.svg deleted file mode 100644 index 24892c80..00000000 --- a/assets/images/new/body_parts/female/bikini.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/bikini_line.png b/assets/images/new/body_parts/female/bikini_line.png new file mode 100644 index 00000000..12fc0e6e Binary files /dev/null and b/assets/images/new/body_parts/female/bikini_line.png differ diff --git a/assets/images/new/body_parts/female/bikini_line.svg b/assets/images/new/body_parts/female/bikini_line.svg deleted file mode 100644 index f1f94b7f..00000000 --- a/assets/images/new/body_parts/female/bikini_line.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/buttocks.png b/assets/images/new/body_parts/female/buttocks.png new file mode 100644 index 00000000..b83576f3 Binary files /dev/null and b/assets/images/new/body_parts/female/buttocks.png differ diff --git a/assets/images/new/body_parts/female/buttocks.svg b/assets/images/new/body_parts/female/buttocks.svg deleted file mode 100644 index 59cd0071..00000000 --- a/assets/images/new/body_parts/female/buttocks.svg +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/chest.png b/assets/images/new/body_parts/female/chest.png new file mode 100644 index 00000000..727ebe7a Binary files /dev/null and b/assets/images/new/body_parts/female/chest.png differ diff --git a/assets/images/new/body_parts/female/chest.svg b/assets/images/new/body_parts/female/chest.svg deleted file mode 100644 index 3b681f90..00000000 --- a/assets/images/new/body_parts/female/chest.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/chest_line.png b/assets/images/new/body_parts/female/chest_line.png new file mode 100644 index 00000000..0b4fecb8 Binary files /dev/null and b/assets/images/new/body_parts/female/chest_line.png differ diff --git a/assets/images/new/body_parts/female/chest_line.svg b/assets/images/new/body_parts/female/chest_line.svg deleted file mode 100644 index dc4f8b25..00000000 --- a/assets/images/new/body_parts/female/chest_line.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/full_leg.svg b/assets/images/new/body_parts/female/full_leg.svg deleted file mode 100644 index e1a5e46d..00000000 --- a/assets/images/new/body_parts/female/full_leg.svg +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/full_legs.png b/assets/images/new/body_parts/female/full_legs.png new file mode 100644 index 00000000..5a365a7e Binary files /dev/null and b/assets/images/new/body_parts/female/full_legs.png differ diff --git a/assets/images/new/body_parts/female/lower_arm.png b/assets/images/new/body_parts/female/lower_arm.png new file mode 100644 index 00000000..717b2cde Binary files /dev/null and b/assets/images/new/body_parts/female/lower_arm.png differ diff --git a/assets/images/new/body_parts/female/lower_arm.svg b/assets/images/new/body_parts/female/lower_arm.svg deleted file mode 100644 index 6d5d2f39..00000000 --- a/assets/images/new/body_parts/female/lower_arm.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/lower_leg.png b/assets/images/new/body_parts/female/lower_leg.png new file mode 100644 index 00000000..88ccacef Binary files /dev/null and b/assets/images/new/body_parts/female/lower_leg.png differ diff --git a/assets/images/new/body_parts/female/lower_leg.svg b/assets/images/new/body_parts/female/lower_leg.svg deleted file mode 100644 index 4961af4b..00000000 --- a/assets/images/new/body_parts/female/lower_leg.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/shoulder.svg b/assets/images/new/body_parts/female/shoulder.svg deleted file mode 100644 index ce611e29..00000000 --- a/assets/images/new/body_parts/female/shoulder.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/shoulders.png b/assets/images/new/body_parts/female/shoulders.png new file mode 100644 index 00000000..e1f253a8 Binary files /dev/null and b/assets/images/new/body_parts/female/shoulders.png differ diff --git a/assets/images/new/body_parts/female/upper_arm.png b/assets/images/new/body_parts/female/upper_arm.png new file mode 100644 index 00000000..1edb873c Binary files /dev/null and b/assets/images/new/body_parts/female/upper_arm.png differ diff --git a/assets/images/new/body_parts/female/upper_arm.svg b/assets/images/new/body_parts/female/upper_arm.svg deleted file mode 100644 index ec126ffd..00000000 --- a/assets/images/new/body_parts/female/upper_arm.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/upper_leg.svg b/assets/images/new/body_parts/female/upper_leg.svg deleted file mode 100644 index b1fd3a95..00000000 --- a/assets/images/new/body_parts/female/upper_leg.svg +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/female/upper_legs.png b/assets/images/new/body_parts/female/upper_legs.png new file mode 100644 index 00000000..a8aa2ec7 Binary files /dev/null and b/assets/images/new/body_parts/female/upper_legs.png differ diff --git a/assets/images/new/body_parts/male/abdomin.png b/assets/images/new/body_parts/male/abdomin.png new file mode 100644 index 00000000..1b180b42 Binary files /dev/null and b/assets/images/new/body_parts/male/abdomin.png differ diff --git a/assets/images/new/body_parts/male/abdomin.svg b/assets/images/new/body_parts/male/abdomin.svg deleted file mode 100644 index 82e2d556..00000000 --- a/assets/images/new/body_parts/male/abdomin.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/axilla.png b/assets/images/new/body_parts/male/axilla.png new file mode 100644 index 00000000..61af9492 Binary files /dev/null and b/assets/images/new/body_parts/male/axilla.png differ diff --git a/assets/images/new/body_parts/male/axilla.svg b/assets/images/new/body_parts/male/axilla.svg deleted file mode 100644 index 85abbfda..00000000 --- a/assets/images/new/body_parts/male/axilla.svg +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/bikini.png b/assets/images/new/body_parts/male/bikini.png new file mode 100644 index 00000000..aa98ea74 Binary files /dev/null and b/assets/images/new/body_parts/male/bikini.png differ diff --git a/assets/images/new/body_parts/male/bikini.svg b/assets/images/new/body_parts/male/bikini.svg deleted file mode 100644 index 1c545916..00000000 --- a/assets/images/new/body_parts/male/bikini.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/bikini_line.png b/assets/images/new/body_parts/male/bikini_line.png new file mode 100644 index 00000000..60ed64e2 Binary files /dev/null and b/assets/images/new/body_parts/male/bikini_line.png differ diff --git a/assets/images/new/body_parts/male/bikini_line.svg b/assets/images/new/body_parts/male/bikini_line.svg deleted file mode 100644 index 7fdc51d1..00000000 --- a/assets/images/new/body_parts/male/bikini_line.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/chest.png b/assets/images/new/body_parts/male/chest.png new file mode 100644 index 00000000..b7cec070 Binary files /dev/null and b/assets/images/new/body_parts/male/chest.png differ diff --git a/assets/images/new/body_parts/male/chest.svg b/assets/images/new/body_parts/male/chest.svg deleted file mode 100644 index 85a761fe..00000000 --- a/assets/images/new/body_parts/male/chest.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/chest_line.png b/assets/images/new/body_parts/male/chest_line.png new file mode 100644 index 00000000..41e779f3 Binary files /dev/null and b/assets/images/new/body_parts/male/chest_line.png differ diff --git a/assets/images/new/body_parts/male/chest_line.svg b/assets/images/new/body_parts/male/chest_line.svg deleted file mode 100644 index 806ddb0c..00000000 --- a/assets/images/new/body_parts/male/chest_line.svg +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/full_leg.svg b/assets/images/new/body_parts/male/full_leg.svg deleted file mode 100644 index b5755167..00000000 --- a/assets/images/new/body_parts/male/full_leg.svg +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/full_legs.png b/assets/images/new/body_parts/male/full_legs.png new file mode 100644 index 00000000..eee2fa07 Binary files /dev/null and b/assets/images/new/body_parts/male/full_legs.png differ diff --git a/assets/images/new/body_parts/male/full_neck.png b/assets/images/new/body_parts/male/full_neck.png new file mode 100644 index 00000000..a75159f6 Binary files /dev/null and b/assets/images/new/body_parts/male/full_neck.png differ diff --git a/assets/images/new/body_parts/male/full_neck.svg b/assets/images/new/body_parts/male/full_neck.svg deleted file mode 100644 index 43183598..00000000 --- a/assets/images/new/body_parts/male/full_neck.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/half_neck.png b/assets/images/new/body_parts/male/half_neck.png new file mode 100644 index 00000000..5ee0249c Binary files /dev/null and b/assets/images/new/body_parts/male/half_neck.png differ diff --git a/assets/images/new/body_parts/male/half_neck.svg b/assets/images/new/body_parts/male/half_neck.svg deleted file mode 100644 index 4e57b51c..00000000 --- a/assets/images/new/body_parts/male/half_neck.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/lower_arm.png b/assets/images/new/body_parts/male/lower_arm.png new file mode 100644 index 00000000..120242ed Binary files /dev/null and b/assets/images/new/body_parts/male/lower_arm.png differ diff --git a/assets/images/new/body_parts/male/lower_arm.svg b/assets/images/new/body_parts/male/lower_arm.svg deleted file mode 100644 index c8dbf48d..00000000 --- a/assets/images/new/body_parts/male/lower_arm.svg +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/lower_leg.svg b/assets/images/new/body_parts/male/lower_leg.svg deleted file mode 100644 index 091c29a4..00000000 --- a/assets/images/new/body_parts/male/lower_leg.svg +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/lower_legs.png b/assets/images/new/body_parts/male/lower_legs.png new file mode 100644 index 00000000..8367aa8c Binary files /dev/null and b/assets/images/new/body_parts/male/lower_legs.png differ diff --git a/assets/images/new/body_parts/male/shoulders.png b/assets/images/new/body_parts/male/shoulders.png new file mode 100644 index 00000000..907f2dd7 Binary files /dev/null and b/assets/images/new/body_parts/male/shoulders.png differ diff --git a/assets/images/new/body_parts/male/shoulders.svg b/assets/images/new/body_parts/male/shoulders.svg deleted file mode 100644 index bd6cac52..00000000 --- a/assets/images/new/body_parts/male/shoulders.svg +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/upper_arm.png b/assets/images/new/body_parts/male/upper_arm.png new file mode 100644 index 00000000..f80a75da Binary files /dev/null and b/assets/images/new/body_parts/male/upper_arm.png differ diff --git a/assets/images/new/body_parts/male/upper_arm.svg b/assets/images/new/body_parts/male/upper_arm.svg deleted file mode 100644 index 7d959a0d..00000000 --- a/assets/images/new/body_parts/male/upper_arm.svg +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/upper_leg.svg b/assets/images/new/body_parts/male/upper_leg.svg deleted file mode 100644 index 342cfd84..00000000 --- a/assets/images/new/body_parts/male/upper_leg.svg +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/images/new/body_parts/male/upper_legs.png b/assets/images/new/body_parts/male/upper_legs.png new file mode 100644 index 00000000..e0c973b7 Binary files /dev/null and b/assets/images/new/body_parts/male/upper_legs.png differ diff --git a/assets/images/new/cart.svg b/assets/images/new/cart.svg new file mode 100644 index 00000000..334b86ba --- /dev/null +++ b/assets/images/new/cart.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/new/logo.png b/assets/images/new/logo.png new file mode 100644 index 00000000..29719b35 Binary files /dev/null and b/assets/images/new/logo.png differ diff --git a/assets/images/pharmacy/call.svg b/assets/images/pharmacy/call.svg new file mode 100644 index 00000000..677d4123 --- /dev/null +++ b/assets/images/pharmacy/call.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/pharmacy/instagram.png b/assets/images/pharmacy/instagram.png new file mode 100644 index 00000000..a03f47bd Binary files /dev/null and b/assets/images/pharmacy/instagram.png differ diff --git a/assets/images/pharmacy/location.svg b/assets/images/pharmacy/location.svg new file mode 100644 index 00000000..a52cc72e --- /dev/null +++ b/assets/images/pharmacy/location.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy/whatsapp.svg b/assets/images/pharmacy/whatsapp.svg new file mode 100644 index 00000000..ee18370c --- /dev/null +++ b/assets/images/pharmacy/whatsapp.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/pharmacy_module/lakum/akum_transfer.png b/assets/images/pharmacy_module/lakum/akum_transfer.png new file mode 100644 index 00000000..30785b08 Binary files /dev/null and b/assets/images/pharmacy_module/lakum/akum_transfer.png differ diff --git a/assets/images/pharmacy_module/payment/applePay.png b/assets/images/pharmacy_module/payment/applePay.png new file mode 100644 index 00000000..fd167e1c Binary files /dev/null and b/assets/images/pharmacy_module/payment/applePay.png differ diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index 53427e0c..b3315e38 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -3f8c659591fcdd0e47e3895f74af395c \ No newline at end of file +8d8845c5c035b7f87f2849054cdedb69 \ No newline at end of file diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f78..cb6be309 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 diff --git a/ios/Podfile b/ios/Podfile index 46c98373..1e8c3c90 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,9 +1,8 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '10.0' +# platform :ios, '9.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' -$FirebaseAnalyticsWithoutAdIdSupport = true project 'Runner', { 'Debug' => :debug, @@ -11,86 +10,32 @@ project 'Runner', { 'Release' => :release, } -# pod 'FBSDKCoreKit' -# pod 'FBSDKLoginKit' - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - generated_key_values + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + target 'Runner' do use_frameworks! use_modular_headers! - # Native Pods - pod 'NVActivityIndicatorView' - pod 'OpenTok' - - - # Flutter Pod - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end - diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 565b2db9..169a7b58 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,246 +1,16 @@ PODS: - - abseil/algorithm (0.20200225.0): - - abseil/algorithm/algorithm (= 0.20200225.0) - - abseil/algorithm/container (= 0.20200225.0) - - abseil/algorithm/algorithm (0.20200225.0): - - abseil/base/config - - abseil/algorithm/container (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/base (0.20200225.0): - - abseil/base/atomic_hook (= 0.20200225.0) - - abseil/base/base (= 0.20200225.0) - - abseil/base/base_internal (= 0.20200225.0) - - abseil/base/bits (= 0.20200225.0) - - abseil/base/config (= 0.20200225.0) - - abseil/base/core_headers (= 0.20200225.0) - - abseil/base/dynamic_annotations (= 0.20200225.0) - - abseil/base/endian (= 0.20200225.0) - - abseil/base/errno_saver (= 0.20200225.0) - - abseil/base/exponential_biased (= 0.20200225.0) - - abseil/base/log_severity (= 0.20200225.0) - - abseil/base/malloc_internal (= 0.20200225.0) - - abseil/base/periodic_sampler (= 0.20200225.0) - - abseil/base/pretty_function (= 0.20200225.0) - - abseil/base/raw_logging_internal (= 0.20200225.0) - - abseil/base/spinlock_wait (= 0.20200225.0) - - abseil/base/throw_delegate (= 0.20200225.0) - - abseil/base/atomic_hook (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/base (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/log_severity - - abseil/base/raw_logging_internal - - abseil/base/spinlock_wait - - abseil/meta/type_traits - - abseil/base/base_internal (0.20200225.0): - - abseil/base/config - - abseil/meta/type_traits - - abseil/base/bits (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/config (0.20200225.0) - - abseil/base/core_headers (0.20200225.0): - - abseil/base/config - - abseil/base/dynamic_annotations (0.20200225.0) - - abseil/base/endian (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/errno_saver (0.20200225.0): - - abseil/base/config - - abseil/base/exponential_biased (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/malloc_internal (0.20200225.0): - - abseil/base/base - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/raw_logging_internal - - abseil/base/periodic_sampler (0.20200225.0): - - abseil/base/core_headers - - abseil/base/exponential_biased - - abseil/base/pretty_function (0.20200225.0) - - abseil/base/raw_logging_internal (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity - - abseil/base/spinlock_wait (0.20200225.0): - - abseil/base/base_internal - - abseil/base/core_headers - - abseil/base/errno_saver - - abseil/base/throw_delegate (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/container/compressed_tuple (0.20200225.0): - - abseil/utility/utility - - abseil/container/inlined_vector (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/container/inlined_vector_internal - - abseil/memory/memory - - abseil/container/inlined_vector_internal (0.20200225.0): - - abseil/base/core_headers - - abseil/container/compressed_tuple - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/span - - abseil/memory (0.20200225.0): - - abseil/memory/memory (= 0.20200225.0) - - abseil/memory/memory (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/meta (0.20200225.0): - - abseil/meta/type_traits (= 0.20200225.0) - - abseil/meta/type_traits (0.20200225.0): - - abseil/base/config - - abseil/numeric/int128 (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/strings/internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/meta/type_traits - - abseil/strings/str_format (0.20200225.0): - - abseil/strings/str_format_internal - - abseil/strings/str_format_internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/types/span - - abseil/strings/strings (0.20200225.0): - - abseil/base/base - - abseil/base/bits - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/base/throw_delegate - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/internal - - abseil/time (0.20200225.0): - - abseil/time/internal (= 0.20200225.0) - - abseil/time/time (= 0.20200225.0) - - abseil/time/internal (0.20200225.0): - - abseil/time/internal/cctz (= 0.20200225.0) - - abseil/time/internal/cctz (0.20200225.0): - - abseil/time/internal/cctz/civil_time (= 0.20200225.0) - - abseil/time/internal/cctz/time_zone (= 0.20200225.0) - - abseil/time/internal/cctz/civil_time (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/time_zone (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/civil_time - - abseil/time/time (0.20200225.0): - - abseil/base/base - - abseil/base/core_headers - - abseil/base/raw_logging_internal - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/time/internal/cctz/civil_time - - abseil/time/internal/cctz/time_zone - - abseil/types (0.20200225.0): - - abseil/types/any (= 0.20200225.0) - - abseil/types/bad_any_cast (= 0.20200225.0) - - abseil/types/bad_any_cast_impl (= 0.20200225.0) - - abseil/types/bad_optional_access (= 0.20200225.0) - - abseil/types/bad_variant_access (= 0.20200225.0) - - abseil/types/compare (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - abseil/types/span (= 0.20200225.0) - - abseil/types/variant (= 0.20200225.0) - - abseil/types/any (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_any_cast - - abseil/utility/utility - - abseil/types/bad_any_cast (0.20200225.0): - - abseil/base/config - - abseil/types/bad_any_cast_impl - - abseil/types/bad_any_cast_impl (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_optional_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_variant_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/compare (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/optional (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/bad_optional_access - - abseil/utility/utility - - abseil/types/span (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/meta/type_traits - - abseil/types/variant (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_variant_access - - abseil/utility/utility - - abseil/utility/utility (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/meta/type_traits - - android_intent (0.0.1): + - audio_session (0.0.1): - Flutter - barcode_scan_fix (0.0.1): - Flutter - MTBBarcodeScanner - - BoringSSL-GRPC (0.0.7): - - BoringSSL-GRPC/Implementation (= 0.0.7) - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Implementation (0.0.7): - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Interface (0.0.7) - - cloud_firestore (0.14.4): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Firestore (~> 6.33.0) - - firebase_core - - Flutter - - cloud_firestore_web (0.1.0): + - camera (0.0.1): - Flutter - connectivity (0.0.1): - Flutter - Reachability - - connectivity_for_web (0.1.0): - - Flutter - - connectivity_macos (0.0.1): - - Flutter - device_calendar (0.0.1): - Flutter - - device_info (0.0.1): - - Flutter - DKImagePickerController/Core (4.3.2): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource @@ -275,188 +45,152 @@ PODS: - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter - - file_picker_web (0.0.1): - - Flutter - - Firebase/Analytics (6.33.0): + - Firebase/Analytics (8.9.0): - Firebase/Core - - Firebase/Core (6.33.0): + - Firebase/Core (8.9.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 6.8.3) - - Firebase/CoreOnly (6.33.0): - - FirebaseCore (= 6.10.3) - - Firebase/Firestore (6.33.0): + - FirebaseAnalytics (~> 8.9.0) + - Firebase/CoreOnly (8.9.0): + - FirebaseCore (= 8.9.0) + - Firebase/Messaging (8.9.0): - Firebase/CoreOnly - - FirebaseFirestore (~> 1.18.0) - - Firebase/Messaging (6.33.0): - - Firebase/CoreOnly - - FirebaseMessaging (~> 4.7.0) - - firebase_analytics (6.3.0): - - Firebase/Analytics (~> 6.33.0) - - Firebase/CoreOnly (~> 6.33.0) + - FirebaseMessaging (~> 8.9.0) + - firebase_analytics (8.3.4): + - Firebase/Analytics (= 8.9.0) - firebase_core - Flutter - - firebase_analytics_web (0.1.0): - - Flutter - - firebase_core (0.5.3): - - Firebase/CoreOnly (~> 6.33.0) + - firebase_core (1.10.0): + - Firebase/CoreOnly (= 8.9.0) - Flutter - - firebase_core_web (0.1.0): - - Flutter - - firebase_messaging (7.0.3): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Messaging (~> 6.33.0) + - firebase_messaging (11.1.0): + - Firebase/Messaging (= 8.9.0) - firebase_core - Flutter - - FirebaseAnalytics (6.8.3): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleAppMeasurement (= 6.8.3) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - - FirebaseCore (6.10.3): - - FirebaseCoreDiagnostics (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - FirebaseCoreDiagnostics (1.7.0): - - GoogleDataTransport (~> 7.4) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - nanopb (~> 1.30906.0) - - FirebaseFirestore (1.18.0): - - abseil/algorithm (= 0.20200225.0) - - abseil/base (= 0.20200225.0) - - abseil/memory (= 0.20200225.0) - - abseil/meta (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/time (= 0.20200225.0) - - abseil/types (= 0.20200225.0) - - FirebaseCore (~> 6.10) - - "gRPC-C++ (~> 1.28.0)" - - leveldb-library (~> 1.22) - - nanopb (~> 1.30906.0) - - FirebaseInstallations (1.7.0): - - FirebaseCore (~> 6.10) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.8.0): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - FirebaseMessaging (4.7.1): - - FirebaseCore (~> 6.10) - - FirebaseInstanceID (~> 4.7) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Reachability (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - Protobuf (>= 3.9.2, ~> 3.9) - - Flutter (1.0.0) - - flutter_email_sender (0.0.1): + - FirebaseAnalytics (8.9.1): + - FirebaseAnalytics/AdIdSupport (= 8.9.1) + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - FirebaseAnalytics/AdIdSupport (8.9.1): + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleAppMeasurement (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - FirebaseCore (8.9.0): + - FirebaseCoreDiagnostics (~> 8.0) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Logger (~> 7.6) + - FirebaseCoreDiagnostics (8.10.0): + - GoogleDataTransport (~> 9.1) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Logger (~> 7.6) + - nanopb (~> 2.30908.0) + - FirebaseInstallations (8.10.0): + - FirebaseCore (~> 8.0) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/UserDefaults (~> 7.6) + - PromisesObjC (< 3.0, >= 1.2) + - FirebaseMessaging (8.9.0): + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleDataTransport (~> 9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Reachability (~> 7.6) + - GoogleUtilities/UserDefaults (~> 7.6) + - nanopb (~> 2.30908.0) + - fit_kit (0.0.1): - Flutter + - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter - flutter_hms_gms_availability (0.0.1): - Flutter - flutter_inappwebview (0.0.1): - Flutter - - flutter_local_notifications (0.0.1): + - flutter_inappwebview/Core (= 0.0.1) + - OrderedSet (~> 5.0) + - flutter_inappwebview/Core (0.0.1): - Flutter - - flutter_plugin_android_lifecycle (0.0.1): + - OrderedSet (~> 5.0) + - flutter_local_notifications (0.0.1): - Flutter - flutter_tts (0.0.1): - Flutter - - flutter_webrtc (0.2.2): + - flutter_webrtc (0.7.1): - Flutter - - GoogleWebRTC (= 1.1.31999) - Libyuv (= 1703) + - WebRTC-SDK (= 92.4515.11) - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - geolocator (6.2.0): + - geolocator_apple (1.2.0): - Flutter - google_maps_flutter (0.0.1): - Flutter - - GoogleMaps (< 3.10) - - GoogleAppMeasurement (6.8.3): - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - - GoogleDataTransport (7.5.1): - - nanopb (~> 1.30906.0) - - GoogleMaps (3.9.0): - - GoogleMaps/Maps (= 3.9.0) - - GoogleMaps/Base (3.9.0) - - GoogleMaps/Maps (3.9.0): + - GoogleMaps + - GoogleAppMeasurement (8.9.1): + - GoogleAppMeasurement/AdIdSupport (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (8.9.1): + - GoogleAppMeasurement/WithoutAdIdSupport (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (8.9.1): + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleDataTransport (9.1.2): + - GoogleUtilities/Environment (~> 7.2) + - nanopb (~> 2.30908.0) + - PromisesObjC (< 3.0, >= 1.2) + - GoogleMaps (5.2.0): + - GoogleMaps/Maps (= 5.2.0) + - GoogleMaps/Base (5.2.0) + - GoogleMaps/Maps (5.2.0): - GoogleMaps/Base - - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/AppDelegateSwizzler (7.6.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (6.7.2): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment (7.6.0): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.6.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.7.2): + - GoogleUtilities/MethodSwizzler (7.6.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Network (7.6.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.7.2)" - - GoogleUtilities/Reachability (6.7.2): + - "GoogleUtilities/NSData+zlib (7.6.0)" + - GoogleUtilities/Reachability (7.6.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/UserDefaults (7.6.0): - GoogleUtilities/Logger - - GoogleWebRTC (1.1.31999) - - "gRPC-C++ (1.28.2)": - - "gRPC-C++/Implementation (= 1.28.2)" - - "gRPC-C++/Interface (= 1.28.2)" - - "gRPC-C++/Implementation (1.28.2)": - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - "gRPC-C++/Interface (= 1.28.2)" - - gRPC-Core (= 1.28.2) - - "gRPC-C++/Interface (1.28.2)" - - gRPC-Core (1.28.2): - - gRPC-Core/Implementation (= 1.28.2) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Implementation (1.28.2): - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - BoringSSL-GRPC (= 0.0.7) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Interface (1.28.2) - - hexcolor (0.0.1): - - Flutter - - "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 @@ -464,53 +198,35 @@ PODS: - Flutter - manage_calendar_events (0.0.1): - Flutter - - map_launcher (0.0.1): - - Flutter - maps_launcher (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) - - nanopb (1.30906.0): - - nanopb/decode (= 1.30906.0) - - nanopb/encode (= 1.30906.0) - - nanopb/decode (1.30906.0) - - nanopb/encode (1.30906.0) + - nanopb (2.30908.0): + - nanopb/decode (= 2.30908.0) + - nanopb/encode (= 2.30908.0) + - nanopb/decode (2.30908.0) + - nanopb/encode (2.30908.0) - native_device_orientation (0.0.1): - Flutter - nfc_in_flutter (1.0.0): - Flutter - - 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): + - OrderedSet (5.0.0) + - package_info_plus (0.4.5): - Flutter - - path_provider_macos (0.0.1): - - Flutter - - path_provider_windows (0.0.1): + - path_provider_ios (0.0.1): - Flutter - "permission_handler (5.1.0+2)": - Flutter - - PromisesObjC (1.2.11) - - Protobuf (3.13.0) + - PromisesObjC (2.0.0) - Reachability (3.2) - screen (0.0.1): - Flutter - - SDWebImage (5.10.4): - - SDWebImage/Core (= 5.10.4) - - SDWebImage/Core (5.10.4) - - shared_preferences (0.0.1): - - Flutter - - shared_preferences_linux (0.0.1): - - Flutter - - shared_preferences_macos (0.0.1): - - Flutter - - shared_preferences_web (0.0.1): - - Flutter - - shared_preferences_windows (0.0.1): + - SDWebImage (5.12.1): + - SDWebImage/Core (= 5.12.1) + - SDWebImage/Core (5.12.1) + - searchable_dropdown (1.1.1): - Flutter - - sms_otp_auto_verify (0.0.1): + - shared_preferences_ios (0.0.1): - Flutter - speech_to_text (0.0.1): - Flutter @@ -518,185 +234,115 @@ PODS: - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) - - SwiftyGif (5.4.0) - - TOCropViewController (2.5.5) + - SwiftyGif (5.4.1) - Try (2.1.1) - - "twilio_programmable_video (0.6.4+1)": - - Flutter - - TwilioVideo (~> 3.7) - - TwilioVideo (3.8.0) - - url_launcher (0.0.1): - - Flutter - - url_launcher_linux (0.0.1): - - Flutter - - url_launcher_macos (0.0.1): - - Flutter - - url_launcher_web (0.0.1): - - Flutter - - url_launcher_windows (0.0.1): + - url_launcher_ios (0.0.1): - Flutter - vibration (1.7.3): - Flutter - - vibration_web (1.6.2): - - Flutter - video_player (0.0.1): - Flutter - - video_player_web (0.0.1): - - Flutter - wakelock (0.0.1): - Flutter - - webview_flutter (0.0.1): + - WebRTC-SDK (92.4515.11) + - webview_flutter_wkwebview (0.0.1): - Flutter - wifi (0.0.1): - Flutter DEPENDENCIES: - - android_intent (from `.symlinks/plugins/android_intent/ios`) + - audio_session (from `.symlinks/plugins/audio_session/ios`) - barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`) - - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - - cloud_firestore_web (from `.symlinks/plugins/cloud_firestore_web/ios`) + - camera (from `.symlinks/plugins/camera/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_calendar (from `.symlinks/plugins/device_calendar/ios`) - - device_info (from `.symlinks/plugins/device_info/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - - file_picker_web (from `.symlinks/plugins/file_picker_web/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - - firebase_analytics_web (from `.symlinks/plugins/firebase_analytics_web/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) + - fit_kit (from `.symlinks/plugins/fit_kit/ios`) - Flutter (from `Flutter`) - - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - flutter_hms_gms_availability (from `.symlinks/plugins/flutter_hms_gms_availability/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`) - - geolocator (from `.symlinks/plugins/geolocator/ios`) + - geolocator_apple (from `.symlinks/plugins/geolocator_apple/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`) - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) - - map_launcher (from `.symlinks/plugins/map_launcher/ios`) - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - 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`) - - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - screen (from `.symlinks/plugins/screen/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - - sms_otp_auto_verify (from `.symlinks/plugins/sms_otp_auto_verify/ios`) + - searchable_dropdown (from `.symlinks/plugins/searchable_dropdown/ios`) + - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - - twilio_programmable_video (from `.symlinks/plugins/twilio_programmable_video/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - vibration (from `.symlinks/plugins/vibration/ios`) - - vibration_web (from `.symlinks/plugins/vibration_web/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) - - video_player_web (from `.symlinks/plugins/video_player_web/ios`) - wakelock (from `.symlinks/plugins/wakelock/ios`) - - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) - wifi (from `.symlinks/plugins/wifi/ios`) SPEC REPOS: trunk: - - abseil - - BoringSSL-GRPC - DKImagePickerController - DKPhotoGallery - Firebase - FirebaseAnalytics - FirebaseCore - FirebaseCoreDiagnostics - - FirebaseFirestore - FirebaseInstallations - - FirebaseInstanceID - FirebaseMessaging - FMDB - GoogleAppMeasurement - GoogleDataTransport - GoogleMaps - GoogleUtilities - - GoogleWebRTC - - "gRPC-C++" - - gRPC-Core - - leveldb-library - Libyuv - MTBBarcodeScanner - nanopb - - NVActivityIndicatorView - - OpenTok + - OrderedSet - PromisesObjC - - Protobuf - Reachability - SDWebImage - SwiftyGif - - TOCropViewController - Try - - TwilioVideo + - WebRTC-SDK EXTERNAL SOURCES: - android_intent: - :path: ".symlinks/plugins/android_intent/ios" + audio_session: + :path: ".symlinks/plugins/audio_session/ios" barcode_scan_fix: :path: ".symlinks/plugins/barcode_scan_fix/ios" - cloud_firestore: - :path: ".symlinks/plugins/cloud_firestore/ios" - cloud_firestore_web: - :path: ".symlinks/plugins/cloud_firestore_web/ios" + camera: + :path: ".symlinks/plugins/camera/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" - connectivity_for_web: - :path: ".symlinks/plugins/connectivity_for_web/ios" - connectivity_macos: - :path: ".symlinks/plugins/connectivity_macos/ios" device_calendar: :path: ".symlinks/plugins/device_calendar/ios" - device_info: - :path: ".symlinks/plugins/device_info/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" - file_picker_web: - :path: ".symlinks/plugins/file_picker_web/ios" firebase_analytics: :path: ".symlinks/plugins/firebase_analytics/ios" - firebase_analytics_web: - :path: ".symlinks/plugins/firebase_analytics_web/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" - firebase_core_web: - :path: ".symlinks/plugins/firebase_core_web/ios" firebase_messaging: :path: ".symlinks/plugins/firebase_messaging/ios" + fit_kit: + :path: ".symlinks/plugins/fit_kit/ios" Flutter: :path: Flutter - flutter_email_sender: - :path: ".symlinks/plugins/flutter_email_sender/ios" flutter_flexible_toast: :path: ".symlinks/plugins/flutter_flexible_toast/ios" flutter_hms_gms_availability: @@ -705,30 +351,18 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" flutter_tts: :path: ".symlinks/plugins/flutter_tts/ios" flutter_webrtc: :path: ".symlinks/plugins/flutter_webrtc/ios" - geolocator: - :path: ".symlinks/plugins/geolocator/ios" + geolocator_apple: + :path: ".symlinks/plugins/geolocator_apple/ios" google_maps_flutter: :path: ".symlinks/plugins/google_maps_flutter/ios" - hexcolor: - :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: @@ -737,174 +371,108 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/location/ios" manage_calendar_events: :path: ".symlinks/plugins/manage_calendar_events/ios" - map_launcher: - :path: ".symlinks/plugins/map_launcher/ios" maps_launcher: :path: ".symlinks/plugins/maps_launcher/ios" native_device_orientation: :path: ".symlinks/plugins/native_device_orientation/ios" nfc_in_flutter: :path: ".symlinks/plugins/nfc_in_flutter/ios" - path_provider: - :path: ".symlinks/plugins/path_provider/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - path_provider_macos: - :path: ".symlinks/plugins/path_provider_macos/ios" - path_provider_windows: - :path: ".symlinks/plugins/path_provider_windows/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_ios: + :path: ".symlinks/plugins/path_provider_ios/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" screen: :path: ".symlinks/plugins/screen/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" - shared_preferences_linux: - :path: ".symlinks/plugins/shared_preferences_linux/ios" - shared_preferences_macos: - :path: ".symlinks/plugins/shared_preferences_macos/ios" - shared_preferences_web: - :path: ".symlinks/plugins/shared_preferences_web/ios" - shared_preferences_windows: - :path: ".symlinks/plugins/shared_preferences_windows/ios" - sms_otp_auto_verify: - :path: ".symlinks/plugins/sms_otp_auto_verify/ios" + searchable_dropdown: + :path: ".symlinks/plugins/searchable_dropdown/ios" + shared_preferences_ios: + :path: ".symlinks/plugins/shared_preferences_ios/ios" speech_to_text: :path: ".symlinks/plugins/speech_to_text/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" - twilio_programmable_video: - :path: ".symlinks/plugins/twilio_programmable_video/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - url_launcher_linux: - :path: ".symlinks/plugins/url_launcher_linux/ios" - url_launcher_macos: - :path: ".symlinks/plugins/url_launcher_macos/ios" - url_launcher_web: - :path: ".symlinks/plugins/url_launcher_web/ios" - url_launcher_windows: - :path: ".symlinks/plugins/url_launcher_windows/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" vibration: :path: ".symlinks/plugins/vibration/ios" - vibration_web: - :path: ".symlinks/plugins/vibration_web/ios" video_player: :path: ".symlinks/plugins/video_player/ios" - video_player_web: - :path: ".symlinks/plugins/video_player_web/ios" wakelock: :path: ".symlinks/plugins/wakelock/ios" - webview_flutter: - :path: ".symlinks/plugins/webview_flutter/ios" + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" wifi: :path: ".symlinks/plugins/wifi/ios" SPEC CHECKSUMS: - abseil: 6c8eb7892aefa08d929b39f9bb108e5367e3228f - android_intent: 367df2f1277a74e4a90e14a8ab3df3112d087052 + audio_session: 4f3e461722055d21515cf3261b64c973c062f345 barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1 - BoringSSL-GRPC: 8edf627ee524575e2f8d19d56f068b448eea3879 - cloud_firestore: b8c0e15fa49dfff87c2817d288b577e5dca2df13 - cloud_firestore_web: 9ec3dc7f5f98de5129339802d491c1204462bfec + camera: fe33292aff715a981eb34d7ce7b35b54337ff34c connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b - connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_calendar: 23b28a5f1ab3bf77e34542fb1167e1b8b29a98f5 - device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 - file_picker_web: 37b10786e88885124fac99dc899866e78a132ef3 - Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_analytics: 36a619088c46224900829f14f4daa71585693a6f - firebase_analytics_web: 7d539061ea4af07563a0e21044af89cab70efec0 - firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 - firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 - firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 - FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 - FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd - FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseFirestore: adff4877869ca91a11250cc0989a6cd56bad163f - FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 - FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 - FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_email_sender: f787522d0e82f50e5766c1213dbffff22fdcf009 + Firebase: 13d8d96499e2635428d5bf0ec675df21f95d9a95 + firebase_analytics: 7a7528bb2abf4ca22cff7a57bbf909dcab73e13d + firebase_core: f770e033e790657b3505f04be4cb24c482912f11 + firebase_messaging: 0c8d1a1732487db7f332fb65232053e93201e2fb + FirebaseAnalytics: 4ab446ce08a3fe52e8a4303dd997cf26276bf968 + FirebaseCore: 599ee609343eaf4941bd188f85e3aa077ffe325b + FirebaseCoreDiagnostics: 56fb7216d87e0e6ec2feddefa9d8a392fe8b2c18 + FirebaseInstallations: 830327b45345ffc859eaa9c17bcd5ae893fd5425 + FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316 + fit_kit: 7643191161673bcd32863ae3f10baed6ce55c7c0 + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 flutter_hms_gms_availability: babc50b18670e99780270bc18d9b17d0a07cd77e - flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 - flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 + flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d - flutter_webrtc: 39898454258b54ba51996850d5da8d5d53bf1524 + flutter_webrtc: a5a79904f0bca0ea23aff49c51ca765f70a0f703 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - geolocator: f5e3de65e241caba7ce3e8a618803387bda73384 - google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 - GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436 - 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 + geolocator_apple: b741765c55dc21950e3e106e8b3584e55cf81ce5 + google_maps_flutter: abdb8dee6c52d4be36ad131ee6ebfacd14417c5a + GoogleAppMeasurement: 837649ad3987936c232f6717c5680216f6243d24 + GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 + GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 + GoogleUtilities: 684ee790a24f73ebb2d1d966e9711c203f2a4237 + image_picker: 9aa50e1d8cdacdbed739e925b7eea16d014367e6 in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541 - in_app_update: 16e877e205f4360264cb536e3a6481f0d90299e1 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa - leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437 - local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + local_auth: ef62030a2731330b95df7ef1331bd15f6a64b8a6 location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 - map_launcher: e325db1261d029ff33e08e03baccffe09593ffea - maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 + maps_launcher: 2e5b6a2d664ec6c27f82ffa81b74228d770ab203 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc - native_device_orientation: e24d00be281de72996640885d80e706142707660 + nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 + native_device_orientation: 3b4cfc9565a7b879cc4fde282b3e27745e852d0d nfc_in_flutter: c656fbfb1ec5b9d021da87b0c87629d62fd5264d - NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 - OpenTok: 414c2c1dc6486f1897015e4d1703558d5eed48c3 - path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 - path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e + path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 - PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f - Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 + PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 - SDWebImage: c666b97e1fa9c64b4909816a903322018f0a9c84 - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae - sms_otp_auto_verify: 201803ac25e13feedaae96eda8b70b10c55b3338 + SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b + searchable_dropdown: 5058be32fdc5e0481d300ff2087129072e71bd62 + shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32 speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 - SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 - TOCropViewController: da59f531f8ac8a94ef6d6c0fc34009350f9e8bfe + SwiftyGif: 6895c887f5551618a3c5dd3ecb512419105bacca Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 - twilio_programmable_video: ce33772ea8275b413c0ab5c5aa2e35f9da2d4066 - TwilioVideo: c13a51ceca375e91620eb7578d2573c90cf53b46 - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 + url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af vibration: b5a33e764c3f609a975b9dca73dce20fdde627dc - vibration_web: 0ba303d92469ba34d71c612a228b315908d7fcd9 - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 - webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 + video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb + wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f + WebRTC-SDK: 21dbc6028a68f3a89718057a2caa970a4da8ebb7 + webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162 wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: df22e8ed6009dd48559053927dc365d6dad6c11f +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6c02c983..9bf7caa5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -520,7 +520,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -659,7 +659,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -692,7 +692,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.hmg.smartphone; + PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16..919434a6 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 35a3c022..8826bbdd 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -29,12 +29,12 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil 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")) +// 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")) +// OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) } } diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index e83c3bf5..1eb27a20 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,128 +1,128 @@ { - "images":[ - { - "idiom":"iphone", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"iphone", - "size":"20x20", - "scale":"3x", - "filename":"Icon-App-20x20@3x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"3x", - "filename":"Icon-App-29x29@3x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"3x", - "filename":"Icon-App-40x40@3x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"2x", - "filename":"Icon-App-60x60@2x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"3x", - "filename":"Icon-App-60x60@3x.png" - }, - { - "idiom":"iphone", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"1x", - "filename":"Icon-App-20x20@1x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"1x", - "filename":"Icon-App-40x40@1x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"1x", - "filename":"Icon-App-76x76@1x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"83.5x83.5", - "scale":"2x", - "filename":"Icon-App-83.5x83.5@2x.png" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "scale" : "1x", - "filename" : "ItunesArtwork@2x.png" - } - ], - "info":{ - "version":1, - "author":"easyappicon" + "images" : [ + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-60x60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-60x60@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-20x20@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-76x76@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-83.5x83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "icon.jpg", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "76x76" } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } } diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/ios/Runner/Helper/OpenTokPlatformBridge.swift b/ios/Runner/Helper/OpenTokPlatformBridge.swift index 38e826e1..132f1384 100644 --- a/ios/Runner/Helper/OpenTokPlatformBridge.swift +++ b/ios/Runner/Helper/OpenTokPlatformBridge.swift @@ -8,52 +8,51 @@ 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("") - } - } +// 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/Info.plist b/ios/Runner/Info.plist index 72bd4ac9..e13174af 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -15,50 +15,73 @@ CFBundlePackageType APPL CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + MinimumOSVersion + 11.0 + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsArbitraryLoadsForMedia + + NSAllowsArbitraryLoadsInWebContent + + + NSAppleMusicUsageDescription + Required by another plugin, Please let us know if you find this functionality anywhere in the app. + NSBluetoothAlwaysUsageDescription + This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. + NSBluetoothPeripheralUsageDescription + This App requires access to Bluetooth to connect blood pressure & blood sugar devices with the app to analyze the data. NSCalendarsUsageDescription - We need access to record you event in to calender. + This app requires calendar access to set reminders for Virtual & Normal Appointments. NSCameraUsageDescription - Need camera access for uploading images + This app requires camera access to enable virtual consultation between patient & doctor + NSContactsUsageDescription + This app requires contacts access to show incoming virtual consultation request. + NSFaceIDUsageDescription + This app requires Face ID to allow biometric authentication for app login. + NSHealthShareUsageDescription + This App need access to HealthKit to read heart rate & other data from your smart watch. + NSHealthUpdateUsageDescription + This App need access to HealthKit to read heart rate & other data from your smart watch. NSLocationAlwaysAndWhenInUseUsageDescription - This app will use your location to show cool stuffs near you. + This App requires access to your location to show the nearest hospitals & ER Locations from your location. NSLocationAlwaysUsageDescription - This app will use your location to show cool stuffs near you. - NSLocationUsageDescription - Need location access for updating nearby friends + This App requires access to your location to show the nearest hospitals from your location. NSLocationWhenInUseUsageDescription - This app will use your location to show cool stuffs near you. + This App requires access to your location to show the nearest hospitals from your location. NSMicrophoneUsageDescription - Need microphone access for uploading videos + This app requires microphone access to enable virtual consultation between patient & doctor + NSMotionUsageDescription + This app requires motion detection access to function properly. NSPhotoLibraryUsageDescription - Need photo library access for uploading images + This app requires photo library access to select image as document & upload it. + NSRemindersUsageDescription + This app requires calendar access to set reminders for Virtual & Normal Appointments. + NSSpeechRecognitionUsageDescription + This app requires speech recognition access to access voice command features. + NSUserActivityTypes + UIBackgroundModes - fetch + audio location - processing + remote-notification UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main - UIRequiredDeviceCapabilities - - location-services - gps - armv7 - UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad @@ -71,5 +94,13 @@ io.flutter.embedded_views_preview + LSApplicationQueriesSchemes + + comgooglemaps + baidumap + iosamap + + + diff --git a/ios/Runner/OpenTok/OpenTok.swift b/ios/Runner/OpenTok/OpenTok.swift index 9cc0b79a..f91d83d5 100644 --- a/ios/Runner/OpenTok/OpenTok.swift +++ b/ios/Runner/OpenTok/OpenTok.swift @@ -6,7 +6,7 @@ // import Foundation -import OpenTok +//import OpenTok import UIKit enum SdkState: String { @@ -17,163 +17,164 @@ enum SdkState: String { } 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)") - } +// 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/lib/config/config.dart b/lib/config/config.dart index c4fabca6..3ed8d764 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; 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/'; @@ -68,7 +68,9 @@ const GET_DOCTOR_RATING_DETAILS = const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions -const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +// const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; const GET_PRESCRIPTION_REPORT = @@ -255,7 +257,7 @@ const GET_PATIENT_SHARE = //URL to get patient appointment history const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; + "Services/Doctors.svc/REST/PateintHasAppoimentHistory_Async"; const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -546,8 +548,8 @@ const SUBSCRIBE_PRODUCT = "subscribe?"; const GET_ORDER = "orders?"; const GET_ORDER_DETAILS = "orders/"; const ADD_CUSTOMER_ADDRESS = "addcustomeraddress"; -const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress"; -const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress"; +const EDIT_CUSTOMER_ADDRESS = "editcustomeraddress"; +const DELETE_CUSTOMER_ADDRESS = "deletecustomeraddress"; const GET_ADDRESS = "Customers/"; const GET_Cancel_ORDER = "cancelorder/"; const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8"; @@ -570,7 +572,10 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; -const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; + +// const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; const GET_MOST_VIEWED_PRODUCTS = "mostview"; const GET_NEW_PRODUCTS = "newproducts"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 56113044..83fedc90 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -50,7 +50,8 @@ const Map localizedValues = { 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, - 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج'}, + 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج '}, + 'noSearchResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, @@ -171,6 +172,7 @@ const Map localizedValues = { "minute": {"en": "Minutes", "ar": "دقيقة"}, "hour": {"en": "Hour", "ar": "ساعة"}, "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"}, + "reminderCancelSuccess": {"en": "The reminder has been cancelled successfully", "ar": "تم إلغاء التذكير بنجاح"}, "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, @@ -245,6 +247,7 @@ const Map localizedValues = { "companyName": {"en": "Company Name:", "ar": "اسم الشركة: "}, "receiptOn": {"en": "Receipt on:", "ar": "تاريخ الفاتورة: "}, "expiryDate": {"en": "Expiry Date:", "ar": "تاريخ الانتهاء: "}, + "expiryPoints": {"en": "Expired", "ar": " منتهية الصلاحية"}, "expiryOn": {"en": "Expiry on:", "ar": "تاريخ الانتهاء: "}, "procedureName": {"en": "Procedure Name:", "ar": "اسم الاجراء:"}, "procedure": {"en": "Procedure", "ar": "اسم الاجراء:"}, @@ -275,6 +278,8 @@ const Map localizedValues = { "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, + "contactUsLocation": {"en": "P.O.Box: 91877 - Riyadh 11643, King Fahad Road - Olaya - Kingdom of Saudi Arabia", 'ar': 'صندوق بريد: 91877 - الرياض 11643 ، طريق الملك فهد - العليا - المملكة العربية السعودية'}, + "contactUsTime": {"en": "Saturday - Wednesday 8:00 AM - 10 PM, Thursday 8:00 AM- 8:00 PM, Friday 2:00 PM - 8:00 PM", 'ar': " السبت – الأربعاء 08:00 ص – 10:00 م , الخميس 08:00 ص – 08:00 م, الجمعة 02:00 م - 08:00 م"}, "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, @@ -449,6 +454,7 @@ const Map localizedValues = { "Frequency": {"en": "Frequency", "ar": "المعدل"}, "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, + "CancelReminder": {"en": "Cancel Reminder", "ar": "إلغاء تذكير"}, "reminderDes": { "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", "ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" @@ -504,7 +510,11 @@ const Map localizedValues = { "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, "ourLocations": {"en": "Our Locations", "ar": "مواقعنا"}, "edit": {"en": "Edit", "ar": "تعديل"}, + "whatsApp": {"en": "Whats App", "ar": " واتس اب"}, + "phone": {"en": "Phone", "ar": " موبايل"}, "delete": {"en": "Delete", "ar": " حذف"}, + "deleteAddress": {"en": "Are you sure want to delete", "ar": " هل انت متأكد تريد حذف هذا العنوان"}, + "deletedAddres": {"en": "Address has been deleted", "ar": " تم حذف العنوان"}, "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, "order": {"en": "My Order", "ar": " طلباتي"}, @@ -553,6 +563,7 @@ const Map localizedValues = { "shipping": {"en": "Shipping", "ar": " الشحن"}, "shipBy": {"en": "SHIP BY:", "ar": "الشحن عن طريق:"}, "lakumPoints": {"en": "Lakum Points", "ar": "نقاط برنامج لكم"}, + "useLakumPoints": {"en": "Use Lakum points", "ar": "استخدم برنامج لكم"}, "use": {"en": "USE", "ar": "استخدم"}, "proceedPay": {"en": "PROCEED TO PAY", "ar": "المتابعة للدفع"}, "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, @@ -798,7 +809,7 @@ const Map localizedValues = { "HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية بناءاً على الطقس الحالي '}, "MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "}, "SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"}, - "ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"}, + "ResendOrder": {"en": "Re-Order & Delivery", "ar": "إعادة طلب و توصيل"}, "Ports": {"en": "Ports", "ar": "المنافذ"}, "Way": {"en": "Way", "ar": "الطريقة"}, "Average": {"en": "Average", "ar": "متوسط"}, @@ -819,7 +830,7 @@ const Map localizedValues = { "body": {"en": "Body Mass", "ar": "كتلة\nالجسم"}, "body_string": {"en": "Body", "ar": "الجسم"}, "face": {"en": "Face", "ar": "وجه"}, - "retouch": {"en": "Retouch", "ar": "تنميق"}, + "retouch": {"en": "Retouch", "ar": "روتوش"}, "bikini": {"en": "Bikini", "ar": "بيكيني"}, "totalMinutes": {"en": "Total Minutes", "ar": "إجمالي الدقائق"}, "feedback": {"en": "Feedback", "ar": "رأيك يهمنا"}, @@ -1078,7 +1089,7 @@ const Map localizedValues = { "removeFromWishlist": {"en": "Remove From Wishlist", "ar": "احذف للمفضلة"}, "noData": {"en": "There is no data", "ar": "لايوجد بيانات"}, "no_data": {"en": "No data", "ar": "لايوجد بيانات"}, - "buyNow": {"en": "buy now", "ar": "إشتري الان"}, + "buyNow": {"en": "Buy Now", "ar": "إشتري الان"}, "quantityShortcut": {"en": "QTY", "ar": "كمية"}, "pharmacyServiceTermsCondition": {"en": "I agree with the terms of service and I adhere to them unconditionally", "ar": " موافق على شروط الخدمة وألتزم بها دون قيد أو شرط"}, "Year": {"en": "YEAR", "ar": "السنة"}, @@ -1352,7 +1363,7 @@ const Map localizedValues = { "en": " This service allows you to activate your LAKUM account after registering completed.", "ar": " تتيح لك هذه الخدمة تفعيل حساب برنامج الولاء لكم بعد اكتمال التسجيل. " }, - "pointsToTransfer": {"en": "Point's to Transfer:", "ar": "النقاط المراد تحويلها:"}, + "pointsToTransfer": {"en": "Points to Transfer:", "ar": "النقاط المراد تحويلها:"}, "enterBeneficiaryAccountNo": {"en": "Enter Beneficiary Account No.", "ar": "أدخل رقم حساب المستفيد"}, "confirm-prescription": {"en": "Are you sure !! you want to send this request", "ar": "تاكيد ارسال الطلب؟"}, "you-already-have-order": {"en": "You already have this order! do you want to view it?", "ar": "لديك هذا الطلب بالفعل! هل تريد مشاهدته؟"}, @@ -1528,6 +1539,7 @@ const Map localizedValues = { "rateDoctorAppo": {"en": "Rate DR & Appointment", "ar": "تقييم الطبيب والموعد"}, "invoice": {"en": "Invoice", "ar": "الفاتورة"}, "requestedDate": {"en": "Req Date", "ar": "التاريخ "}, + "requestedDateLiveCare": {"en": "Requested Date: ", "ar": "التاريخ: "}, "callDuration": {"en": "Call Duration", "ar": "مدة الاتصال"}, "alreadyRated": {"en": "This appointment has been previously evaluated.", "ar": "تم تقييم هذا الموعد مسبقاً"}, "insuranceCompany": {"en": "Insurance Company", "ar": "شركة تأمين"}, @@ -1691,8 +1703,7 @@ const Map localizedValues = { "lowLimits": {"en": "Please check the value you have entered, since the body fat percentage cannot be this low.", "ar": "يرجى التحقق من القيمة التي أدخلتها ، حيث لا يمكن أن تكون نسبة الدهون في الجسم منخفضة."}, "estimates": {"en": "Estimates the total body fat based on\nthe size", "ar": "تقدير إجمالي الدهون في الجسم بناءً على \ n الحجم"}, - - "myCart": {"en": "Cart", "ar": "عربة التسوق"}, + "myCart": {"en": "My Cart", "ar": "عربة التسوق"}, "browseOffers": {"en": "Browse offers by clinic", "ar": "تصفح العروض حسب العيادة"}, "inactiveAct":{"en":"Almost inactive (little or no exercise)","ar":"غير نشط تقريبا (ممارسة الرياضة قليلة أو منعدمة)"}, "light":{"en":"Lightly active (1-3) days per week","ar":"خفيف النشاط (1-3 أيام في الأسبوع)"}, @@ -1721,10 +1732,18 @@ const Map localizedValues = { "dietModerate":{"en":"Moderate Carb","ar":"حمية معتدلة الكربوهيدرات"}, "dietUSDA":{"en":"USDA Guidelines","ar":"ارشادات وزارة الزراعة الأمريكية"}, "dietZone":{"en":"Zone Diet","ar":"حمية زون"}, - "Protein": {"en": "Protein", "ar": "بروتين"}, "Cals": {"en": "Cals", "ar": "كالس"}, "gramsPerDay": {"en": "Grams Per Day", "ar": "غرام في اليوم"}, "gr": {"en": "gr", "ar": "غرام"}, "gramsPerMeal": {"en": "Grams Per Meal", "ar": "عدد الجرامات لكل وجبة"}, + "syncSuccess": {"en": "Data Synced Successfully", "ar": "تمت مزامنة البيانات بنجاح"}, + "points": {"en": "Points", "ar": "نقاط"}, + "availableBalance": {"en": "Available Balance", "ar": "الرصيد المتوفر"}, + "ordersDashboard": {"en": "My Orders", "ar": "طلباتي"}, + "productOutOfStock": {"en": "Out Of Stock", "ar": "إنتهى من المخزن"}, + "productQuantity": {"en": "Quantity", "ar": "كمية"}, + + "yourTurn": {"en": "your turn is after", "ar": "دورك بعد"}, + "patients": {"en": "patients", "ar": "مرضي"}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index c256d0c1..723e17a0 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -21,6 +21,7 @@ const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; const PHARMACY_LAST_VISITED_PRODUCTS = 'last-visited'; const PHARMACY_CUSTOMER_ID = 'costumer-id'; +const PHARMACY_CUSTOMER_GUID = 'customer-guid'; const PHARMACY_CUSTOMER_OBJECT = 'pharmacy-customer-object'; const IS_ROBOT_VISIBLE = 'robot-visible'; const IS_ROBOT_INIT = 'robot-init'; diff --git a/lib/core/model/labs/patient_lab_special_result.dart b/lib/core/model/labs/patient_lab_special_result.dart index 2fbcb832..8e24a04d 100644 --- a/lib/core/model/labs/patient_lab_special_result.dart +++ b/lib/core/model/labs/patient_lab_special_result.dart @@ -3,7 +3,7 @@ class PatientLabSpecialResult { String moduleID; String resultData; String resultDataHTML; - Null resultDataTxt; + dynamic resultDataTxt; PatientLabSpecialResult( {this.invoiceNo, diff --git a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart index 9cc3d3b9..d5022f0f 100644 --- a/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart +++ b/lib/core/model/packages_offers/requests/CreateCustomerRequestModel.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:flutter/cupertino.dart'; class PackagesCustomerRequestModel { @@ -19,7 +20,9 @@ class PackagesCustomerRequestModel { this.email = user.emailAddress; this.phone = user.mobileNumber; this.national_id = user.patientIdentificationNo; - this.date_of_birth = user.dateofBirth; + + String isoDateTime = DateUtil.getISODateFormat(user.dateofBirthDataTime); + this.date_of_birth = isoDateTime; } Map json() { diff --git a/lib/core/model/packages_offers/responses/tamara_payment_option.dart b/lib/core/model/packages_offers/responses/tamara_payment_option.dart index ad79f5f3..2b694a23 100644 --- a/lib/core/model/packages_offers/responses/tamara_payment_option.dart +++ b/lib/core/model/packages_offers/responses/tamara_payment_option.dart @@ -3,6 +3,7 @@ class TamaraPaymentOption { double minLimit; double maxLimit; int id; + bool enable = true; String fullName() => '$name Months'; diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart index c609fa0b..e7948d7d 100644 --- a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -2,35 +2,35 @@ import 'PointsAmountPerYear.dart'; import 'PointsDetails.dart'; class LakumInquiryInformationObjVersion { - int accountNumber; + num accountNumber; String accountStatus; String barCode; - int consumedPoints; + num consumedPoints; String consumedPointsAmount; List consumedPointsAmountPerYear; List consumedPointsDetails; String createdDate; - int expiredPoints; + num expiredPoints; String expiryDate; - int gainedPoints; + num gainedPoints; List gainedPointsAmountPerYear; List gainedPointsDetails; String lakumMessageStatus; String memberName; String memberUniversalId; String mobileNumber; - int pointsBalance; - int pointsBalanceAmount; - int pointsWillBeExpired; + num pointsBalance; + num pointsBalanceAmount; + num pointsWillBeExpired; String prefLang; - int statusCode; - int transferPoints; + num statusCode; + num transferPoints; List transferPointsAmountPerYear; List transferPointsDetails; dynamic waitingPoints; dynamic loyalityAmount; dynamic loyalityPoints; - int purchaseRate; + num purchaseRate; LakumInquiryInformationObjVersion( {this.accountNumber, diff --git a/lib/core/model/pharmacies/PointsAmountPerMonth.dart b/lib/core/model/pharmacies/PointsAmountPerMonth.dart index 71cf3498..c5b96bd8 100644 --- a/lib/core/model/pharmacies/PointsAmountPerMonth.dart +++ b/lib/core/model/pharmacies/PointsAmountPerMonth.dart @@ -1,11 +1,11 @@ import 'PointsAmountPerday.dart'; class PointsAmountPerMonth { - double amountPerMonth; - String month; + dynamic amountPerMonth; + dynamic month; int monthNumber; List pointsAmountPerday; - double pointsPerMonth; + dynamic pointsPerMonth; PointsAmountPerMonth( {this.amountPerMonth, diff --git a/lib/core/model/pharmacies/PointsAmountPerYear.dart b/lib/core/model/pharmacies/PointsAmountPerYear.dart index eef74064..2d25855f 100644 --- a/lib/core/model/pharmacies/PointsAmountPerYear.dart +++ b/lib/core/model/pharmacies/PointsAmountPerYear.dart @@ -1,10 +1,10 @@ import 'PointsAmountPerMonth.dart'; class PointsAmountPerYear { - int amountPerYear; + num amountPerYear; List pointsAmountPerMonth; - int pointsPerYear; - int year; + num pointsPerYear; + num year; PointsAmountPerYear( {this.amountPerYear, diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index cef20c30..ad2c533a 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -31,6 +31,7 @@ class Orders { String orderStatusn; bool canCancel; bool canRefund; + String orderGuid; dynamic customerId; dynamic orderSubtotalExclTax; dynamic orderShippingExclTax; @@ -47,6 +48,7 @@ class Orders { this.orderStatusn, this.canCancel, this.canRefund, + this.orderGuid, this.customerId, this.orderShippingExclTax, this.orderSubtotalExclTax, @@ -63,6 +65,7 @@ class Orders { orderStatusn = json['order_statusn']; canCancel = json['can_cancel']; canRefund = json['can_refund']; + orderGuid = json['order_guid']; customerId = json['customer_id']; orderSubtotalExclTax= json["order_subtotal_excl_tax"]; orderShippingExclTax= json["order_shipping_excl_tax"]; diff --git a/lib/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart index 5d91c829..f6f93fa2 100644 --- a/lib/core/model/pharmacies/payment-checkout-data.dart +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -11,7 +11,7 @@ class PaymentCheckoutData { LacumAccountInformation lacumInformation; bool cartDataVisible; ShippingOption shippingOption; - int usedLakumPoints; + num usedLakumPoints; PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index bd2e94e4..2f92fe5e 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -39,7 +39,8 @@ class CustomerAddressesService extends BaseService { Map queryParams = {'fields': 'addresses'}; hasError = false; var customerID = await sharedPref.getObject(PHARMACY_CUSTOMER_ID); - await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID", onSuccess: (dynamic response, int statusCode) { + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + await baseAppClient.getPharmacy("$BASE_PHARMACY_URL$GET_CUSTOMER_ADDRESSES$customerID/$customerGUID", onSuccess: (dynamic response, int statusCode) { addressesList.clear(); response["customers"][0]["addresses"].forEach((data) { addressesList.add(AddressInfo.fromJson(data)); @@ -65,12 +66,12 @@ class CustomerAddressesService extends BaseService { class CustomerInfo { bool isRegistered; - String userName; + dynamic userName; dynamic password; - String email; + dynamic email; dynamic errorMessage; - String mobileNumber; - int customerId; + dynamic mobileNumber; + dynamic customerId; CustomerInfo({this.isRegistered, this.userName, this.password, this.email, this.errorMessage, this.mobileNumber, this.customerId}); @@ -103,7 +104,7 @@ class AddressInfo { String lastName; String email; dynamic company; - int countryId; + dynamic countryId; String country; dynamic stateProvinceId; String city; diff --git a/lib/core/service/PrescriptionDeliveryService.dart b/lib/core/service/PrescriptionDeliveryService.dart index 1d849755..28e5bae4 100644 --- a/lib/core/service/PrescriptionDeliveryService.dart +++ b/lib/core/service/PrescriptionDeliveryService.dart @@ -28,7 +28,7 @@ class PrescriptionDeliveryService extends BaseService { body['AppointmentNo'] = appointmentNo.toString(); // body['CreatedBy'] = createdBy; body['DischargeID'] = dischargeID.toString(); - await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(ADD_PRESCRIPTION_ORDER_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { var asd = ""; }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 1f6ca580..52def3eb 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -134,7 +134,7 @@ class BaseAppClient { print(jsonBody); if (await Utils.checkConnection()) { - final response = await http.post(url.trim(), body: json.encode(body), headers: headers); + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -307,7 +307,7 @@ class BaseAppClient { print("Body : ${json.encode(body)}"); if (await Utils.checkConnection()) { - final response = await http.post(url.trim(), body: json.encode(body), headers: headers); + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -408,7 +408,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { final response = await http.get( - url.trim(), + Uri.parse(url.trim()), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, ); final int statusCode = response.statusCode; @@ -450,7 +450,7 @@ class BaseAppClient { var ss = json.encode(queryParams); if (await Utils.checkConnection()) { - final response = await http.get(url.trim(), headers: { + final response = await http.get(Uri.parse(url.trim()), headers: { 'Content-Type': 'text/html; charset=utf-8', 'Accept': 'application/json', 'Authorization': token ?? '', @@ -467,7 +467,9 @@ class BaseAppClient { onFailure(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode); Navigator.of(AppGlobal.context).pushNamed(HOME); } else { - onFailure('Error While Fetching data', statusCode); + var bodyUtf = json.decode(utf8.decode(response.bodyBytes)); + print(bodyUtf); + onFailure(bodyUtf['error']['ErrorEndUserMsg'], statusCode); } } else { // var parsed = json.decode(response.body.toString()); @@ -488,11 +490,12 @@ class BaseAppClient { }) async { String url = fullUrl; print("URL Query String: $url"); + print("body: $body"); if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.post( - url.trim(), + Uri.parse(url.trim()), body: json.encode(body), headers: headers, ); @@ -500,6 +503,8 @@ class BaseAppClient { print("statusCode :$statusCode"); if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); + print(response.body.toString()); + if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { @@ -524,7 +529,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.get( - url.trim(), + Uri.parse(url.trim()), headers: headers, ); @@ -549,7 +554,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.put( - url.trim(), + Uri.parse(url.trim()), body: json.encode(body), headers: headers, ); @@ -583,7 +588,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.delete( - url.trim(), + Uri.parse(url.trim()), headers: headers, ); @@ -724,7 +729,7 @@ class BaseAppClient { var ss = json.encode(body); if (await Utils.checkConnection()) { - final response = await http.post(url.trim(), body: json.encode(body), headers: { + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: { // 'Content-Type': 'application/json', // 'Accept': 'application/json', // 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index 0a7d9e68..01ea61e3 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -55,7 +55,7 @@ class PrescriptionsService extends BaseService { prescriptionsOrderListRC.clear(); Map body = Map(); body['ID'] = orderID; - await baseAppClient.post(GET_ALL_PRESCRIPTION_INFO_RC + "?PatientId=" + patientID.toString(), onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_PRESCRIPTION_INFO_RC + "?PatientId=" + patientID.toString(), isRCService: true, onSuccess: (dynamic response, int statusCode) { response['response']['report'].forEach((prescriptionsOrder) { prescriptionsOrderListRC.add(PrescriptionInfoRCModel.fromJson(prescriptionsOrder)); }); @@ -69,7 +69,7 @@ class PrescriptionsService extends BaseService { prescriptionsOrderList.clear(); Map body = Map(); // body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_ALL_PRESCRIPTION_ORDERS_RC, isRCService: true, onSuccess: (dynamic response, int statusCode) { response['response'].forEach((prescriptionsOrder) { prescriptionsOrderList.add(GetCMCAllOrdersResponseModel.fromJson(prescriptionsOrder)); }); diff --git a/lib/core/service/packages_offers/PackagesOffersServices.dart b/lib/core/service/packages_offers/PackagesOffersServices.dart index ae5396a7..6c4e0d24 100644 --- a/lib/core/service/packages_offers/PackagesOffersServices.dart +++ b/lib/core/service/packages_offers/PackagesOffersServices.dart @@ -75,6 +75,7 @@ class OffersAndPackagesServices extends BaseService { Future> getTamaraOptions({@required BuildContext context, @required bool showLoading = true}) async { if (tamaraPaymentOptions != null && tamaraPaymentOptions.isNotEmpty) return tamaraPaymentOptions; + tamaraPaymentOptions.clear(); var url = EXA_CART_API_BASE_URL + PACKAGES_TAMARA_OPT; await baseAppClient.simpleGet(url, headers: packagesAuthHeader, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 899cc66b..b9368180 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -21,10 +21,11 @@ class OrderPreviewService extends BaseService { Future getAddresses() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getString(PHARMACY_CUSTOMER_GUID); Map queryParams = {'fields': 'addresses'}; hasError = false; try { - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) { addresses.clear(); response['customers'][0]['addresses'].forEach((item) { addresses.add(Addresses.fromJson(item)); @@ -58,13 +59,15 @@ class OrderPreviewService extends BaseService { Future getShoppingCart() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + if (customerId == null) return null; Map queryParams = {'shopping_cart_type': '1'}; dynamic localRes; hasError = false; try { - await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId", onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_SHOPPING_CART$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -198,7 +201,7 @@ class OrderPreviewService extends BaseService { orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; - orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + // orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; List> itemsList = List(); shoppingCarts.forEach((item) { @@ -245,6 +248,9 @@ class OrderPreviewService extends BaseService { case 4: return "INSTALLMENT"; break; + case 5: + return "ApplePay"; + break; default: return ""; } diff --git a/lib/core/service/parmacyModule/parmacy_module_service.dart b/lib/core/service/parmacyModule/parmacy_module_service.dart index cc330ed7..7c7afa30 100644 --- a/lib/core/service/parmacyModule/parmacy_module_service.dart +++ b/lib/core/service/parmacyModule/parmacy_module_service.dart @@ -22,16 +22,12 @@ class PharmacyModuleService extends BaseService { List mostViewedProducts = List(); Future makeVerifyCustomer(dynamic data) async { - Map queryParams = { - 'FileNumber': data['PatientID'].toString() - }; + Map queryParams = {'FileNumber': data['PatientID'].toString()}; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_VERIFY_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (response['UserName'] != null) { - sharedPref.setString( - PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); + sharedPref.setString(PHARMACY_CUSTOMER_ID, response['CustomerId'].toString()); print(response); } else { await createUser(); @@ -57,13 +53,14 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_CREATE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (!response['IsRegistered']) { } else { customerInfo = CustomerInfo.fromJson(response); - await sharedPref.setObject( - PHARMACY_CUSTOMER_ID, customerInfo.customerId); + print(response['customerDto']); + print(response['customerDto']['customerGuid']); + await sharedPref.setObject(PHARMACY_CUSTOMER_ID, customerInfo.customerId); + await sharedPref.setObject(PHARMACY_CUSTOMER_GUID, response['customerDto']['customerGuid']); } // await generatePharmacyToken(); }, onFailure: (String error, int statusCode) { @@ -83,11 +80,9 @@ class PharmacyModuleService extends BaseService { }; hasError = false; try { - await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER, - onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy(PHARMACY_AUTORZIE_CUSTOMER, onSuccess: (dynamic response, int statusCode) async { if (response['Status'] == 200) { - await sharedPref.setString( - PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); + await sharedPref.setString(PHARMACY_AUTORZIE_TOKEN, response['token'].toString()); } }, onFailure: (String error, int statusCode) { hasError = true; @@ -101,8 +96,7 @@ class PharmacyModuleService extends BaseService { Future getBannerListList() async { hasError = false; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BANNER, onSuccess: (dynamic response, int statusCode) { bannerItems.clear(); response['images'].forEach((item) { bannerItems.add(PharmacyImageObject.fromJson(item)); @@ -120,8 +114,7 @@ class PharmacyModuleService extends BaseService { if (manufacturerList.isNotEmpty) return; Map queryParams = {'page': '1', 'limit': '8'}; try { - await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_TOP_MANUFACTURER, onSuccess: (dynamic response, int statusCode) { manufacturerList.clear(); response['manufacturer'].forEach((item) { Manufacturer manufacturer = Manufacturer.fromJson(item); @@ -147,8 +140,7 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage,reviews', }; try { - await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_PHARMACY_BEST_SELLER_PRODUCT, onSuccess: (dynamic response, int statusCode) { bestSellerProducts.clear(); response['products'].forEach((item) { bestSellerProducts.add(PharmacyProduct.fromJson(item)); @@ -165,23 +157,18 @@ class PharmacyModuleService extends BaseService { Future getLastVisitedProducts() async { String lastVisited = ""; - if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != - null) { - lastVisited = - await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); + if (await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS) != null) { + lastVisited = await this.sharedPref.getString(PHARMACY_LAST_VISITED_PRODUCTS); // lastVisited = "2458,4561"; try { - await baseAppClient - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_IDS$lastVisited", onSuccess: (dynamic response, int statusCode) { lastVisitedProducts.clear(); response['products'].forEach((item) { lastVisitedProducts.add(PharmacyProduct.fromJson(item)); }); hasError = false; }, onFailure: (String error, int statusCode) { - hasError = - true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); + hasError = true; // sharedPref.setString(PHARMACY_LAST_VISITED_PRODUCTS, ""); super.error = error; }); } catch (error) { @@ -197,8 +184,7 @@ class PharmacyModuleService extends BaseService { 'id,discount_ids,name,reviews,namen,localized_names,display_order,short_description,full_description,full_descriptionn,sku,order_minimum_quantity,order_maximum_quantity,price,old_price,images,is_rx,rx_message,rx_messagen,discount_name,discount_namen,approved_rating_sum,approved_total_reviews,allow_back_in_stock_subscriptions,stock_quantity,stock_availability,stock_availabilityn,discount_percentage', }; try { - await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.getPharmacy(GET_MOST_VIEWED_PRODUCTS, onSuccess: (dynamic response, int statusCode) { mostViewedProducts.clear(); response['products'].forEach((item) { mostViewedProducts.add(PharmacyProduct.fromJson(item)); diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 3cc45680..ef8650c8 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model import 'package:diplomaticquarterapp/core/model/pharmacy/final_products_model.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/scan_qr_model.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/validators.dart'; import 'base_service.dart'; @@ -90,8 +91,11 @@ class PharmacyCategoriseService extends BaseService { Future searchProducts({String productName}) async { hasError = false; _searchList.clear(); + // the language ID in pharmacy is different not same in patient app, en == 1 , ar == 2 + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageId = languageID == 'ar' ? 2 : 1; String endPoint = productName != null - ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=' + "$languageId" : GET_SEARCH_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, @@ -187,11 +191,14 @@ class PharmacyCategoriseService extends BaseService { ); } - Future getSubProducts({String id}) async { + Future getSubProducts( + {String id, int pageIndex, bool isLoading = false}) async { hasError = false; - _subProductsList.clear(); + if (isLoading == false) { + _subProductsList.clear(); + } String endPoint = id != null - ? GET_SUB_PRODUCTS + "$id" + '&page=1&limit=50' + ? GET_SUB_PRODUCTS + "$id" + '&page=' + '$pageIndex' + '&limit=24' : GET_SUB_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, @@ -300,9 +307,9 @@ class PharmacyCategoriseService extends BaseService { _parentProductsList.clear(); endPoint = FILTERED_PRODUCTS + "$categoryId" + - "&manufacturerids=$brandId" + - "&price_min=$min" + - "&price_max=$max&page=1&limit=50"; + "$brandId" + + "$min" + + "$max&page=1&limit=50"; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { @@ -325,9 +332,9 @@ class PharmacyCategoriseService extends BaseService { _subProductsList.clear(); endPoint = FILTERED_PRODUCTS + "$categoryId" + - "&manufacturerids=$brandId" + - "&price_min=$min" + - "&price_max=$max&page=1&limit=50"; + "$brandId" + + "$min" + + "$max&page=1&limit=50"; await baseAppClient.getPharmacy( endPoint, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index f480fb56..dd1030c6 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -147,9 +147,9 @@ class PrescriptionsViewModel extends BaseViewModel { } } - getPrescriptionReportDetailsRC() async { + getPrescriptionReportDetailsRC(int orderID, dynamic patientID) async { setState(ViewState.Busy); - await _prescriptionsService.getPrescriptionsInfoRC(4, 2001273); + await _prescriptionsService.getPrescriptionsInfoRC(orderID, patientID); if (_prescriptionsService.hasError) { error = _prescriptionsService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart index af750eab..b1fcc1d1 100644 --- a/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart +++ b/lib/core/viewModels/packages_offers/PackagesOffersViewModel.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; +import 'package:diplomaticquarterapp/core/model/packages_offers/responses/tamara_payment_option.dart'; import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; @@ -25,6 +26,22 @@ class PackagesViewModel extends BaseViewModel { List get cartItemList => service.cartItemList; List get hospitals => service.hospitals; + List get tamara_options => service.tamaraPaymentOptions; + bool allowTamara = true; + + setTamaraIllegablity(double amount){ + bool illegible = true; + if(tamara_options == null || tamara_options.isEmpty) + illegible = false; + else{ + tamara_options.forEach((element) { + final ill = (amount >= element.minLimit && amount <= element.maxLimit); + element.enable = ill; + illegible = illegible || ill; + }); + } + allowTamara = illegible; + } String _cartItemCount = ""; diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index e9f2a3d4..12623290 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -156,6 +156,8 @@ class OrderPreviewViewModel extends BaseViewModel { case 4: return "${assetFile}installment.png"; break; + case 5: + return "${assetFile}applePay.png"; default: return ""; } @@ -166,8 +168,7 @@ class OrderPreviewViewModel extends BaseViewModel { } getInformationsByAddress(String identificationNo) async { - await getShippingOption(); - await getLacumAccountInformation(identificationNo); + await getShippingOption(identificationNo); } getLacumAccountInformation(String identificationNo) async { @@ -194,18 +195,18 @@ class OrderPreviewViewModel extends BaseViewModel { } } - getShippingOption() async { + Future getShippingOption(String identificationNo) async { setState(ViewState.Busy); - await _orderService.getShippingOption(paymentCheckoutData.address).then((res) { - paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); - setState(ViewState.Idle); + await _orderService.getShippingOption(paymentCheckoutData.address).then((res) async { + if (_orderService.hasError) { + error = _orderService.error; + setState(ViewState.Error); + } else { + paymentCheckoutData.shippingOption = ShippingOption.fromJson(res); + setState(ViewState.Idle); + await getLacumAccountInformation(identificationNo); + } }); - if (_orderService.hasError) { - error = _orderService.error; - setState(ViewState.Error); - } else { - setState(ViewState.Idle); - } } Future makeOrder() async { diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index b6420c9c..dae79ac1 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -75,7 +75,6 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.faxNumber = user.faxNumber; sendingAddress.customerAttributes = ""; sendingAddress.createdOnUtc = DateTime.now().toString(); - if (editedAddress == null) { ///TODO Fatima* @@ -83,20 +82,26 @@ class PharmacyAddressesViewModel extends BaseViewModel { } else { await _pharmacyAddressService.editCustomerAddress(sendingAddress); + } if (_pharmacyAddressService.hasError) { - error = _pharmacyAddressService.error; - Utils.showErrorToast(error); - setState(ViewState.Error); + await _pharmacyAddressService.getAddresses(); + setState(ViewState.Idle); + + + // setState(ViewState.Error); } else { setState(ViewState.Idle); } + + + } - Future deleteAddresses(AddressInfo sendingAddress) async { + Future deleteAddresses(AddressInfo address) async { setState(ViewState.Busy); - await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); + await _pharmacyAddressService.deleteCustomerAddress(address); if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart index c03e8e87..1bd0d542 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -1,5 +1,5 @@ import 'dart:async'; -import 'dart:convert' as convert; +import 'dart:convert'; import 'dart:typed_data'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; @@ -92,8 +92,8 @@ class LacumViewModel extends BaseViewModel { Uint8List convertBase64ToBarCodeImage() { try { - final _byteImage = convert.base64Decode( - lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); + final _byteImage = base64Decode( + lacumGroupInformation.lakumInquiryInformationObjVersion.barCode.split(',').last); return _byteImage; } catch (e) { print(e); diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index fe5be016..0ea53363 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -37,9 +37,9 @@ class OrderModelViewModel extends BaseViewModel { - Future getOrder(customerId, pageID) async { + Future getOrder(customerId, customerGUID, pageID) async { setState(ViewState.Busy); - await _orderService.getOrder(customerId, pageID); + await _orderService.getOrder(customerId, customerGUID, pageID); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.Error); @@ -49,9 +49,9 @@ class OrderModelViewModel extends BaseViewModel { } } - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { setState(ViewState.Busy); - await _orderDetailsService.getOrderDetails(OrderId); + await _orderDetailsService.getOrderDetails(OrderId, orderGUID); if (_orderDetailsService.hasError) { error = _orderDetailsService.error; setState(ViewState.Error); diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index df895e28..23952514 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.notifyMe(customerId, itemID, context); + await _productDetailService.notifyMe(customerId, itemID); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModels/pharmacy_categorise_view_model.dart b/lib/core/viewModels/pharmacy_categorise_view_model.dart index fcae18d2..2be2f14c 100644 --- a/lib/core/viewModels/pharmacy_categorise_view_model.dart +++ b/lib/core/viewModels/pharmacy_categorise_view_model.dart @@ -121,7 +121,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.BusyLocal); - //GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context); await _pharmacyCategoriseService.getParentProducts( id: i, pageNumber: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { @@ -129,31 +129,45 @@ class PharmacyCategoriseViewModel extends BaseViewModel { setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); - //GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); } - Future getSubCategorise({String i}) async { + Future getSubCategorise( + {String i, + int pageIndex, + bool isLoading = false, + BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _pharmacyCategoriseService.getSubCategorise(id: i); + await _pharmacyCategoriseService.getSubCategorise( + id: i, + ); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else - getSubProducts(i: i); + getSubProducts( + i: i, pageIndex: pageIndex, isLoading: isLoading, context: context); } - Future getSubProducts({String i}) async { + Future getSubProducts( + {String i, + int pageIndex, + bool isLoading = false, + BuildContext context}) async { hasError = false; // _insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); - await _pharmacyCategoriseService.getSubProducts(id: i); + setState(ViewState.BusyLocal); + GifLoaderDialogUtils.showMyDialog(context); + await _pharmacyCategoriseService.getSubProducts( + id: i, pageIndex: pageIndex, isLoading: isLoading); if (_pharmacyCategoriseService.hasError) { error = _pharmacyCategoriseService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); + GifLoaderDialogUtils.hideDialog(context); } Future getFinalProducts({String i}) async { diff --git a/lib/core/viewModels/qr_view_model.dart b/lib/core/viewModels/qr_view_model.dart index a4a08e3f..da597a0b 100644 --- a/lib/core/viewModels/qr_view_model.dart +++ b/lib/core/viewModels/qr_view_model.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/qr/qr_parking_model.dart'; @@ -16,7 +16,7 @@ class QrViewModel extends BaseViewModel { readQr() async { //TODO fix the barcode scan - String result = await BarcodeScanner.scan(); + String result = (await BarcodeScanner.scan())?.rawContent; var data = json.decode(result); var qRParkingID = data['QRParkingID']; setState(ViewState.BusyLocal); diff --git a/lib/main.dart b/lib/main.dart index 0dd18a2d..a3175350 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,8 +9,10 @@ import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; +import 'package:diplomaticquarterapp/uitl/push-notification-handler.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -23,10 +25,12 @@ import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; + + + void main() async { WidgetsFlutterBinding.ensureInitialized(); - FirebaseApp defaultApp = await Firebase.initializeApp(); - + await Firebase.initializeApp(); setupLocator(); runApp(MyApp()); } @@ -39,9 +43,11 @@ class MyApp extends StatefulWidget { class _MyApp extends State { AppUpdateInfo _updateInfo; - Future checkForUpdate() async { + final GlobalKey navigatorKey = GlobalKey(); + + Future checkForUpdate() async { // todo need to verify 'imp' InAppUpdate.checkForUpdate().then((info) { - if (info.updateAvailable) { + if (info.immediateUpdateAllowed) { InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString())); } }).catchError((e) { @@ -65,6 +71,7 @@ class _MyApp extends State { @override Widget build(BuildContext context) { PlatformBridge.init(context); + PushNotificationHandler(context).init(); // Asyncronously LocalNotification.init(onNotificationClick: (payload) { LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); @@ -112,7 +119,7 @@ class _MyApp extends State { // ], navigatorKey: locator().navigatorKey, showSemanticsDebugger: false, - title: 'Diplomatic Quarter App', + title: 'Dr. AlHabib', locale: projectProvider.appLocal, localizationsDelegates: [ TranslationBaseDelegate(), @@ -169,6 +176,7 @@ class _MyApp extends State { // ), // ), initialRoute: SPLASH, + // initialRoute: CALL_PAGE, // initialRoute: OPENTOK_CALL_PAGE, // initialRoute: PACKAGES_OFFERS, // initialRoute: PACKAGES_ORDER_COMPLETED, diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 0da1a273..d43dceb3 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -9,6 +9,7 @@ class DoctorList { int actualDoctorRate; int clinicRoomNo; dynamic date; + dynamic appointmentDate; dynamic dayName; int doctorID; String doctorImageURL; @@ -53,6 +54,7 @@ class DoctorList { this.actualDoctorRate, this.clinicRoomNo, this.date, + this.appointmentDate, this.dayName, this.doctorID, this.doctorImageURL, @@ -97,6 +99,7 @@ class DoctorList { actualDoctorRate = json['ActualDoctorRate']; clinicRoomNo = json['ClinicRoomNo']; date = json['Date']; + appointmentDate = json['AppointmentDate']; dayName = json['DayName']; doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; diff --git a/lib/models/Clinics/ClinicListResponse.dart b/lib/models/Clinics/ClinicListResponse.dart index cabb47b2..1aa4065e 100644 --- a/lib/models/Clinics/ClinicListResponse.dart +++ b/lib/models/Clinics/ClinicListResponse.dart @@ -41,6 +41,12 @@ class ListClinicCentralized { data['LiveCareServiceID'] = this.liveCareServiceID; return data; } + + + @override + String toString() { + return '${clinicDescription}'.toLowerCase() + ' ${clinicDescription}'.toUpperCase(); + } } class ListGetBookScheduleConfigsList { diff --git a/lib/models/LiveCare/IncomingCallData.dart b/lib/models/LiveCare/IncomingCallData.dart index 9234c876..d98b4c5b 100644 --- a/lib/models/LiveCare/IncomingCallData.dart +++ b/lib/models/LiveCare/IncomingCallData.dart @@ -1,4 +1,6 @@ class IncomingCallData { + String callerID; + String receiverID; String msgID; String notfID; String notificationForeground; @@ -49,6 +51,8 @@ class IncomingCallData { this.sound}); IncomingCallData.fromJson(Map json) { + callerID = json['callerID']; + receiverID = json['PatientID']; msgID = json['msgID']; notfID = json['notfID']; notificationForeground = json['notification_foreground']; diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart index d681f764..ac514dc2 100644 --- a/lib/models/SmartWatch/HealthData.dart +++ b/lib/models/SmartWatch/HealthData.dart @@ -4,15 +4,13 @@ class healthData { String MachineDate; double Value; int TransactionsListID; - String Notes; healthData({ this.MedCategoryID, this.MedSubCategoryID, this.MachineDate, this.Value, - this.TransactionsListID, - this.Notes, + this.TransactionsListID }); healthData.fromJson(Map json) { @@ -21,7 +19,6 @@ class healthData { MachineDate = json['MachineDate']; Value = json['Value']; TransactionsListID = json['TransactionsListID']; - Notes = json['Notes']; } Map toJson() { @@ -31,7 +28,6 @@ class healthData { 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/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart index 5ef5089c..4a7f33f0 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_page.dart @@ -63,7 +63,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { } _getCurrentLocation() async { - await getLastKnownPosition().then((value) { + await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; _longitude = value.longitude; }).catchError((e) { @@ -89,7 +89,7 @@ class _NewCMCPageState extends State with TickerProviderStateMixin { void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart index 5e2b0498..e6eefefe 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_one_page.dart @@ -1,14 +1,11 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_get_items_request_model.dart'; import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_insert_pres_order_request_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/theme/colors.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/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/dragable_sheet.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/photo_view_page.dart'; @@ -125,7 +122,10 @@ class _NewCMCStepOnePageState extends State { ), margin: EdgeInsets.all(12), child: IconButton( - icon: SvgPicture.asset("assets/images/new/ic_zoom.svg",color: Colors.white,), + icon: SvgPicture.asset( + "assets/images/new/ic_zoom.svg", + color: Colors.white, + ), padding: EdgeInsets.all(12), onPressed: () { showDraggableDialog(context, PhotoViewPage(projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png")); @@ -162,9 +162,9 @@ class _NewCMCStepOnePageState extends State { widget.cMCInsertPresOrderRequestModel.patientERCMCInsertServicesList = [patientERCMCInsertServicesList]; await widget.model.getCustomerInfo(); - // if (widget.model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(); - // } else { + if (widget.model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(); + } else { navigateTo( context, NewCMCStepTowPage( @@ -174,7 +174,7 @@ class _NewCMCStepOnePageState extends State { model: widget.model, ), ); - // } + } } }, ), diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart index 89d58317..42c8186a 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/new_cmc_step_tow_page.dart @@ -146,7 +146,6 @@ class _NewCMCStepTowPageState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, description: TranslationBase.of(context).infoCMC, @@ -285,7 +284,7 @@ class _NewCMCStepTowPageState extends State { void confirmSelectLocationDialog(List addresses) { showDialog( context: context, - child: SelectLocationDialog( + builder: (cxt) => SelectLocationDialog( addresses: addresses, selectedAddress: _selectedAddress, onValueSelected: (value) { diff --git a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart index 48b904aa..78c1d140 100644 --- a/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/orders_log_details_page.dart @@ -32,7 +32,7 @@ class OrdersLogDetailsPage extends StatelessWidget { void showConfirmMessage(CMCViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).cancelOrderMsg, onTap: () { UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); 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 25efb016..363b46e2 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 @@ -238,7 +238,7 @@ class _NewEReferralStepOnePageState extends State { void confirmSelectRelationTypeDialog(List relations) { showDialog( context: context, - child: SelectRelationTypeDialog( + builder: (cxt) => SelectRelationTypeDialog( relationTypes: relations, selectedRelation: _selectedRelation, onValueSelected: (value) { 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 439a9ec7..cf6428c8 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 @@ -459,7 +459,7 @@ class _NewEReferralStepThreePageState extends State { void confirmSelectCityDialog(List cities) { showDialog( context: context, - child: SelectCityDialog( + builder: (cxt) => SelectCityDialog( cities: cities, selectedCity: _selectedCity, onValueSelected: (value) { 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 57341838..a953705e 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 @@ -270,7 +270,7 @@ class _NewEReferralStepTowPageState extends State { void confirmSelectCityDialog(List cities) { showDialog( context: context, - child: SelectCityDialog( + builder: (cxt) => SelectCityDialog( cities: cities, selectedCity: _selectedCity, onValueSelected: (value) { @@ -285,7 +285,7 @@ class _NewEReferralStepTowPageState extends State { void confirmSelectCountryTypeDialog() { showDialog( context: context, - child: SelectCountryDialog( + builder: (cxt) => SelectCountryDialog( selectedCountry: _selectedCountry, onValueSelected: (value) { setState(() { 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 5751dcfe..b2277560 100644 --- a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -89,7 +89,7 @@ class _SearchForReferralsPageState extends State { } showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: selectedCriteria.value, onValueSelected: (index) { @@ -229,7 +229,7 @@ class _SearchForReferralsPageState extends State { void confirmSelectCountryTypeDialog() { showDialog( context: context, - child: SelectCountryDialog( + builder: (cxt) => SelectCountryDialog( selectedCountry: _selectedCountry, onValueSelected: (value) { setState(() { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index 58d66b3d..7a4c02a4 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -7,7 +7,7 @@ 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/buttons/secondary_button.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'; @@ -46,90 +46,81 @@ class _LocationPageState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) {}, - builder: (_, model, widget) => AppScaffold( - appBarTitle: TranslationBase.of(context).addAddress, - isShowDecPage: false, - isShowAppBar: true, - baseViewModel: model, - showNewAppBarTitle: true, - showNewAppBar: true, - body: PlacePicker( - apiKey: GOOGLE_API_KEY, - enableMyLocationButton: true, - automaticallyImplyAppBarLeading: false, - autocompleteOnTrailingWhitespace: true, - selectInitialPosition: true, - autocompleteLanguage: projectViewModel.currentLanguage, - enableMapTypeButton: true, - searchForInitialValue: false, - onPlacePicked: (PickResult result) { - print(result.adrAddress); - }, - selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { - print("state: $state, isSearchBarFocused: $isSearchBarFocused"); - return isSearchBarFocused - ? Container() - : FloatingCard( - bottomPosition: 0.0, - leftPosition: 0.0, - rightPosition: 0.0, - width: 500, - borderRadius: BorderRadius.circular(12.0), - child: state == SearchingState.Searching - ? Center(child: CircularProgressIndicator()) - : Container( - margin: EdgeInsets.all(12), - child: Column( - children: [ - SecondaryButton( - color: Colors.grey[800], - textColor: Colors.white, - onTap: () async { - AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( - customer: Customer(addresses: [ - Addresses( - address1: selectedPlace.formattedAddress, - address2: selectedPlace.formattedAddress, - customerAttributes: "", - city: "", - createdOnUtc: "", - id: 0, - latLong: "$latitude,$longitude", - email: "") - ]), - ); + onModelReady: (model) {}, + builder: (_, model, widget) => AppScaffold( + appBarTitle: TranslationBase.of(context).addAddress, + isShowDecPage: false, + isShowAppBar: true, + baseViewModel: model, + showNewAppBarTitle: true, + showNewAppBar: true, + body: PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onPlacePicked: (PickResult result) { + print("onPlacePickedonPlacePickedonPlacePickedonPlacePicked"); + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(0.0), + child: state == SearchingState.Searching + ? SizedBox(height: 43,child: Center(child: CircularProgressIndicator())).insideContainer + : DefaultButton(TranslationBase.of(context).addNewAddress, () async { - selectedPlace.addressComponents.forEach((e) { - if (e.types.contains("country")) { - addNewAddressRequestModel.customer.addresses[0].country = e.longName; - } - if (e.types.contains("postal_code")) { - addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; - } - if (e.types.contains("locality")) { - addNewAddressRequestModel.customer.addresses[0].city = e.longName; - } - }); + // print(); + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + city: "", + createdOnUtc: "", + id: 0, + latLong: "${selectedPlace.geometry.location}", + email: "") + ]), + ); - await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } else { - AppToast.showSuccessToast(message: "Address Added Successfully"); - } - Navigator.of(context).pop(addNewAddressRequestModel); - }, - label: TranslationBase.of(context).addNewAddress, - ), - ], - ), - ), - ); - }, - initialPosition: LatLng(latitude, longitude), - useCurrentLocation: showCurrentLocation, - ), - )); + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); + + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(addNewAddressRequestModel); + }).insideContainer + ); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, + ), + ), + ); } } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 31518f61..10418bc2 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -279,7 +279,7 @@ class _NewHomeHealthCareStepTowPageState extends State addresses) { showDialog( context: context, - child: SelectLocationDialog( + builder: (cxt) => SelectLocationDialog( addresses: addresses, selectedAddress: _selectedAddress, onValueSelected: (value) { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart index 82f91cff..fce9c4b0 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_home_health_care_page.dart @@ -8,7 +8,6 @@ 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/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; @@ -41,7 +40,7 @@ class _NewHomeHealthCarePageState extends State with Tick } _getCurrentLocation() async { - await getLastKnownPosition().then((value) { + await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; _longitude = value.longitude; }).catchError((e) { @@ -67,22 +66,22 @@ class _NewHomeHealthCarePageState extends State with Tick void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmWithMessageDialog( - message: TranslationBase.of(context).cancelOrderMsg, - onTap: () async { - model.setState(ViewState.Busy); - UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); + builder: (cxt) => ConfirmWithMessageDialog( + message: TranslationBase.of(context).cancelOrderMsg, + onTap: () async { + model.setState(ViewState.Busy); + UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); - 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(); - } - }, - )); + 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(); + } + }, + )); } ProjectViewModel projectViewModel = Provider.of(context); diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart index e14d07e8..620920de 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/orders_log_details_page.dart @@ -28,7 +28,7 @@ class OrdersLogDetailsPage extends StatelessWidget { void showConfirmMessage(HomeHealthCareViewModel model, GetCMCAllOrdersResponseModel order) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).cancelOrderMsg, onTap: () async { UpdatePresOrderRequestModel updatePresOrderRequestModel = UpdatePresOrderRequestModel(presOrderID: order.iD, rejectionReason: "", presOrderStatus: 4, editedBy: 3); diff --git a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart index edc82034..38d7a568 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h20_setting.dart @@ -271,7 +271,7 @@ class _H2oSettingState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedActiveLevel, onValueSelected: (index) { @@ -300,7 +300,7 @@ class _H2oSettingState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedRemindedTime, onValueSelected: (index) { diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index 984d0680..7b10078b 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -341,7 +341,7 @@ class _TodayPageState extends State { String title = "${TranslationBase.of(context).areyousure} $amount ${(isUnitML ? TranslationBase.of(context).ml : TranslationBase.of(context).l).toLowerCase()} ?"; await showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: title, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart index b61cd4fc..717be242 100644 --- a/lib/pages/Blood/blood_donation.dart +++ b/lib/pages/Blood/blood_donation.dart @@ -149,7 +149,7 @@ class _BloodDonationPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedHospitalIndex, isScrollable: true, @@ -170,7 +170,7 @@ class _BloodDonationPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedGenderIndex, onValueSelected: (index) { @@ -195,7 +195,7 @@ class _BloodDonationPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedBloodTypeIndex, isScrollable: true, diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 96e8d593..51142817 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -44,7 +44,7 @@ class ConfirmPaymentPage extends StatelessWidget { showDialog( context: context, barrierDismissible: false, - child: ConfirmSMSDialog( + builder: (cxt) => ConfirmSMSDialog( phoneNumber: patientInfoAndMobileNumber.mobileNumber, ), ).then((value) { diff --git a/lib/pages/Blood/new_text_Field.dart b/lib/pages/Blood/new_text_Field.dart index 8506ac6a..643e1a93 100644 --- a/lib/pages/Blood/new_text_Field.dart +++ b/lib/pages/Blood/new_text_Field.dart @@ -192,7 +192,7 @@ class _NewTextFieldsState extends State { style: Theme.of(context) .textTheme - .body2 + .bodyText2 .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index bdf387d6..63e711e5 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -21,6 +22,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'book_reminder_page.dart'; @@ -88,7 +90,6 @@ class _BookConfirmState extends State { null, widget.doctor.noOfPatientsRate, "", - ), isNeedToShowButton: false, ), @@ -199,10 +200,10 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () async { - if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { - insertAppointment(context, widget.doctor); - } else { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertLiveCareScheduledAppointment(context, widget.doctor); + } else { + insertAppointment(context, widget.doctor); } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), @@ -248,7 +249,7 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () async { - if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -375,7 +376,6 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { - print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 3c3c1402..5bf0a9f0 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -17,7 +17,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/nfc/nfc_reader_sheet.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:nfc_in_flutter/nfc_in_flutter.dart'; +import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; class QRCode extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -42,11 +42,11 @@ class _QRCodeState extends State { _bytes = base64.decode(widget.appoQR.split(',').last); widget.authUser = new AuthenticatedUser(); - NFC.isNDEFSupported.then((supported) { - setState(() { - _supportsNFC = true; - }); + + FlutterNfcKit.nfcAvailability.then((value) { + _supportsNFC = (value == NFCAvailability.available); }); + super.initState(); } diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 8e576c99..3a6d9185 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -78,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index b1b8a154..37ec070a 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -1,12 +1,18 @@ +import 'dart:collection'; + import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.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/laser_body_parts_data.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/material.dart'; import 'package:provider/provider.dart'; @@ -129,11 +135,13 @@ class _LaserClinicState extends State with SingleTickerProviderStat labelStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', letterSpacing: -0.48, ), tabs: [Text(TranslationBase.of(context).male), Text(TranslationBase.of(context).female)], @@ -176,8 +184,11 @@ class _LaserClinicState extends State with SingleTickerProviderStat Expanded( child: DefaultButton( TranslationBase.of(context).continues, - () {}, - color: Color(0xff359846), + getDuration() != 0 ? () { + callDoctorsSearchAPI(); + } : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, ), ), ], @@ -187,6 +198,65 @@ class _LaserClinicState extends State with SingleTickerProviderStat ); } + callDoctorsSearchAPI() { + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsList(253, 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(); + }); + } + int getDuration() { int duration = 0; if (_isFullBody) { @@ -255,7 +325,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat color: _selectedCategoryIndex == index ? Colors.transparent : Color(0xffEAEAEA), ), ), - padding: EdgeInsets.symmetric(vertical: 11, horizontal: 26), + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 26), child: Text( list[index].title, style: TextStyle( @@ -404,6 +474,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat color: Color(0xff2B353E), letterSpacing: -0.48, ), + maxLines: 1, ), ), ], diff --git a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart index ee3e7b4a..7901d7b6 100644 --- a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart +++ b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart @@ -24,6 +24,8 @@ class _LiveCareBookAppointmentState extends State { @override Widget build(BuildContext context) { return AppScaffold( + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, isShowDecPage: false, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 1703f183..7fb724b8 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -10,6 +10,7 @@ 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/BookAppointment/dialog/clinic_list_dialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -40,6 +41,7 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; String dropdownValue; + String dropdownTitle = ""; String projectDropdownValue; // var event = RobotProvider(); @@ -101,9 +103,7 @@ class _SearchByClinicState extends State { top: 20, ), child: Text( - TranslationBase - .of(context) - .doctorFilter, + TranslationBase.of(context).doctorFilter, style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -118,9 +118,7 @@ class _SearchByClinicState extends State { Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Text( - TranslationBase - .of(context) - .gender, + TranslationBase.of(context).gender, style: TextStyle( fontSize: 12, letterSpacing: -0.48, @@ -135,56 +133,48 @@ class _SearchByClinicState extends State { children: [ Flexible( child: Row( - children: [ - Radio( - value: TranslationBase - .of(context) - .female, - groupValue: radioValue, - onChanged: (v) { - setState(() { - radioValue = v; - }); - }, - ), - Text( - TranslationBase - .of(context) - .female, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], - )), + children: [ + Radio( + value: TranslationBase.of(context).female, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase.of(context).female, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), Flexible( child: Row( - children: [ - Radio( - value: TranslationBase - .of(context) - .male, - groupValue: radioValue, - onChanged: (v) { - setState(() { - radioValue = v; - }); - }, - ), - Text( - TranslationBase - .of(context) - .male, - style: TextStyle( - fontSize: 12, - letterSpacing: -0.48, - fontWeight: FontWeight.w600, - ), - ), - ], - )), + children: [ + Radio( + value: TranslationBase.of(context).male, + groupValue: radioValue, + onChanged: (v) { + setState(() { + radioValue = v; + }); + }, + ), + Text( + TranslationBase.of(context).male, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + fontWeight: FontWeight.w600, + ), + ), + ], + )), ], ), ), @@ -214,173 +204,143 @@ class _SearchByClinicState extends State { }); }, ), - Text(TranslationBase - .of(context) - .nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), + Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), ], ), ), widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: clinicsList.map((result) { - return RoundedContainer( - child: ListTile( - onTap: () { - // setState(() { - dropdownValue = result.clinicID.toString(); - setState(() { - if (!isDentalSelectedAndSupported()) { - projectDropdownValue = ""; - getDoctorsList(context); - } else {} - }); - }, - title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); - }).toList()) + crossAxisAlignment: CrossAxisAlignment.start, + children: clinicsList.map((result) { + return RoundedContainer( + child: ListTile( + onTap: () { + // setState(() { + dropdownValue = result.clinicID.toString(); + setState(() { + if (!isDentalSelectedAndSupported()) { + projectDropdownValue = ""; + getDoctorsList(context); + } else {} + }); + }, + title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0)))); + }).toList()) : InkWell( - onTap: () { - // dropdownKey.currentState; - openDropdown(clinicDropdownKey); - }, - child: Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + onTap: () { + showClickListDialog(context, clinicsList, onSelection: (ListClinicCentralized clincs) { + Navigator.pop(context); + setState(() { + print(clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString()); + dropdownTitle = clincs.clinicDescription; + dropdownValue = + clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); + if (dropdownValue == "253-false-0-0") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else if (!isDentalSelectedAndSupported() && !nearestAppo) { + projectDropdownValue = ""; + getDoctorsList(context); + } else { + print("Dental"); + } + }); + }); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 8), + child: Row( children: [ - Text( - TranslationBase - .of(context) - .selectClinic, - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), - ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - onTap: () { - print("Clicked"); - }, - key: clinicDropdownKey, - hint: new Text( - TranslationBase - .of(context) - .selectClinic, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectClinic, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), ), - value: dropdownValue, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString() + - "-" + - item.isLiveCareClinicAndOnline.toString() + - "-" + - item.liveCareClinicID.toString() + - "-" + - item.liveCareServiceID.toString(), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(item.clinicDescription), - item.isLiveCareClinicAndOnline - ? SvgPicture.asset('assets/images/new-design/video_icon_green_right.svg', height: 12, width: 12, fit: BoxFit.cover) - : Container(), - ]), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - print(newValue); - dropdownValue = newValue; - if (dropdownValue == "253-false-0-0") { - Navigator.push(context, FadePage(page: LaserClinic())); - } else - if (!isDentalSelectedAndSupported() && !nearestAppo) { - projectDropdownValue = ""; - getDoctorsList(context); - } else { - print("Dental"); - } - }); - }, - ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 2), + child: Text( + dropdownTitle, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + ), + ], ), ), + Icon(Icons.keyboard_arrow_down), ], ), ), - Icon(Icons.keyboard_arrow_down), - ], - ), - ), - ), + ), mHeight(20), isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded) ? InkWell( - onTap: () { - openDropdown(projectDropdownKey); - }, - child: Container( - width: double.infinity, - decoration: containerRadius(Colors.white, 12), - margin: EdgeInsets.only(left: 20, right: 20), - padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), - child: Row( - children: [ - Flexible( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + onTap: () { + openDropdown(projectDropdownKey); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( children: [ - Text( - TranslationBase.of(context).selectHospital, - style: TextStyle( - fontSize: 11, - letterSpacing: -0.44, - fontWeight: FontWeight.w600, - ), - ), - Container( - height: 18, - child: DropdownButtonHideUnderline( - child: DropdownButton( - key: projectDropdownKey, - hint: new Text(TranslationBase.of(context).selectHospital), - value: projectDropdownValue, - iconSize: 0, - isExpanded: true, - style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), - items: projectsList.map((item) { - return new DropdownMenuItem( - value: item.mainProjectID.toString(), - child: new Text(item.name), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - projectDropdownValue = newValue; - getDoctorsList(context); - }); - }, - ), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + child: DropdownButtonHideUnderline( + child: DropdownButton( + key: projectDropdownKey, + hint: new Text(TranslationBase.of(context).selectHospital), + value: projectDropdownValue, + iconSize: 0, + isExpanded: true, + style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black), + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString(), + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + getDoctorsList(context); + }); + }, + ), + ), + ), + ], ), ), + Icon(Icons.keyboard_arrow_down), ], - ), - ), - Icon(Icons.keyboard_arrow_down), - ], - )), - ) + )), + ) : Container(), ], ), @@ -612,7 +572,7 @@ class _SearchByClinicState extends State { List doctorByHospital = _patientDoctorAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, - ) + ) .toList(); if (doctorByHospital.length != 0) { diff --git a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart new file mode 100644 index 00000000..96bf9492 --- /dev/null +++ b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart @@ -0,0 +1,127 @@ +import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:progress_hud_v2/generated/i18n.dart'; + +showClickListDialog(BuildContext context, List clinicsList, {Function(ListClinicCentralized) onSelection}) { + showDialog( + context: context, + builder: (BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.0), + ), //this right here + child: Container( + width: double.infinity, + // width: MediaQuery.of(context).size.width - 10, + height: MediaQuery.of(context).size.height - 80, + child: ClickListDialog( + clinicsList: clinicsList, + onSelection: onSelection, + ), + ), + ); + }, + ); +} + +class ClickListDialog extends StatefulWidget { + List clinicsList; + Function(ListClinicCentralized) onSelection; + + ClickListDialog({this.clinicsList, this.onSelection}); + + @override + _ClickListDialogState createState() => _ClickListDialogState(); +} + +class _ClickListDialogState extends State { + TextEditingController controller = new TextEditingController(); + List tempClinicsList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + addAllData(); + } + + addAllData() { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + tempClinicsList.add(widget.clinicsList[i]); + } + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: TextField( + controller: controller, + onChanged: (v) { + if (v.length > 0) { + tempClinicsList.clear(); + for (int i = 0; i < widget.clinicsList.length; i++) { + if (widget.clinicsList[i].clinicDescription.toLowerCase().contains(v.toLowerCase())) { + tempClinicsList.add(widget.clinicsList[i]); + } + } + } else { + addAllData(); + } + setState(() {}); + }, + decoration: InputDecoration( + hintStyle: TextStyle(fontSize: 17), + hintText: 'Search Clinic', + suffixIcon: Icon(Icons.search), + border: InputBorder.none, + contentPadding: EdgeInsets.all(12), + ), + ), + ), + Expanded( + child: ListView.separated( + padding: EdgeInsets.all(12), + itemBuilder: (context, index) { + return InkWell( + onTap: () { + widget.onSelection(tempClinicsList[index]); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: Text(tempClinicsList[index].clinicDescription.trim())), + tempClinicsList[index].isLiveCareClinicAndOnline + ? SvgPicture.asset( + 'assets/images/new-design/video_icon_green_right.svg', + height: 12, + width: 12, + fit: BoxFit.cover, + ) + : Container(), + ], + ), + ), + ); + }, + itemCount: tempClinicsList.length, + separatorBuilder: (BuildContext context, int index) { + return mHeight(8); + }, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 1e2e48df..7ebc26ca 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -54,9 +53,19 @@ class DoctorView extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - doctor.name, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + children: [ + Expanded( + child: Text( + doctor.name, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), Row( diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 43038658..6fcab59a 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -14,13 +14,15 @@ Future> requestPermissions() async { } showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { if (await Permission.calendar.request().isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } else { requestPermissions().then((results) { if (results[Permission.calendar].isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } }); } @@ -29,7 +31,7 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S final CalendarPlugin _myPlugin = CalendarPlugin(); Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -41,31 +43,35 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String onClick: (int i) async { if (i == 0) { // Before 30 mints - dateTime = Jiffy(dateTime).subtract(minutes: 30); + dateTime = Jiffy(dateTime).subtract(minutes: 30).dateTime; // dateTime.add(new Duration(minutes: -30)); } else if (i == 1) { // Before 1 hour // dateTime.add(new Duration(minutes: -60)); - dateTime = Jiffy(dateTime).subtract(hours: 1); + dateTime = Jiffy(dateTime).subtract(hours: 1).dateTime; } else if (i == 2) { // Before 1 hour and 30 mints // dateTime.add(new Duration(minutes: -90)); - dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30); + dateTime = Jiffy(dateTime).subtract(hours: 1, minutes: 30).dateTime; } else if (i == 3) { // Before 2 hours // dateTime.add(new Duration(minutes: -120)); - dateTime = Jiffy(dateTime).subtract(hours: 2); + dateTime = Jiffy(dateTime).subtract(hours: 2).dateTime; } - CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - calendarUtils - .createOrUpdateEvent( - title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, - description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, - scheduleDateTime: dateTime, - eventId: eventId) - .then((value) {}); + if (onMultiDateSuccess == null) { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + calendarUtils + .createOrUpdateEvent( + title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, + description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + scheduleDateTime: dateTime, + eventId: eventId) + .then((value) {}); - onSuccess(); + onSuccess(); + } else { + onMultiDateSuccess(i); + } }, ), ); @@ -144,12 +150,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder30, + Text( + TranslationBase.of(context).appoReminder30, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -163,12 +171,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder60, + Text( + TranslationBase.of(context).appoReminder60, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -182,12 +192,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder90, + Text( + TranslationBase.of(context).appoReminder90, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart index fa526360..0711fa85 100644 --- a/lib/pages/ChildVaccines/add_newchild_page.dart +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -300,7 +300,7 @@ class _AddNewChildPageState extends State { void confirmSelectDayDialog() { showDialog( context: context, - child: DayCheckBoxDialog( + builder: (cxt) => DayCheckBoxDialog( title: 'Select Day', selectedDaysOfWeek: widget.daysOfWeek, onValueSelected: (value) { diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart index 45a63414..9aa7b6c0 100644 --- a/lib/pages/ChildVaccines/vaccinationtable_page.dart +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -145,7 +145,7 @@ class VaccinationTablePage extends StatelessWidget { //=============== showDialog( context: context, - child: SelectGenderDialog( + builder: (cxt) => SelectGenderDialog( okFunction: () async { await model.getCreateVaccinationTable(babyInfo, true); if (model.state == ViewState.Idle) { diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index f3658fae..54ca8ce7 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -595,7 +595,7 @@ class _MyFamily extends State with TickerProviderStateMixin { deleteFamily(family, context) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).removeFamilyMember, onTap: () { removeFamily(family, context); diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 4e249e53..ed31b3fc 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -1,9 +1,6 @@ import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.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/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; @@ -17,9 +14,7 @@ class NotificationsDetailsPage extends StatelessWidget { DateTime d = DateUtil.convertStringToDate(date); String monthName = DateUtil.getMonth(d.month).toString(); TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); - String minute = timeOfDay.minute < 10 - ? timeOfDay.minute.toString().padLeft(2, '0') - : timeOfDay.minute.toString(); + String minute = timeOfDay.minute < 10 ? timeOfDay.minute.toString().padLeft(2, '0') : timeOfDay.minute.toString(); String hour = '${timeOfDay.hourOfPeriod}:$minute'; if (timeOfDay.period == DayPeriod.am) { @@ -39,67 +34,50 @@ class NotificationsDetailsPage extends StatelessWidget { showNewAppBar: true, showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).notificationDetails, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 25, - ), - Container( - width: double.infinity, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + " " + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), - style: TextStyle( - fontSize: 18.0, - color: Colors.black, - fontWeight: FontWeight.w600 - ), - ), - ), - ), - SizedBox( - height: 15, - ), - if (notification.messageTypeData.length != 0) - FractionallySizedBox( - widthFactor: 0.9, - child: Image.network(notification.messageTypeData, - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent loadingProgress) { - if (loadingProgress == null) return child; - return Center( - child: SizedBox( - width: 40.0, - height: 40.0, - child: AppCircularProgressIndicator(), - ), - ); - }, - fit: BoxFit - .fill) //Image.network(notification.messageTypeData), - ), - SizedBox( - height: 15, - ), - Row( - children: [ - Expanded( - child: Center( - child: Text(notification.message), - ), - ), - ], + body: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) + + " " + + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + + if (notification.messageTypeData.length != 0) + Padding( + padding: const EdgeInsets.only(top: 18), + child: Image.network(notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator(), ), - ], - ), + ); + }, fit: BoxFit.fill), + ), + + SizedBox(height: 18), + Text( + notification.message.trim(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, ), ), - ), + + ], + ), ); } } diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index fc34dbfe..7c86ebf5 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -8,7 +8,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -36,6 +35,7 @@ class NotificationsPage extends StatelessWidget { appBarTitle: TranslationBase.of(context).notifications, baseViewModel: model, body: ListView.separated( + physics: BouncingScrollPhysics(), itemBuilder: (context, index) { if (index == model.notifications.length) { return InkWell( @@ -47,87 +47,90 @@ class NotificationsPage extends StatelessWidget { await model.getNotifications(getNotificationsRequestModel, context); GifLoaderDialogUtils.hideDialog(context); }, - child: Center( + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12), 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)), + size: 24, ), + SizedBox(width: 8), + Text(TranslationBase.of(context).moreNotifications, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.42, decoration: TextDecoration.underline)), ], ), ), ); } - return InkWell( onTap: () async { if (!model.notifications[index].isRead) { model.markAsRead(model.notifications[index].id); } Navigator.push( - context, - FadePage( - page: NotificationsDetailsPage( + context, + FadePage( + page: NotificationsDetailsPage( notification: model.notifications[index], - ))); + ), + ), + ); }, child: Container( width: double.infinity, - padding: EdgeInsets.all(8.0), + padding: EdgeInsets.fromLTRB(15.0, 14, 21, 12), decoration: BoxDecoration( color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor.withOpacity(0.05), border: projectViewModel.isArabic ? Border( right: BorderSide( color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, - width: 5.0, + width: 6.0, ), ) : Border( left: BorderSide( color: model.notifications[index].isRead ? Theme.of(context).scaffoldBackgroundColor : CustomColors.accentColor, - width: 5.0, + width: 6.0, ), ), ), - child: Row( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) + + Row( + children: [ + Expanded( + child: Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(model.notifications[index].createdOn)) + " " + - DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false)), - SizedBox( - height: 5, + DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(model.notifications[index].createdOn), false), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, ), - Row( - children: [ - Expanded(child: Texts(model.notifications[index].message)), - if (model.notifications[index].messageType == "image") - Icon( - FontAwesomeIcons.images, - color: CustomColors.grey, - ) - ], - ), - SizedBox( - height: 5, - ), - ], + ), ), + if (model.notifications[index].messageType == "image") + Icon( + FontAwesomeIcons.image, + color: Color(0xffC9C9C9), + ) + ], + ), + SizedBox(height: 4), + Text( + model.notifications[index].message.trim(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, ), ), ], @@ -139,8 +142,9 @@ class NotificationsPage extends StatelessWidget { return Column( children: [ Divider( - color: Colors.grey[300], + color: Color(0xffEFEFEF), thickness: 2.0, + height: 1, ), ], ); diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart index f9b2b190..aaba5d2a 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/AmbulanceRequestIndex.dart @@ -376,7 +376,7 @@ class _AmbulanceRequestIndexPageState extends State { void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).cancelOrderMsg, onTap: () { Future.delayed(new Duration(milliseconds: 300)).then((value) async { diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index 0e63bf76..67d2f979 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -54,7 +54,7 @@ class _PickupLocationState extends State { } _getCurrentLocation() async { - await getLastKnownPosition().then((value) { + await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; _longitude = value.longitude; }).catchError((e) { @@ -561,7 +561,7 @@ class _PickupLocationState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedHospitalIndex, isScrollable: true, diff --git a/lib/pages/ErService/OrderLogPage.dart b/lib/pages/ErService/OrderLogPage.dart index fb8de6d9..e98b41c0 100644 --- a/lib/pages/ErService/OrderLogPage.dart +++ b/lib/pages/ErService/OrderLogPage.dart @@ -26,7 +26,7 @@ class OrderLogPage extends StatelessWidget { void showConfirmMessage(AmRequestViewModel model, int presOrderID, BuildContext context) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).cancelOrderMsg, onTap: () { Future.delayed(new Duration(milliseconds: 300)).then((value) async { diff --git a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart index 9d9ca428..b64c0fbf 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-pickup-address-page.dart @@ -267,7 +267,7 @@ class RRTRequestPickupAddressPageState extends State addresses) { showDialog( context: context, - child: SelectLocationDialog( + builder: (cxt) => SelectLocationDialog( addresses: addresses, selectedAddress: selectedAddress, onValueSelected: (value) { diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index acfe444f..fcf1b6f0 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; @@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAl import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; @@ -57,6 +59,7 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + ToDoCountProviderModel model = Provider.of(context); var size = MediaQuery.of(context).size; final double itemHeight = projectViewModel.isArabic ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; @@ -72,7 +75,7 @@ class _AppointmentActionsState extends State { onTap: shouldEnable ? null : () { - _handleButtonClicks(appoButtonsList[index]); + _handleButtonClicks(appoButtonsList[index], model); }, child: MedicalProfileItem( title: appoButtonsList[index].title, @@ -88,7 +91,7 @@ class _AppointmentActionsState extends State { ); } - _handleButtonClicks(AppoDetailsButton) { + _handleButtonClicks(AppoDetailsButton, ToDoCountProviderModel model) { switch (AppoDetailsButton.caller) { case "openReschedule": widget.tabController.animateTo((widget.tabController.index + 1) % 2); @@ -113,7 +116,8 @@ class _AppointmentActionsState extends State { ); break; case "goToTodoList": - Navigator.of(context).pop(); + // Navigator.of(context).pop(); + navigateToToDoPage(context, model); break; case "askDoc": askYourDoc(); @@ -556,6 +560,18 @@ class _AppointmentActionsState extends State { ))); } + navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { + if (widget.projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } + } + rateAppointment() { widget.browser = new MyInAppBrowser(); var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart index 9a315bba..a3460b24 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog_prescription.dart @@ -33,7 +33,6 @@ class PrescriptionReminderDialog extends StatefulWidget { } class _ReminderDialogState extends State { - final CalendarPlugin _myPlugin = CalendarPlugin(); @override Widget build(BuildContext context) { diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index 7a0bdc2e..3e22494e 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -6,7 +6,6 @@ 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:flutter_datetime_picker/flutter_datetime_picker.dart'; class PaymentDialog extends StatefulWidget { AppoitmentAllHistoryResultList appo; @@ -23,96 +22,90 @@ class PaymentDialog extends StatefulWidget { class _PaymentDialogState extends State { @override Widget build(BuildContext context) { - return Container( - child: Dialog( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), - child: Container( - height: 550.0, - width: 450.0, - child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text(TranslationBase.of(context).invoiceDetails, style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w600)), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), - child: Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Colors.black, fontSize: 15.0, fontWeight: FontWeight.w600)), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), - child: Text(getDate(widget.appo.appointmentDate), style: getTextStyle()), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 0.0), - child: Text(widget.appo.projectName, style: getTextStyle()), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), - child: Table( - children: [ - TableRow(decoration: BoxDecoration(), children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), - TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())), - ]), - TableRow(children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), - TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())), - ]), - TableRow(children: [ - TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), - TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())), - ]), - ], - ), - ), - Divider( - color: Colors.grey, - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 5.0), - child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)), + return Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + //height: 550.0, + width: 450.0, + padding: EdgeInsets.all(21), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + Text( + TranslationBase.of(context).invoiceDetails, + style: TextStyle( + fontSize: 24.0, + fontWeight: FontWeight.w600, + letterSpacing: -1.14, + color: Color(0xff2B353E), ), - Container(margin: EdgeInsets.fromLTRB(20.0, 5.0, 20.0, 5.0), child: getPaymentMethods()), - Container( - margin: EdgeInsets.fromLTRB(20.0, 30.0, 20.0, 15.0), - child: Text(TranslationBase.of(context).appoPaymentConfirm, style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor, fontWeight: FontWeight.w600)), + ), + Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Color(0xff2E303A), fontSize: 16.0, fontWeight: FontWeight.w600,letterSpacing: -0.64)), + Text(getDate(widget.appo.appointmentDate), style: getTextStyle()), + Text(widget.appo.projectName, style: getTextStyle()), + Divider( + color: Colors.grey, + ), + Table( + children: [ + TableRow(decoration: BoxDecoration(), children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())), + ]), + TableRow(children: [ + TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)), + TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())), + ]), + ], + ), + Divider(color: Colors.grey), + Text( + TranslationBase.of(context).YouCanPayByTheFollowingOptions, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), ), - Container( - alignment: Alignment.center, - height: 40.0, - margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 20.0), - child: Flex( - direction: Axis.horizontal, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).cancel_nocaps, - () { - Navigator.pop(context, null); - }, - color: CustomColors.accentColor, - textColor: Colors.white, - ), + ), + getPaymentMethods(), + SizedBox(height: 12), + Text( + TranslationBase.of(context).appoPaymentConfirm, + style: TextStyle(fontSize: 14.0, color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.56), + ), + SizedBox(height: 12), + Container( + alignment: Alignment.center, + child: Row( + // direction: Axis.horizontal, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel_nocaps, + () { + Navigator.pop(context, null); + }, + color: CustomColors.accentColor, + textColor: Colors.white, ), - mWidth(10.0), - Expanded( - child: DefaultButton( - TranslationBase.of(context).confirm, - () { - Navigator.pop(context, widget.patientShareResponse); - }, - color: CustomColors.green, - textColor: Colors.white, - ), + ), + mWidth(10.0), + Expanded( + child: DefaultButton( + TranslationBase.of(context).confirm, + () { + Navigator.pop(context, widget.patientShareResponse); + }, + color: CustomColors.green, + textColor: Colors.white, ), - ], - ), + ), + ], ), - ]), - ), + ), + ]), ), ); } @@ -120,21 +113,17 @@ class _PaymentDialogState extends State { _getNormalText(text) { return Container( margin: EdgeInsets.only(top: 10.0, right: 10.0), - child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Colors.black)), + child: Text(text, style: TextStyle(fontSize: 13, letterSpacing: 0.5, color: Color(0xff2E303A))), ); } TextStyle getTextStyle() { - return TextStyle(color: Colors.grey[700], fontSize: 13.0, fontWeight: FontWeight.w600); + return TextStyle(color: Color(0xff575757), fontSize: 13.0, fontWeight: FontWeight.w600); } String getDate(String date) { DateTime dateObj = DateUtil.convertStringToDate(date); - return DateUtil.getDayMonthYearDateFormatted(dateObj) + - " " + - dateObj.hour.toString() + - ":" + - getMinute(dateObj); + return DateUtil.getDayMonthYearDateFormatted(dateObj) + " " + dateObj.hour.toString() + ":" + getMinute(dateObj); } String getMinute(DateTime dateObj) { diff --git a/lib/pages/conference/conference_page.dart b/lib/pages/conference/conference_page.dart index dc00bf6e..3e5ebe41 100644 --- a/lib/pages/conference/conference_page.dart +++ b/lib/pages/conference/conference_page.dart @@ -1,388 +1,390 @@ -import 'dart:async'; - -import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; -import 'package:diplomaticquarterapp/pages/conference/conference_button_bar.dart'; -import 'package:diplomaticquarterapp/pages/conference/conference_room.dart'; -import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart'; -import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/platform_alert_dialog.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:wakelock/wakelock.dart'; - -class ConferencePage extends StatefulWidget { - final RoomModel roomModel; - - const ConferencePage({Key key, this.roomModel}) : super(key: key); - - @override - _ConferencePageState createState() => _ConferencePageState(); -} - -class _ConferencePageState extends State { - final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); - final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); - ConferenceRoom _conferenceRoom; - StreamSubscription _onConferenceRoomException; - - @override - void initState() { - super.initState(); - _lockInPortrait(); - _connectToRoom(); - _wakeLock(true); - } - - void _connectToRoom() async { - try { - final conferenceRoom = ConferenceRoom( - name: widget.roomModel.name, - token: widget.roomModel.token, - identity: widget.roomModel.identity, - ); - await conferenceRoom.connect(); - setState(() { - _conferenceRoom = conferenceRoom; - _onConferenceRoomException = _conferenceRoom.onException.listen((err) async { - await PlatformAlertDialog( - title: err is PlatformException ? err.message : 'An error occured', - content: err is PlatformException ? err.details : err.toString(), - defaultActionText: 'OK', - ).show(context); - }); - _conferenceRoom.addListener(_conferenceRoomUpdated); - }); - } catch (err) { - print(err); - await PlatformAlertDialog( - title: err is PlatformException ? err.message : 'An error occured', - content: err is PlatformException ? err.details : err.toString(), - defaultActionText: 'OK', - ).show(context); - - Navigator.of(context).pop(); - } - } - - Future _lockInPortrait() async { - await SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp, - DeviceOrientation.portraitDown, - ]); - } - - @override - void dispose() { - _freePortraitLock(); - _wakeLock(false); - _disposeStreamsAndSubscriptions(); - if (_conferenceRoom != null) _conferenceRoom.removeListener(_conferenceRoomUpdated); - super.dispose(); - } - - Future _freePortraitLock() async { - await SystemChrome.setPreferredOrientations([ - DeviceOrientation.landscapeRight, - DeviceOrientation.landscapeLeft, - DeviceOrientation.portraitUp, - DeviceOrientation.portraitDown, - ]); - } - - Future _disposeStreamsAndSubscriptions() async { - if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); - if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); - if (_onConferenceRoomException != null) await _onConferenceRoomException.cancel(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async => false, - child: Scaffold( - backgroundColor: Colors.white, - body: _conferenceRoom == null ? showProgress() : buildLayout(), - ), - ); - } - - LayoutBuilder buildLayout() { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - children: [ - _buildParticipants(context, constraints.biggest, _conferenceRoom), - ConferenceButtonBar( - audioEnabled: _conferenceRoom.onAudioEnabled, - videoEnabled: _conferenceRoom.onVideoEnabled, - onAudioEnabled: _conferenceRoom.toggleAudioEnabled, - onVideoEnabled: _conferenceRoom.toggleVideoEnabled, - onHangup: _onHangup, - onSwitchCamera: _conferenceRoom.switchCamera, - onPersonAdd: _onPersonAdd, - onPersonRemove: _onPersonRemove, - onHeight: _onHeightBar, - onShow: _onShowBar, - onHide: _onHideBar, - ), - ], - ); - }, - ); - } - - Widget showProgress() { - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center(child: CircularProgressIndicator()), - SizedBox( - height: 10, - ), - Text( - 'Connecting to the call...', - style: TextStyle(color: Colors.white), - ), - ], - ); - } - - Future _onHangup() async { - print('onHangup'); - await _conferenceRoom.disconnect(); - Navigator.of(context).pop(); - } - - void _onPersonAdd() { - print('onPersonAdd'); - try { - _conferenceRoom.addDummy( - child: Stack( - children: [ - const Placeholder(), - Center( - child: Text( - (_conferenceRoom.participants.length + 1).toString(), - style: const TextStyle( - shadows: [ - Shadow( - blurRadius: 3.0, - color: Color.fromARGB(255, 0, 0, 0), - ), - Shadow( - blurRadius: 8.0, - color: Color.fromARGB(255, 255, 255, 255), - ), - ], - fontSize: 80, - ), - ), - ), - ], - ), - ); - } on PlatformException catch (err) { - PlatformAlertDialog( - title: err.message, - content: err.details, - defaultActionText: 'OK', - ).show(context); - } - } - - void _onPersonRemove() { - print('onPersonRemove'); - _conferenceRoom.removeDummy(); - } - - Widget _buildParticipants(BuildContext context, Size size, ConferenceRoom conferenceRoom) { - final children = []; - final length = conferenceRoom.participants.length; - - if (length <= 2) { - _buildOverlayLayout(context, size, children); - return Stack(children: children); - } - - void buildInCols(bool removeLocalBeforeChunking, bool moveLastOfEachRowToNextRow, int columns) { - _buildLayoutInGrid( - context, - size, - children, - removeLocalBeforeChunking: removeLocalBeforeChunking, - moveLastOfEachRowToNextRow: moveLastOfEachRowToNextRow, - columns: columns, - ); - } - -// if (length <= 3) { -// buildInCols(true, false, 1); -// } else if (length == 5) { -// buildInCols(false, true, 2); -// } else if (length <= 6 || length == 8) { -// buildInCols(false, false, 2); -// } else if (length == 7 || length == 9) { -// buildInCols(true, false, 2); -// } else if (length == 10) { -// buildInCols(false, true, 3); -// } else if (length == 13 || length == 16) { -// buildInCols(true, false, 3); -// } else if (length <= 18) { -// buildInCols(false, false, 3); -// } - - return Column( - children: children, - ); - } - - void _buildOverlayLayout(BuildContext context, Size size, List children) { - final participants = _conferenceRoom.participants; - if (participants.length == 1) { - children.add(_buildNoiseBox()); - } else { - final remoteParticipant = participants.firstWhere((ParticipantWidget participant) => participant.isRemote, orElse: () => null); - if (remoteParticipant != null) { - children.add(remoteParticipant); - } - } - - final localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null); - if (localParticipant != null) { - children.add(DraggablePublisher( - key: Key('publisher'), - child: localParticipant, - availableScreenSize: size, - onButtonBarVisible: _onButtonBarVisibleStreamController.stream, - onButtonBarHeight: _onButtonBarHeightStreamController.stream, - )); - } - } - - void _buildLayoutInGrid( - BuildContext context, - Size size, - List children, { - bool removeLocalBeforeChunking = false, - bool moveLastOfEachRowToNextRow = false, - int columns = 2, - }) { - final participants = _conferenceRoom.participants; - ParticipantWidget localParticipant; - if (removeLocalBeforeChunking) { - localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null); - if (localParticipant != null) { - participants.remove(localParticipant); - } - } - final chunkedParticipants = chunk(array: participants, size: columns); - if (localParticipant != null) { - chunkedParticipants.last.add(localParticipant); - participants.add(localParticipant); - } - - if (moveLastOfEachRowToNextRow) { - for (var i = 0; i < chunkedParticipants.length - 1; i++) { - var participant = chunkedParticipants[i].removeLast(); - chunkedParticipants[i + 1].insert(0, participant); - } - } - - for (final participantChunk in chunkedParticipants) { - final rowChildren = []; - for (final participant in participantChunk) { - rowChildren.add( - Container( - width: size.width / participantChunk.length, - height: size.height / chunkedParticipants.length, - child: participant, - ), - ); - } - children.add( - Container( - height: size.height / chunkedParticipants.length, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: rowChildren, - ), - ), - ); - } - } - - NoiseBox _buildNoiseBox() { - return NoiseBox( - density: NoiseBoxDensity.xLow, - backgroundColor: Colors.grey.shade900, - child: Center( - child: Container( - color: Colors.black54, - width: double.infinity, - height: 40, - child: Center( - child: Text( - 'Waiting for another participant to connect to the call...', - key: Key('text-wait'), - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), - ), - ), - ), - ); - } - - List> chunk({@required List array, @required int size}) { - final result = >[]; - if (array.isEmpty || size <= 0) { - return result; - } - var first = 0; - var last = size; - final totalLoop = array.length % size == 0 ? array.length ~/ size : array.length ~/ size + 1; - for (var i = 0; i < totalLoop; i++) { - if (last > array.length) { - result.add(array.sublist(first, array.length)); - } else { - result.add(array.sublist(first, last)); - } - first = last; - last = last + size; - } - return result; - } - - void _onHeightBar(double height) { - _onButtonBarHeightStreamController.add(height); - } - - void _onShowBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); - }); - _onButtonBarVisibleStreamController.add(true); - } - - void _onHideBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); - }); - _onButtonBarVisibleStreamController.add(false); - } - - Future _wakeLock(bool enable) async { - try { - return await (enable ? Wakelock.enable() : Wakelock.disable()); - } catch (err) { - print('Unable to change the Wakelock and set it to $enable'); - print(err); - } - } - - void _conferenceRoomUpdated() { - setState(() {}); - } -} +// import 'dart:async'; +// +// import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; +// import 'package:diplomaticquarterapp/pages/conference/conference_button_bar.dart'; +// import 'package:diplomaticquarterapp/pages/conference/conference_room.dart'; +// import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +// import 'package:diplomaticquarterapp/pages/conference/draggable_publisher.dart'; +// import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/platform_alert_dialog.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// import 'package:wakelock/wakelock.dart'; +// +// class ConferencePage extends StatefulWidget { +// final RoomModel roomModel; +// +// const ConferencePage({Key key, this.roomModel}) : super(key: key); +// +// @override +// _ConferencePageState createState() => _ConferencePageState(); +// } +// +// class _ConferencePageState extends State { +// final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); +// final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); +// // ConferenceRoom _conferenceRoom; +// StreamSubscription _onConferenceRoomException; +// +// @override +// void initState() { +// super.initState(); +// _lockInPortrait(); +// _connectToRoom(); +// _wakeLock(true); +// } +// +// void _connectToRoom() async { +// try { +// final conferenceRoom = ConferenceRoom( +// name: widget.roomModel.name, +// token: widget.roomModel.token, +// identity: widget.roomModel.identity, +// ); +// await conferenceRoom.connect(); +// setState(() { +// _conferenceRoom = conferenceRoom; +// _onConferenceRoomException = _conferenceRoom.onException.listen((err) async { +// await PlatformAlertDialog( +// title: err is PlatformException ? err.message : 'An error occured', +// content: err is PlatformException ? err.details : err.toString(), +// defaultActionText: 'OK', +// ).show(context); +// }); +// _conferenceRoom.addListener(_conferenceRoomUpdated); +// }); +// } catch (err) { +// print(err); +// await PlatformAlertDialog( +// title: err is PlatformException ? err.message : 'An error occured', +// content: err is PlatformException ? err.details : err.toString(), +// defaultActionText: 'OK', +// ).show(context); +// +// Navigator.of(context).pop(); +// } +// } +// +// Future _lockInPortrait() async { +// await SystemChrome.setPreferredOrientations([ +// DeviceOrientation.portraitUp, +// DeviceOrientation.portraitDown, +// ]); +// } +// +// @override +// void dispose() { +// _freePortraitLock(); +// _wakeLock(false); +// _disposeStreamsAndSubscriptions(); +// if (_conferenceRoom != null) _conferenceRoom.removeListener(_conferenceRoomUpdated); +// super.dispose(); +// } +// +// Future _freePortraitLock() async { +// await SystemChrome.setPreferredOrientations([ +// DeviceOrientation.landscapeRight, +// DeviceOrientation.landscapeLeft, +// DeviceOrientation.portraitUp, +// DeviceOrientation.portraitDown, +// ]); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); +// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); +// if (_onConferenceRoomException != null) await _onConferenceRoomException.cancel(); +// } +// +// @override +// Widget build(BuildContext context) { +// return WillPopScope( +// onWillPop: () async => false, +// child: Scaffold( +// backgroundColor: Colors.white, +// body: _conferenceRoom == null ? showProgress() : buildLayout(), +// ), +// ); +// } +// +// LayoutBuilder buildLayout() { +// return LayoutBuilder( +// builder: (BuildContext context, BoxConstraints constraints) { +// return Stack( +// children: [ +// _buildParticipants(context, constraints.biggest, _conferenceRoom), +// ConferenceButtonBar( +// audioEnabled: _conferenceRoom.onAudioEnabled, +// videoEnabled: _conferenceRoom.onVideoEnabled, +// onAudioEnabled: _conferenceRoom.toggleAudioEnabled, +// onVideoEnabled: _conferenceRoom.toggleVideoEnabled, +// onHangup: _onHangup, +// onSwitchCamera: _conferenceRoom.switchCamera, +// onPersonAdd: _onPersonAdd, +// onPersonRemove: _onPersonRemove, +// onHeight: _onHeightBar, +// onShow: _onShowBar, +// onHide: _onHideBar, +// ), +// ], +// ); +// }, +// ); +// } +// +// Widget showProgress() { +// return Column( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Center(child: CircularProgressIndicator()), +// SizedBox( +// height: 10, +// ), +// Text( +// 'Connecting to the call...', +// style: TextStyle(color: Colors.white), +// ), +// ], +// ); +// } +// +// Future _onHangup() async { +// print('onHangup'); +// await _conferenceRoom.disconnect(); +// LandingPage.isOpenCallPage = false; +// Navigator.of(context).pop(); +// } +// +// void _onPersonAdd() { +// print('onPersonAdd'); +// try { +// _conferenceRoom.addDummy( +// child: Stack( +// children: [ +// const Placeholder(), +// Center( +// child: Text( +// (_conferenceRoom.participants.length + 1).toString(), +// style: const TextStyle( +// shadows: [ +// Shadow( +// blurRadius: 3.0, +// color: Color.fromARGB(255, 0, 0, 0), +// ), +// Shadow( +// blurRadius: 8.0, +// color: Color.fromARGB(255, 255, 255, 255), +// ), +// ], +// fontSize: 80, +// ), +// ), +// ), +// ], +// ), +// ); +// } on PlatformException catch (err) { +// PlatformAlertDialog( +// title: err.message, +// content: err.details, +// defaultActionText: 'OK', +// ).show(context); +// } +// } +// +// void _onPersonRemove() { +// print('onPersonRemove'); +// _conferenceRoom.removeDummy(); +// } +// +// Widget _buildParticipants(BuildContext context, Size size, ConferenceRoom conferenceRoom) { +// final children = []; +// final length = conferenceRoom.participants.length; +// +// if (length <= 2) { +// _buildOverlayLayout(context, size, children); +// return Stack(children: children); +// } +// +// void buildInCols(bool removeLocalBeforeChunking, bool moveLastOfEachRowToNextRow, int columns) { +// _buildLayoutInGrid( +// context, +// size, +// children, +// removeLocalBeforeChunking: removeLocalBeforeChunking, +// moveLastOfEachRowToNextRow: moveLastOfEachRowToNextRow, +// columns: columns, +// ); +// } +// +// // if (length <= 3) { +// // buildInCols(true, false, 1); +// // } else if (length == 5) { +// // buildInCols(false, true, 2); +// // } else if (length <= 6 || length == 8) { +// // buildInCols(false, false, 2); +// // } else if (length == 7 || length == 9) { +// // buildInCols(true, false, 2); +// // } else if (length == 10) { +// // buildInCols(false, true, 3); +// // } else if (length == 13 || length == 16) { +// // buildInCols(true, false, 3); +// // } else if (length <= 18) { +// // buildInCols(false, false, 3); +// // } +// +// return Column( +// children: children, +// ); +// } +// +// void _buildOverlayLayout(BuildContext context, Size size, List children) { +// final participants = _conferenceRoom.participants; +// if (participants.length == 1) { +// children.add(_buildNoiseBox()); +// } else { +// final remoteParticipant = participants.firstWhere((ParticipantWidget participant) => participant.isRemote, orElse: () => null); +// if (remoteParticipant != null) { +// children.add(remoteParticipant); +// } +// } +// +// final localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null); +// if (localParticipant != null) { +// children.add(DraggablePublisher( +// key: Key('publisher'), +// child: localParticipant, +// availableScreenSize: size, +// onButtonBarVisible: _onButtonBarVisibleStreamController.stream, +// onButtonBarHeight: _onButtonBarHeightStreamController.stream, +// )); +// } +// } +// +// void _buildLayoutInGrid( +// BuildContext context, +// Size size, +// List children, { +// bool removeLocalBeforeChunking = false, +// bool moveLastOfEachRowToNextRow = false, +// int columns = 2, +// }) { +// final participants = _conferenceRoom.participants; +// ParticipantWidget localParticipant; +// if (removeLocalBeforeChunking) { +// localParticipant = participants.firstWhere((ParticipantWidget participant) => !participant.isRemote, orElse: () => null); +// if (localParticipant != null) { +// participants.remove(localParticipant); +// } +// } +// final chunkedParticipants = chunk(array: participants, size: columns); +// if (localParticipant != null) { +// chunkedParticipants.last.add(localParticipant); +// participants.add(localParticipant); +// } +// +// if (moveLastOfEachRowToNextRow) { +// for (var i = 0; i < chunkedParticipants.length - 1; i++) { +// var participant = chunkedParticipants[i].removeLast(); +// chunkedParticipants[i + 1].insert(0, participant); +// } +// } +// +// for (final participantChunk in chunkedParticipants) { +// final rowChildren = []; +// for (final participant in participantChunk) { +// rowChildren.add( +// Container( +// width: size.width / participantChunk.length, +// height: size.height / chunkedParticipants.length, +// child: participant, +// ), +// ); +// } +// children.add( +// Container( +// height: size.height / chunkedParticipants.length, +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: rowChildren, +// ), +// ), +// ); +// } +// } +// +// NoiseBox _buildNoiseBox() { +// return NoiseBox( +// density: NoiseBoxDensity.xLow, +// backgroundColor: Colors.grey.shade900, +// child: Center( +// child: Container( +// color: Colors.black54, +// width: double.infinity, +// height: 40, +// child: Center( +// child: Text( +// 'Waiting for another participant to connect to the call...', +// key: Key('text-wait'), +// textAlign: TextAlign.center, +// style: TextStyle(color: Colors.white), +// ), +// ), +// ), +// ), +// ); +// } +// +// List> chunk({@required List array, @required int size}) { +// final result = >[]; +// if (array.isEmpty || size <= 0) { +// return result; +// } +// var first = 0; +// var last = size; +// final totalLoop = array.length % size == 0 ? array.length ~/ size : array.length ~/ size + 1; +// for (var i = 0; i < totalLoop; i++) { +// if (last > array.length) { +// result.add(array.sublist(first, array.length)); +// } else { +// result.add(array.sublist(first, last)); +// } +// first = last; +// last = last + size; +// } +// return result; +// } +// +// void _onHeightBar(double height) { +// _onButtonBarHeightStreamController.add(height); +// } +// +// void _onShowBar() { +// setState(() { +// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); +// }); +// _onButtonBarVisibleStreamController.add(true); +// } +// +// void _onHideBar() { +// setState(() { +// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); +// }); +// _onButtonBarVisibleStreamController.add(false); +// } +// +// Future _wakeLock(bool enable) async { +// try { +// return await (enable ? Wakelock.enable() : Wakelock.disable()); +// } catch (err) { +// print('Unable to change the Wakelock and set it to $enable'); +// print(err); +// } +// } +// +// void _conferenceRoomUpdated() { +// setState(() {}); +// } +// } diff --git a/lib/pages/conference/conference_room.dart b/lib/pages/conference/conference_room.dart index 9c8c1c9a..b68f8ee8 100644 --- a/lib/pages/conference/conference_room.dart +++ b/lib/pages/conference/conference_room.dart @@ -1,530 +1,529 @@ -import 'dart:async'; -import 'dart:typed_data'; - -import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:twilio_programmable_video/twilio_programmable_video.dart'; - -class ConferenceRoom with ChangeNotifier { - final String name; - final String token; - final String identity; - - final StreamController _onAudioEnabledStreamController = StreamController.broadcast(); - Stream onAudioEnabled; - final StreamController _onVideoEnabledStreamController = StreamController.broadcast(); - Stream onVideoEnabled; - final StreamController _onExceptionStreamController = StreamController.broadcast(); - Stream onException; - - final Completer _completer = Completer(); - - final List _participants = []; - final List _participantBuffer = []; - final List _streamSubscriptions = []; - final List _dataTracks = []; - final List _messages = []; - - CameraCapturer _cameraCapturer; - Room _room; - Timer _timer; - - ConferenceRoom({ - @required this.name, - @required this.token, - @required this.identity, - }) { - onAudioEnabled = _onAudioEnabledStreamController.stream; - onVideoEnabled = _onVideoEnabledStreamController.stream; - onException = _onExceptionStreamController.stream; - } - - List get participants { - return [..._participants]; - } - - Future connect() async { - print('ConferenceRoom.connect()'); - try { - await TwilioProgrammableVideo.debug(dart: true, native: true); - await TwilioProgrammableVideo.setSpeakerphoneOn(true); - - _cameraCapturer = CameraCapturer(CameraSource.FRONT_CAMERA); - var connectOptions = ConnectOptions( - token, - roomName: name, - preferredAudioCodecs: [OpusCodec()], - audioTracks: [LocalAudioTrack(true)], - dataTracks: [LocalDataTrack()], - videoTracks: [LocalVideoTrack(true, _cameraCapturer)], - enableDominantSpeaker: true, - ); - - _room = await TwilioProgrammableVideo.connect(connectOptions); - - _streamSubscriptions.add(_room.onConnected.listen(_onConnected)); - _streamSubscriptions.add(_room.onConnectFailure.listen(_onConnectFailure)); - - return _completer.future; - } catch (err) { - print(err); - rethrow; - } - } - - Future disconnect() async { - print('ConferenceRoom.disconnect()'); - if (_timer != null) { - _timer.cancel(); - } - await _room.disconnect(); - } - - @override - void dispose() { - print('ConferenceRoom.dispose()'); - _disposeStreamsAndSubscriptions(); - super.dispose(); - } - - Future _disposeStreamsAndSubscriptions() async { - await _onAudioEnabledStreamController.close(); - await _onVideoEnabledStreamController.close(); - await _onExceptionStreamController.close(); - for (var streamSubscription in _streamSubscriptions) { - await streamSubscription.cancel(); - } - } - - Future sendMessage(String message) async { - final tracks = _room.localParticipant.localDataTracks; - final localDataTrack = tracks.isEmpty ? null : tracks[0].localDataTrack; - if (localDataTrack == null || _messages.isNotEmpty) { - print('ConferenceRoom.sendMessage => Track is not available yet, buffering message.'); - _messages.add(message); - return; - } - await localDataTrack.send(message); - } - - Future sendBufferMessage(ByteBuffer message) async { - final tracks = _room.localParticipant.localDataTracks; - final localDataTrack = tracks.isEmpty ? null : tracks[0].localDataTrack; - if (localDataTrack == null) { - return; - } - await localDataTrack.sendBuffer(message); - } - - Future toggleVideoEnabled() async { - final tracks = _room.localParticipant.localVideoTracks; - final localVideoTrack = tracks.isEmpty ? null : tracks[0].localVideoTrack; - if (localVideoTrack == null) { - print('ConferenceRoom.toggleVideoEnabled() => Track is not available yet!'); - return; - } - await localVideoTrack.enable(!localVideoTrack.isEnabled); - - var index = _participants.indexWhere((ParticipantWidget participant) => !participant.isRemote); - if (index < 0) { - return; - } - var participant = _participants[index]; - _participants.replaceRange( - index, - index + 1, - [ - participant.copyWith(videoEnabled: localVideoTrack.isEnabled), - ], - ); - print('ConferenceRoom.toggleVideoEnabled() => ${localVideoTrack.isEnabled}'); - _onVideoEnabledStreamController.add(localVideoTrack.isEnabled); - notifyListeners(); - } - - Future toggleAudioEnabled() async { - final tracks = _room.localParticipant.localAudioTracks; - final localAudioTrack = tracks.isEmpty ? null : tracks[0].localAudioTrack; - if (localAudioTrack == null) { - print('ConferenceRoom.toggleAudioEnabled() => Track is not available yet!'); - return; - } - await localAudioTrack.enable(!localAudioTrack.isEnabled); - - var index = _participants.indexWhere((ParticipantWidget participant) => !participant.isRemote); - if (index < 0) { - return; - } - var participant = _participants[index]; - _participants.replaceRange( - index, - index + 1, - [ - participant.copyWith(audioEnabled: localAudioTrack.isEnabled), - ], - ); - print('ConferenceRoom.toggleAudioEnabled() => ${localAudioTrack.isEnabled}'); - _onAudioEnabledStreamController.add(localAudioTrack.isEnabled); - notifyListeners(); - } - - Future switchCamera() async { - print('ConferenceRoom.switchCamera()'); - try { - await _cameraCapturer.switchCamera(); - } on FormatException catch (e) { - print( - 'ConferenceRoom.switchCamera() failed because of FormatException with message: ${e.message}', - ); - } - } - - void addDummy({Widget child}) { - print('ConferenceRoom.addDummy()'); - if (_participants.length >= 18) { - throw PlatformException( - code: 'ConferenceRoom.maximumReached', - message: 'Maximum reached', - details: 'Currently the lay-out can only render a maximum of 18 participants', - ); - } - _participants.insert( - 0, - ParticipantWidget( - id: (_participants.length + 1).toString(), - child: child, - isRemote: true, - audioEnabled: true, - videoEnabled: true, - isDummy: true, - ), - ); - notifyListeners(); - } - - void removeDummy() { - print('ConferenceRoom.removeDummy()'); - var dummy = _participants.firstWhere((participant) => participant.isDummy, orElse: () => null); - if (dummy != null) { - _participants.remove(dummy); - notifyListeners(); - } - } - - void _onConnected(Room room) { - print('ConferenceRoom._onConnected => state: ${room.state}'); - - // When connected for the first time, add remote participant listeners - _streamSubscriptions.add(_room.onParticipantConnected.listen(_onParticipantConnected)); - _streamSubscriptions.add(_room.onParticipantDisconnected.listen(_onParticipantDisconnected)); - _streamSubscriptions.add(_room.onDominantSpeakerChange.listen(_onDominantSpeakerChanged)); - // Only add ourselves when connected for the first time too. - _participants.add( - _buildParticipant( - child: room.localParticipant.localVideoTracks[0].localVideoTrack.widget(), - id: identity, - audioEnabled: true, - videoEnabled: true, - ), - ); - for (final remoteParticipant in room.remoteParticipants) { - var participant = _participants.firstWhere((participant) => participant.id == remoteParticipant.sid, orElse: () => null); - if (participant == null) { - print('Adding participant that was already present in the room ${remoteParticipant.sid}, before I connected'); - _addRemoteParticipantListeners(remoteParticipant); - } - } - // We have to listen for the [onDataTrackPublished] event on the [LocalParticipant] in - // order to be able to use the [send] method. - _streamSubscriptions.add(room.localParticipant.onDataTrackPublished.listen(_onLocalDataTrackPublished)); - notifyListeners(); - _completer.complete(room); - - _timer = Timer.periodic(const Duration(minutes: 1), (_) { - // Let's see if we can send some data over the DataTrack API - sendMessage('And another minute has passed since I connected...'); - // Also try the ByteBuffer way of sending data - final list = 'This data has been sent over the ByteBuffer channel of the DataTrack API'.codeUnits; - var bytes = Uint8List.fromList(list); - sendBufferMessage(bytes.buffer); - }); - } - - void _onLocalDataTrackPublished(LocalDataTrackPublishedEvent event) { - // Send buffered messages, if any... - while (_messages.isNotEmpty) { - var message = _messages.removeAt(0); - print('Sending buffered message: $message'); - event.localDataTrackPublication.localDataTrack.send(message); - } - } - - void _onConnectFailure(RoomConnectFailureEvent event) { - print('ConferenceRoom._onConnectFailure: ${event.exception}'); - _completer.completeError(event.exception); - } - - void _onDominantSpeakerChanged(DominantSpeakerChangedEvent event) { - print('ConferenceRoom._onDominantSpeakerChanged: ${event.remoteParticipant.identity}'); - var oldDominantParticipant = _participants.firstWhere((p) => p.isDominant, orElse: () => null); - if (oldDominantParticipant != null) { - var oldDominantParticipantIndex = _participants.indexOf(oldDominantParticipant); - _participants.replaceRange(oldDominantParticipantIndex, oldDominantParticipantIndex + 1, [oldDominantParticipant.copyWith(isDominant: false)]); - } - - var newDominantParticipant = _participants.firstWhere((p) => p.id == event.remoteParticipant.sid); - var newDominantParticipantIndex = _participants.indexOf(newDominantParticipant); - _participants.replaceRange(newDominantParticipantIndex, newDominantParticipantIndex + 1, [newDominantParticipant.copyWith(isDominant: true)]); - notifyListeners(); - } - - void _onParticipantConnected(RoomParticipantConnectedEvent event) { - print('ConferenceRoom._onParticipantConnected, ${event.remoteParticipant.sid}'); - _addRemoteParticipantListeners(event.remoteParticipant); - } - - void _onParticipantDisconnected(RoomParticipantDisconnectedEvent event) { - print('ConferenceRoom._onParticipantDisconnected: ${event.remoteParticipant.sid}'); - _participants.removeWhere((ParticipantWidget p) => p.id == event.remoteParticipant.sid); - notifyListeners(); - } - - ParticipantWidget _buildParticipant({ - @required Widget child, - @required String id, - @required bool audioEnabled, - @required bool videoEnabled, - RemoteParticipant remoteParticipant, - }) { - return ParticipantWidget( - id: remoteParticipant?.sid, - isRemote: remoteParticipant != null, - child: child, - audioEnabled: audioEnabled, - videoEnabled: videoEnabled, - ); - } - - void _addRemoteParticipantListeners(RemoteParticipant remoteParticipant) { - print('ConferenceRoom._addRemoteParticipantListeners() => Adding listeners to remoteParticipant ${remoteParticipant.sid}'); - _streamSubscriptions.add(remoteParticipant.onAudioTrackDisabled.listen(_onAudioTrackDisabled)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackEnabled.listen(_onAudioTrackEnabled)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackPublished.listen(_onAudioTrackPublished)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackSubscribed.listen(_onAudioTrackSubscribed)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackSubscriptionFailed.listen(_onAudioTrackSubscriptionFailed)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackUnpublished.listen(_onAudioTrackUnpublished)); - _streamSubscriptions.add(remoteParticipant.onAudioTrackUnsubscribed.listen(_onAudioTrackUnsubscribed)); - - _streamSubscriptions.add(remoteParticipant.onDataTrackPublished.listen(_onDataTrackPublished)); - _streamSubscriptions.add(remoteParticipant.onDataTrackSubscribed.listen(_onDataTrackSubscribed)); - _streamSubscriptions.add(remoteParticipant.onDataTrackSubscriptionFailed.listen(_onDataTrackSubscriptionFailed)); - _streamSubscriptions.add(remoteParticipant.onDataTrackUnpublished.listen(_onDataTrackUnpublished)); - _streamSubscriptions.add(remoteParticipant.onDataTrackUnsubscribed.listen(_onDataTrackUnsubscribed)); - - _streamSubscriptions.add(remoteParticipant.onVideoTrackDisabled.listen(_onVideoTrackDisabled)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackEnabled.listen(_onVideoTrackEnabled)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackPublished.listen(_onVideoTrackPublished)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackSubscribed.listen(_onVideoTrackSubscribed)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackSubscriptionFailed.listen(_onVideoTrackSubscriptionFailed)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackUnpublished.listen(_onVideoTrackUnpublished)); - _streamSubscriptions.add(remoteParticipant.onVideoTrackUnsubscribed.listen(_onVideoTrackUnsubscribed)); - } - - void _onAudioTrackDisabled(RemoteAudioTrackEvent event) { - print('ConferenceRoom._onAudioTrackDisabled(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}, isEnabled: ${event.remoteAudioTrackPublication.isTrackEnabled}'); - _setRemoteAudioEnabled(event); - } - - void _onAudioTrackEnabled(RemoteAudioTrackEvent event) { - print('ConferenceRoom._onAudioTrackEnabled(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}, isEnabled: ${event.remoteAudioTrackPublication.isTrackEnabled}'); - _setRemoteAudioEnabled(event); - } - - void _onAudioTrackPublished(RemoteAudioTrackEvent event) { - print('ConferenceRoom._onAudioTrackPublished(), ${event.remoteParticipant.sid}}'); - } - - void _onAudioTrackSubscribed(RemoteAudioTrackSubscriptionEvent event) { - print('ConferenceRoom._onAudioTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); - _addOrUpdateParticipant(event); - } - - void _onAudioTrackSubscriptionFailed(RemoteAudioTrackSubscriptionFailedEvent event) { - print('ConferenceRoom._onAudioTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); - _onExceptionStreamController.add( - PlatformException( - code: 'ConferenceRoom.audioTrackSubscriptionFailed', - message: 'AudioTrack Subscription Failed', - details: event.exception.toString(), - ), - ); - } - - void _onAudioTrackUnpublished(RemoteAudioTrackEvent event) { - print('ConferenceRoom._onAudioTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); - } - - void _onAudioTrackUnsubscribed(RemoteAudioTrackSubscriptionEvent event) { - print('ConferenceRoom._onAudioTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrack.sid}'); - } - - void _onDataTrackPublished(RemoteDataTrackEvent event) { - print('ConferenceRoom._onDataTrackPublished(), ${event.remoteParticipant.sid}}'); - } - - void _onDataTrackSubscribed(RemoteDataTrackSubscriptionEvent event) { - print('ConferenceRoom._onDataTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); - final dataTrack = event.remoteDataTrackPublication.remoteDataTrack; - _dataTracks.add(dataTrack); - _streamSubscriptions.add(dataTrack.onMessage.listen(_onMessage)); - _streamSubscriptions.add(dataTrack.onBufferMessage.listen(_onBufferMessage)); - } - - void _onDataTrackSubscriptionFailed(RemoteDataTrackSubscriptionFailedEvent event) { - print('ConferenceRoom._onDataTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); - _onExceptionStreamController.add( - PlatformException( - code: 'ConferenceRoom.dataTrackSubscriptionFailed', - message: 'DataTrack Subscription Failed', - details: event.exception.toString(), - ), - ); - } - - void _onDataTrackUnpublished(RemoteDataTrackEvent event) { - print('ConferenceRoom._onDataTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); - } - - void _onDataTrackUnsubscribed(RemoteDataTrackSubscriptionEvent event) { - print('ConferenceRoom._onDataTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrack.sid}'); - } - - void _onVideoTrackDisabled(RemoteVideoTrackEvent event) { - print('ConferenceRoom._onVideoTrackDisabled(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}, isEnabled: ${event.remoteVideoTrackPublication.isTrackEnabled}'); - _setRemoteVideoEnabled(event); - } - - void _onVideoTrackEnabled(RemoteVideoTrackEvent event) { - print('ConferenceRoom._onVideoTrackEnabled(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}, isEnabled: ${event.remoteVideoTrackPublication.isTrackEnabled}'); - _setRemoteVideoEnabled(event); - } - - void _onVideoTrackPublished(RemoteVideoTrackEvent event) { - print('ConferenceRoom._onVideoTrackPublished(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); - } - - void _onVideoTrackSubscribed(RemoteVideoTrackSubscriptionEvent event) { - print('ConferenceRoom._onVideoTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrack.sid}'); - _addOrUpdateParticipant(event); - } - - void _onVideoTrackSubscriptionFailed(RemoteVideoTrackSubscriptionFailedEvent event) { - print('ConferenceRoom._onVideoTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); - _onExceptionStreamController.add( - PlatformException( - code: 'ConferenceRoom.videoTrackSubscriptionFailed', - message: 'VideoTrack Subscription Failed', - details: event.exception.toString(), - ), - ); - } - - void _onVideoTrackUnpublished(RemoteVideoTrackEvent event) { - print('ConferenceRoom._onVideoTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); - } - - void _onVideoTrackUnsubscribed(RemoteVideoTrackSubscriptionEvent event) { - print('ConferenceRoom._onVideoTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrack.sid}'); - } - - void _onMessage(RemoteDataTrackStringMessageEvent event) { - print('onMessage => ${event.remoteDataTrack.sid}, ${event.message}'); - } - - void _onBufferMessage(RemoteDataTrackBufferMessageEvent event) { - print('onBufferMessage => ${event.remoteDataTrack.sid}, ${String.fromCharCodes(event.message.asUint8List())}'); - } - - void _setRemoteAudioEnabled(RemoteAudioTrackEvent event) { - if (event.remoteAudioTrackPublication == null) { - return; - } - var index = _participants.indexWhere((ParticipantWidget participant) => participant.id == event.remoteParticipant.sid); - if (index < 0) { - return; - } - var participant = _participants[index]; - _participants.replaceRange( - index, - index + 1, - [ - participant.copyWith(audioEnabled: event.remoteAudioTrackPublication.isTrackEnabled), - ], - ); - notifyListeners(); - } - - void _setRemoteVideoEnabled(RemoteVideoTrackEvent event) { - if (event.remoteVideoTrackPublication == null) { - return; - } - var index = _participants.indexWhere((ParticipantWidget participant) => participant.id == event.remoteParticipant.sid); - if (index < 0) { - return; - } - var participant = _participants[index]; - _participants.replaceRange( - index, - index + 1, - [ - participant.copyWith(videoEnabled: event.remoteVideoTrackPublication.isTrackEnabled), - ], - ); - notifyListeners(); - } - - void _addOrUpdateParticipant(RemoteParticipantEvent event) { - print('ConferenceRoom._addOrUpdateParticipant(), ${event.remoteParticipant.sid}'); - final participant = _participants.firstWhere( - (ParticipantWidget participant) => participant.id == event.remoteParticipant.sid, - orElse: () => null, - ); - if (participant != null) { - print('Participant found: ${participant.id}, updating A/V enabled values'); - _setRemoteVideoEnabled(event); - _setRemoteAudioEnabled(event); - } else { - final bufferedParticipant = _participantBuffer.firstWhere( - (ParticipantBuffer participant) => participant.id == event.remoteParticipant.sid, - orElse: () => null, - ); - if (bufferedParticipant != null) { - _participantBuffer.remove(bufferedParticipant); - } else if (event is RemoteAudioTrackEvent) { - print('Audio subscription came first, waiting for the video subscription...'); - _participantBuffer.add( - ParticipantBuffer( - id: event.remoteParticipant.sid, - audioEnabled: event.remoteAudioTrackPublication?.remoteAudioTrack?.isEnabled ?? true, - ), - ); - return; - } - if (event is RemoteVideoTrackSubscriptionEvent) { - print('New participant, adding: ${event.remoteParticipant.sid}'); - _participants.insert( - 0, - _buildParticipant( - child: event.remoteVideoTrack.widget(), - id: event.remoteParticipant.sid, - remoteParticipant: event.remoteParticipant, - audioEnabled: bufferedParticipant?.audioEnabled ?? true, - videoEnabled: event.remoteVideoTrackPublication?.remoteVideoTrack?.isEnabled ?? true, - ), - ); - } - notifyListeners(); - } - } -} +// import 'dart:async'; +// import 'dart:typed_data'; +// +// import 'package:diplomaticquarterapp/pages/conference/participant_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// +// class ConferenceRoom with ChangeNotifier { +// final String name; +// final String token; +// final String identity; +// +// final StreamController _onAudioEnabledStreamController = StreamController.broadcast(); +// Stream onAudioEnabled; +// final StreamController _onVideoEnabledStreamController = StreamController.broadcast(); +// Stream onVideoEnabled; +// final StreamController _onExceptionStreamController = StreamController.broadcast(); +// Stream onException; +// +// final Completer _completer = Completer(); +// +// final List _participants = []; +// final List _participantBuffer = []; +// final List _streamSubscriptions = []; +// final List _dataTracks = []; +// final List _messages = []; +// +// CameraCapturer _cameraCapturer; +// Room _room; +// Timer _timer; +// +// ConferenceRoom({ +// @required this.name, +// @required this.token, +// @required this.identity, +// }) { +// onAudioEnabled = _onAudioEnabledStreamController.stream; +// onVideoEnabled = _onVideoEnabledStreamController.stream; +// onException = _onExceptionStreamController.stream; +// } +// +// List get participants { +// return [..._participants]; +// } +// +// Future connect() async { +// print('ConferenceRoom.connect()'); +// try { +// await TwilioProgrammableVideo.debug(dart: true, native: true); +// await TwilioProgrammableVideo.setSpeakerphoneOn(true); +// +// _cameraCapturer = CameraCapturer(CameraSource.FRONT_CAMERA); +// var connectOptions = ConnectOptions( +// token, +// roomName: name, +// preferredAudioCodecs: [OpusCodec()], +// audioTracks: [LocalAudioTrack(true)], +// dataTracks: [LocalDataTrack()], +// videoTracks: [LocalVideoTrack(true, _cameraCapturer)], +// enableDominantSpeaker: true, +// ); +// +// _room = await TwilioProgrammableVideo.connect(connectOptions); +// +// _streamSubscriptions.add(_room.onConnected.listen(_onConnected)); +// _streamSubscriptions.add(_room.onConnectFailure.listen(_onConnectFailure)); +// +// return _completer.future; +// } catch (err) { +// print(err); +// rethrow; +// } +// } +// +// Future disconnect() async { +// print('ConferenceRoom.disconnect()'); +// if (_timer != null) { +// _timer.cancel(); +// } +// await _room.disconnect(); +// } +// +// @override +// void dispose() { +// print('ConferenceRoom.dispose()'); +// _disposeStreamsAndSubscriptions(); +// super.dispose(); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// await _onAudioEnabledStreamController.close(); +// await _onVideoEnabledStreamController.close(); +// await _onExceptionStreamController.close(); +// for (var streamSubscription in _streamSubscriptions) { +// await streamSubscription.cancel(); +// } +// } +// +// Future sendMessage(String message) async { +// final tracks = _room.localParticipant.localDataTracks; +// final localDataTrack = tracks.isEmpty ? null : tracks[0].localDataTrack; +// if (localDataTrack == null || _messages.isNotEmpty) { +// print('ConferenceRoom.sendMessage => Track is not available yet, buffering message.'); +// _messages.add(message); +// return; +// } +// await localDataTrack.send(message); +// } +// +// Future sendBufferMessage(ByteBuffer message) async { +// final tracks = _room.localParticipant.localDataTracks; +// final localDataTrack = tracks.isEmpty ? null : tracks[0].localDataTrack; +// if (localDataTrack == null) { +// return; +// } +// await localDataTrack.sendBuffer(message); +// } +// +// Future toggleVideoEnabled() async { +// final tracks = _room.localParticipant.localVideoTracks; +// final localVideoTrack = tracks.isEmpty ? null : tracks[0].localVideoTrack; +// if (localVideoTrack == null) { +// print('ConferenceRoom.toggleVideoEnabled() => Track is not available yet!'); +// return; +// } +// await localVideoTrack.enable(!localVideoTrack.isEnabled); +// +// var index = _participants.indexWhere((ParticipantWidget participant) => !participant.isRemote); +// if (index < 0) { +// return; +// } +// var participant = _participants[index]; +// _participants.replaceRange( +// index, +// index + 1, +// [ +// participant.copyWith(videoEnabled: localVideoTrack.isEnabled), +// ], +// ); +// print('ConferenceRoom.toggleVideoEnabled() => ${localVideoTrack.isEnabled}'); +// _onVideoEnabledStreamController.add(localVideoTrack.isEnabled); +// notifyListeners(); +// } +// +// Future toggleAudioEnabled() async { +// final tracks = _room.localParticipant.localAudioTracks; +// final localAudioTrack = tracks.isEmpty ? null : tracks[0].localAudioTrack; +// if (localAudioTrack == null) { +// print('ConferenceRoom.toggleAudioEnabled() => Track is not available yet!'); +// return; +// } +// await localAudioTrack.enable(!localAudioTrack.isEnabled); +// +// var index = _participants.indexWhere((ParticipantWidget participant) => !participant.isRemote); +// if (index < 0) { +// return; +// } +// var participant = _participants[index]; +// _participants.replaceRange( +// index, +// index + 1, +// [ +// participant.copyWith(audioEnabled: localAudioTrack.isEnabled), +// ], +// ); +// print('ConferenceRoom.toggleAudioEnabled() => ${localAudioTrack.isEnabled}'); +// _onAudioEnabledStreamController.add(localAudioTrack.isEnabled); +// notifyListeners(); +// } +// +// Future switchCamera() async { +// print('ConferenceRoom.switchCamera()'); +// try { +// await _cameraCapturer.switchCamera(); +// } on FormatException catch (e) { +// print( +// 'ConferenceRoom.switchCamera() failed because of FormatException with message: ${e.message}', +// ); +// } +// } +// +// void addDummy({Widget child}) { +// print('ConferenceRoom.addDummy()'); +// if (_participants.length >= 18) { +// throw PlatformException( +// code: 'ConferenceRoom.maximumReached', +// message: 'Maximum reached', +// details: 'Currently the lay-out can only render a maximum of 18 participants', +// ); +// } +// _participants.insert( +// 0, +// ParticipantWidget( +// id: (_participants.length + 1).toString(), +// child: child, +// isRemote: true, +// audioEnabled: true, +// videoEnabled: true, +// isDummy: true, +// ), +// ); +// notifyListeners(); +// } +// +// void removeDummy() { +// print('ConferenceRoom.removeDummy()'); +// var dummy = _participants.firstWhere((participant) => participant.isDummy, orElse: () => null); +// if (dummy != null) { +// _participants.remove(dummy); +// notifyListeners(); +// } +// } +// +// void _onConnected(Room room) { +// print('ConferenceRoom._onConnected => state: ${room.state}'); +// +// // When connected for the first time, add remote participant listeners +// _streamSubscriptions.add(_room.onParticipantConnected.listen(_onParticipantConnected)); +// _streamSubscriptions.add(_room.onParticipantDisconnected.listen(_onParticipantDisconnected)); +// _streamSubscriptions.add(_room.onDominantSpeakerChange.listen(_onDominantSpeakerChanged)); +// // Only add ourselves when connected for the first time too. +// _participants.add( +// _buildParticipant( +// child: room.localParticipant.localVideoTracks[0].localVideoTrack.widget(), +// id: identity, +// audioEnabled: true, +// videoEnabled: true, +// ), +// ); +// for (final remoteParticipant in room.remoteParticipants) { +// var participant = _participants.firstWhere((participant) => participant.id == remoteParticipant.sid, orElse: () => null); +// if (participant == null) { +// print('Adding participant that was already present in the room ${remoteParticipant.sid}, before I connected'); +// _addRemoteParticipantListeners(remoteParticipant); +// } +// } +// // We have to listen for the [onDataTrackPublished] event on the [LocalParticipant] in +// // order to be able to use the [send] method. +// _streamSubscriptions.add(room.localParticipant.onDataTrackPublished.listen(_onLocalDataTrackPublished)); +// notifyListeners(); +// _completer.complete(room); +// +// _timer = Timer.periodic(const Duration(minutes: 1), (_) { +// // Let's see if we can send some data over the DataTrack API +// sendMessage('And another minute has passed since I connected...'); +// // Also try the ByteBuffer way of sending data +// final list = 'This data has been sent over the ByteBuffer channel of the DataTrack API'.codeUnits; +// var bytes = Uint8List.fromList(list); +// sendBufferMessage(bytes.buffer); +// }); +// } +// +// void _onLocalDataTrackPublished(LocalDataTrackPublishedEvent event) { +// // Send buffered messages, if any... +// while (_messages.isNotEmpty) { +// var message = _messages.removeAt(0); +// print('Sending buffered message: $message'); +// event.localDataTrackPublication.localDataTrack.send(message); +// } +// } +// +// void _onConnectFailure(RoomConnectFailureEvent event) { +// print('ConferenceRoom._onConnectFailure: ${event.exception}'); +// _completer.completeError(event.exception); +// } +// +// void _onDominantSpeakerChanged(DominantSpeakerChangedEvent event) { +// print('ConferenceRoom._onDominantSpeakerChanged: ${event.remoteParticipant.identity}'); +// var oldDominantParticipant = _participants.firstWhere((p) => p.isDominant, orElse: () => null); +// if (oldDominantParticipant != null) { +// var oldDominantParticipantIndex = _participants.indexOf(oldDominantParticipant); +// _participants.replaceRange(oldDominantParticipantIndex, oldDominantParticipantIndex + 1, [oldDominantParticipant.copyWith(isDominant: false)]); +// } +// +// var newDominantParticipant = _participants.firstWhere((p) => p.id == event.remoteParticipant.sid); +// var newDominantParticipantIndex = _participants.indexOf(newDominantParticipant); +// _participants.replaceRange(newDominantParticipantIndex, newDominantParticipantIndex + 1, [newDominantParticipant.copyWith(isDominant: true)]); +// notifyListeners(); +// } +// +// void _onParticipantConnected(RoomParticipantConnectedEvent event) { +// print('ConferenceRoom._onParticipantConnected, ${event.remoteParticipant.sid}'); +// _addRemoteParticipantListeners(event.remoteParticipant); +// } +// +// void _onParticipantDisconnected(RoomParticipantDisconnectedEvent event) { +// print('ConferenceRoom._onParticipantDisconnected: ${event.remoteParticipant.sid}'); +// _participants.removeWhere((ParticipantWidget p) => p.id == event.remoteParticipant.sid); +// notifyListeners(); +// } +// +// ParticipantWidget _buildParticipant({ +// @required Widget child, +// @required String id, +// @required bool audioEnabled, +// @required bool videoEnabled, +// RemoteParticipant remoteParticipant, +// }) { +// return ParticipantWidget( +// id: remoteParticipant?.sid, +// isRemote: remoteParticipant != null, +// child: child, +// audioEnabled: audioEnabled, +// videoEnabled: videoEnabled, +// ); +// } +// +// void _addRemoteParticipantListeners(RemoteParticipant remoteParticipant) { +// print('ConferenceRoom._addRemoteParticipantListeners() => Adding listeners to remoteParticipant ${remoteParticipant.sid}'); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackDisabled.listen(_onAudioTrackDisabled)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackEnabled.listen(_onAudioTrackEnabled)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackPublished.listen(_onAudioTrackPublished)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackSubscribed.listen(_onAudioTrackSubscribed)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackSubscriptionFailed.listen(_onAudioTrackSubscriptionFailed)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackUnpublished.listen(_onAudioTrackUnpublished)); +// _streamSubscriptions.add(remoteParticipant.onAudioTrackUnsubscribed.listen(_onAudioTrackUnsubscribed)); +// +// _streamSubscriptions.add(remoteParticipant.onDataTrackPublished.listen(_onDataTrackPublished)); +// _streamSubscriptions.add(remoteParticipant.onDataTrackSubscribed.listen(_onDataTrackSubscribed)); +// _streamSubscriptions.add(remoteParticipant.onDataTrackSubscriptionFailed.listen(_onDataTrackSubscriptionFailed)); +// _streamSubscriptions.add(remoteParticipant.onDataTrackUnpublished.listen(_onDataTrackUnpublished)); +// _streamSubscriptions.add(remoteParticipant.onDataTrackUnsubscribed.listen(_onDataTrackUnsubscribed)); +// +// _streamSubscriptions.add(remoteParticipant.onVideoTrackDisabled.listen(_onVideoTrackDisabled)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackEnabled.listen(_onVideoTrackEnabled)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackPublished.listen(_onVideoTrackPublished)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackSubscribed.listen(_onVideoTrackSubscribed)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackSubscriptionFailed.listen(_onVideoTrackSubscriptionFailed)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackUnpublished.listen(_onVideoTrackUnpublished)); +// _streamSubscriptions.add(remoteParticipant.onVideoTrackUnsubscribed.listen(_onVideoTrackUnsubscribed)); +// } +// +// void _onAudioTrackDisabled(RemoteAudioTrackEvent event) { +// print('ConferenceRoom._onAudioTrackDisabled(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}, isEnabled: ${event.remoteAudioTrackPublication.isTrackEnabled}'); +// _setRemoteAudioEnabled(event); +// } +// +// void _onAudioTrackEnabled(RemoteAudioTrackEvent event) { +// print('ConferenceRoom._onAudioTrackEnabled(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}, isEnabled: ${event.remoteAudioTrackPublication.isTrackEnabled}'); +// _setRemoteAudioEnabled(event); +// } +// +// void _onAudioTrackPublished(RemoteAudioTrackEvent event) { +// print('ConferenceRoom._onAudioTrackPublished(), ${event.remoteParticipant.sid}}'); +// } +// +// void _onAudioTrackSubscribed(RemoteAudioTrackSubscriptionEvent event) { +// print('ConferenceRoom._onAudioTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); +// _addOrUpdateParticipant(event); +// } +// +// void _onAudioTrackSubscriptionFailed(RemoteAudioTrackSubscriptionFailedEvent event) { +// print('ConferenceRoom._onAudioTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); +// _onExceptionStreamController.add( +// PlatformException( +// code: 'ConferenceRoom.audioTrackSubscriptionFailed', +// message: 'AudioTrack Subscription Failed', +// details: event.exception.toString(), +// ), +// ); +// } +// +// void _onAudioTrackUnpublished(RemoteAudioTrackEvent event) { +// print('ConferenceRoom._onAudioTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrackPublication.trackSid}'); +// } +// +// void _onAudioTrackUnsubscribed(RemoteAudioTrackSubscriptionEvent event) { +// print('ConferenceRoom._onAudioTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteAudioTrack.sid}'); +// } +// +// void _onDataTrackPublished(RemoteDataTrackEvent event) { +// print('ConferenceRoom._onDataTrackPublished(), ${event.remoteParticipant.sid}}'); +// } +// +// void _onDataTrackSubscribed(RemoteDataTrackSubscriptionEvent event) { +// print('ConferenceRoom._onDataTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); +// final dataTrack = event.remoteDataTrackPublication.remoteDataTrack; +// _dataTracks.add(dataTrack); +// _streamSubscriptions.add(dataTrack.onMessage.listen(_onMessage)); +// _streamSubscriptions.add(dataTrack.onBufferMessage.listen(_onBufferMessage)); +// } +// +// void _onDataTrackSubscriptionFailed(RemoteDataTrackSubscriptionFailedEvent event) { +// print('ConferenceRoom._onDataTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); +// _onExceptionStreamController.add( +// PlatformException( +// code: 'ConferenceRoom.dataTrackSubscriptionFailed', +// message: 'DataTrack Subscription Failed', +// details: event.exception.toString(), +// ), +// ); +// } +// +// void _onDataTrackUnpublished(RemoteDataTrackEvent event) { +// print('ConferenceRoom._onDataTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteDataTrackPublication.trackSid}'); +// } +// +// void _onDataTrackUnsubscribed(RemoteDataTrackSubscriptionEvent event) { +// print('ConferenceRoom._onDataTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteDataTrack.sid}'); +// } +// +// void _onVideoTrackDisabled(RemoteVideoTrackEvent event) { +// print('ConferenceRoom._onVideoTrackDisabled(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}, isEnabled: ${event.remoteVideoTrackPublication.isTrackEnabled}'); +// _setRemoteVideoEnabled(event); +// } +// +// void _onVideoTrackEnabled(RemoteVideoTrackEvent event) { +// print('ConferenceRoom._onVideoTrackEnabled(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}, isEnabled: ${event.remoteVideoTrackPublication.isTrackEnabled}'); +// _setRemoteVideoEnabled(event); +// } +// +// void _onVideoTrackPublished(RemoteVideoTrackEvent event) { +// print('ConferenceRoom._onVideoTrackPublished(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); +// } +// +// void _onVideoTrackSubscribed(RemoteVideoTrackSubscriptionEvent event) { +// print('ConferenceRoom._onVideoTrackSubscribed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrack.sid}'); +// _addOrUpdateParticipant(event); +// } +// +// void _onVideoTrackSubscriptionFailed(RemoteVideoTrackSubscriptionFailedEvent event) { +// print('ConferenceRoom._onVideoTrackSubscriptionFailed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); +// _onExceptionStreamController.add( +// PlatformException( +// code: 'ConferenceRoom.videoTrackSubscriptionFailed', +// message: 'VideoTrack Subscription Failed', +// details: event.exception.toString(), +// ), +// ); +// } +// +// void _onVideoTrackUnpublished(RemoteVideoTrackEvent event) { +// print('ConferenceRoom._onVideoTrackUnpublished(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrackPublication.trackSid}'); +// } +// +// void _onVideoTrackUnsubscribed(RemoteVideoTrackSubscriptionEvent event) { +// print('ConferenceRoom._onVideoTrackUnsubscribed(), ${event.remoteParticipant.sid}, ${event.remoteVideoTrack.sid}'); +// } +// +// void _onMessage(RemoteDataTrackStringMessageEvent event) { +// print('onMessage => ${event.remoteDataTrack.sid}, ${event.message}'); +// } +// +// void _onBufferMessage(RemoteDataTrackBufferMessageEvent event) { +// print('onBufferMessage => ${event.remoteDataTrack.sid}, ${String.fromCharCodes(event.message.asUint8List())}'); +// } +// +// void _setRemoteAudioEnabled(RemoteAudioTrackEvent event) { +// if (event.remoteAudioTrackPublication == null) { +// return; +// } +// var index = _participants.indexWhere((ParticipantWidget participant) => participant.id == event.remoteParticipant.sid); +// if (index < 0) { +// return; +// } +// var participant = _participants[index]; +// _participants.replaceRange( +// index, +// index + 1, +// [ +// participant.copyWith(audioEnabled: event.remoteAudioTrackPublication.isTrackEnabled), +// ], +// ); +// notifyListeners(); +// } +// +// void _setRemoteVideoEnabled(RemoteVideoTrackEvent event) { +// if (event.remoteVideoTrackPublication == null) { +// return; +// } +// var index = _participants.indexWhere((ParticipantWidget participant) => participant.id == event.remoteParticipant.sid); +// if (index < 0) { +// return; +// } +// var participant = _participants[index]; +// _participants.replaceRange( +// index, +// index + 1, +// [ +// participant.copyWith(videoEnabled: event.remoteVideoTrackPublication.isTrackEnabled), +// ], +// ); +// notifyListeners(); +// } +// +// void _addOrUpdateParticipant(RemoteParticipantEvent event) { +// print('ConferenceRoom._addOrUpdateParticipant(), ${event.remoteParticipant.sid}'); +// final participant = _participants.firstWhere( +// (ParticipantWidget participant) => participant.id == event.remoteParticipant.sid, +// orElse: () => null, +// ); +// if (participant != null) { +// print('Participant found: ${participant.id}, updating A/V enabled values'); +// _setRemoteVideoEnabled(event); +// _setRemoteAudioEnabled(event); +// } else { +// final bufferedParticipant = _participantBuffer.firstWhere( +// (ParticipantBuffer participant) => participant.id == event.remoteParticipant.sid, +// orElse: () => null, +// ); +// if (bufferedParticipant != null) { +// _participantBuffer.remove(bufferedParticipant); +// } else if (event is RemoteAudioTrackEvent) { +// print('Audio subscription came first, waiting for the video subscription...'); +// _participantBuffer.add( +// ParticipantBuffer( +// id: event.remoteParticipant.sid, +// audioEnabled: event.remoteAudioTrackPublication?.remoteAudioTrack?.isEnabled ?? true, +// ), +// ); +// return; +// } +// if (event is RemoteVideoTrackSubscriptionEvent) { +// print('New participant, adding: ${event.remoteParticipant.sid}'); +// _participants.insert( +// 0, +// _buildParticipant( +// child: event.remoteVideoTrack.widget(), +// id: event.remoteParticipant.sid, +// remoteParticipant: event.remoteParticipant, +// audioEnabled: bufferedParticipant?.audioEnabled ?? true, +// videoEnabled: event.remoteVideoTrackPublication?.remoteVideoTrack?.isEnabled ?? true, +// ), +// ); +// } +// notifyListeners(); +// } +// } +// } diff --git a/lib/pages/conference/web_rtc/call_home_page.dart b/lib/pages/conference/web_rtc/call_home_page.dart index 7153bf92..dd841a6c 100644 --- a/lib/pages/conference/web_rtc/call_home_page.dart +++ b/lib/pages/conference/web_rtc/call_home_page.dart @@ -1,172 +1,61 @@ -import 'dart:async'; - -import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -import '../conference_button_bar.dart'; - -class CallHomePage extends StatefulWidget { - @override - _CallHomePageState createState() => _CallHomePageState(); -} - -class _CallHomePageState extends State { - bool showNoise = false; - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - - final StreamController _audioButton = StreamController.broadcast(); - final StreamController _videoButton = StreamController.broadcast(); - final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); - final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); - - //Stream to enable video - MediaStream stream; - - @override - void initState() { - // TODO: implement initState - super.initState(); - _localRenderer.initialize(); - _remoteRenderer.initialize(); - - enableVideo(); - } - - enableVideo() async { - //Stream to enable video - stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); - // _audioButton.add(false); - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - _localRenderer.dispose(); - _remoteRenderer.dispose(); - _audioButton.close(); - _videoButton.close(); - stream.dispose(); - _disposeStreamsAndSubscriptions(); - } - - Future _disposeStreamsAndSubscriptions() async { - if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); - if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); - } - - @override - Widget build(BuildContext context) { - // return WillPopScope( - // onWillPop: () async => false, - // child: Scaffold( - // backgroundColor: Colors.black, - // // body: , - // ), - // ); - - return Scaffold( - backgroundColor: Colors.white, - body: showNoise ? _buildNoiseBox() : buildLayout(), - ); - } - - LayoutBuilder buildLayout() { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - children: [ - CamViewWidget( - localRenderer: _localRenderer, - remoteRenderer: _remoteRenderer, - stream: stream, - constraints: constraints, - onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, - onButtonBarHeightStreamController: _onButtonBarHeightStreamController, - ), - ConferenceButtonBar( - audioEnabled: _audioButton.stream, - videoEnabled: _videoButton.stream, - onAudioEnabled: _onAudioEnable, - onVideoEnabled: _onVideoEnabled, - onSwitchCamera: _onSwitchCamera, - onHangup: _onHangup, - onPersonAdd: () {}, - onPersonRemove: () {}, - onHeight: _onHeightBar, - onShow: _onShowBar, - onHide: _onHideBar, - ), - ], - ); - }, - ); - } - - NoiseBox _buildNoiseBox() { - return NoiseBox( - density: NoiseBoxDensity.xLow, - backgroundColor: Colors.grey.shade900, - child: Center( - child: Container( - color: Colors.black54, - width: double.infinity, - height: 40, - child: Center( - child: Text( - 'Waiting for another participant to connect to the call...', - key: Key('text-wait'), - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), - ), - ), - ), - ); - } - - Function _onAudioEnable() { - bool enabled = stream.getAudioTracks()[0].enabled; - stream.getAudioTracks()[0].enabled = !enabled; - _audioButton.add(!enabled); - } - - Function _onVideoEnabled() { - bool enabled = stream.getVideoTracks()[0].enabled; - stream.getVideoTracks()[0].enabled = !enabled; - _videoButton.add(!enabled); - } - - Function _onSwitchCamera() { - // stream.getAudioTracks()[0].enabled = false; - // stream.getVideoTracks()[0].enabled = false; - Helper.switchCamera(stream.getVideoTracks()[0]); - } - - void _onShowBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); - }); - _onButtonBarVisibleStreamController.add(true); - } - - void _onHeightBar(double height) { - _onButtonBarHeightStreamController.add(height); - } - - void _onHideBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); - }); - _onButtonBarVisibleStreamController.add(false); - } - - Future _onHangup() async { - print('onHangup'); - Navigator.of(context).pop(); - } -} +// import 'dart:async'; +// +// import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// // import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// import '../conference_button_bar.dart'; +// +// class CallHomePage extends StatefulWidget { +// final String receiverId; +// final String callerId; +// +// const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); +// +// @override +// _CallHomePageState createState() => _CallHomePageState(); +// } +// +// class _CallHomePageState extends State { +// bool showNoise = false; +// // RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// // RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// +// final StreamController _audioButton = StreamController.broadcast(); +// final StreamController _videoButton = StreamController.broadcast(); +// final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); +// final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); +// +// //Stream to enable video +// // MediaStream localMediaStream; +// // MediaStream remoteMediaStream; +// Signaling signaling = Signaling()..init(); +// +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// startCall(); +// } +// +// startCall() async{ +// // await _localRenderer.initialize(); +// // await _remoteRenderer.initialize(); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); +// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// backgroundColor: Colors.white, +// body: Container() //showNoise ? _buildNoiseBox() : buildLayout(), +// ); +// } +// } diff --git a/lib/pages/conference/web_rtc/call_home_page_.dart b/lib/pages/conference/web_rtc/call_home_page_.dart new file mode 100644 index 00000000..27fb5919 --- /dev/null +++ b/lib/pages/conference/web_rtc/call_home_page_.dart @@ -0,0 +1,186 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import '../conference_button_bar.dart'; + +class CallHomePage extends StatefulWidget { + final String receiverId; + final String callerId; + + const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); + + @override + _CallHomePageState createState() => _CallHomePageState(); +} + +class _CallHomePageState extends State { + bool showNoise = true; + RTCVideoRenderer _localRenderer = RTCVideoRenderer(); + RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); + + final StreamController _audioButton = StreamController.broadcast(); + final StreamController _videoButton = StreamController.broadcast(); + final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); + final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); + + //Stream to enable video + MediaStream localMediaStream; + MediaStream remoteMediaStream; + Signaling signaling = Signaling()..init(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + startCall(); + } + + startCall() async{ + await _localRenderer.initialize(); + await _remoteRenderer.initialize(); + final connected = await receivedCall(); + } + + + Future receivedCall() async { + //Stream local media + localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); + _localRenderer.srcObject = localMediaStream; + + final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, onRemoteMediaStream: (remoteMediaStream){ + setState(() { + this.remoteMediaStream = remoteMediaStream; + _remoteRenderer.srcObject = remoteMediaStream; + }); + }); + + if(connected){ + signaling.signalR.listen( + onAcceptCall: (arg0){ + print(arg0.toString()); + }, + onCandidate: (candidateJson){ + signaling.addCandidate(candidateJson); + }, + onDeclineCall: (arg0,arg1){ + // _onHangup(); + }, + onHangupCall: (arg0){ + // _onHangup(); + }, + + onOffer: (offerSdp, callerUser) async{ + print('${offerSdp.toString()} | ${callerUser.toString()}'); + await signaling.answerOffer(offerSdp); + } + ); + } + return connected; + } + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _localRenderer?.dispose(); + _remoteRenderer?.dispose(); + _audioButton?.close(); + _videoButton?.close(); + localMediaStream?.dispose(); + remoteMediaStream?.dispose(); + _disposeStreamsAndSubscriptions(); + } + + Future _disposeStreamsAndSubscriptions() async { + if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); + if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: buildLayout(), + ); + } + + LayoutBuilder buildLayout() { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Stack( + children: [ + CamViewWidget( + localRenderer: _localRenderer, + remoteRenderer: _remoteRenderer, + constraints: constraints, + onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, + onButtonBarHeightStreamController: _onButtonBarHeightStreamController, + ), + ConferenceButtonBar( + audioEnabled: _audioButton.stream, + videoEnabled: _videoButton.stream, + onAudioEnabled: _onAudioEnable, + onVideoEnabled: _onVideoEnabled, + onSwitchCamera: _onSwitchCamera, + onHangup: _onHangup, + onPersonAdd: () {}, + onPersonRemove: () {}, + onHeight: _onHeightBar, + onShow: _onShowBar, + onHide: _onHideBar, + ), + ], + ); + }, + ); + } + + Function _onAudioEnable() { + final audioTrack = localMediaStream.getAudioTracks()[0]; + final mute = audioTrack.muted; + Helper.setMicrophoneMute(!mute, audioTrack); + _audioButton.add(mute); + } + + Function _onVideoEnabled() { + final videoTrack = localMediaStream.getVideoTracks()[0]; + bool videoEnabled = videoTrack.enabled; + localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; + _videoButton.add(!videoEnabled); + } + + Function _onSwitchCamera() { + Helper.switchCamera(localMediaStream.getVideoTracks()[0]); + } + + void _onShowBar() { + setState(() { + }); + _onButtonBarVisibleStreamController.add(true); + } + + void _onHeightBar(double height) { + _onButtonBarHeightStreamController.add(height); + } + + void _onHideBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); + }); + _onButtonBarVisibleStreamController.add(false); + } + + Future _onHangup() async { + signaling.hangupCall(widget.callerId, widget.receiverId); + print('onHangup'); + Navigator.of(context).pop(); + } + + +} diff --git a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart index 3db0c74b..c652cacc 100644 --- a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart +++ b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:core'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; import 'package:flutter/material.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart'; @@ -9,12 +10,12 @@ import 'draggable_cam.dart'; class CamViewWidget extends StatefulWidget { RTCVideoRenderer localRenderer; RTCVideoRenderer remoteRenderer; - MediaStream stream; + MediaStream localStream; BoxConstraints constraints; StreamController onButtonBarVisibleStreamController; StreamController onButtonBarHeightStreamController; - CamViewWidget({this.localRenderer, this.remoteRenderer, this.stream, this.constraints, this.onButtonBarVisibleStreamController, this.onButtonBarHeightStreamController}); + CamViewWidget({this.localRenderer, this.remoteRenderer, this.constraints, this.onButtonBarVisibleStreamController, this.onButtonBarHeightStreamController}); @override _CamViewWidgetState createState() => _CamViewWidgetState(); @@ -24,16 +25,6 @@ class _CamViewWidgetState extends State { @override void initState() { super.initState(); - Future.delayed(const Duration(milliseconds: 300), () { - showCamera(); - }); - } - - showCamera() async { - setState(() async { - widget.localRenderer.srcObject = widget.stream; - widget.remoteRenderer.srcObject = widget.stream; - }); } @override @@ -43,19 +34,49 @@ class _CamViewWidgetState extends State { height: double.infinity, child: Stack( children: [ - Container( - child: RTCVideoView(widget.localRenderer, mirror: true), + FractionallySizedBox( + heightFactor: 1, widthFactor: 1, + child: Container( + color: Colors.black87, + child: RTCVideoView(widget.remoteRenderer, mirror: true,filterQuality: FilterQuality.medium,), + ), + ), + + if(widget.remoteRenderer.srcObject == null) + Positioned.fill(child: _buildNoiseBox()), + + Positioned.fill( + child: RTCVideoView(widget.remoteRenderer) ), + DraggableCam( key: Key('publisher'), onButtonBarHeight: widget.onButtonBarHeightStreamController.stream, onButtonBarVisible: widget.onButtonBarVisibleStreamController.stream, availableScreenSize: widget.constraints.biggest, - child: RTCVideoView(widget.remoteRenderer), + child: RTCVideoView(widget.localRenderer) ), - // Expanded(child: RTCVideoView(widget.remoteRenderer)), + + if(widget.remoteRenderer.srcObject == null) + Container( + margin: EdgeInsets.all(MediaQuery.of(context).size.width/8), + child: Text( + 'Waiting for another participant to connect to the call...', + key: Key('text-wait'), + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ) + ), ], ), ); } + + + Widget _buildNoiseBox() { + return NoiseBox( + density: NoiseBoxDensity.xHigh, + backgroundColor: Colors.grey.shade900, + ); + } } diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 298e617e..6e879612 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -94,6 +94,13 @@ class _SendFeedbackPageState extends State { this.appointHistory = widget.appointment; }); requestPermissions(); + event.controller.stream.listen((p) { + if (p['isIOSFeedback'] == 'true') { + if (this.mounted) { + this.titleController.value = p['data']; + } + } + }); super.initState(); } @@ -445,7 +452,7 @@ class _SendFeedbackPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: selectedStatusIndex, onValueSelected: (index) { @@ -538,9 +545,10 @@ class _SendFeedbackPageState extends State { if (result.finalResult == true) { setState(() { + messageController.text += reconizedWord + '\n'; RoboSearch.closeAlertDialog(context); speech.stop(); - messageController.text = reconizedWord + '\n'; + }); } } diff --git a/lib/pages/feedback/status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart index 15e3e3dd..419cf1b0 100644 --- a/lib/pages/feedback/status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -95,7 +95,7 @@ class _StatusFeedbackPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: selectedStatusIndex, onValueSelected: (index) { diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 91e953ad..41fa74f0 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -93,6 +93,8 @@ class _FinalProductsPageState extends State { isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: Container( height: MediaQuery.of(context).size.height * 5.87, @@ -214,20 +216,37 @@ class _FinalProductsPageState extends State { Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center, - child: Image.network( - model.finalProducts[index].images.isNotEmpty - ? model.finalProducts[index].images[0].thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), + child: (model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, + height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, + ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[index].images[0].thumb +// : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', +// fit: BoxFit.cover, +// height: 80, +// ), ), Container( - width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + width: model.finalProducts[index].rxMessage != null ? double.infinity : 0, + //MediaQuery.of(context).size.width / 2.8 : 0, padding: EdgeInsets.all(4), decoration: 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( @@ -372,33 +391,48 @@ class _FinalProductsPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 8), 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, + child:(model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[index].images[0].thumb +// : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', +// fit: BoxFit.contain, +// height: 80, +// ), ), ], ), Column( children: [ Container( - width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 4.3 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + //borderRadius: BorderRadius.only(topLeft: Radius.circular(5)), ), child:model.finalProducts[index].rxMessage != null ? Texts( projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, color: Colors.white, regular: true, - fontSize: 10, + fontSize: 8, fontWeight: FontWeight.w600, ) : Texts(""), @@ -485,7 +519,7 @@ class _FinalProductsPageState extends State { color: CustomColors.green, ), onPressed: () async { - if (model.finalProducts[index].rxMessage == null) { + if (model.finalProducts[index].isRx == false) { GifLoaderDialogUtils.showMyDialog(context); await addToCartFunction(1, model.finalProducts[index].id); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/insurance/insurance_approval_detail_screen.dart b/lib/pages/insurance/insurance_approval_detail_screen.dart index fa6d0f5a..c5f84602 100644 --- a/lib/pages/insurance/insurance_approval_detail_screen.dart +++ b/lib/pages/insurance/insurance_approval_detail_screen.dart @@ -77,9 +77,9 @@ class InsuranceApprovalDetail extends StatelessWidget { MyRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), SizedBox(height: 6), - MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", + MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.receiptOn)) ?? "", projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", + MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.expiryDate)) ?? "", projectViewModel.isArabic), ], ), diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 52ce35c8..bd665046 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -140,7 +140,7 @@ class _InsuranceApprovalState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", + MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName != null ? model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach : "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), ], diff --git a/lib/pages/insurance/insurance_card_update_details.dart b/lib/pages/insurance/insurance_card_update_details.dart index f765d9b7..71637051 100644 --- a/lib/pages/insurance/insurance_card_update_details.dart +++ b/lib/pages/insurance/insurance_card_update_details.dart @@ -352,7 +352,7 @@ class InsuranceCardUpdateDetails extends StatelessWidget { void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo, InsuranceViewModel model}) { showDialog( context: context, - child: AttachInsuranceCardImageDialog( + builder: (cxt) => AttachInsuranceCardImageDialog( fileNo: fileNo, name: name, image: (file, image) async { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 2bca7a9e..f73172b6 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -26,6 +26,8 @@ import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; +import 'package:diplomaticquarterapp/uitl/push-notification-handler.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; @@ -43,6 +45,7 @@ import 'package:provider/provider.dart'; import '../../locator.dart'; import '../../routes.dart'; + class LandingPage extends StatefulWidget { static LandingPage shared; _LandingPageState state; @@ -83,7 +86,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ///inject the user data AuthenticatedUserObject authenticatedUserObject = locator(); - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging?.instance; final authService = new AuthProvider(); var event = RobotProvider(); @@ -196,32 +199,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); - var route = ModalRoute.of(context); - - if (route != null) {} - - //setState(() { AppGlobal.context = context; if (state == AppLifecycleState.resumed) { - if (LandingPage.isOpenCallPage) { - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - isPageNavigated = false; - }); - } - } + PushNotificationHandler.getInstance().onResume(); sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); } - - if (state == AppLifecycleState.paused) { - isPageNavigated = false; - } - - if (state == AppLifecycleState.inactive) { - isPageNavigated = false; - } - //}); } @override @@ -233,6 +215,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { @override void initState() { super.initState(); + PushNotificationHandler.getInstance().onResume(); WidgetsBinding.instance.addObserver(this); AppGlobal.context = context; @@ -241,14 +224,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - // signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); - locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { familyFileProvider.getSharedRecordByStatus(); } - // if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] //for now commented to reduce this call will enable it when needed @@ -257,10 +237,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { // PlatformBridge().connectHMGGuestWifi().then((value) => {GifLoaderDialogUtils.hideDialog(context)}); // }).checkAndConnectIfNoInternet(); - if (Platform.isIOS) { - _firebaseMessaging.requestNotificationPermissions(); - } - requestPermissions().then((results) { locationUtils.getCurrentLocation(); _firebaseMessaging.getToken().then((String token) { @@ -271,8 +247,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (!projectViewModel.isLoginChild) { checkUserStatus(token); } - - // if (projectViewModel.isLogin) this.getNotificationCount(DEVICE_TOKEN); } }); if (results[Permission.location].isGranted) {} @@ -283,107 +257,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { // if (results[Permission.calendar].isGranted) ; }); - // }); - // - // //_firebase Background message handler - _firebaseMessaging.configure( - onMessage: (Map message) async { - // showDialog("onMessage: $message"); - print("onMessage: $message"); - print(message); - print(message['name']); - print(message['appointmentdate']); - - if (Platform.isIOS) { - if (message['is_call'] == "true") { - var route = ModalRoute.of(context); - - if (route != null) { - print(route.settings.name); - } - - Map myMap = new Map.from(message); - print(myMap); - LandingPage.isOpenCallPage = true; - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - isPageNavigated = false; - }); - } - } else { - print("Is Call Not Found iOS"); - } - } else { - print("Is Call Not Found iOS"); - } - - if (Platform.isAndroid) { - if (message['data'].containsKey("is_call")) { - var route = ModalRoute.of(context); - - if (route != null) { - print(route.settings.name); - } - - Map myMap = new Map.from(message['data']); - print(myMap); - LandingPage.isOpenCallPage = true; - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - isPageNavigated = false; - }); - } - } else { - print("Is Call Not Found Android"); - LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']); - } - } else { - print("Is Call Not Found Android"); - } - }, - onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - onLaunch: (Map message) async { - print("onLaunch: $message"); - // showDialog("onLaunch: $message"); - }, - onResume: (Map message) async { - print("onResume: $message"); - print(message); - print(message['name']); - print(message['appointmentdate']); - - // showDialog("onResume: $message"); - - if (Platform.isIOS) { - if (message['is_call'] == "true") { - var route = ModalRoute.of(context); - - if (route != null) { - print(route.settings.name); - } - - Map myMap = new Map.from(message); - print(myMap); - LandingPage.isOpenCallPage = true; - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - isPageNavigated = false; - }); - } - } else { - print("Is Call Not Found iOS"); - } - } else { - print("Is Call Not Found iOS"); - } - }, - ); } Future> requestPermissions() async { @@ -407,18 +280,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { return permissionResults; } - static Future myBackgroundMessageHandler(Map message) async { - Map myMap = new Map.from(message['data']); - if (message.containsKey('data')) { - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - LandingPage.isOpenCallPage = true; - } - - if (message.containsKey('notification')) { - final dynamic notification = message['notification']; - } - } - void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 9e650966..42ec25a6 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -1,4 +1,4 @@ -import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; @@ -76,7 +76,7 @@ class _LandingPagePharmacyState extends State { children: [ PharmacyPage(), PharmacyCategorisePage(), - PharmacyProfilePage(), + PharmacyProfilePage(moveToOrder: false), CartOrderPage(changeTab: changeCurrentTab), ], ), @@ -86,11 +86,13 @@ class _LandingPagePharmacyState extends State { void _scanQrAndGetProduct() async { try { - String result = await BarcodeScanner.scan(); + ScanResult result = await BarcodeScanner.scan(); try { - String barcode = result; + String barcode = result?.rawContent; 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); @@ -100,7 +102,8 @@ 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/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 9e164c09..a420dc94 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -1,8 +1,14 @@ +import 'dart:ui'; + +import 'package:camera/camera.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; -import 'package:diplomaticquarterapp/pages/conference/conference_page.dart'; import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; +import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page_.dart'; import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:just_audio/just_audio.dart'; @@ -20,10 +26,14 @@ class _IncomingCallState extends State with SingleTickerProviderSt AnimationController _animationController; final player = AudioPlayer(); + CameraController _controller; + Future _initializeControllerFuture; + bool isCameraReady = false; @override void initState() { _animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 500)); + isCameraReady = false; WidgetsBinding.instance.addPostFrameCallback((_) => _runAnimation()); @@ -38,6 +48,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt void dispose() { _animationController.dispose(); player.stop(); + _controller.dispose(); disposeAudioResources(); super.dispose(); } @@ -46,117 +57,279 @@ class _IncomingCallState extends State with SingleTickerProviderSt Widget build(BuildContext context) { return AppScaffold( isShowAppBar: false, - body: SafeArea( - child: Container( - decoration: BoxDecoration(color: Colors.grey[700]), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + isShowDecPage: false, + body: FutureBuilder( + future: _initializeControllerFuture, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + return Stack( + alignment: FractionalOffset.center, children: [ - Container( - margin: EdgeInsets.only(top: 30.0), - alignment: Alignment.center, - child: Text("Incoming Video Call", textAlign: TextAlign.center, style: TextStyle(fontSize: 26.0, color: Colors.white, letterSpacing: 1.0)), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.fromLTRB(50.0, 30.0, 50.0, 20.0), - child: Image.asset('assets/images/new-design/hmg_full_logo_hd_white.png'), - ), - Container( - margin: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 0.0), - child: Divider( - color: Colors.white, - thickness: 1.0, - ), - ), - Container( - margin: EdgeInsets.only(top: 20.0), - alignment: Alignment.center, - child: Text("Dr Eyad Ismail Abu Jayab", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, letterSpacing: 0.8, color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - alignment: Alignment.center, - child: Text("Speciality", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), - ), - Container( - decoration: BoxDecoration( - color: Colors.grey[900].withOpacity(0.8), - borderRadius: BorderRadius.all(Radius.circular(10.0)), - ), - padding: EdgeInsets.all(20.0), - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Text("Appointment Information", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, letterSpacing: 1.0, color: Colors.white)), - Container( - margin: EdgeInsets.only(top: 20.0), - child: Text("Sun, 15th Dec, 2019, 09:00", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), - ), - Container( - margin: EdgeInsets.only(top: 20.0), - child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), - ), - ], - ), + new Positioned.fill( + child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)), ), - Container( - margin: EdgeInsets.only(top: 100.0), - alignment: Alignment.center, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - RotationTransition( - turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), - child: Container( - child: RawMaterialButton( - onPressed: () { - _submit(); - }, - elevation: 2.0, - fillColor: Colors.green, - child: Icon( - Icons.call, - color: Colors.white, - size: 35.0, + new Positioned.fill( + child: new ClipRect( + child: new BackdropFilter( + filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: new Container( + decoration: new BoxDecoration(color: Colors.grey[800].withOpacity(0.8)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: const EdgeInsets.all(21.0), + child: Row( + children: [ + Image.asset( + "assets/images/new/logo.png", + height: 70, + width: 70, + ), + Container( + margin: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + widget.incomingCallData.doctorname, + style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12), + ), + Text( + TranslationBase.of(context).videoAppo, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xffC6C6C6), letterSpacing: -0.48, height: 23 / 24), + ), + SizedBox(height: 2), + ], + ), + ), + ], + ), + ), + Container( + margin: const EdgeInsets.all(21.0), + width: MediaQuery.of(context).size.width, + decoration: cardRadius(15.0, color: Colors.black), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0), + child: Text( + TranslationBase.of(context).appoInfo, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 23 / 12), + ), + ), + Container( + padding: const EdgeInsets.only(left: 16.0, right: 16.0), + child: Text( + widget.incomingCallData.appointmentdate + ", " + widget.incomingCallData.appointmenttime, + style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), + ), + ), + Container( + padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0), + child: Text( + widget.incomingCallData.clinicname, + style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), + ), + ), + ], + ), + ), + Spacer(), + Container( + margin: EdgeInsets.only(bottom: 70.0, left: 49, right: 49), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + RotationTransition( + turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), + child: Container( + child: RawMaterialButton( + onPressed: () { + _submit(); + }, + elevation: 2.0, + fillColor: Colors.green, + child: Icon( + Icons.call, + color: Colors.white, + size: 35.0, + ), + padding: EdgeInsets.all(15.0), + shape: CircleBorder(), + ), + )), + Container( + child: RawMaterialButton( + onPressed: () { + backToHome(); + }, + elevation: 2.0, + fillColor: Colors.red, + child: Icon( + Icons.call_end, + color: Colors.white, + size: 35.0, + ), + padding: EdgeInsets.all(15.0), + shape: CircleBorder(), + ), + ), + ], ), - padding: EdgeInsets.all(15.0), - shape: CircleBorder(), ), - )), - Container( - child: RawMaterialButton( - onPressed: () { - backToHome(); - }, - elevation: 2.0, - fillColor: Colors.red, - child: Icon( - Icons.call_end, - color: Colors.white, - size: 35.0, - ), - padding: EdgeInsets.all(15.0), - shape: CircleBorder(), + ], ), ), - ], + ), ), ), ], - )), + ); + } else { + return const Center(child: CircularProgressIndicator()); + } + }, ), + // body: isCameraReady + // ? + // : Container( + // height: 200.0, + // width: 200.0, + // color: Colors.green, + // ), + // body: Container( + // decoration: BoxDecoration(color: Colors.grey[700]), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Container( + // margin: EdgeInsets.only(top: 30.0), + // alignment: Alignment.center, + // child: Text("Incoming Video Call", textAlign: TextAlign.center, style: TextStyle(fontSize: 26.0, color: Colors.white, letterSpacing: 1.0)), + // ), + // Container( + // alignment: Alignment.center, + // margin: EdgeInsets.fromLTRB(50.0, 30.0, 50.0, 20.0), + // child: Image.asset('assets/images/new-design/hmg_full_logo_hd_white.png'), + // ), + // Container( + // margin: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 0.0), + // child: Divider( + // color: Colors.white, + // thickness: 1.0, + // ), + // ), + // Container( + // margin: EdgeInsets.only(top: 20.0), + // alignment: Alignment.center, + // child: Text("Dr Eyad Ismail Abu Jayab", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, letterSpacing: 0.8, color: Colors.white)), + // ), + // Container( + // margin: EdgeInsets.only(top: 10.0), + // alignment: Alignment.center, + // child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), + // ), + // Container( + // margin: EdgeInsets.only(top: 10.0), + // alignment: Alignment.center, + // child: Text("Speciality", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), + // ), + // Container( + // decoration: BoxDecoration( + // color: Colors.grey[900].withOpacity(0.8), + // borderRadius: BorderRadius.all(Radius.circular(10.0)), + // ), + // padding: EdgeInsets.all(20.0), + // margin: EdgeInsets.only(top: 20.0), + // child: Column( + // children: [ + // Text("Appointment Information", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, letterSpacing: 1.0, color: Colors.white)), + // Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Text("Sun, 15th Dec, 2019, 09:00", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), + // ), + // Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), + // ), + // ], + // ), + // ), + // Container( + // margin: EdgeInsets.only(top: 100.0), + // alignment: Alignment.center, + // child: Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // RotationTransition( + // turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), + // child: Container( + // child: RawMaterialButton( + // onPressed: () { + // _submit(); + // }, + // elevation: 2.0, + // fillColor: Colors.green, + // child: Icon( + // Icons.call, + // color: Colors.white, + // size: 35.0, + // ), + // padding: EdgeInsets.all(15.0), + // shape: CircleBorder(), + // ), + // )), + // Container( + // child: RawMaterialButton( + // onPressed: () { + // LandingPage.isOpenCallPage = false; + // backToHome(); + // }, + // elevation: 2.0, + // fillColor: Colors.red, + // child: Icon( + // Icons.call_end, + // color: Colors.white, + // size: 35.0, + // ), + // padding: EdgeInsets.all(15.0), + // shape: CircleBorder(), + // ), + // ), + // ], + // ), + // ), + // ], + // )), ); } void _runAnimation() async { + final cameras = await availableCameras(); + final firstCamera = cameras[1]; + + _controller = CameraController( + // Get a specific camera from the list of available cameras. + firstCamera, + // Define the resolution to use. + ResolutionPreset.medium, + ); + _initializeControllerFuture = _controller.initialize(); + + setState(() { + isCameraReady = true; + }); + setAudioFile(); for (int i = 0; i < 100; i++) { await _animationController.forward(); @@ -165,7 +338,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt } Future _submit() async { - backToHome(); + // backToHome(); try { final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); @@ -176,10 +349,11 @@ class _IncomingCallState extends State with SingleTickerProviderSt // ConferencePage(roomModel: roomModel), // ), // ); - await Navigator.of(context).push( - MaterialPageRoute( + await _controller.dispose(); + await Navigator.of(context).pushReplacement( + MaterialPageRoute( fullscreenDialog: true, - builder: (BuildContext context) => CallHomePage(), + builder: (BuildContext context) => CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID), ), ); } catch (err) { @@ -191,6 +365,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt } void backToHome() { + LandingPage.isOpenCallPage = false; player.stop(); // disposeAudioResources(); Navigator.of(context).pop(); diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 91659278..def0461d 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -223,7 +223,7 @@ class _LiveCareHistoryCardState extends State { openInvoice() { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: projectViewModel.user.emailAddress, onTapSendEmail: () { sendInvoiceEmail(context); diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart index 26d2e829..c5628276 100644 --- a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -1,18 +1,22 @@ import 'package:circular_countdown_timer/circular_countdown_timer.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.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/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/my_rich_text.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class LiveCarePendingRequest extends StatefulWidget { ErRequestHistoryList pendingERRequestHistoryList; final Function getLiveCareHistory; - LiveCarePendingRequest( - {@required this.getLiveCareHistory, this.pendingERRequestHistoryList}); + LiveCarePendingRequest({@required this.getLiveCareHistory, this.pendingERRequestHistoryList}); @override _LiveCarePendingRequestState createState() => _LiveCarePendingRequestState(); @@ -27,136 +31,197 @@ class _LiveCarePendingRequestState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300]), - borderRadius: BorderRadius.circular(10), - color: Colors.white, - shape: BoxShape.rectangle, - ), - margin: EdgeInsets.all(15.0), + margin: EdgeInsets.fromLTRB(21, 21, 21, 12), padding: EdgeInsets.all(10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [ - Container( - child: Text("In Progress:", - style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 10.0), - child: Text("Estimated Waiting Time: ", - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), - ), - Container( - transform: Matrix4.translationValues(0.0, -50.0, 0.0), - alignment: Alignment.center, - child: CircularCountDownTimer( - duration: - widget.pendingERRequestHistoryList.watingtimeInteger * 60, - width: MediaQuery.of(context).size.width / 3, - height: MediaQuery.of(context).size.height / 3, - color: Colors.white, - fillColor: Colors.green[700], - strokeWidth: 15.0, - textStyle: TextStyle( - fontSize: 22.0, - color: Colors.black87, - fontWeight: FontWeight.bold), - isReverse: true, - isTimerTextShown: true, - onComplete: () { - print('Countdown Ended'); - }, - ), - ), - Container( - transform: Matrix4.translationValues(0.0, -60.0, 0.0), - child: Divider( - color: Colors.grey[500], - thickness: 0.7, - ), - ), + children: [ Container( - transform: Matrix4.translationValues(0.0, -50.0, 0.0), - child: Text("Requested date:", - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)), - ), - Container( - transform: Matrix4.translationValues(0.0, -30.0, 0.0), - child: Text( - DateUtil.getDateFormatted( - widget.pendingERRequestHistoryList.arrivalTime), - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), - ), - Container( - transform: Matrix4.translationValues(0.0, -20.0, 0.0), - padding: EdgeInsets.all(7.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(5)), - color: Colors.red[800], - ), - margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text(widget.pendingERRequestHistoryList.stringCallStatus, - style: TextStyle(fontSize: 14.0, color: Colors.white)), - ), - Container( - transform: Matrix4.translationValues(0.0, 0.0, 0.0), - child: Divider( - color: Colors.grey[500], - thickness: 0.7, + width: MediaQuery.of(context).size.width, + decoration: cardRadius(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.fromLTRB(16, 21, 16, 23), + child: Text(TranslationBase.of(context).waitingTime, style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600, letterSpacing: -0.64)), + ), + Container( + height: MediaQuery.of(context).size.height * 0.25, + transform: Matrix4.translationValues(0.0, -10.0, 0.0), + alignment: Alignment.center, + child: CircularCountDownTimer( + duration: widget.pendingERRequestHistoryList.watingtimeInteger * 60, + width: MediaQuery.of(context).size.width / 2, + height: MediaQuery.of(context).size.height / 2, + ringColor: Colors.white, + fillColor: CustomColors.green, + strokeWidth: 7.0, + textStyle: TextStyle(fontSize: 32.0, color: Color(0xff2E303A), fontWeight: FontWeight.w400), + isReverse: true, + isTimerTextShown: true, + onComplete: () { + print('Countdown Ended'); + }, + ), + ), + ], ), ), Container( - alignment: Alignment.center, - transform: Matrix4.translationValues(0.0, 10.0, 0.0), - child: Text( - "Your turn is after " + - widget.pendingERRequestHistoryList.patCount.toString() + - " Patients", - style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - Container( - transform: Matrix4.translationValues(0.0, 130.0, 0.0), - alignment: Alignment.bottomCenter, + margin: const EdgeInsets.fromLTRB(0, 12, 0, 0), + padding: const EdgeInsets.fromLTRB(16, 21, 16, 12), width: MediaQuery.of(context).size.width, - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width, - height: 45.0, - child: RaisedButton( - color: Colors.red[800], - textColor: Colors.white, - elevation: 0, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - cancelLiveCareRequest(); - }, - child: Text(TranslationBase.of(context).cancel, - style: TextStyle(fontSize: 18.0)), - ), + decoration: cardRadius(15.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: cardRadius(15.0, color: Color(0xffCC9B14)), + padding: const EdgeInsets.all(5.0), + child: Text(widget.pendingERRequestHistoryList.stringCallStatus, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4)), + ), + Container( + padding: const EdgeInsets.all(5.0), + child: MyRichText(TranslationBase.of(context).requestedDateLiveCare, + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.pendingERRequestHistoryList.arrivalTime)), projectViewModel.isArabic), + ), + Container( + padding: const EdgeInsets.all(5.0), + child: Text(TranslationBase.of(context).yourTurn + " " + widget.pendingERRequestHistoryList.patCount.toString() + " " + TranslationBase.of(context).patients, + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.48)), + ), + // Container( + // child: DefaultButton(TranslationBase.of(context).cancel, () { + // cancelLiveCareRequest(); + // }), + // ), + ], ), ), ], ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + // children: [ + // Container( + // child: Text("In Progress:", + // style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), + // Container( + // alignment: Alignment.center, + // margin: EdgeInsets.only(top: 10.0), + // child: Text("Estimated Waiting Time: ", + // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, -50.0, 0.0), + // alignment: Alignment.center, + // child: CircularCountDownTimer( + // duration: + // widget.pendingERRequestHistoryList.watingtimeInteger * 60, + // width: MediaQuery.of(context).size.width / 3, + // height: MediaQuery.of(context).size.height / 3, + // color: Colors.white, + // fillColor: Colors.green[700], + // strokeWidth: 15.0, + // textStyle: TextStyle( + // fontSize: 22.0, + // color: Colors.black87, + // fontWeight: FontWeight.bold), + // isReverse: true, + // isTimerTextShown: true, + // onComplete: () { + // print('Countdown Ended'); + // }, + // ), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, -60.0, 0.0), + // child: Divider( + // color: Colors.grey[500], + // thickness: 0.7, + // ), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, -50.0, 0.0), + // child: Text("Requested date:", + // style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, -30.0, 0.0), + // child: Text( + // DateUtil.getDateFormatted( + // widget.pendingERRequestHistoryList.arrivalTime), + // style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, -20.0, 0.0), + // padding: EdgeInsets.all(7.0), + // decoration: BoxDecoration( + // shape: BoxShape.rectangle, + // borderRadius: BorderRadius.all(Radius.circular(5)), + // color: Colors.red[800], + // ), + // margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + // child: Text(widget.pendingERRequestHistoryList.stringCallStatus, + // style: TextStyle(fontSize: 14.0, color: Colors.white)), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, 0.0, 0.0), + // child: Divider( + // color: Colors.grey[500], + // thickness: 0.7, + // ), + // ), + // Container( + // alignment: Alignment.center, + // transform: Matrix4.translationValues(0.0, 10.0, 0.0), + // child: Text( + // "Your turn is after " + + // widget.pendingERRequestHistoryList.patCount.toString() + + // " Patients", + // style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + // ), + // Container( + // transform: Matrix4.translationValues(0.0, 110.0, 0.0), + // alignment: Alignment.bottomCenter, + // width: MediaQuery.of(context).size.width, + // child: ButtonTheme( + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10.0), + // ), + // minWidth: MediaQuery.of(context).size.width, + // height: 45.0, + // child: RaisedButton( + // color: Colors.red[800], + // textColor: Colors.white, + // elevation: 0, + // disabledTextColor: Colors.white, + // disabledColor: new Color(0xFFbcc2c4), + // onPressed: () { + // cancelLiveCareRequest(); + // }, + // child: Text(TranslationBase.of(context).cancel, + // style: TextStyle(fontSize: 18.0)), + // ), + // ), + // ), + // ], + // ), ); } cancelLiveCareRequest() { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service - .cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context) - .then((res) { + service.cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - AppToast.showSuccessToast( - message: "LiveCare request cancelled successfully"); + AppToast.showSuccessToast(message: "LiveCare request cancelled successfully"); widget.getLiveCareHistory(); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index bf4d33c7..232f62de 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; @@ -11,12 +13,12 @@ import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; -import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart'; 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/PlatformBridge.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 +31,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:permission_handler/permission_handler.dart'; import '../live_care_payment_page.dart'; @@ -180,40 +183,43 @@ class _clinic_listState extends State { 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); - } + askVideoCallPermission().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); - // } - // } - // }); + } + + Future askVideoCallPermission() async { + if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { + return false; + } + if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { + await drawOverAppsMessageDialog(context); + return false; + } + return true; + } + + Future drawOverAppsMessageDialog(BuildContext context) async { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: "Please select 'Dr. Alhabib' from the list and allow draw over app permission to use live care.", + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + await PlatformBridge.shared().askDrawOverAppsPermission(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); } showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { @@ -452,7 +458,7 @@ class _clinic_listState extends State { children: [ isDataLoaded ? Expanded( - child: Container( + child: Container( child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 ? Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -484,30 +490,30 @@ class _clinic_listState extends State { ) : getNoDataWidget(context), ), - ) + ) : Container(), isDataLoaded ? 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)), + 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(), ], ); @@ -542,10 +548,6 @@ class _clinic_listState extends State { ); }, ), - // 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, diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 1903e561..b1217409 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -107,7 +107,7 @@ class _ConfirmLogin extends State { return Scaffold( backgroundColor: Color(0xfff8f8f8), - resizeToAvoidBottomPadding: false, + resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, leading: IconButton( diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index b77d34f3..ab34d75f 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -21,7 +21,7 @@ class LoginType extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xfff8f8f8), - resizeToAvoidBottomPadding: false, + resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, leading: IconButton( diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 11ed7c79..ea8ef803 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -389,7 +389,9 @@ class _Register extends State { Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))), } else - {AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)} + { + AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong), + } }); } } diff --git a/lib/pages/medical/active_medications/reminder_page.dart b/lib/pages/medical/active_medications/reminder_page.dart index a6df5f28..7ad8f9f2 100644 --- a/lib/pages/medical/active_medications/reminder_page.dart +++ b/lib/pages/medical/active_medications/reminder_page.dart @@ -281,7 +281,7 @@ class _ReminderPageState extends State { void confirmSelectDayDialog() { showDialog( context: context, - child: DayCheckBoxDialog( + builder: (cxt) => DayCheckBoxDialog( title: 'Select Day', selectedDaysOfWeek: widget.daysOfWeek, onValueSelected: (value) { diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 051b9b95..2fdb93ce 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -101,7 +101,7 @@ class _AdvancePaymentPageState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: beneficiaryType == BeneficiaryType.MyAccount ? 0 : (beneficiaryType == BeneficiaryType.MyFamilyFiles ? 1 : (beneficiaryType == BeneficiaryType.OtherAccount ? 2 : -1)), @@ -359,7 +359,7 @@ class _AdvancePaymentPageState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedHospitalIndex, isScrollable: true, @@ -380,7 +380,7 @@ class _AdvancePaymentPageState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, isScrollable: true, selectedIndex: _selectedPatientIndex, @@ -404,7 +404,7 @@ class _AdvancePaymentPageState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, isScrollable: true, selectedIndex: _selectedFamilyMemberIndex, diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart index 972d6b92..e1f7fdd4 100644 --- a/lib/pages/medical/balance/new_text_Field.dart +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -189,7 +189,7 @@ class _NewTextFieldsState extends State { autofocus: widget.autoFocus ?? false, validator: widget.validator, onSaved: widget.onSaved, - style: Theme.of(context).textTheme.body2.copyWith( + style: Theme.of(context).textTheme.bodyText2.copyWith( fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index 28e1c1a9..ebf32924 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -72,6 +72,7 @@ class DoctorHomePage extends StatelessWidget { clinicName: _doctorList.clinicName, actualDoctorRate: _doctorList.actualDoctorRate, doctorID: _doctorList.doctorID, + date: _doctorList.appointmentDate, doctorRate: _doctorList.doctorRate, gender: _doctorList.gender, doctorTitle: _doctorList.doctorTitle, diff --git a/lib/pages/medical/eye/ClassesPage.dart b/lib/pages/medical/eye/ClassesPage.dart index bb38d095..573e5bf3 100644 --- a/lib/pages/medical/eye/ClassesPage.dart +++ b/lib/pages/medical/eye/ClassesPage.dart @@ -106,7 +106,7 @@ class ClassesPage extends StatelessWidget { void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: email, onTapSendEmail: () { onTap(); diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index 007a5527..49db73b8 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -167,7 +167,7 @@ class ContactLensPage extends StatelessWidget { void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: email, onTapSendEmail: () { onTap(); diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 3d59af3d..6a62af5d 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -167,7 +167,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: email, onTapSendEmail: () { onTap(); diff --git a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart index 5ef8c69c..a3452d0b 100644 --- a/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart +++ b/lib/pages/medical/my_trackers/Weight/AddWeightPage.dart @@ -9,8 +9,6 @@ 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/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -96,7 +94,7 @@ class _AddWeightPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: weightUnit, onValueSelected: (index) { @@ -198,7 +196,7 @@ class _AddWeightPageState extends State { onTap: () { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).removeMeasure, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart index 6857b6cd..b2f7e759 100644 --- a/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart +++ b/lib/pages/medical/my_trackers/Weight/WeightHomePage.dart @@ -57,7 +57,7 @@ class _WeightHomePageState extends State with SingleTickerProvid onPressed: () { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart index a4c0b943..9e666cf7 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/AddBloodPressurePage.dart @@ -106,7 +106,7 @@ class _AddBloodPressurePageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: measuredArm, onValueSelected: (index) { diff --git a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart index 7501e910..7cb1b154 100644 --- a/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart +++ b/lib/pages/medical/my_trackers/blood_pressure/BloodPressureHomePage.dart @@ -127,7 +127,7 @@ class _BloodPressureHomePageState extends State with Sing () { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart index 8e47e4e8..a3c1fa94 100644 --- a/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart +++ b/lib/pages/medical/my_trackers/blood_suger/AddBloodSugarPage.dart @@ -214,7 +214,7 @@ class _AddBloodSugarPageState extends State { onTap: () { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).removeMeasure, onTap: () async { GifLoaderDialogUtils.showMyDialog(context); @@ -301,7 +301,7 @@ class _AddBloodSugarPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedMeasureUnitIndex, onValueSelected: (index) { @@ -320,7 +320,7 @@ class _AddBloodSugarPageState extends State { showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedMeasureTimeIndex, isScrollable: true, diff --git a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart index eeef1de5..21ed5840 100644 --- a/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart +++ b/lib/pages/medical/my_trackers/blood_suger/blood_sugar_home_page.dart @@ -135,7 +135,7 @@ class _BloodSugarHomePageState extends State with SingleTick () { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () async { GifLoaderDialogUtils.showMyDialog(context); diff --git a/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart index 7248b7e0..4e0fe4e6 100644 --- a/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/CurvedChartBloodPressure.dart @@ -13,12 +13,7 @@ class CurvedChartBloodPressure extends StatelessWidget { final int indexes; final double horizontalInterval; - CurvedChartBloodPressure( - {this.title, - this.timeSeries1, - this.indexes, - this.timeSeries2, - this.horizontalInterval = 20.0}); + CurvedChartBloodPressure({this.title, this.timeSeries1, this.indexes, this.timeSeries2, this.horizontalInterval = 20.0}); List xAxixs = List(); List yAxixs = List(); @@ -43,8 +38,7 @@ class CurvedChartBloodPressure extends StatelessWidget { ), Text( title, - style: TextStyle( - color: Colors.black, fontSize: 15, letterSpacing: 2), + style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), textAlign: TextAlign.center, ), SizedBox( @@ -52,8 +46,7 @@ class CurvedChartBloodPressure extends StatelessWidget { ), Expanded( child: Padding( - padding: - const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), + padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15), child: LineChart( sampleData1(context), swapAnimationDuration: const Duration(milliseconds: 250), @@ -72,9 +65,7 @@ class CurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Theme.of(context).primaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: Theme.of(context).primaryColor), ), SizedBox( width: 5, @@ -90,8 +81,7 @@ class CurvedChartBloodPressure extends StatelessWidget { Container( width: 20, height: 20, - decoration: BoxDecoration( - shape: BoxShape.rectangle, color: secondaryColor), + decoration: BoxDecoration(shape: BoxShape.rectangle, color: secondaryColor), ), SizedBox( width: 5, @@ -124,19 +114,17 @@ class CurvedChartBloodPressure extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), - gridData: FlGridData( - show: true, drawVerticalLine: true, drawHorizontalLine: true), + gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), - margin: 22, getTitles: (value) { if (timeSeries1.length < 15) { @@ -145,10 +133,8 @@ class CurvedChartBloodPressure extends StatelessWidget { } else return ''; } else { - if (value.toInt() == 0) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; - if (value.toInt() == timeSeries1.length - 1) - return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == 0) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; + if (value.toInt() == timeSeries1.length - 1) return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; if (xAxixs.contains(value.toInt())) { return '${timeSeries1[value.toInt()].time.month}/ ${timeSeries1[value.toInt()].time.year}'; } @@ -158,9 +144,12 @@ class CurvedChartBloodPressure extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, - - getTextStyles: (value) => const TextStyle( + interval: getMaxY() - getMinY() <= 500 + ? 50 + : getMaxY() - getMinY() <= 1000 + ? 100 + : 200, + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/medical/my_trackers/widget/LineChartCurved.dart b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart index 47a5d490..a49f7c80 100644 --- a/lib/pages/medical/my_trackers/widget/LineChartCurved.dart +++ b/lib/pages/medical/my_trackers/widget/LineChartCurved.dart @@ -163,14 +163,14 @@ class LineChartCurved extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), @@ -194,7 +194,7 @@ class LineChartCurved extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart index bf3d9cb9..8431dd0b 100644 --- a/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart +++ b/lib/pages/medical/my_trackers/widget/MonthCurvedChartBloodPressure.dart @@ -113,14 +113,14 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), @@ -138,7 +138,7 @@ class MonthCurvedChartBloodPressure extends StatelessWidget { ? 30 : 40, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart index c1ef7f5a..6192134c 100644 --- a/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart +++ b/lib/pages/medical/my_trackers/widget/MonthLineChartCurved.dart @@ -87,7 +87,7 @@ class MonthLineChartCurved extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData( @@ -100,7 +100,7 @@ class MonthLineChartCurved extends StatelessWidget { titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), @@ -111,7 +111,7 @@ class MonthLineChartCurved extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index f9f8f7e2..401bf694 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -66,7 +66,7 @@ class _PatientSickLeavePageState extends State { void showConfirmMessage(PatientSickLeaveViewMode model, int index) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { model.sendSickLeaveEmail( diff --git a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart index 6574780d..ba094229 100644 --- a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart +++ b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart @@ -7,14 +7,14 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.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/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -39,6 +39,7 @@ class PrescriptionDeliveryAddressPage extends StatefulWidget { class _PrescriptionDeliveryAddressPageState extends State { AddressInfo _selectedAddress; + int _selectedAddressIndex = -1; Completer _controller = Completer(); CameraPosition _kGooglePlex = CameraPosition( @@ -86,55 +87,58 @@ class _PrescriptionDeliveryAddressPageState extends State confirmSelectLocationDialog(model.addressesList), - child: Container( - padding: EdgeInsets.all(8), - width: double.infinity, - // height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white, - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - getAddressName(), - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 12, - letterSpacing: -0.45, - ), - ), + CommonDropDownView(TranslationBase.of(context).selectAddress, getAddressName(), () { + List list = [ + for (int i = 0; i < model.addressesList.length; i++) RadioSelectionDialogModel(model.addressesList[i].address1, i), + ]; + + showDialog( + context: context, + builder: (cxt) => RadioSelectionDialog( + listData: list, + isScrollable: true, + selectedIndex: _selectedAddressIndex, + onValueSelected: (index) { + _selectedAddressIndex = index; + _selectedAddress = model.addressesList[index]; + List latLongArr = _selectedAddress.latLong.split(','); + + latitude = double.parse(latLongArr[0]); + longitude = double.parse(latLongArr[1]); + markers = Set(); + markers.add( + Marker( + markerId: MarkerId( + _selectedAddress.latLong.hashCode.toString(), ), - Icon(Icons.arrow_drop_down) - ], - ), - ), + position: LatLng(latitude, longitude), + ), + ); + _kGooglePlex = CameraPosition( + target: LatLng(latitude, longitude), + zoom: 14.4746, + ); + setState(() {}); + }, ), - height: 50, - width: double.infinity, - ), - ), + ); + }).withBorderedContainer, + SizedBox(height: 12), InkWell( onTap: () async { Navigator.push( context, FadePage( - page: LocationPage( - latitude: latitude, - longitude: longitude, - )), + page: LocationPage( + latitude: latitude, + longitude: longitude, + ), + ), ).then((value) { if (value != null && value is AddNewAddressRequestModel) { setState(() { @@ -179,140 +183,108 @@ class _PrescriptionDeliveryAddressPageState extends State SelectLocationDialog( addresses: addresses, selectedAddress: _selectedAddress, onValueSelected: (value) { @@ -355,9 +327,6 @@ class _PrescriptionDeliveryAddressPageState extends State ConfirmWithMessageDialog( message: TranslationBase.of(context).confirmPrescription, okTitle: TranslationBase.of(context).ok, onTap: () async { @@ -225,7 +225,7 @@ class PrescriptionOrderOverview extends StatelessWidget { void showErrorDialog(BuildContext context, String error) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).youAlreadyHaveOrder, okTitle: TranslationBase.of(context).orderOverview, onTap: () { diff --git a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart index b12cc386..bb0f6a30 100644 --- a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart @@ -28,7 +28,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { body: Column( children: [ Padding( - padding: const EdgeInsets.fromLTRB(21, 21, 21, 0), + padding: const EdgeInsets.fromLTRB(21, 21, 21, 10), child: Container( width: double.infinity, padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), @@ -50,7 +50,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { ClipRRect( borderRadius: BorderRadius.all(Radius.circular(5)), child: Image.network( - prescriptionReport.imageSRCUrl, + prescriptionReport?.imageSRCUrl ?? "", fit: BoxFit.cover, width: 60, height: 70, @@ -60,7 +60,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''), + child: Texts((prescriptionReport?.itemDescription ?? "").isNotEmpty ? prescriptionReport?.itemDescription ?? "" : prescriptionReport?.itemDescriptionN ?? ''), ), ), ) @@ -72,7 +72,7 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { ? Expanded( child: ListView.builder( scrollDirection: Axis.vertical, - padding: EdgeInsets.all(21), + padding: EdgeInsets.fromLTRB(21, 11, 21, 21), physics: BouncingScrollPhysics(), itemBuilder: (context, index) { GetHMGLocationsModel location = GetHMGLocationsModel(); diff --git a/lib/pages/medical/prescriptions/prescription_details_inp.dart b/lib/pages/medical/prescriptions/prescription_details_inp.dart index 8c181f88..25c3790c 100644 --- a/lib/pages/medical/prescriptions/prescription_details_inp.dart +++ b/lib/pages/medical/prescriptions/prescription_details_inp.dart @@ -1,279 +1,216 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_inp.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; +import 'package:diplomaticquarterapp/models/header_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.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/widgets/data_display/text.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'; +import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; class PrescriptionDetailsPageINP extends StatelessWidget { final PrescriptionReportINP prescriptionReport; + final Prescriptions prescriptions; - PrescriptionDetailsPageINP({Key key, this.prescriptionReport}); + PrescriptionDetailsPageINP({Key key, this.prescriptionReport, this.prescriptions}); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty - ? prescriptionReport.itemDescription - : prescriptionReport.itemDescriptionN ?? ''), - ), - ), - ) - ], - ), - ), - Container( - margin: EdgeInsets.all(8), - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - ), - ), - ), - child: Center( - child: Column( - children: [ - Container( - width: 50, - decoration: BoxDecoration(color: Colors.white, shape: BoxShape.rectangle), - child: Column( - children: [ - Icon( - Icons.pin_drop, - color: Colors.red[800], - size: 55, - ), - ], - ), - ), - SizedBox( - height: 5, - ), - Texts(TranslationBase.of(context).availability) - ], - ), - )), - ), - _addReminderButton(context) - ], - ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DoctorHeader( + headerModel: HeaderModel( + prescriptions.doctorName, + prescriptions.doctorID, + prescriptions.doctorImageURL, + prescriptions.speciality, + "", + prescriptions.name, + DateUtil.convertStringToDate(prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + prescriptions.nationalityFlagURL, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, + "", ), - Container( - color: Colors.white, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - child: Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)), - children: [ - TableRow( - children: [ - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).route, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).frequency, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 4), - child: Center( - child: Texts( - "${TranslationBase.of(context).dailyDoses}", - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).duration, - fontSize: 14, - ))), + isNeedToShowButton: false, + ), + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + children: [ + Container( + padding: EdgeInsets.all(14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + //spreadRadius: 5, + blurRadius: 27, + offset: Offset(0, -3), + ), ], ), - TableRow( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.routeN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text(prescriptionReport.frequencyN ?? ''))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))), - Container( - color: Colors.white, - height: 50, - width: double.infinity, - child: Center(child: Text('${prescriptionReport.days}'))) + Row( + children: [ + 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( + child: Text( + (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ) + ], + ), + SizedBox(height: 12), + Table(border: TableBorder(horizontalInside: BorderSide(width: 1, color: Colors.black, style: BorderStyle.solid)), children: [ + TableRow( + children: [ + Utils.tableColumnTitle(TranslationBase.of(context).route, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).frequency, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).dailyDoses, showDivider: false), + Utils.tableColumnTitle(TranslationBase.of(context).duration, showDivider: false) + ], + ), + TableRow( + children: [ + Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + ], + ), + ]), + Text( + TranslationBase.of(context).remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), + ), + Text( + prescriptionReport.remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), + ), ], ), - ], - ), + ), + ], ), - Container( - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - width: double.infinity, - color: Colors.white, - padding: EdgeInsets.all(5), - child: Center( - child: Column( - children: [ - Texts(TranslationBase.of(context).notes), - SizedBox( - height: 5, - ), - Divider( - height: 0.5, - color: Colors.grey[300], - ), - SizedBox( - height: 5, - ), - Texts(prescriptionReport.remarks ?? ''), - ], + ), + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).availability, + () { + Navigator.push( + context, + FadePage( + page: PharmacyForPrescriptionsPage( + itemID: prescriptionReport.itemID, + prescriptionReport: PrescriptionReport.fromJson(prescriptionReport.toJson()), + ), + ), + ); + }, + iconData: Icons.location_on, + color: Color(0xff359846), + ), ), - ), - ) - ], - ), - ), - ); - } - - Widget _addReminderButton(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).addReminder, + () { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - return GestureDetector( - onTap: () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - print(prescriptionReport); - showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: ReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "Prescription Reminder", - description: - "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: "/Date(${startDate.millisecondsSinceEpoch}+0300)/", - endDate: "/Date(${endDate.millisecondsSinceEpoch}+0300)/", - location: prescriptionReport.remarks, + showReminderDialog( + context, + endDate, + "", + prescriptionReport.itemID.toString(), + "", + "", + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + onMultiDateSuccess: (int selectedIndex) { + setCalender(context, prescriptionReport.itemID.toString(), selectedIndex); + }, + ); + return; + }, + iconData: Icons.notifications_active, + color: Color(0xffD02127), + fontSize: 13.0, + //textColor: Color(0xff2B353E), ), ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); - }, - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Container( - // height: 100.0, - margin: EdgeInsets.all(7.0), - padding: EdgeInsets.only(bottom: 4.0), - decoration: BoxDecoration( - boxShadow: [BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0)], - borderRadius: BorderRadius.circular(10), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 0.0), - child: Text("add", - overflow: TextOverflow.clip, - style: TextStyle(color: new Color(0xffB8382C), letterSpacing: 1.0, fontSize: 18.0)), - ), - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Text("reminder", - overflow: TextOverflow.clip, - style: TextStyle(color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), - ), - Container( - alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(10.0, 7.0, 0.0, 8.0) - : EdgeInsets.fromLTRB(0.0, 7.0, 10.0, 8.0), - child: Image.asset("assets/images/new-design/reminder_icon.png", width: 45.0, height: 45.0), - ), ], ), ), @@ -281,4 +218,57 @@ class PrescriptionDetailsPageINP extends StatelessWidget { ), ); } + + setCalender(BuildContext context, String eventId, int reminderIndex) async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + int frequencyNumber = int.parse(prescriptionReport?.frequency); + + DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); //Time will start at 8:00 AM from starting date + if (frequencyNumber == null) frequencyNumber = 1; //Some time frequency number is null so by default will be 2 + + int remainingDays = prescriptionReport.days - (Jiffy(DateTime.now()).diff(DateUtil.convertStringToDate(prescriptionReport.orderDate), Units.DAY)); + + GifLoaderDialogUtils.showMyDialog(context); + + for (int i = 0; i < remainingDays; i++) { + //event for number of days. + for (int j = 0; j < frequencyNumber ?? 1; j++) { + // event for number of times per day. + if (j != 0) { + actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose. + } + //Time subtraction from actual reminder time. like before 30, or 1 hour. + if (reminderIndex == 0) { + // Before 30 mints + actualDate = Jiffy(actualDate).subtract(minutes: 30).dateTime; + // dateTime.add(new Duration(minutes: -30)); + } else if (reminderIndex == 1) { + // Before 1 hour + // dateTime.add(new Duration(minutes: -60)); + actualDate = Jiffy(actualDate).subtract(hours: 1).dateTime; + } else if (reminderIndex == 2) { + // Before 1 hour and 30 mints + // dateTime.add(new Duration(minutes: -90)); + actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30).dateTime; + } else if (reminderIndex == 3) { + // Before 2 hours + // dateTime.add(new Duration(minutes: -120)); + actualDate = Jiffy(actualDate).subtract(hours: 2).dateTime; + } + calendarUtils + .createOrUpdateEvent( + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + scheduleDateTime: actualDate, + eventId: eventId + (i.toString() + j.toString()), //event id with varitions + ) + .then((value) {}); + actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0); + } + actualDate = Jiffy(actualDate).add(days: 1).dateTime; + print(actualDate); + } + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + GifLoaderDialogUtils.hideDialog(context); + } } diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 5a47ec3b..36f77a33 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,13 +1,17 @@ +import 'dart:collection'; + +import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.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.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -18,21 +22,34 @@ 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'; +import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; -class PrescriptionDetailsPage extends StatelessWidget { +class PrescriptionDetailsPage extends StatefulWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); + @override + _PrescriptionDetailsPageState createState() => _PrescriptionDetailsPageState(); +} + +class _PrescriptionDetailsPageState extends State { + bool hasReminder = false; + + @override + void initState() { + checkIfHasReminder(); + super.initState(); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, showNewAppBar: true, - backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, body: Column( @@ -40,18 +57,18 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ DoctorHeader( headerModel: HeaderModel( - prescriptions.doctorName, - prescriptions.doctorID, - prescriptions.doctorImageURL, - prescriptions.speciality, + widget.prescriptions.doctorName, + widget.prescriptions.doctorID, + widget.prescriptions.doctorImageURL, + widget.prescriptions.speciality, "", - prescriptions.name, - DateUtil.convertStringToDate(prescriptions.appointmentDate), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - prescriptions.nationalityFlagURL, - prescriptions.doctorRate, - prescriptions.actualDoctorRate, - prescriptions.noOfPatientsRate, + widget.prescriptions.name, + DateUtil.convertStringToDate(widget.prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions.appointmentDate)), + widget.prescriptions.nationalityFlagURL, + widget.prescriptions.doctorRate, + widget.prescriptions.actualDoctorRate, + widget.prescriptions.noOfPatientsRate, "", ), isNeedToShowButton: false, @@ -81,28 +98,13 @@ 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, - // ), - // ), - // ), InkWell( child: Stack( alignment: Alignment.center, children: [ Container( child: Image.network( - prescriptionReport.imageSRCUrl, + widget.prescriptionReport.imageSRCUrl, fit: BoxFit.cover, width: 48, height: 49, @@ -123,13 +125,15 @@ class PrescriptionDetailsPage extends StatelessWidget { ], ), onTap: () { - showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + showZoomImageDialog(context, widget.prescriptionReport.imageSRCUrl); }, ), SizedBox(width: 12), Expanded( child: Text( - (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + (widget.prescriptionReport.itemDescription.isNotEmpty ? widget.prescriptionReport.itemDescription : widget.prescriptionReport.itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), ) @@ -147,10 +151,10 @@ class PrescriptionDetailsPage extends StatelessWidget { ), TableRow( children: [ - Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), ], ), ]), @@ -159,7 +163,7 @@ class PrescriptionDetailsPage extends StatelessWidget { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), ), Text( - prescriptionReport.remarks, + widget.prescriptionReport.remarks, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), ], @@ -182,8 +186,8 @@ class PrescriptionDetailsPage extends StatelessWidget { context, FadePage( page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - prescriptionReport: prescriptionReport, + itemID: widget.prescriptionReport.itemID, + prescriptionReport: widget.prescriptionReport, ), ), ); @@ -195,54 +199,35 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox(width: 10), Expanded( child: DefaultButton( - TranslationBase.of(context).addReminder, + hasReminder ? TranslationBase.of(context).cancelReminder : TranslationBase.of(context).addReminder, () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - showReminderDialog( - context, - endDate, - "", - prescriptionReport.itemID.toString(), - "", - "", - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - onSuccess: () { - AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - }, - ); - return; - - 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: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, - ), - ), - ); + if (hasReminder) { + cancelReminders(); + } else { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + widget.prescriptionReport.days); + showReminderDialog( + context, + endDate, + "", + widget.prescriptionReport.itemID.toString(), + "", + "", + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + onMultiDateSuccess: (int selectedIndex) { + setCalender(context, widget.prescriptionReport.itemID.toString(), selectedIndex); }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); + ); + return; + } }, iconData: Icons.notifications_active, color: Color(0xffD02127), + fontSize: 13.0, //textColor: Color(0xff2B353E), ), ), @@ -253,4 +238,98 @@ class PrescriptionDetailsPage extends StatelessWidget { ), ); } + + checkIfHasReminder() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30).dateTime; + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120).dateTime; + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) + setState(() { + hasReminder = true; + }); + }); + }); + } + + cancelReminders() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30).dateTime; + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120).dateTime; + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + }); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess); + setState(() { + hasReminder = false; + }); + } + + setCalender(BuildContext context, String eventId, int reminderIndex) async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); //Time will start at 8:00 AM from starting date + if (widget.prescriptionReport?.frequencyNumber == null) widget.prescriptionReport.frequencyNumber = 1; //Some time frequency number is null so by default will be 2 + + int remainingDays = widget.prescriptionReport.days - (Jiffy(DateTime.now()).diff(DateUtil.convertStringToDate(widget.prescriptionReport.orderDate), Units.DAY)); + + GifLoaderDialogUtils.showMyDialog(context); + + for (int i = 0; i < remainingDays; i++) { + //event for number of days. + for (int j = 0; j < widget.prescriptionReport.frequencyNumber ?? 1; j++) { + // event for number of times per day. + if (j != 0) { + actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose. + } + //Time subtraction from actual reminder time. like before 30, or 1 hour. + if (reminderIndex == 0) { + // Before 30 mints + actualDate = Jiffy(actualDate).subtract(minutes: 30).dateTime; + // dateTime.add(new Duration(minutes: -30)); + } else if (reminderIndex == 1) { + // Before 1 hour + // dateTime.add(new Duration(minutes: -60)); + actualDate = Jiffy(actualDate).subtract(hours: 1).dateTime; + } else if (reminderIndex == 2) { + // Before 1 hour and 30 mints + // dateTime.add(new Duration(minutes: -90)); + actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30).dateTime; + } else if (reminderIndex == 3) { + // Before 2 hours + // dateTime.add(new Duration(minutes: -120)); + actualDate = Jiffy(actualDate).subtract(hours: 2).dateTime; + } + calendarUtils + .createOrUpdateEvent( + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", + scheduleDateTime: actualDate, + eventId: eventId + (i.toString() + j.toString()), //event id with varitions + ) + .then((value) {}); + actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0); + } + actualDate = Jiffy(actualDate).add(days: 1).dateTime; + print(actualDate); + } + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + GifLoaderDialogUtils.hideDialog(context); + setState(() { + hasReminder = true; + }); + } } diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 0e627a95..3e830747 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -79,6 +79,7 @@ class PrescriptionItemsPage extends StatelessWidget { FadePage( page: PrescriptionDetailsPageINP( prescriptionReport: model.prescriptionReportListINP[index], + prescriptions: prescriptions, ), ), ); @@ -243,6 +244,8 @@ class PrescriptionItemsPage extends StatelessWidget { doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity, days: model.prescriptionReportEnhList[index].days, itemID: model.prescriptionReportEnhList[index].itemID, + orderDate: model.prescriptionReportEnhList[index].orderDate, + startDate: model.prescriptionReportEnhList[index].startDate, remarks: model.prescriptionReportEnhList[index].remarks); Navigator.push( context, @@ -408,7 +411,7 @@ class PrescriptionItemsPage extends StatelessWidget { void showConfirmMessage(BuildContext context, PrescriptionsViewModel model) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { model.sendPrescriptionEmail( diff --git a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart index e9b1dfb6..1343f479 100644 --- a/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_history_details_page.dart @@ -21,7 +21,7 @@ class PrescriptionsHistoryDetailsPage extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.getPrescriptionReportDetailsRC(), + onModelReady: (model) => model.getPrescriptionReportDetailsRC(prescriptionsOrder.iD, projectViewModel.user.patientID), builder: (_, model, widget) { int status = prescriptionsOrder.statusId; String _statusDisp = prescriptionsOrder.statusText; diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index d5efa38b..4cb1e890 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -65,12 +65,12 @@ class _HomePrescriptionsPageState extends State with Sing unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), labelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index f2a9490e..8a13d860 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -110,7 +110,7 @@ class RadiologyDetailsPage extends StatelessWidget { void showConfirmMessage({FinalRadiology finalRadiology, RadiologyViewModel model}) { showDialog( context: AppGlobal.context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { model.sendRadReportEmail(mes: TranslationBase.of(AppGlobal.context).sendSuc, finalRadiology: finalRadiology); diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index 8d72216a..cc76214b 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -121,7 +121,7 @@ class ReportListWidget extends StatelessWidget { void showConfirmMessage(Reports report) { showDialog( context: AppGlobal.context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: emailAddress, onTapSendEmail: () { sendReportEmail(report); diff --git a/lib/pages/medical/reports/reports_page.dart b/lib/pages/medical/reports/reports_page.dart index 85d35d84..bdd638e5 100644 --- a/lib/pages/medical/reports/reports_page.dart +++ b/lib/pages/medical/reports/reports_page.dart @@ -20,7 +20,7 @@ class MedicalReports extends StatelessWidget { void confirmBox(AppointmentHistory model, ReportsViewModel reportsViewModel) { showDialog( context: context, - child: ConfirmWithMessageDialog( + builder: (cxt) => ConfirmWithMessageDialog( message: TranslationBase.of(context).confirmMsgReport, onTap: () => reportsViewModel.insertRequestForMedicalReport(model, TranslationBase.of(context).successSendReport), ), diff --git a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart index cceb8b1e..02e69481 100644 --- a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart @@ -137,8 +137,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; - weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -165,8 +167,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; - monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -193,8 +197,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; - yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + } isYearlyDataLoaded = true; }); }).catchError((err) { @@ -457,16 +463,16 @@ class _DistanceTrackerState extends State with SingleTickerProv children: [ yearlyStepsList.isEmpty ? Container( - child: Center( - child: Text(TranslationBase.of(context).noDataAvailable), - ), - ) + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) : Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - }, - children: fullData(context), - ), + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), ], ), ) @@ -549,7 +555,7 @@ class _DistanceTrackerState extends State with SingleTickerProv ), ); yearlyStepsList.forEach( - (step) { + (step) { tableRow.add( TableRow( children: [ @@ -559,7 +565,8 @@ class _DistanceTrackerState extends State with SingleTickerProv )} ', 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), + Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_, + isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -567,5 +574,4 @@ class _DistanceTrackerState extends State with SingleTickerProv ); 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 80a12cca..48902ff0 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 @@ -36,40 +36,29 @@ class _HealthDataListState extends State { appBarTitle: TranslationBase.of(context).smartWatches, isShowAppBar: true, showNewAppBar: true, + backgroundColor: Color(0xffF7F7F7), 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]; - }, - ), - ), - ], + body: Column( + children: [ + Expanded( + child: GridView.builder( + physics: BouncingScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.all(21), + itemCount: myMedicalList.length, + itemBuilder: (BuildContext context, int index) { + return myMedicalList[index]; + }, + ), ), - ), + syncHealthDataButton(), + ], ), - bottomSheet: syncHealthDataButton(), ); } List myOptionsList(BuildContext context) { - List medical = List(); + List medical = []; medical.add(InkWell( onTap: () => Navigator.push( diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart index 077ed4bf..5d4b8e4a 100644 --- a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -171,7 +171,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + if (avgMonthlyHearRateValue != 0) { + monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -198,7 +200,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + if (avgYearlyHearRateValue != 0) { + yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { 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 17d9d8a8..0c0be8c3 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 @@ -44,228 +44,236 @@ class _SmartWatchInstructionsState extends State { isShowDecPage: true, showNewAppBar: true, showNewAppBarTitle: true, + backgroundColor: Color(0xffF7F7F7), 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), - ), + body: Column( + children: [ + Expanded( + child: Container( + child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), + ), + ), + DefaultButton( + TranslationBase.of(context).continues, + () { + _openHealthDataList(); + }, + color: Color(0xff359846), + ).insideContainer + ], ), ); } _getAppleWatchInstructions() { return SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, children: [ - Container( - 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( + Text( + TranslationBase.of(context).supportedWatches, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w600, + letterSpacing: -1.2, + color: Color(0xff2E303A), + ), + ), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), 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)), - ), - ) - ], - ), - ), - ), - Expanded( + 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( - 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)), - ), - ) - ], - ), + width: MediaQuery.of(context).size.width * 0.22, + child: Text("Apple Watch Series 1", overflow: TextOverflow.clip, style: TextStyle(fontSize: 12.0)), ), - ), + ) ], ), ), - Container( + ), + Expanded( + child: Container( margin: EdgeInsets.only(top: 10.0), child: Row( children: [ - Expanded( + 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( - 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)), - ), - ) - ], - ), + 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-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/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)), ), - ), - ), - ], + ) + ], + ), ), ), - 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/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)), ), - ), - ), - 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.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)), ), - ), - ), - ], + ) + ], + ), ), ), - 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)), + 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.all(10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro2, 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/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)), + ), + ) + ], + ), + ), ), - InkWell( - onTap: () { - showInstructionsDialog(); - }, - 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)), + 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)), + ), + ) + ], + ), ), ), ], ), ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).syncInstructionsIntro1, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + ), + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).syncInstructionsIntro2, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + ), + ), + SizedBox(height: 12), + InkWell( + onTap: () { + showInstructionsDialog(); + }, + child: Text(TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), + ), ], ), ); @@ -273,183 +281,200 @@ class _SmartWatchInstructionsState extends State { _getGoogleWatchInstructions() { return SingleChildScrollView( - 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)), + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).supportedWatches, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w600, + letterSpacing: -1.2, + color: Color(0xff2E303A), ), - 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ) - ], - ), + ), + 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)), - ), + ), + SizedBox(height: 12), + InkWell( + onTap: () { + launch("https://wearos.google.com/#find-your-watch"); + }, + child: Text( + TranslationBase.of(context).moreSupportedWatches, + style: TextStyle(fontSize: 14.0, color: Colors.blue, fontWeight: FontWeight.w600, decoration: TextDecoration.underline, letterSpacing: -0.56), ), - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).syncInstructionsIntro1, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: Color(0xff575757), ), - Container( - margin: EdgeInsets.only(top: 10.0, bottom: 10.0), - child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).syncInstructionsIntro2, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + fontWeight: FontWeight.w600, + color: Color(0xff575757), ), - 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)), - ), + ), + SizedBox(height: 12), + InkWell( + onTap: () { + showInstructionsDialog(); + }, + child: Text( + TranslationBase.of(context).watchInstructions, + style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline), ), - ], - ), + ), + ], ), ); } @@ -470,69 +495,107 @@ class _SmartWatchInstructionsState extends State { children: [ Container( width: 350.0, + padding: EdgeInsets.all(21), 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); - }, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).smartWatches, + style: TextStyle(fontSize: 18.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -1.2), + ), + IconButton( + icon: Icon( + Icons.close, + color: Color(0xff2E303A), ), - ], - ), + 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)), + Text( + TranslationBase.of(context).syncInstructionsIntro3, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), + SizedBox(height: 12), Platform.isIOS ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - 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)), + Text( + TranslationBase.of(context).iosInstructions1, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), - Container( - 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)), + SizedBox(height: 12), + Text( + TranslationBase.of(context).iosInstructions2, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), - Container( - 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)), + SizedBox(height: 12), + Text( + TranslationBase.of(context).iosInstructions3, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), ], ) : Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - 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)), + Text( + TranslationBase.of(context).androidInstructions1, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), - Container( - 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)), + SizedBox(height: 12), + Text( + TranslationBase.of(context).androidInstructions2, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), - Container( - 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)), + SizedBox(height: 12), + Text( + TranslationBase.of(context).androidInstructions3, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), - Container( - 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)), + SizedBox(height: 12), + Text( + TranslationBase.of(context).androidInstructions4, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), ), ], ), diff --git a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart index 5f63c2ad..3832d799 100644 --- a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart @@ -136,7 +136,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -163,7 +165,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -190,7 +194,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index ac497ba4..4fcb08e1 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -1,29 +1,25 @@ +import 'dart:io'; + import 'package:collection/collection.dart'; import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.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/widgets/buttons/defaultButton.dart'; -import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; +import 'package:health/health.dart'; class syncHealthDataButton extends StatefulWidget { - double marginTop; - - double hight; - - double minWidth; - - syncHealthDataButton({this.marginTop, this.hight, this.minWidth}); + syncHealthDataButton(); @override _syncHealthDataButtonState createState() => _syncHealthDataButtonState(); } class _syncHealthDataButtonState extends State { - List dataTypes = List(); + List _healthDataList = []; List Med_InsertTransactionsInputsList = new List(); List Med_InsertTransactionsInputsList2 = new List(); @@ -38,27 +34,12 @@ class _syncHealthDataButtonState extends State { @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(); - }), - ), - ); + return DefaultButton(TranslationBase.of(context).syncHealthData, () => readAll()).insideContainer; } void readAll() async { @@ -68,99 +49,43 @@ class _syncHealthDataButtonState extends State { 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: 1000, - ); - - if (type == DataType.DISTANCE) { - MedCategoryID = 7; - } else if (type == DataType.STEP_COUNT) { - MedCategoryID = 6; - } else if (type == DataType.HEART_RATE) { - MedCategoryID = 3; - } + DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); - 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: "")); - }); - } + HealthFactory health = HealthFactory(); + List types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING]; + + await health.requestAuthorization(types); + + try { + List healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); + _healthDataList.addAll(healthData); + } catch (e) { + print("Caught exception in getHealthDataFromTypes: $e"); } + + _healthDataList = HealthFactory.removeDuplicates(_healthDataList); + + _healthDataList.forEach((x) { + if (x.type == HealthDataType.STEPS) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 6, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.HEART_RATE) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 3, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 7, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + }); + 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; @@ -190,39 +115,22 @@ class _syncHealthDataButtonState extends State { 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: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add(new healthData( - MedCategoryID: 4, - MedSubCategoryID: element['MedSubCategoryID'], - MachineDate: DateUtil.convertDateToString(date), - Value: element['Value'], - TransactionsListID: TransactionsListID++, - Notes: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); } - // else if(element['MedCategoryID'] == 8){ - // - // totalCalories += element['Value'] ; - // } }); if (counter == 0) { @@ -235,27 +143,16 @@ class _syncHealthDataButtonState extends State { } Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalSteps, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalDistance, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++)); }); addInsertTransactionsInputsList(); 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() { @@ -264,7 +161,7 @@ class _syncHealthDataButtonState extends State { SmartWatchIntegrationService service = new SmartWatchIntegrationService(); service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); + AppToast.showSuccessToast(message: TranslationBase.of(context).syncSuccess); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); diff --git a/lib/pages/medical/vital_sign/LineChartCurved.dart b/lib/pages/medical/vital_sign/LineChartCurved.dart index 12cfa026..305d158e 100644 --- a/lib/pages/medical/vital_sign/LineChartCurved.dart +++ b/lib/pages/medical/vital_sign/LineChartCurved.dart @@ -101,14 +101,14 @@ class LineChartCurved extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), @@ -132,7 +132,7 @@ class LineChartCurved extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart index b4afebad..967c98cc 100644 --- a/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart +++ b/lib/pages/medical/vital_sign/LineChartCurvedBloodPressure.dart @@ -142,14 +142,14 @@ class LineChartCurvedBloodPressure extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), @@ -173,7 +173,7 @@ class LineChartCurvedBloodPressure extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart index 97daf27f..da983d56 100644 --- a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart @@ -18,28 +18,25 @@ dynamic languageID; class ClinicPackagesPage extends StatefulWidget { List products; + ClinicPackagesPage({@required this.products}); @override _ClinicPackagesPageState createState() => _ClinicPackagesPageState(); - - } -class _ClinicPackagesPageState extends State with AfterLayoutMixin{ +class _ClinicPackagesPageState extends State with AfterLayoutMixin { AppScaffold appScaffold; List get _products => widget.products; PackagesViewModel viewModel; - onProductCartClick(PackagesResponseModel product) async { - if(viewModel.service.customer == null) - viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + if (viewModel.service.customer == null) viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); - if(viewModel.service.customer != null) { + 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){ + await viewModel.service.addProductToCart(request, context: context).then((response) { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { utils.Utils.showErrorToast(error); @@ -47,9 +44,8 @@ class _ClinicPackagesPageState extends State with AfterLayo } } - @override - void afterFirstLayout(BuildContext context) async{ + void afterFirstLayout(BuildContext context) async { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); } @@ -58,13 +54,11 @@ class _ClinicPackagesPageState extends State with AfterLayo super.initState(); } - @override Widget build(BuildContext context) { - return BaseView( allowAny: true, - onModelReady: (model){ + onModelReady: (model) { viewModel = model; }, builder: (_, model, wi) => appScaffold = AppScaffold( @@ -76,22 +70,25 @@ class _ClinicPackagesPageState extends State with AfterLayo isOfferPackages: true, showOfferPackagesCart: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( - padding: const EdgeInsets.all(5), + padding: const EdgeInsets.all(12), child: StaggeredGridView.countBuilder( - crossAxisCount:4, + crossAxisCount: 4, itemCount: _products.length, itemBuilder: (BuildContext context, int index) => new Container( color: Colors.transparent, - child: PackagesItemCard( itemContentPadding: 10,itemModel: _products[index], onCartClick: onProductCartClick,) - ), + child: PackagesItemCard( + itemContentPadding: 10, + itemModel: _products[index], + onCartClick: onProductCartClick, + )), staggeredTileBuilder: (int index) => StaggeredTile.fit(2), mainAxisSpacing: 20, crossAxisSpacing: 10, - ) - ), + )), ), ); } - } diff --git a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart index 17c88cc8..c4d0ce6e 100644 --- a/lib/pages/packages_offers/OfferAndPackageDetailPage.dart +++ b/lib/pages/packages_offers/OfferAndPackageDetailPage.dart @@ -4,11 +4,11 @@ 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/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:expandable/expandable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:html/parser.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -45,185 +45,171 @@ class OfferAndPackagesDetailState extends State { isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - color: Colors.white, - padding: const EdgeInsets.all(21.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(15.0), - child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill), - ), - ), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 21.0), - child: Text(widget.itemModel.name, maxLines: 1, style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14))), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0), - child: Text(widget.itemModel.shortDescription, - maxLines: 2, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), - Row( + body: Column( + children: [ + Expanded( + child: ListView( + physics: BouncingScrollPhysics(), children: [ Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 12.0), - child: RatingBar.readOnly( - initialRating: 4.5, - size: 18.0, - filledColor: Color(0XFFD02127), - emptyColor: Color(0XFFD02127), - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, + color: Colors.white, + padding: const EdgeInsets.all(21.0), + child: AspectRatio( + aspectRatio: 333 / 333, + child: ClipRRect( + borderRadius: BorderRadius.circular(15.0), + child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill), + ), ), ), - ], - ), - Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, top: 18.0), - width: double.infinity, - height: 50.0, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: widget.itemModel.storeNames.length, - separatorBuilder: (context, index) { - return mWidth(5.0); - }, - itemBuilder: (BuildContext context, int index) { - return contactButton(widget.itemModel.storeNames[index].toString()); - }, - ), - ), - Container( - padding: const EdgeInsets.only(top: 18.0), - child: ExpandableNotifier( - initialExpanded: true, - child: Container( - color: Colors.white, + Padding( + padding: const EdgeInsets.all(21.0), child: Column( - children: [ - ScrollOnExpand( - scrollOnExpand: true, - scrollOnCollapse: false, - child: ExpandablePanel( - hasIcon: false, - theme: const ExpandableThemeData( - headerAlignment: ExpandablePanelHeaderAlignment.center, - tapBodyToCollapse: true, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.itemModel.name, + maxLines: 1, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, color: Color(0xff2E303A), letterSpacing: -1.14), + ), + Text( + widget.itemModel.shortDescription, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -.56), + ), + SizedBox(height: 9), + Row( + children: [ + RatingBar.readOnly( + initialRating: 4.5, + // todo ask haroon about rating value + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), - header: Padding( - padding: const EdgeInsets.only(top: 20, bottom: 20, left: 21, right: 21), - child: InkWell( + ], + ), + SizedBox(height: 16), + SizedBox( + height: 34, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemCount: widget.itemModel.storeNames.length, + separatorBuilder: (context, index) { + return mWidth(5.0); + }, + itemBuilder: (BuildContext context, int index) { + return contactButton(widget.itemModel.storeNames[index].toString()); + }, + ), + ), + ], + ), + ), + ExpandableNotifier( + initialExpanded: true, + child: Container( + color: Colors.white, + margin: EdgeInsets.only(bottom: 21), + child: Column( + children: [ + ScrollOnExpand( + scrollOnExpand: true, + scrollOnCollapse: false, + child: ExpandablePanel( + hasIcon: false, + theme: const ExpandableThemeData( + headerAlignment: ExpandablePanelHeaderAlignment.center, + tapBodyToCollapse: true, + ), + header: InkWell( onTap: () { setState(() { expandFlag = !expandFlag; controller.expanded = expandFlag; }); }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).description, - maxLines: 1, - style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -1.14), - ), - ], + child: Padding( + padding: const EdgeInsets.all(21), + child: Row( + children: [ + Expanded( + child: Text( + TranslationBase.of(context).description, + maxLines: 1, + style: TextStyle(fontSize: 19.0, color: Color(0xff2E303A), fontWeight: FontWeight.bold, letterSpacing: -1.14), + ), + ), + Icon( + expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, + color: Color(0xff2E303A), ), - ), - Icon( - expandFlag ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, - color: Color(0xff2E303A), - ), - ], + ], + ), ), ), - ), - builder: (_, collapsed, expanded) { - return Expandable( - controller: controller, - collapsed: collapsed, - expanded: Container( - padding: const EdgeInsets.only(left: 21.0, right: 21.0, bottom: 21.0), + builder: (_, collapsed, expanded) { + return Expandable( + controller: controller, + collapsed: collapsed, + expanded: Padding( + padding: const EdgeInsets.only(bottom: 21, left: 21, right: 21), child: Text(parseHtmlString(widget.itemModel.fullDescription), - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.textColor), overflow: TextOverflow.clip)), - theme: const ExpandableThemeData(crossFadePoint: 0), - ); - }, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.56, + color: Color(0xff575757), + ), + overflow: TextOverflow.clip), + ), + theme: const ExpandableThemeData(crossFadePoint: 0), + ); + }, + ), ), - ), - ], + ], + ), ), ), - ), + ], ), - ], - ), - ), - bottomSheet: Container( - padding: const EdgeInsets.only(top: 16, bottom: 16, left: 21, right: 21), - color: Colors.white, - child: Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if(widget.itemModel.hasDiscountsApplied) Container( - margin: const EdgeInsets.only(top: 0.0), - child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, - style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), - Container( - margin: const EdgeInsets.only(top: 0.0), - child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, - style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), - ], + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.itemModel.hasDiscountsApplied) + Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2)), + Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, letterSpacing: -0.76, color: Color(0xff2B353E))), + ], + ), ), - ), - SizedBox(width: 8), - Expanded( - child: SizedBox( - height: 43, - width: double.infinity, - child: FlatButton( - onPressed: () { - // onCartClick(); + SizedBox(width: 8), + Expanded( + child: DefaultButton( + TranslationBase.of(context).addToCart, + () { widget.onCartClick(widget.itemModel); }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: SvgPicture.asset("assets/images/new/add-to-cart.svg", color: Colors.white), - ), - Container( - child: Text( - TranslationBase.of(context).addToCart, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), - ), - ), - ], - ), - color: const Color(0xffD02127), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), + svgIcon: "assets/images/new/add_to_cart.svg", + isTextExpanded: false, ), ), - ), - ], - ), + ], + ).insideContainer + ], ), ), ); @@ -236,18 +222,26 @@ class OfferAndPackagesDetailState extends State { } Widget contactButton(String title) { - return SizedBox( - height: 32, - width: 80.0, - child: FlatButton( - onPressed: () {}, + return Container( + height: 34, + padding: EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 9), + alignment: Alignment.center, + decoration: BoxDecoration( color: Colors.white, - shape: StadiumBorder(side: BorderSide(color: CustomColors.devider, width: 1)), - child: Text( - title, - style: TextStyle(fontSize: 10, letterSpacing: -0.4, color: CustomColors.textColor), - maxLines: 1, + border: Border.all(color: Color(0xffEAEAEA), width: 1), + borderRadius: BorderRadius.all( + Radius.circular(36.0), + ), + ), + child: Text( + title, + style: TextStyle( + fontSize: 10, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, + color: Color(0xff535353), ), + maxLines: 1, ), ); } diff --git a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart index 4b42774b..ee0e3880 100644 --- a/lib/pages/packages_offers/OfferAndPackagesCartPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesCartPage.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/ResponseModel.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/requests/AddProductToCartRequestModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/PackageOrderCompletedPage.dart'; @@ -22,7 +23,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; dynamic languageID; const _columnCount = 1; @@ -115,195 +115,122 @@ class _PackagesCartPageState extends State with AfterLayoutMix ? Column( children: [ Expanded( - child: StaggeredGridView.countBuilder( - crossAxisCount: (_columnCount * _columnCount), - itemCount: viewModel.cartItemList.length, - itemBuilder: (BuildContext context, int index) { - var item = viewModel.cartItemList[index]; - return Dismissible( - key: Key(index.toString()), - direction: DismissDirection.startToEnd, - background: _cartItemDeleteContainer(), - secondaryBackground: _cartItemDeleteContainer(), - confirmDismiss: (direction) async { - bool status = await viewModel.service.deleteProductFromCart(item.id, context: context, showLoading: false); - return status; - }, - onDismissed: (direction) { - viewModel.cartItemList.removeAt(index); + child: ListView.separated( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + itemBuilder: (cxt, index) { + var item = viewModel.cartItemList[index]; + return PackagesCartItemCard( + itemModel: item, + viewModel: viewModel, + getCartItems: fetchData, + shouldStepperChangeApply: (apply, total) async { + var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply); + ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) { + utils.Utils.showErrorToast(error); + }); + if (response.status) { + fetchData(); + } + return response.status ?? false; }, - child: PackagesCartItemCard( - itemModel: item, - viewModel: viewModel, - getCartItems: fetchData, - shouldStepperChangeApply: (apply, total) async { - var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply); - ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) { - utils.Utils.showErrorToast(error); - }); - if (response.status) { - fetchData(); - } - return response.status ?? false; - }, - )); - }, - staggeredTileBuilder: (int index) => StaggeredTile.fit(_columnCount), - mainAxisSpacing: 0, - crossAxisSpacing: 10, - ), + ); + }, + separatorBuilder: (cxt, index) => SizedBox(height: 12), + itemCount: viewModel.cartItemList.length), ), Container( - height: 0.25, - color: Theme.of(context).primaryColor, + height: 1, + color: Color(0xffEFEFEF), ), - ], - ) - : getNoDataWidget(context), - bottomSheet: viewModel.cartItemList.length > 0 - ? Container( - padding: EdgeInsets.all(21.0), - width: double.infinity, - color: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - margin: EdgeInsets.only(bottom: 12.0), - child: InkWell( - onTap: () => confirmSelectHospitalDialog(model.hospitals), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 50, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(color: CustomColors.devider), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getHospitalName(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0.0, 0.0, 20.0, 0.0), - child: Text(TranslationBase.of(context).YouCanPayByTheFollowingOptions, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600)), - ), - Container( - width: MediaQuery.of(context).size.width * 0.75, - margin: EdgeInsets.fromLTRB(0.0, 8.0, 20.0, 5.0), - child: getPaymentMethods(), - ), - Container( - margin: EdgeInsets.only(top: 14.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 24.0, - width: 24.0, - child: Checkbox( - value: _agreeTerms, - onChanged: (v) { - setState(() => _agreeTerms = v); - }), - ), - Expanded( - child: Text( - TranslationBase.of(context).iAcceptTermsConditions, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48), - ), - ), - ], - ), - ), + if (viewModel.cartItemList.length > 0) Container( + padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15), + width: double.infinity, + color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 12, bottom: 3), - child: Row( - children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientShareToDo), - ), - Expanded( - child: _getNormalText(TranslationBase.of(context).sar + " " + (subtotal ?? 0.0).toStringAsFixed(2), isBold: true), - ) - ], + CommonDropDownView( + TranslationBase.of(context).hospital, + getHospitalName(), + () => confirmSelectHospitalDialog(model.hospitals), + ).withBorderedContainer, + SizedBox(height: 12), + Text( + TranslationBase.of(context).YouCanPayByTheFollowingOptions, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, ), ), - mDivider(Colors.grey[200]), - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 3, bottom: 3), - child: Row( - children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientTaxToDo), - ), - Expanded( - child: _getNormalText(TranslationBase.of(context).sar + ' ' + (tax ?? 0.0).toStringAsFixed(2), isBold: true), - ) - ], - ), + SizedBox( + width: MediaQuery.of(context).size.width * 0.75, + child: getPaymentMethods(), ), - mDivider(Colors.grey[200]), - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 3, bottom: 3), + Padding( + padding: EdgeInsets.only(top: 12.0, bottom: 12), child: Row( + mainAxisAlignment: MainAxisAlignment.start, children: [ - Expanded( - child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo), + SizedBox( + height: 16.0, + width: 16.0, + child: Checkbox( + value: _agreeTerms, + onChanged: (v) { + setState(() => _agreeTerms = v); + }), ), + SizedBox(width: 10), Expanded( - child: _getNormalText(TranslationBase.of(context).sar + ' ' + (total ?? 0.0).toStringAsFixed(2), isBold: true, isTotal: true), - ) + child: Text( + TranslationBase.of(context).iAcceptTermsConditions, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.textColor, letterSpacing: -0.48), + ), + ), ], ), ), - ], - ), - ), - Container( - padding: EdgeInsets.only(top: 21, bottom: 21), - child: DefaultButton( - TranslationBase.of(context).payNow, - (_agreeTerms && _selectedHospital != null) - ? () { - Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { - setState(() {}); - }))).then((value) { - print(value); - if (value != null) { - _selectedPaymentMethod = value; - _selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value}; - onPayNowClick(); + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _amountView(TranslationBase.of(context).patientShareToDo, (subtotal ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), + mDivider(Color(0xffEFEFEF)), + _amountView(TranslationBase.of(context).patientTaxToDo, (tax ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), + mDivider(Color(0xffEFEFEF)), + _amountView(TranslationBase.of(context).patientShareTotalToDo, (total ?? 0.0).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true, isTotal: true), + ], + ), + SizedBox(height: 12), + DefaultButton( + TranslationBase.of(context).payNow, + (_agreeTerms && _selectedHospital != null) + ? () { + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }))).then((value) { + print(value); + if (value != null) { + _selectedPaymentMethod = value; + _selectedPaymentParams = {"payment_method_system_name": "Payments.PayFort", "payment_option": value}; + onPayNowClick(); + } + }); } - }); - } - : null, - color: CustomColors.green, - disabledColor: CustomColors.grey2, + : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, + ), + ], ), - ), - ], - ), + ) + ], ) - : SizedBox(), + : getNoDataWidget(context), ); }, ); @@ -315,7 +242,7 @@ class _PackagesCartPageState extends State with AfterLayoutMix ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, selectedIndex: _selectedHospitalIndex, isScrollable: true, @@ -336,13 +263,18 @@ class _PackagesCartPageState extends State with AfterLayoutMix } fetchData() async { - 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(() {}); + final cartResponse = await viewModel.service.cartItems(context: context).catchError((error) {}); + if(cartResponse != null){ + subtotal = cartResponse['subtotal'] ?? 0.0; + tax = cartResponse['tax'] ?? 0.0; + total = cartResponse['total'] ?? 0.0; + viewModel.service.getTamaraOptions(context: context, showLoading: true).then((tamara_options){ + if(tamara_options != null || tamara_options.isNotEmpty) { + viewModel.setTamaraIllegablity(total); + setState(() {}); + } + }); + } } paymentClosed({@required int orderId, @required bool withStatus, dynamic data}) async { @@ -355,6 +287,7 @@ class _PackagesCartPageState extends State with AfterLayoutMix debugPrint(error); }); } + } // Widget _payNow(BuildContext context, {double subtotal, double tax, double total, @required VoidCallback onPayNowClick}) { @@ -407,6 +340,19 @@ class _PackagesCartPageState extends State with AfterLayoutMix // )), // ); // } +_amountView(String title, String value, {bool isBold = false, bool isTotal = false}) { + return Padding( + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: Row(children: [ + Expanded( + child: _getNormalText(title), + ), + Expanded( + child: _getNormalText(value, isBold: isBold, isTotal: isTotal), + ), + ]), + ); +} _getNormalText(text, {bool isBold = false, bool isTotal = false}) { return Text( @@ -416,10 +362,10 @@ _getNormalText(text, {bool isBold = false, bool isTotal = false}) { ? isTotal ? 16 : 12 - : 10, + : 11, letterSpacing: -0.5, - color: isBold ? Colors.black : Colors.grey[700], - fontWeight: FontWeight.w600, + color: isBold ? Color(0xff2E303A) : Color(0xff575757), + fontWeight: isTotal ? FontWeight.bold : FontWeight.w600, ), ); } diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index d323b36d..91f59c74 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOff import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/ClinicOfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesCartPage.dart'; @@ -19,13 +20,13 @@ 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; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/offers_packages/PackagesOfferCard.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class PackagesHomePage extends StatefulWidget { @@ -99,148 +100,88 @@ class _PackagesHomePageState extends State { appBarTitle: TranslationBase.of(context).offerAndPackages, isShowAppBar: true, isPharmacy: false, + backgroundColor: Color(0xfff7f7f7), showPharmacyCart: false, isOfferPackages: true, showOfferPackagesCart: false, isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, - body: SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: projectViewModel.isArabic ? const EdgeInsets.only(top: 21, right: 21, bottom: 21) : const EdgeInsets.only(top: 21, left: 21, bottom: 21), - child: Column( - children: [ - inputWidget(TranslationBase.of(context).search, "", _searchTextController, isInputTypeNum: false), - SizedBox( - height: 10, - ), - InkWell( - onTap: () => showClinicSelectionList(), - child: Container( - padding: EdgeInsets.all(12), - margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), - width: double.infinity, - height: 65, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - selectedClinic != null ? selectedClinic.name : TranslationBase.of(context).browseOffers, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), - ), - ), - SizedBox( - height: 20, - ), - Container( - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.8, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: viewModel.bestSellerList.length, - separatorBuilder: (context, index) { - return mWidth(9.0); - }, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard( - itemModel: viewModel.bestSellerList[index], - onCartClick: onProductCartClick, - ); - }, - ), - ), - SizedBox( - height: 21, - ), - // // Best Seller Horizontal Scrollable List - Container( - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.8, - child: ListView.separated( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: viewModel.latestOffersList.length, - separatorBuilder: (context, index) { - return mWidth(9.0); - }, - itemBuilder: (BuildContext context, int index) { - return PackagesItemCard( - itemModel: viewModel.latestOffersList[index], - onCartClick: onProductCartClick, - ); - }, - ), - ), - ], - ), - ), - SizedBox( - height: 50.0, - ) - ], - ), - ), - bottomSheet: Container( - color: Colors.white, - padding: const EdgeInsets.all(12.0), - child: SizedBox( - height: 43, - width: double.infinity, - child: FlatButton( - onPressed: () { - onCartClick(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, + body: Column( + children: [ + Expanded( + child: ListView( + padding: EdgeInsets.only(top: 21, bottom: 21), + physics: BouncingScrollPhysics(), children: [ + inputWidget(TranslationBase.of(context).search, "", _searchTextController, isInputTypeNum: false), + SizedBox(height: 12), Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: SvgPicture.asset("assets/images/new/cart.svg"), - // child: Icon( - // Icons.add_shopping_cart_rounded, - // size: 30.0, - // color: Colors.white, - // ), + padding: const EdgeInsets.only(left: 21, right: 21), + child: CommonDropDownView(TranslationBase.of(context).browseOffers, selectedClinic?.name ?? TranslationBase.of(context).selectClinic, () => showClinicSelectionList()) + .withBorderedContainer, + ), + SizedBox(height: 12), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(left: 21, right: 21), + itemCount: viewModel.bestSellerList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.bestSellerList[index], + onCartClick: onProductCartClick, + ); + }, + ), ), + SizedBox(height: 12), Container( - child: Text( - TranslationBase.of(context).myCart, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48), + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.8, + child: ListView.separated( + scrollDirection: Axis.horizontal, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.only(left: 21, right: 21), + itemCount: viewModel.latestOffersList.length, + separatorBuilder: (context, index) { + return mWidth(9.0); + }, + itemBuilder: (BuildContext context, int index) { + return PackagesItemCard( + itemModel: viewModel.latestOffersList[index], + onCartClick: onProductCartClick, + ); + }, ), ), ], ), - color: const Color(0xffD02127), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), ), - ), + DefaultButton( + TranslationBase.of(context).myCart, + onCartClick, + svgIcon: "assets/images/new/cart.svg", + isTextExpanded: false, + count: viewModel?.service?.customer?.shoppingCartItems?.length ?? 0, + ).insideContainer + ], ), ); }, ); } + int _selectedClinic = -1; + showClinicSelectionList() async { var clinics = viewModel.service.categoryList; if (clinics.isEmpty) { @@ -254,11 +195,12 @@ class _PackagesHomePageState extends State { ]; showDialog( context: context, - child: RadioSelectionDialog( + builder: (cxt) => RadioSelectionDialog( listData: list, - selectedIndex: 0, + selectedIndex: _selectedClinic, isScrollable: true, onValueSelected: (index) async { + _selectedClinic = index; selectedClinic = clinics[index]; var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true); if (clinicProducts.isNotEmpty) @@ -348,7 +290,7 @@ class _PackagesHomePageState extends State { {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), - margin: projectViewModel.isArabic ? const EdgeInsets.only(left: 21) : const EdgeInsets.only(right: 21), + margin: const EdgeInsets.only(left: 21, right: 21), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 33e616a5..6bdc9080 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -31,12 +31,14 @@ class ParentCategorisePage extends StatefulWidget { String id; String titleName; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -75,559 +77,782 @@ class _ParentCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCategoriseParent(i: id, pageIndex: pageIndex, isLoading: false, context: context), + onModelReady: (model) => model.getCategoriseParent( + i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( - isPharmacy: true, - appBarTitle: titleName, - isBottomBar: true, - isShowAppBar: true, - backgroundColor: Colors.white, - isShowDecPage: false, - baseViewModel: model, - body: SmartRefresher( - enablePullDown: false, - controller: controller, - enablePullUp: true, - onLoading: () async { - setState(() { - ++pageIndex; - }); - await model.getParentProducts(pageIndex: pageIndex, i: id, isLoading: true, context: context); - if (model.state != ViewState.BusyLocal && pageIndex < 5) { - controller.loadComplete(); - } else { - controller.loadFailed(); - } - }, - child: SingleChildScrollView( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - id == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : id == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : id == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : id == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : id == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : id == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : id == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : id == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : id == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : id == '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.categoriseParent.length > 8) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + builder: + (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isPharmacy: true, + appBarTitle: titleName, + isBottomBar: true, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + baseViewModel: model, + body: SmartRefresher( + enablePullDown: false, + controller: controller, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getParentProducts( + pageIndex: pageIndex, + i: id, + isLoading: true, + context: context); + if (model.state != ViewState.BusyLocal && + pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: Container( - child: Texts( - TranslationBase.of(context).viewCategorise, + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context) + .viewCategorise, // 'View All Categories', - fontWeight: FontWeight.w300, + fontWeight: FontWeight.w300, + ), + ), + ), + Icon(Icons.arrow_forward) + ], ), - ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + )), + ); + }), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, ), - Icon(Icons.arrow_forward) ], ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategoriseModalsheet( -// id: model.categorise[0].id, -// titleName: model.categorise[0].name, - )), - ); - }), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - ], - ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200.withOpacity(0.45), - ), - child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, - ), + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: + MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: + model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: + EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), + ), + ), + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.197, + // height: MediaQuery.of(context) + // .size + // .height * + // 0.08, + child: Center( + child: Texts( + projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + fontSize: 13.4, + fontWeight: + FontWeight.w600, + maxLines: 3, + ), + ), + ), + ], ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[index] + .id, + parentId: id, + )), + ); + print(id); + }, ), + ); + }), + ), + ), + ), + + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, ), - Container( - width: MediaQuery.of(context).size.width * 0.197, - // height: MediaQuery.of(context) - // .size - // .height * - // 0.08, - child: Center( - child: Texts( - projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, - fontSize: 13.4, - fontWeight: FontWeight.w600, - maxLines: 3, - ), - ), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of(context).refine, + fontWeight: FontWeight.w600, ), ], ), onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: projectViewModel.isArabic ? model.categoriseParent[index].namen : model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: id, - )), - ); - print(id); - }, - ), - ); - }), - ), - ), - ), - - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, - fontWeight: FontWeight.w600, - ), - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - color: Colors.white, - height: MediaQuery.of(context).size.height * 1.95, - child: Column( - children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - TranslationBase.of(context).refine, + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: + scrollController, + child: Container( + color: Colors.white, + height: + MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( + children: [ + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + children: [ + Icon( + Icons + .wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of( + context) + .refine, // 'Refine', - fontWeight: FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( // 'Close', - TranslationBase.of(context).closeIt, - color: Colors.red, - fontWeight: FontWeight.w600, - fontSize: 15.0, + TranslationBase.of( + context) + .closeIt, + color: Colors + .red, + fontWeight: + FontWeight + .w600, + fontSize: + 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( - children: [ - ExpansionTile( - title: Texts(TranslationBase.of(context).categorise), - children: [ - ProcedureListWidget( - model: model, - masterList: model.categoriseParent, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelected(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).brands), - children: [ - ProcedureListWidget( - model: model, - masterList: model.brandsList, - removeHistory: (item) { - setState(() { - entityListBrands.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityListBrands.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelectedBrands(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).price), - children: [ - Container( - color: Color(0xffEEEEEE), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).min), - Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .categorise), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .categoriseParent, + removeHistory: + (item) { + setState( + () { + entityList + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityList + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .brands), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .brandsList, + removeHistory: + (item) { + setState( + () { + entityListBrands + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityListBrands + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelectedBrands(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .price), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).min), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: minField, + ), + ), + ], ), - controller: minField, - ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).max), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: maxField, + ), + ), + ], + ), + ], ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets + .all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, children: [ - Texts(TranslationBase.of(context).max), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), - ), - controller: maxField, + width: + 150, + child: + Button( + label: TranslationBase.of(context) + .reset, + backgroundColor: + Colors.red, + onTap: + () { + setState( + () { + entityList.clear(); + entityListBrands.clear(); + }); + minField + .clear(); + maxField + .clear(); + }, ), ), - ], - ), - ], - ), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.4, - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - width: 100, - child: Button( - label: TranslationBase.of(context).reset, - backgroundColor: Colors.red, - ), - ), - SizedBox( - width: 30, - ), - Container( - width: 200, - child: Button( - onTap: () async { - String categoriesId = ""; - for (CategoriseParentModel category in entityList) { - if (categoriesId == "") { - categoriesId = category.id; - } else { - categoriesId = "$categoriesId,${category.id}"; - } - } - String brandIds = ""; - for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == "") { - brandIds = brand.id; - } else { - brandIds = "$brandIds,${brand.id}"; - } - } + SizedBox( + width: 10, + ), + Container( + width: + 150, + child: + Button( + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = category.id; + } else { + categoriesId = "$categoriesId,${category.id}"; + } + } + String + brandIds = + ""; + for (CategoriseParentModel brand + in entityListBrands) { + if (brandIds == + "") { + brandIds = brand.id; + } else { + brandIds = "$brandIds,${brand.id}"; + } + } - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog( + context); - await model.getFilteredProducts( - min: minField.text.toString(), max: maxField.text.toString(), categoryId: categoriesId, brandId: brandIds); - GifLoaderDialogUtils.hideDialog(context); + await model.getFilteredProducts( + min: minField.text.isEmpty ? "" : "&price_min=" + minField.text.toString(), + max: maxField.text.isEmpty ? "" : "&price_max=" + maxField.text.toString(), + categoryId: categoriesId, + brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds); + GifLoaderDialogUtils.hideDialog( + context); - Navigator.pop(context); - }, - label: TranslationBase.of(context).apply, - backgroundColor: Colors.green, + Navigator.pop( + context); + }, + label: TranslationBase.of(context) + .apply, + backgroundColor: + Colors.green, + ), + ), + ], + ), ), - ), - ], - ), + ], + ), + ], ), - ], - ), - ], - ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, //width: 0.3, // indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: CustomColors.green, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: CustomColors.green, - size: 29.0, - ); - } - }); - }, - ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - model.parentProducts.isNotEmpty - ? styleOne == true - ? model.state != ViewState.BusyLocal - ? Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, + ), ), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: InkWell( - child: Card( - color: model.parentProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: CustomColors.green, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: CustomColors.green, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + model.parentProducts.isNotEmpty + ? styleOne == true + ? Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.15, + child: GridView.builder( + physics: + NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: + model.parentProducts.length, + itemBuilder: (BuildContext context, + int index) { + return NetworkBaseView( + baseViewModel: model, + child: InkWell( + child: Card( + color: model + .parentProducts[ + index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors + .grey.shade300, + width: 1, + ), ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric(horizontal: 0), - width: MediaQuery.of(context).size.width / 3, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Stack( + margin: + EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: + BoxDecoration( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular( + 110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets + .symmetric( + horizontal: 0), + width: MediaQuery.of( + context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ - if (model.parentProducts[index].discountName != null) - RotatedBox( - quarterTurns: 4, - child: Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - TranslationBase.of(context).offers.toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: FontWeight.w900, + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: + 4, + child: + Container( + decoration: + BoxDecoration(), + child: + Padding( + padding: + EdgeInsets.only( + right: + 5.0, + top: + 20.0, + bottom: + 5.0, + ), + child: + Texts( + TranslationBase.of(context) + .offers + .toUpperCase(), + color: + Colors.red, + fontSize: + 13.0, + fontWeight: + FontWeight.w900, + ), + ), + transform: + new Matrix4.rotationZ( + 5.837200), ), ), - transform: new Matrix4.rotationZ(5.837200), + Container( + margin: EdgeInsets + .fromLTRB( + 0, + 16, + 0, + 0), + alignment: + Alignment + .center, + child: Image + .network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit + .cover, + height: 80, + ), ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model.parentProducts[index].images.isNotEmpty - ? model.parentProducts[index].images[0].thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), - ), // Container( // width: model.parentProducts[index].rxMessage != // null @@ -677,144 +902,251 @@ class _ParentCategorisePageState extends State { // .w400, // // ), // ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (model.parentProducts[index].discountName != null) - Container( - width: double.infinity, - height: 13.0, - decoration: BoxDecoration( - color: Color(0xff5AB145), + ], + ), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: double + .infinity, + height: + 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), + ), + child: + Center( + child: + Texts( + model + .parentProducts[index] + .discountName, + regular: + true, + color: + Colors.white, + fontSize: + 10.4, + ), + ), + ), + Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[index] + .name, + regular: + true, + fontSize: + 12, + fontWeight: + FontWeight + .w700, ), - child: Center( - child: Texts( - model.parentProducts[index].discountName, - regular: true, - color: Colors.white, - fontSize: 10.4, + Padding( + padding: const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: + Texts( + "SAR ${model.parentProducts[index].price}", + bold: + true, + fontSize: + 14, ), ), - ), - Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w700, - ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ + Row( + children: [ // StarRating( // totalAverage: model.parentProducts[index].approvedRatingSum > 0 // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[index] + .approvedRatingSum + .toDouble(), + size: + 15.0, + filledColor: + Colors.yellow[700], + emptyColor: + Colors.grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons.star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) ], ), - ], - ), + ), + ], ), - ], + ), ), - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), - }, - )); - }, - ), - ) - : Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + )); + }, + ), + ) + : Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.122, + child: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + itemCount: + model.parentProducts.length, + itemBuilder: + (BuildContext context, + int index) { + return InkWell( + child: Card( + child: Row( children: [ - Column( + Stack( children: [ - Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, + Column( + children: [ + Container( + decoration: + BoxDecoration(), + child: + Padding( + padding: + EdgeInsets + .only( + left: 9.0, + top: 8.0, + right: + 10.0, + ), + ), ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: model.parentProducts[index].images.isNotEmpty - ? Image.network( - model.parentProducts[index].images[0].thumb, - fit: BoxFit.contain, - height: 70, - ) - : Text(TranslationBase.of(context).noImage), + Container( + margin: EdgeInsets + .fromLTRB( + 0, + 0, + 0, + 0), + alignment: + Alignment + .center, + child: model + .parentProducts[ + index] + .images + .isNotEmpty + ? Image + .network( + model + .parentProducts[index] + .images[0] + .thumb, + fit: BoxFit + .contain, + height: + 70, + ) + : Text(TranslationBase.of( + context) + .noImage), + ), + ], ), - ], - ), - Column( - children: [ - Container( - width: model.parentProducts[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: model.parentProducts[index].rxMessage != null - ? Texts( - projectProvider.isArabic ? model.parentProducts[index].rxMessagen : model.parentProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - : Texts(""), + Column( + children: [ + Container( + width: model.parentProducts[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: model.parentProducts[index] + .rxMessage != + null + ? Texts( + projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: + Colors.white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), // Texts( // model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", // color: Colors.white, @@ -822,147 +1154,201 @@ class _ParentCategorisePageState extends State { // fontSize: 10, // fontWeight: FontWeight.w400, // ), + ), + ], ), ], ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, - vertical: 0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of(context).size.width * 0.635, - child: Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : model.parentProducts[index].name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 5, - ), - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: const EdgeInsets.only(top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), + Container( + margin: EdgeInsets + .symmetric( + horizontal: 0, + vertical: 0, ), - Row( + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.635, + child: Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : model + .parentProducts[ + index] + .name, + regular: true, + fontSize: + 13.2, + fontWeight: + FontWeight + .w500, + maxLines: 5, + ), + ), + SizedBox( + height: 8.0, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: + 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ // StarRating( // totalAverage: model.parentProducts[index].approvedRatingSum > 0 // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // : 0, // forceStars: true), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w400, + ) + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) ], ), - ], - ), + ), + widget.authenticatedUserObject + .isLogin + ? Container( + child: + IconButton( + icon: + Icon( + Icons + .shopping_cart, + size: + 18, + color: + CustomColors.green, + ), + onPressed: + () async { + if (model.parentProducts[index].isRx == + false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, + model.parentProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + }), + ) + : Container(), + ], ), - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon( - Icons.shopping_cart, - size: 18, - color: CustomColors.green, - ), - onPressed: () async { - if (model.parentProducts[index].rxMessage == null) { - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.parentProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage(); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - }), - ) - : Container(), - ], + ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + child: Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Padding( + padding: + const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, - ), + Padding( + padding: + const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context) + .noData, + // 'There is no data', + style: + TextStyle(fontSize: 30), + ), + ) + ], ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, - // 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], + ), ), - ), - ), - ) - : Center( - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: AlwaysStoppedAnimation( - Colors.grey[500], - ), - ), - ) - ], - ), - ), - ), - ))); + ) + ], + ), + ), + ), + ))); } addToCartFunction(quantity, itemID) async { @@ -971,7 +1357,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = entityList.where((element) => masterKey.id == element.id); + Iterable history = + entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -979,7 +1366,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = + entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 46c5e7a3..8ac83fd2 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -31,11 +31,13 @@ class _ProductCheckTypeWidgetState extends State { ? widget.model.wishListList[index].product.namen : widget.model.wishListList[index].product.name, productPrice: widget.model.wishListList[index].subtotal, - productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + // productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + productRate: widget.model.wishListList[index].product.approvedRatingSum.toDouble(), 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, + isRx:widget.model.wishListList[index].product.isRx, ), ), diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart index afa5382f..0b1aa73d 100644 --- a/lib/pages/pharmacies/compare-list.dart +++ b/lib/pages/pharmacies/compare-list.dart @@ -16,7 +16,7 @@ class CompareList with ChangeNotifier { ); } else { for (int i = 0; i < _product.length; i++) { - if (_product.length <= 4 && _product[i].id != data.id) { + if (_product.length < 4 && _product[i].id != data.id) { _product.add(data); AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg // 'You have added a product to the Compare list' diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index 82a11610..34b21001 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -33,6 +34,9 @@ class _ComparePageState extends State { appBarTitle: TranslationBase.of(context).compare, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, body: SingleChildScrollView( child: Container( child: compareList(), @@ -110,6 +114,7 @@ class slideDetail extends StatefulWidget { class _slideDetailState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return ListView.builder( scrollDirection: Axis.horizontal, itemCount: widget.data.length, @@ -119,7 +124,7 @@ class _slideDetailState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 750, + height: 760, width: 150, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( @@ -168,10 +173,10 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( + child:Align( alignment: Alignment.topLeft, child: RichText( - text: languageID == "ar"? TextSpan( + text: projectViewModel.isArabic ? TextSpan( text: widget.data[index].namen, style: TextStyle( fontWeight: FontWeight.bold, @@ -190,8 +195,9 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( text: TextSpan( text: "SAR ${widget.data[index].price.toString()}", @@ -201,8 +207,20 @@ class _slideDetailState extends State { fontWeight: FontWeight.bold), ), ), + ): + Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: "SAR ${widget.data[index].price.toString()}", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), + ), Padding( padding: EdgeInsets.only(top: 8.0), child: Container( @@ -213,58 +231,61 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].nameN : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].nameN :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ) - :TextSpan( + ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].name : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].name :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), + ) ), - ), + ) ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValuen:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ):TextSpan( + ) + ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValue : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValue:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), + ) ), - ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -275,58 +296,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -337,58 +362,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -399,58 +428,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -461,58 +494,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -523,67 +560,64 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color: Colors.grey, - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), + ], ), ), diff --git a/lib/pages/pharmacies/my_reviews.dart b/lib/pages/pharmacies/my_reviews.dart index 08ba3d14..39304cac 100644 --- a/lib/pages/pharmacies/my_reviews.dart +++ b/lib/pages/pharmacies/my_reviews.dart @@ -26,6 +26,9 @@ class _MyReviewsPageState extends State { appBarTitle: TranslationBase.of(context).reviews, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.reviewListList.length == 0 ? Container( 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 70858fa9..7a252bd6 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -1,29 +1,25 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; 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/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.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/buttons/defaultButton.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 '../../../../locator.dart'; -import 'cart-order-preview.dart'; - class CartOrderPage extends StatefulWidget { final Function(int) changeTab; @@ -35,10 +31,13 @@ class CartOrderPage extends StatefulWidget { class _CartOrderPageState extends State { bool isLoading = true; + String customerId; + String customerGUID; @override void initState() { super.initState(); + getCustomer(); getData(); } @@ -64,8 +63,7 @@ class _CartOrderPageState extends State { body: NetworkBaseView( isLoading: isLoading, isLocalLoader: true, - child: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) + child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? Container( height: height * 0.85, width: double.infinity, @@ -91,46 +89,36 @@ class _CartOrderPageState extends State { endIndent: 0, ), Container( - child: Column( - children: [ - ...List.generate( - model.cartResponse.shoppingCarts != null - ? model.cartResponse.shoppingCarts.length - : 0, - (index) => ProductOrderItem( - model.cartResponse - .shoppingCarts[index], () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.changeProductQuantity(model - .cartResponse.shoppingCarts[index]); - if (model.state != ViewState.Error) { - // appScaffold.appBar.badgeUpdater( - // '${value.quantityCount ?? 0}'); - } - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - GifLoaderDialogUtils.hideDialog( - context); - }, () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .deleteProduct(model.cartResponse - .shoppingCarts[index]) - .then((value) { - if (model.state == - ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); - } - GifLoaderDialogUtils.hideDialog( - context); - }); - })) - ], - ), + child: ListView.builder( + itemCount: model.cartResponse.shoppingCarts.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + // physics: const AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + return ProductOrderItem( + item: model.cartResponse.shoppingCarts[index], + changeCartItems: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.changeProductQuantity(model.cartResponse.shoppingCarts[index]); + if (model.state != ViewState.Error) {} + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + GifLoaderDialogUtils.hideDialog(context); + }, + deleteCartItems: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.deleteProduct(model.cartResponse.shoppingCarts[index]).then((value) { + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + GifLoaderDialogUtils.hideDialog(context); + }); + }, + model: model, + ); + }), ), const Divider( color: Color(0xFFD6D6D6), @@ -242,28 +230,47 @@ class _CartOrderPageState extends State { padding: const EdgeInsets.all(8.0), child: Text( TranslationBase.of(context).noData, -// 'There is no data', style: TextStyle(fontSize: 30), ), - ) + ), + Padding( + padding: const EdgeInsets.fromLTRB(60.0, 8.0, 60.0, 0.0), + child: DefaultButton( + TranslationBase.of(context).ordersDashboard, + () { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + }, + color: Colors.green, + ), + ), ], ), ), ), bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, + height: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? height * 0.15 : 0, color: Colors.white, child: OrderBottomWidget(model.addresses, height, model, isLoading), ), ); } + getCustomer() async { + String custID; + String custGUID; + custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + setState(() { + customerId = custID; + customerGUID = custGUID; + }); + print("customer Id is" + customerId); + print("customer GUID is" + customerGUID); + return customerId; + } + void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); + await Provider.of(context, listen: false).getShoppingCart(); setState(() { isLoading = false; }); @@ -289,8 +296,7 @@ class _OrderBottomWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - return ! widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || - widget.model.cartResponse.shoppingCarts.length == 0) + return !widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || widget.model.cartResponse.shoppingCarts.length == 0) ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -337,8 +343,7 @@ class _OrderBottomWidgetState extends State { padding: EdgeInsets.symmetric(horizontal: 4), margin: const EdgeInsets.symmetric(vertical: 4), child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, + TranslationBase.of(context).pharmacyServiceTermsCondition, fontSize: 13, color: Colors.grey.shade800, fontWeight: FontWeight.normal, @@ -346,10 +351,7 @@ class _OrderBottomWidgetState extends State { ), ), InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, + onTap: () => {Navigator.push(context, FadePage(page: PharmacyTermsConditions()))}, child: Container( child: Icon( Icons.info, @@ -375,8 +377,7 @@ class _OrderBottomWidgetState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0), child: Row( children: [ Texts( @@ -385,8 +386,7 @@ class _OrderBottomWidgetState extends State { fontWeight: FontWeight.bold, ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), + padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, @@ -408,33 +408,16 @@ class _OrderBottomWidgetState extends State { ), RaisedButton( onPressed: isAgree -// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { if (widget.model.isCartItemsOutOfStock()) - { - // Toast msg - AppToast.showErrorToast( - message: TranslationBase.of(context) - .outOfStockMsg) - } + {AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)} else - { - _navigateToAddressPage(widget - .model.user.patientIdentificationNo) - // Navigator.push( - // context, - // FadePage( - // page: - // OrderPreviewPage(widget.addresses))) - } + {_navigateToAddressPage(projectProvider.user.patientIdentificationNo)} } : null, child: new Text( "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), + style: new TextStyle(color: isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), color: Color(0xFF4CAF50), disabledColor: Color(0xFF848484), @@ -458,8 +441,7 @@ class _OrderBottomWidgetState extends State { if (result != null) { GifLoaderDialogUtils.showMyDialog(context); var address = result; - widget.model.paymentCheckoutData.address = - Addresses.fromJson(address.toJson()); + widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson()); await widget.model.getInformationsByAddress(identificationNo); await widget.model.getShoppingCart(); // widget.changeMainState(); 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 0110984c..dc8dc0d7 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -1,9 +1,12 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/theme/colors.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'; @@ -17,8 +20,11 @@ class OrderPreviewPage extends StatefulWidget { final List addresses; final OrderPreviewViewModel model; + + OrderPreviewPage({this.addresses, this.model}); + @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); } @@ -26,6 +32,10 @@ class OrderPreviewPage extends StatefulWidget { class _OrderPreviewPageState extends State { MyInAppBrowser browser; bool isLoading = true; + bool isChecked = false; + + + @override void initState() { @@ -40,6 +50,7 @@ class _OrderPreviewPageState extends State { }); } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); @@ -71,16 +82,99 @@ class _OrderPreviewPageState extends State { height: 10, ), widget.model.paymentCheckoutData.lacumInformation != null - ? Container( - child: Column( - children: [ - LakumWidget(widget.model), - SizedBox( - height: 10, + ? AbsorbPointer( + absorbing: true, + child: Stack( + children: [ + Container( + child: Column( + children: [ + // LakumWidget(widget.model), + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { + setState(() { + isChecked = value; + print(isChecked); + if (value){ + // isChecked; + PaymentBottomWidget.isChecked = true; + print(value); + }else{ + PaymentBottomWidget.isChecked = false; + } + setState(() { + }); + }); + }, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) + ), + ], + ), + ), + ], + ), + + ), + ), + + ], + ), + ), + SizedBox( + height: 10, + ), + ], + ), ), - ], - ), - ) + Container( + height: MediaQuery.of(context).size.height * .10, + color: Colors.white.withOpacity(0.6), + ) + ], + ), + ) : Container(), Container( color: Colors.white, @@ -190,7 +284,49 @@ class _OrderPreviewPageState extends State { indent: 0, endIndent: 0, ), + isChecked ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).lakum}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + Texts( + "- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + ], + ) : Container(), + isChecked ? const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ): Container(), + isChecked ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + " ${TranslationBase.of(context).sar}""${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ) + : Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Texts( @@ -200,7 +336,7 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", + " ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -228,9 +364,12 @@ class _OrderPreviewPageState extends State { child: PaymentBottomWidget(widget.model), ), ); + } changeMainState() { setState(() {}); } + + } diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart index cdd26ddc..77c3d587 100644 --- a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -1,30 +1,18 @@ -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 'dart:ui'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class LakumWidget extends StatefulWidget { final OrderPreviewViewModel model; + LakumWidget(this.model); @override @@ -33,39 +21,51 @@ class LakumWidget extends StatefulWidget { class _LakumWidgetState extends State { TextEditingController _pointsController = new TextEditingController(); + bool useLakumWidgets = false; @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); + _pointsController.text = widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString(); return Container( color: Colors.white, padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), child: Row( children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/lakum_checkout.png", - width: 30.0, - fit: BoxFit.scaleDown, - ), - Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "${TranslationBase.of(context).lakumPoints}", - fontSize: 12, - fontWeight: FontWeight.bold, + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: useLakumWidgets, + onChanged: (bool value) { + setState(() { + useLakumWidgets = value; + print(useLakumWidgets); +// if (value){ +// // isChecked; +// OrderPreviewPage.isChecked = true; +// print(value); +// }else{ +// OrderPreviewPage.isChecked = false; +// } + setState(() { + }); + }); + }, ), - Texts( - "${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", - fontSize: 12, - fontWeight: FontWeight.normal, - ), - ], - ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], ), Expanded( child: Container( @@ -74,112 +74,114 @@ class _LakumWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Texts( - "${TranslationBase.of(context).riyal}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), Container( - margin: projectProvider.isArabic - ? EdgeInsets.only(right: 4) - : EdgeInsets.only(left: 4), - width: 60, - height: 50, - child: TextField( - decoration: InputDecoration( - border: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.2), - gapPadding: 0, - borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topRight: Radius.circular(8), - bottomRight: Radius.circular(8)) - : BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, ), - disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.4), - gapPadding: 0, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) ), - ), - controller: _pointsController, - keyboardType: TextInputType.number, - style: TextStyle( - fontSize: 14, - color: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount > - 0 - ? Colors.black - : Colors.grey, - ), - enabled: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount == - 0 - ? false - : true, - onChanged: (val) { - var value = int.tryParse(val); - if (value != null && - value <= - widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount) { - widget.model.paymentCheckoutData.usedLakumPoints = - value; - } else { - widget.model.paymentCheckoutData.usedLakumPoints = 0; - } - _pointsController.text = - "${widget.model.paymentCheckoutData.usedLakumPoints}"; - }, - ), - ), - Container( - height: 50, - padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), - decoration: new BoxDecoration( - color: Color(0xff3666E0), - shape: BoxShape.rectangle, - borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topLeft: Radius.circular(6), - bottomLeft: Radius.circular(6)) - : BorderRadius.only( - topRight: Radius.circular(6), - bottomRight: Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: Color(0xff3666E0), - width: 0.8, - )), - ), - child: Texts( - "${TranslationBase.of(context).use}", - fontSize: 12, - color: Colors.white, - fontWeight: FontWeight.bold, + ], ), ), ], ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Texts( + // "${TranslationBase.of(context).riyal}", + // fontSize: 12, + // fontWeight: FontWeight.bold, + // ), + // Container( + // margin: projectProvider.isArabic ? EdgeInsets.only(right: 4) : EdgeInsets.only(left: 4), + // width: 60, + // height: 50, + // child: TextField( + // decoration: InputDecoration( + // border: OutlineInputBorder( + // borderSide: BorderSide(color: Colors.black, width: 0.2), + // gapPadding: 0, + // borderRadius: projectProvider.isArabic + // ? BorderRadius.only(topRight: Radius.circular(8), bottomRight: Radius.circular(8)) + // : BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), + // ), + // disabledBorder: OutlineInputBorder( + // borderSide: BorderSide(color: Colors.black, width: 0.4), + // gapPadding: 0, + // borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), + // ), + // ), + // controller: _pointsController, + // keyboardType: TextInputType.number, + // style: TextStyle( + // fontSize: 14, + // color: widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount > 0 ? Colors.black : Colors.grey, + // ), + // enabled: widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount == 0 ? false : true, + // onChanged: (val) { + // var value = int.tryParse(val); + // if (value != null && value <= widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount) { + // widget.model.paymentCheckoutData.usedLakumPoints = value; + // } else { + // widget.model.paymentCheckoutData.usedLakumPoints = 0; + // } + // _pointsController.text = "${widget.model.paymentCheckoutData.usedLakumPoints}"; + // }, + // ), + // ), + // Container( + // height: 50, + // padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), + // decoration: new BoxDecoration( + // color: Color(0xff3666E0), + // shape: BoxShape.rectangle, + // borderRadius: projectProvider.isArabic + // ? BorderRadius.only(topLeft: Radius.circular(6), bottomLeft: Radius.circular(6)) + // : BorderRadius.only(topRight: Radius.circular(6), bottomRight: Radius.circular(6)), + // border: Border.fromBorderSide(BorderSide( + // color: Color(0xff3666E0), + // width: 0.8, + // )), + // ), + // child: Texts( + // "${TranslationBase.of(context).use}", + // fontSize: 12, + // color: Colors.white, + // fontWeight: FontWeight.bold, + // ), + // ), + // ], + // ), ), ), +// useLakumWidgets ? +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts( +// "${TranslationBase.of(context).lakum}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// Texts( +// "${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance).toStringAsFixed(2)}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// ], +// ) +// :Container() ], ), ); diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index 6eee6528..00595711 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -1,9 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/navigation_service.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'; @@ -12,6 +16,7 @@ import 'package:provider/provider.dart'; class PaymentBottomWidget extends StatelessWidget { final OrderPreviewViewModel model; + static bool isChecked = true; BuildContext context; MyInAppBrowser browser; @@ -35,10 +40,15 @@ class PaymentBottomWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( - margin: - EdgeInsets.symmetric(horizontal: 0, vertical: 4), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 4), child: Row( children: [ + isChecked ? Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount - model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ): Texts( "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, @@ -46,8 +56,7 @@ class PaymentBottomWidget extends StatelessWidget { color: Color(0xff929295), ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), + padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, @@ -76,26 +85,22 @@ class PaymentBottomWidget extends StatelessWidget { width: 1, ), ), - onPressed: (orderPreviewViewModel - .paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) + onPressed: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? () async { + GifLoaderDialogUtils.showMyDialog(context); await model.makeOrder(); if (model.state == ViewState.Idle) { - AppToast.showSuccessToast( - message: TranslationBase.of(context).compeleteOrderMsg - // "Order has been placed successfully!!" - ); - openPayment( - model.orderListModel[0], model.authenticatedUserObject.user); + AppToast.showSuccessToast(message: TranslationBase.of(context).compeleteOrderMsg); + GifLoaderDialogUtils.hideDialog(context); + openPayment(model.orderListModel[0], model.authenticatedUserObject.user); } else { AppToast.showErrorToast(message: model.error); } - Navigator.pop(context); - Navigator.pop(context); + navigateToCartPage(); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); + // Navigator.pop(context); } : null, child: Padding( @@ -103,34 +108,14 @@ class PaymentBottomWidget extends StatelessWidget { child: new Text( "${TranslationBase.of(context).proceedPay}", style: new TextStyle( - color: (orderPreviewViewModel - .paymentCheckoutData.address != - null && - orderPreviewViewModel.paymentCheckoutData - .paymentOption != - null) - ? Colors.white - : Colors.grey.shade400, + color: + (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.white : Colors.grey.shade400, fontWeight: FontWeight.bold, fontSize: 12), ), ), - color: - (orderPreviewViewModel.paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) - ? Colors.green - : Color(0xff929295), - disabledColor: - (orderPreviewViewModel.paymentCheckoutData.address != - null && - orderPreviewViewModel - .paymentCheckoutData.paymentOption != - null) - ? Colors.green - : Color(0xff929295), + color: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295), + disabledColor: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? Colors.green : Color(0xff929295), ), ), ], @@ -144,20 +129,10 @@ class PaymentBottomWidget extends StatelessWidget { OrderDetailModel order, AuthenticatedUser authenticatedUser, ) { - browser = new MyInAppBrowser( - onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); + browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart); - browser.openPharmacyPaymentBrowser( - order, - order.orderTotal, - 'ePharmacy Order', - order.id, - order.billingAddress.email, - order.customValuesXml, - "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", - authenticatedUser.patientID, - authenticatedUser, - browser); + browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml, + "${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser); } onBrowserLoadStart(String url) { @@ -181,19 +156,20 @@ class PaymentBottomWidget extends StatelessWidget { }); } + navigateToCartPage() { + Navigator.pushAndRemoveUntil(locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 0)), (Route r) => false); + } + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { print("onBrowserExit Called!!!!"); if (isPaymentMade) { - AppToast.showSuccessToast( - message: "شكراً\nPayment status for your order is Paid"); - Navigator.pop(context); - Navigator.pop(context); + AppToast.showSuccessToast(message: "شكراً\nPayment status for your order is Paid"); + // Navigator.pop(context); + // Navigator.pop(context); } else { - AppToast.showErrorToast( - message: - "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); - Navigator.pop(context); - Navigator.pop(context); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + // Navigator.pop(context); + // Navigator.pop(context); } } } 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 a1634e21..bf51f8e5 100644 --- a/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/select_address_widget.dart @@ -189,9 +189,10 @@ class _SelectAddressWidgetState extends State { model.paymentCheckoutData.shippingOption == null ? "" : model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" - ? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png" + ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, + width: 100, ), margin: EdgeInsets.symmetric(horizontal: 8), ), diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart index f05c6da4..057b444c 100644 --- a/lib/pages/pharmacies/screens/lacum-transfer-page.dart +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -41,6 +41,9 @@ class _LacumTransferPageState extends State { isShowAppBar: true, isPharmacy: true, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, + showPharmacyCart: false, backgroundColor: Colors.white, baseViewModel: model, body: Container( @@ -71,7 +74,8 @@ class _LacumTransferPageState extends State { color: Color(0xffe1e1e1), width: 0.4, )), - color: Color(0xff6294ed), + color: Colors.green + //(0xff6294ed), ), child: Row( crossAxisAlignment: @@ -104,7 +108,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, @@ -164,7 +168,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index c4415852..db441433 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -28,11 +28,13 @@ class LakumMainPage extends StatelessWidget { return BaseView( onModelReady: (model) async { await model.getLacumData(); - if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) { + if (model.lacumInformation.yahalaAccountNo == 0 || + model.lacumInformation.yahalaAccountNo == null) { navigateToLakumRegister(context); } else { if (model.lacumInformation.status == "Hold") { - Navigator.pushReplacement(context, FadePage(page: LakumActivationVidaPage())); + Navigator.pushReplacement( + context, FadePage(page: LakumActivationVidaPage())); } } }, @@ -42,6 +44,8 @@ class LakumMainPage extends StatelessWidget { isPharmacy: true, showPharmacyCart: false, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, backgroundColor: Colors.white, baseViewModel: model, appBarIcons: _buildAppBarICons(context, model), @@ -49,7 +53,10 @@ class LakumMainPage extends StatelessWidget { body: Container( width: double.infinity, child: SingleChildScrollView( - child: (model.lacumGroupInformation != null && model.lacumGroupInformation.lakumInquiryInformationObjVersion != null) + child: (model.lacumGroupInformation != null && + model.lacumGroupInformation + .lakumInquiryInformationObjVersion != + null) ? Column( children: [ Stack( @@ -63,32 +70,61 @@ class LakumMainPage extends StatelessWidget { SizedBox( height: mediaQuery.size.height * 0.02, ), - Container(width: mediaQuery.size.width * 1, child: LakumBannerWidget(model, mediaQuery, true)), + Container( + width: mediaQuery.size.width * 1, + height: mediaQuery.size.width * .6, + child: LakumBannerWidget( + model, mediaQuery, true)), ], ) ], ), SizedBox( - width: 8, + height: 12, ), - LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), + LakumHomeButtons(mediaQuery, model), SizedBox( - height: 20, + height: 12, ), Container( - height: 125, - margin: EdgeInsets.symmetric(horizontal: 16), + height: 110, + margin: EdgeInsets.symmetric( + horizontal: 16, vertical: 12.0), child: ListView( scrollDirection: Axis.horizontal, children: [ - LacumPointsWidget(mediaQuery, 1, TranslationBase.of(context).balance, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance, null), + LacumPointsWidget( + mediaQuery, + 1, + TranslationBase.of(context).balance, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalance, + null), SizedBox( width: 8, ), - LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), + LacumPointsWidget( + mediaQuery, + 2, + TranslationBase.of(context).gained, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .pointsBalanceAmount, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .gainedPointsAmountPerYear), SizedBox( width: 8, ), @@ -96,28 +132,52 @@ class LakumMainPage extends StatelessWidget { mediaQuery, 3, TranslationBase.of(context).consumed, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null - ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount != + null + ? int.parse(model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmount) : 0, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .consumedPointsAmountPerYear), SizedBox( width: 8, ), - LacumPointsWidget(mediaQuery, 4, TranslationBase.of(context).transferred, 0, model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPoints, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPointsAmountPerYear), + LacumPointsWidget( + mediaQuery, + 4, + TranslationBase.of(context).transferred, + 0, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPoints, + model + .lacumGroupInformation + .lakumInquiryInformationObjVersion + .transferPointsAmountPerYear), ], ), ), - LacumPointsWidget( - mediaQuery, - 3, - TranslationBase.of(context).consumed, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null - ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) - : 0, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), + // LacumPointsWidget( + // mediaQuery, + // 3, + // TranslationBase.of(context).consumed, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + // ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + // : 0, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), SizedBox( width: 8, ), @@ -129,7 +189,8 @@ class LakumMainPage extends StatelessWidget { ), ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -144,7 +205,7 @@ class LakumMainPage extends StatelessWidget { Padding( padding: EdgeInsets.symmetric(horizontal: 8), child: Texts( - TranslationBase.of(context).expiryDate, + TranslationBase.of(context).expiryPoints, // "Expired", fontSize: 14, ), @@ -152,7 +213,7 @@ class LakumMainPage extends StatelessWidget { ], ), Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints}${TranslationBase.of(context).lakumPoint} ", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} ${TranslationBase.of(context).lakumPoint} ", fontWeight: FontWeight.bold, fontSize: 14, ), @@ -165,39 +226,45 @@ class LakumMainPage extends StatelessWidget { // fontSize: 14, // ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), - child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset( - "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", - fit: BoxFit.fill, - width: 20, - height: 25, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8), - child: Texts( - TranslationBase.of(context).Waitinggained, + Row( + children: [ + Image.asset( + "assets/images/pharmacy_module/lakum/waiting_gained_icon.png", + fit: BoxFit.fill, + width: 20, + height: 25, + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 8), + child: Texts( + TranslationBase.of(context) + .Waitinggained, // "Waiting gained", - fontSize: 14, - ), - ) - ], - ), - Texts( - "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ])), + fontSize: 14, + ), + ) + ], + ), + Texts( + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}", + fontWeight: FontWeight.bold, + fontSize: 14, + ), + ])), // Texts( // "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} Points", // fontWeight: FontWeight.bold, // fontSize: 14, // ), Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 8), + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 8), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -250,7 +317,11 @@ class LakumMainPage extends StatelessWidget { } navigateToLakumRegister(BuildContext context) { - Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo))); + Navigator.pushReplacement( + context, + FadePage( + page: LakumRegistrationPage( + projectViewModel.user.patientIdentificationNo))); } } @@ -260,7 +331,12 @@ List _buildAppBarICons(BuildContext context, LacumViewModel model) { icon: Icon(Icons.settings), color: Colors.white, onPressed: () { - Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); + Navigator.push( + context, + FadePage( + page: LakumSettingPage( + model.lacumInformation, model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); }, ), ]; @@ -280,10 +356,12 @@ class LakumHomeButtons extends StatelessWidget { children: [ Expanded( child: InkWell( - onTap: () { - print("Account activate click"); - Navigator.push(context, FadePage(page: LakumActivationVidaPage())).then((result) => {model.getLacumGroupData()}); - }, +// onTap: () { +// print("Account activate click"); +// Navigator.push( +// context, FadePage(page: LakumActivationVidaPage())) +// .then((result) => {model.getLacumGroupData()}); +// }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( @@ -325,7 +403,12 @@ class LakumHomeButtons extends StatelessWidget { child: InkWell( onTap: () { print("Lacum transfer click"); - Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData()}); + Navigator.push( + context, + FadePage( + page: LacumTransferPage(model.lacumInformation, + model.lacumGroupInformation))) + .then((result) => {model.getLacumGroupData()}); }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), @@ -341,7 +424,8 @@ class LakumHomeButtons extends StatelessWidget { child: Row( children: [ Image.asset( - "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", + "assets/images/pharmacy_module/lakum/akum_transfer.png", + // "assets/images/pharmacy_module/lakum/Lakum_transfer_icon.png", fit: BoxFit.fill, width: 35, height: 30, @@ -371,18 +455,20 @@ class LacumPointsWidget extends StatelessWidget { final MediaQueryData mediaQuery; final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer final String title; - final int riyal; - final int point; + final num riyal; + final num point; Color titleColor; final List pointsAmountPerYear; - LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, this.point, this.pointsAmountPerYear) { + LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, + this.point, this.pointsAmountPerYear) { if (pointType == 1) { titleColor = Color(0xffefefef); } else if (pointType == 2) { - titleColor = Color(0xff004bcc); - } else if (pointType == 3) { + // titleColor = Color(0xff004bcc); titleColor = Color(0xff339933); + } else if (pointType == 3) { + titleColor = Colors.grey; } else { titleColor = Color(0xffffa500); } @@ -394,16 +480,18 @@ class LacumPointsWidget extends StatelessWidget { onTap: () { if (pointType != 1) { if (pointsAmountPerYear != null && pointsAmountPerYear.length > 0) { - Navigator.push(context, FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); + Navigator.push(context, + FadePage(page: LakumPointsYearPage(pointsAmountPerYear))); } else { - AppToast.showErrorToast(message: TranslationBase.of(context).lakumMsg); + AppToast.showErrorToast( + message: TranslationBase.of(context).lakumMsg); // show snackBar No Details Points are there } } }, child: Container( width: mediaQuery.size.width / 2 - 25, - padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 2), + padding: EdgeInsets.only(top: 12, left: 8, right: 8, bottom: 8), decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(8), @@ -411,13 +499,13 @@ class LacumPointsWidget extends StatelessWidget { color: Color(0xffe1e1e1), width: 0.4, )), - color: pointType == 1 ? Color(0xff004bcc) : Color(0xffefefef), + color: pointType == 1 ? Color(0xff339933) : Color(0xffefefef), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded( + Container( + margin: EdgeInsets.only(bottom: 10.0), child: Column( children: [ Row( @@ -443,15 +531,15 @@ class LacumPointsWidget extends StatelessWidget { ), Expanded( child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ if (pointType != 4) Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).RIYAL, -// "RIYAL", + TranslationBase.of(context).sar, fontSize: 13, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, @@ -479,11 +567,10 @@ class LacumPointsWidget extends StatelessWidget { child: Container( margin: EdgeInsets.only(left: 8, right: 8), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context).point, -// "POINT", + TranslationBase.of(context).points, fontSize: 12, fontWeight: FontWeight.bold, color: pointType == 1 ? Colors.white : Colors.black, diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart index df333cdf..ba6e4537 100644 --- a/lib/pages/pharmacies/screens/lakum-points-year-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -66,7 +66,7 @@ class _LakumPointsYearPageState extends State { (index) => LakumPointTableRowWidget( false, widget.pointsAmountPerYear[widget.selectedIndexYear] - .pointsAmountPerMonth[index].month, + .pointsAmountPerMonth[index].month.toString(), widget.pointsAmountPerYear[widget.selectedIndexYear] .pointsAmountPerMonth[index].pointsPerMonth, widget.pointsAmountPerYear[widget.selectedIndexYear] diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 978afae3..53b0357e 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -16,13 +16,10 @@ class PaymentMethodSelectPage extends StatefulWidget { final bool isUpdating; final Function changeMainState; - const PaymentMethodSelectPage( - {Key key, this.model, this.isUpdating = false, this.changeMainState}) - : super(key: key); + const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key); @override - _PaymentMethodSelectPageState createState() => - _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -85,16 +82,17 @@ class _PaymentMethodSelectPageState extends State { selectedPaymentOption = PaymentOption.mastercard; }) }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.installments, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.installments; - }) - }), + widget.model.cartResponse.totalAmount > 1000 + ? PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.installments, + () => { + setState(() { + selectedPaymentOption = PaymentOption.installments; + }) + }) + : Container(), if (Platform.isIOS) PaymentMethodCard( cardWidth, @@ -118,8 +116,7 @@ class _PaymentMethodSelectPageState extends State { TranslationBase.of(context).next, selectedPaymentOption != null ? () { - widget.model.paymentCheckoutData.paymentOption = - selectedPaymentOption; + widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption; if (widget.isUpdating) { widget.changeMainState(); Navigator.pop(context); @@ -150,14 +147,12 @@ 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; } @@ -171,9 +166,7 @@ class PaymentMethodCard extends StatelessWidget { 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), + side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -182,13 +175,7 @@ class PaymentMethodCard extends StatelessWidget { Container( width: 24, height: 24, - decoration: containerColorRadiusBorderWidth( - isSelected - ? CustomColors.accentColor - : Colors.transparent, - 100, - Colors.grey, - 0.5), + decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), mWidth(12), Container( @@ -200,8 +187,7 @@ class PaymentMethodCard extends StatelessWidget { if (isSelected) Container( decoration: containerRadius(CustomColors.green, 200), - padding: - EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), child: Text( TranslationBase.of(context).paymentSelected, style: TextStyle( diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 1f90f454..8f500064 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -48,7 +48,7 @@ class _PharmacyPageState extends State { isMainPharmacyPages: true, isPharmacy: true, isShowPharmacyAppbar: true, - backgroundColor: Colors.white, + backgroundColor: Color(0xffFEFEFE), body: Container( width: double.infinity, child: SingleChildScrollView( diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 13e94c87..209a97bf 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,11 +1,16 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:map_launcher/map_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; - const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + final InAppBrowser browser = new InAppBrowser(); + + AvailabilityInfo({Key key, this.previousModel}) : super(key: key); @override Widget build(BuildContext context) { @@ -17,56 +22,67 @@ class AvailabilityInfo extends StatelessWidget { TranslationBase.of(context).noLocationAvailable, ), ) - : ListView.builder( - physics: ScrollPhysics(), - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: previousModel.productLocationService.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Image.network(previousModel.productLocationService[index].projectImageUrl), - ), - SizedBox( - width: 10, - ), - Expanded( - flex: 4, - child: Text( - previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), - style: TextStyle(fontSize: 12), + : Container( + margin: EdgeInsets.only(bottom: 40), + child: ListView.builder( + physics: ScrollPhysics(), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: previousModel.productLocationService.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.all(8), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Image.network(previousModel.productLocationService[index].projectImageUrl), + ), + SizedBox( + width: 10, ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.location_on), - color: Colors.red, - onPressed: () {}, + Expanded( + flex: 4, + child: Text( + previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(), + style: TextStyle(fontSize: 12), + ), ), - ), - Expanded( - flex: 1, - child: IconButton( - icon: Icon(Icons.phone), - color: Colors.red, - onPressed: () {}, + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.location_on), + color: Colors.red, + onPressed: () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription, + ); + }, + ), ), - ), - ], - ), - Divider(height: 1.2, color: Colors.grey) - ], - ), - ); - }, + Expanded( + flex: 1, + child: IconButton( + icon: Icon(Icons.phone), + color: Colors.red, + onPressed: () { + launch("tel://" + previousModel.productLocationService[index].phoneNumber); + }, + ), + ), + ], + ), + Divider(height: 1.2, color: Colors.grey) + ], + ), + ); + }, + ), ); } diff --git a/lib/pages/pharmacies/screens/product-details/details_info.dart b/lib/pages/pharmacies/screens/product-details/details_info.dart index bc5e7f80..e7a7f663 100644 --- a/lib/pages/pharmacies/screens/product-details/details_info.dart +++ b/lib/pages/pharmacies/screens/product-details/details_info.dart @@ -22,33 +22,34 @@ class DetailsInfo extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Texts( - TranslationBase.of(context) - .description, - fontSize: 17, - color: Colors.grey, - ), - ), +// Container( +// child: Texts( +// TranslationBase.of(context) +// .description, +// fontSize: 17, +// color: Colors.grey, +// ), +// ), +// SizedBox( +// height: 10, +// ), +// Divider(height: 1, color: Colors.grey), SizedBox( height: 10, ), - Divider(height: 1, color: Colors.grey), - SizedBox( - height: 15, - ), Container( - child: Texts( + margin: EdgeInsets.only(left: 10, right: 10), + child: Text( projectViewModel.isArabic ? product.fullDescriptionn : product .fullDescription ?? "", - fontSize: 16, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.56), ), ), SizedBox( - height: 20, + height: 60, ), ]), ); 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 644ab693..b0f6db78 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,11 +1,17 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/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/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; import '../../../../../locator.dart'; @@ -24,8 +30,13 @@ class FooterWidget extends StatefulWidget { int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, - {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, 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(); @@ -34,7 +45,20 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; - AuthenticatedUserObject authenticatedUserObject = locator(); + + static final GlobalKey _key = GlobalKey(); + AuthenticatedUserObject authenticatedUserObject = + locator(); + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + @override + void initState() { + super.initState(); + if (!isBuyNowDisable() || !isAddToCartDisable()) { + quantityUI = 160; + showUI = true; + } + } @override Widget build(BuildContext context) { @@ -44,14 +68,25 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: Color(0xFF707070), width: 0), + boxShadow: [ + BoxShadow( + color: Color(0xFFCCCCCC), + spreadRadius: 0, + blurRadius: 4, + offset: Offset(2, 2), // changes position of shadow + ), + ], + // border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, child: Column( children: [ - showUI + !showUI ? Container( + height: 10, + ) + : Container( width: double.infinity, height: 100, color: Colors.white, @@ -67,10 +102,11 @@ class _FooterWidgetState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).quantity, - style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold), - ), + child: Texts( + TranslationBase.of(context).productQuantity, + fontSize: 15, + fontWeight: FontWeight.bold, + color: Color(0xFF575757)), ), InkWell( child: Icon(Icons.close, color: Colors.black), @@ -92,7 +128,11 @@ 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( @@ -100,14 +140,19 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration(labelText: ' Quantity # '), + key: _key, + keyboardType: TextInputType.number, + textAlign: TextAlign.center, + decoration: + InputDecoration(hintText: ' 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; @@ -123,9 +168,6 @@ class _FooterWidgetState extends State { ], ), ), - ) - : Container( - height: 20, ), Container( height: 58, @@ -134,25 +176,46 @@ class _FooterWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width: 90, height: 60, child: FlatButton( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, + child: Row( children: [ - Expanded( - flex: 4, - child: Text( - widget.quantity.toString(), - style: TextStyle(fontSize: 20), - ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).productQuantity, + fontSize: 10, + fontWeight: FontWeight.w600, + ), + Row( + children: [ + AppText( + widget.quantity.toString(), + fontSize: 16, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + Icon( + Icons.keyboard_arrow_down, + color: Color(0xFF2E303A), + size: 25, + ) + ], + ), + ], + ), + SizedBox( + width: 10, ), - Expanded( - flex: 5, - child: Text( - TranslationBase.of(context).quantityShortcut, - style: TextStyle(fontSize: 16), + SizedBox( + height: 40, + width: 1, + child: Container( + color: Color(0xFFEFEFEF), ), ), ], @@ -177,21 +240,26 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric(vertical: 4.0), child: SecondaryButton( - label: TranslationBase.of(context).addToCart.toUpperCase(), - disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, + label: TranslationBase.of(context).addToCart, + disabled: isAddToCartDisable(), + fontSize: 15, onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else - await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); + await widget.addToCartFunction( + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); }, fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50), - borderRadius: 3, - color: Color(0xFF4CAF50), + borderRadius: 6, + disableColor: Color(0xFFD6D6D6), + textColor: + isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white, + color: Color(0xFF535353), ), ), SizedBox( @@ -199,24 +267,27 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric(vertical: 4.0), child: SecondaryButton( - label: TranslationBase.of(context).buyNow.toUpperCase(), - disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, + label: TranslationBase.of(context).buyNow, + fontSize: 15, + disabled: isBuyNowDisable(), onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else { - await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - + await widget.addToShoppingCartFunction( + quantity: widget.quantity, + itemID: widget.item.id, + model: widget.model); } }, + textColor: + isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white, 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.isRx ? Colors.grey : Colors.grey[800], + borderRadius: 6, + disableColor: Color(0xFFD6D6D6), + color: Color(0xFF5AB145), ), ), ], @@ -227,6 +298,51 @@ class _FooterWidgetState extends State { ); } + bool isBuyNowDisable() { + return (!widget.isAvailable && widget.quantity > 0) || + (widget.quantity > widget.quantityLimit) || + widget.item.isRx; + } + + bool isAddToCartDisable() { + return (!widget.isAvailable && widget.quantity > 0) || + widget.quantity > widget.quantityLimit || + widget.item.isRx; + } + + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login() async { + final authService = new AuthProvider(); + 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); + authService + .selectDeviceImei(DEVICE_TOKEN) + .then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(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, + ); + }); + } + } + onChangeValue(int i) { setState(() { widget.quantity = i; diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index ad802349..6799f30e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -5,15 +5,14 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-name-and-price.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/recommended_products.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/reviews_info.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/shared/custom-divider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -122,12 +121,44 @@ class __ProductDetailPageState extends State { child: Column( children: [ if (widget.product.images.isNotEmpty) - Container( - height: MediaQuery.of(context).size.height * .40, - child: Image.network( - widget.product.images[0].src.trim(), - fit: BoxFit.contain, - ), + Stack( + children: [ + Container( + height: MediaQuery.of(context).size.height * .40, + child: Center( + child: Image.network( + widget.product.images[0].src.trim(), + fit: BoxFit.contain, + ), + ), + ), + if (model.isStockAvailable != null && !model.isStockAvailable) + Container( + height: MediaQuery.of(context).size.height * .40, + color: Colors.white.withOpacity(0.6), + // child: AppText("Out of Stock"), + ), + if (model.isStockAvailable != null && !model.isStockAvailable) + Positioned( + // bottom: 10, + top: MediaQuery.of(context).size.height * .088, + left: MediaQuery.of(context).size.width * .32, + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * .40, + // color: Colors.white.withOpacity(0.75), + child: RotationTransition( + turns: new AlwaysStoppedAnimation(310 / 360), + child: AppText( + TranslationBase.of(context).productOutOfStock, + color: Color(0xFF000000).withOpacity(0.19), + fontSize: projectViewModel.isArabic ? 40 : 50, + fontWeight: FontWeight.bold, + )), + ), + ), + ), + ], ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) ], @@ -159,33 +190,34 @@ class __ProductDetailPageState extends State { ), ), SizedBox( - height: 6, - ), - Container( - color: Colors.white, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), - child: Texts( - TranslationBase.of(context).specification, - fontSize: 15, - fontWeight: FontWeight.bold, - ), - width: double.infinity, - ), - // Divider(color: Colors.grey), - ], - ), - ), - SizedBox( - height: 6, + height: 10, ), +// Container( +// color: Colors.white, +// child: Column( +// mainAxisAlignment: MainAxisAlignment.start, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// padding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), +// child: Texts( +// TranslationBase.of(context).specification, +// fontSize: 15, +// fontWeight: FontWeight.bold, +// ), +// width: double.infinity, +// ), +// // Divider(color: Colors.grey), +// ], +// ), +// ), +// SizedBox( +// height: 6, +// ), Container( // width: 500, - margin: EdgeInsets.only(bottom: 6), + margin: EdgeInsets.only(bottom: 10), + padding: EdgeInsets.only(bottom: 10), color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -205,7 +237,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -236,7 +268,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -251,20 +283,22 @@ class __ProductDetailPageState extends State { Column( children: [ FlatButton( - onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - await model.getProductLocationData(widget.product.sku); - GifLoaderDialogUtils.hideDialog(context); - - setState(() { - isDetails = false; - isReviews = false; - isAvailability = true; - }); - }, + onPressed: model.isStockAvailable != null && model.isStockAvailable + ? () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProductLocationData(widget.product.sku); + GifLoaderDialogUtils.hideDialog(context); +// + setState(() { + isDetails = false; + isReviews = false; + isAvailability = true; + }); + } + : null, child: Text( TranslationBase.of(context).availability, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -288,9 +322,18 @@ class __ProductDetailPageState extends State { previousModel: model, ) : isAvailability - ? AvailabilityInfo( - previousModel: model, - ) + //&& widget.product.stockAvailability != "Out of stock" + ? AvailabilityInfo(previousModel: model) +// : isAvailability && widget.product.stockAvailability == "Out of stock" +// ? Container( +// // padding: EdgeInsets.all(15), +// padding: EdgeInsets.fromLTRB(15, 15, 15, 20), +// margin: EdgeInsets.only(bottom: 20), +// alignment: Alignment.center, +// child: Text( +// TranslationBase.of(context).noLocationAvailable, +// ), +// ) : Container(), ], ), @@ -298,17 +341,17 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - if (projectViewModel.isLogin) - RecommendedProducts( - product: widget.product, - productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction(itemID: itemID, model: model); - }, - deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction(itemID: itemID, model: model); - }, - ) +// if (projectViewModel.isLogin) +// RecommendedProducts( +// product: widget.product, +// productDetailViewModel: model, +// addToWishlistFunction: (itemID) async { +// await addToWishlistFunction(itemID: itemID, model: model); +// }, +// deleteFromWishlistFunction: (itemID) async { +// await deleteFromWishlistFunction(itemID: itemID, model: model); +// }, +// ) ], ), ), @@ -358,8 +401,8 @@ class __ProductDetailPageState extends State { await model.addToCartData(quantity, itemID, context); GifLoaderDialogUtils.hideDialog(context); } -} -notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { - await model.notifyMe(customerId, itemId, context); + notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async { + await model.notifyMe(customerId, itemId); + } } diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 0f25b236..a71a5a1e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.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/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -22,10 +23,17 @@ class ProductNameAndPrice extends StatefulWidget { final bool isStockAvailable; final String stockAvailability; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); ProductNameAndPrice(this.context, this.item, - {this.customerId, this.isInWishList, this.notifyMeWhenAvailable, this.addToWishlistFunction, this.deleteFromWishlistFunction, this.isStockAvailable = true, this.stockAvailability}); + {this.customerId, + this.isInWishList, + this.notifyMeWhenAvailable, + this.addToWishlistFunction, + this.deleteFromWishlistFunction, + this.isStockAvailable = true, + this.stockAvailability}); @override _ProductNameAndPriceState createState() => _ProductNameAndPriceState(); @@ -36,134 +44,307 @@ class _ProductNameAndPriceState extends State { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - FractionallySizedBox( - widthFactor: 0.95, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20), - Texts( - widget.stockAvailability, - fontWeight: FontWeight.bold, - fontSize: 15, - color: widget.isStockAvailable ? Colors.green : Colors.red, - ), - // SizedBox(width: 20), - if (widget.authenticatedUserObject.isLogin) - !widget.isStockAvailable && widget.customerId != null - ? InkWell( - onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), - child: Row(children: [ - Texts( - TranslationBase.of(context).notifyMe, - decoration: TextDecoration.underline, - color: Colors.blue, - ), - SizedBox(width: 4), - Icon( - FontAwesomeIcons.bell, - color: Colors.blue, - size: 15.0, - ) - ]), + return Container( + color: Color(0xffF7F7F7), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + widget.item.rxMessage != null + ? Container( + // width: widget.item.rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + width: double.infinity, + height: 40, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Color(0xffD02127), + // color: Colors.red[700] + // borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + ), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.only(left: 8, right: 8), + child: Icon( + Icons.warning, + color: Colors.white, + ), + ), + Text( + projectViewModel.isArabic + ? widget.item.rxMessagen.toString() + : widget.item.rxMessage.toString(), + style: TextStyle( + color: Colors.white, + // regular: true, + fontSize: 17, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + // textAlign: TextAlign.center, + )), + ], + )) + : Container(), + FractionallySizedBox( + widthFactor: 0.93, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ +// Texts(widget.item.price.toString() + " " + TranslationBase.of(context).sar, fontWeight: FontWeight.bold, fontSize: 20), + if (widget.stockAvailability != null) + Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0), + padding: EdgeInsets.only( + left: 11.0, right: 11.0, top: 0, bottom: 0), + decoration: BoxDecoration( + border: Border.all( + color: getStatusBackgroundColor(), + style: BorderStyle.solid, + width: 5.0, + ), + color: getStatusBackgroundColor(), + borderRadius: BorderRadius.circular(30.0)), + // child: Text( + // widget.stockAvailability, + // style: TextStyle( + // fontWeight: FontWeight.w600, + // fontSize: 11, + // color: Color(0xffFFFFFF), + // ), + // color: getStatusBackgroundColor(), + // borderRadius: BorderRadius.circular(30.0)), + child: Text( + widget.stockAvailability, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 11, color: Color(0xffFFFFFF),letterSpacing:-0.44)), + //color: widget.isStockAvailable ? Colors.white : Colors.red, + ), + // SizedBox(width: 20), + if ( + widget.authenticatedUserObject.isLogin) + widget.stockAvailability != null && + !widget.isStockAvailable && + widget.customerId != null + ? Container( + child: Row( + children: [ + IconButton( + iconSize: 25, + icon: Icon(Icons.notifications_active), + color: new Color(0xff2E303A), + onPressed: () { + widget.notifyMeWhenAvailable( + context, widget.item.id); + }, + ), + IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList + ? Color(0xff2E303A) + : Color(0xffD02127), + onPressed: () async { + { + if (widget.customerId != null) { + if (!widget.isInWishList) { + await widget + .addToWishlistFunction(widget.item.id); + } else { + await widget.deleteFromWishlistFunction( + widget.item.id); + } + } else { + return; + } + setState(() {}); + } + }, + ) + ], + ), ) - : IconWithBg( - icon: !widget.isInWishList ? Icons.favorite_border : Icons.favorite, - color: !widget.isInWishList ? Colors.white : Colors.red[800], - onPress: () async { - { - if (widget.customerId != null) { - if (!widget.isInWishList) { - await widget.addToWishlistFunction(widget.item.id); + : IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList + ? Color(0xff2E303A) + : Color(0xffD02127), + onPressed: () async { + { + if (widget.customerId != null) { + if (!widget.isInWishList) { + await widget + .addToWishlistFunction(widget.item.id); + } else { + await widget.deleteFromWishlistFunction( + widget.item.id); + } } else { - await widget.deleteFromWishlistFunction(widget.item.id); + return; } - } else { - return; + setState(() {}); } - setState(() {}); - } - }, - ) - ], + }, + ) +// BorderedButton( +// TranslationBase.of(context).notifyMe, +// hasBorder: true, +// borderColor: Colors.green, +// textColor: Colors.green, +// fontWeight: FontWeight.bold, +// vPadding: 6, +// hPadding: 14, +// handler: () => widget.notifyMeWhenAvailable(context, widget.item.id), +// ) +// InkWell( +// onTap: () => widget.notifyMeWhenAvailable(context, widget.item.id), +// child: Row(children: [ +// Texts( +// TranslationBase.of(context).notifyMe, +// decoration: TextDecoration.underline, +// color: Colors.blue, +// ), +// SizedBox(width: 4), +// Icon( +// FontAwesomeIcons.bell, +// color: Colors.blue, +// size: 15.0, +// ) +// ]), +// ) +// : IconWithBg( +// icon: !widget.isInWishList ? Icons.favorite_border : Icons.favorite, +// color: !widget.isInWishList ? Colors.white : Colors.red[800], +// onPress: () async { +// { +// if (widget.customerId != null) { +// if (!widget.isInWishList) { +// await widget.addToWishlistFunction(widget.item.id); +// } else { +// await widget.deleteFromWishlistFunction(widget.item.id); +// } +// } else { +// return; +// } +// setState(() {}); +// } +// }, +// ) + ], + ), ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - margin: EdgeInsets.only(left: 5), - child: Align( - alignment: projectViewModel.isArabic ? Alignment.topRight : Alignment.topLeft, - child: Text( - projectViewModel.isArabic ? widget.item.namen : widget.item.name, - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + Padding( + padding: + const EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 12), + child: Container( + margin: EdgeInsets.only(left: 10, right: 10), + child: Align( + alignment: projectViewModel.isArabic + ? Alignment.topRight + : Alignment.topLeft, + child: Text( + projectViewModel.isArabic + ? widget.item.namen + : widget.item.name, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + letterSpacing: -0.96), + ), ), ), ), - ), - FractionallySizedBox( - widthFactor: 0.95, - child: Row( - children: [ - Container( - child: Align( - alignment: Alignment.bottomLeft, - child: Row( - children: [ - RatingBar.readOnly( - initialRating: double.parse(widget.item.approvedRatingSum.toString()), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[400], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - SizedBox( - width: 10, - ), + Padding( + padding: const EdgeInsets.only(left: 8, right: 8), + child: Container( + margin: EdgeInsets.only(left: 10, right: 10), + child: Align( + alignment: projectViewModel.isArabic + ? Alignment.topRight + : Alignment.topLeft, + child: Text( + TranslationBase.of(context).sar + + " " + + widget.item.price.toString(), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 19, + letterSpacing: -0.76), + ), + ), + ), + ), + FractionallySizedBox( + widthFactor: 0.95, + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8), + child: Align( + alignment: Alignment.bottomLeft, + child: Row( + children: [ + RatingBar.readOnly( + initialRating: double.parse( + widget.item.approvedRatingSum.toString()), + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + SizedBox( + width: 5, + ), // Texts( // "${widget.item.approvedRatingSum}", // fontWeight: FontWeight.bold, // fontSize: 12, // ), - SizedBox( - width: 30, - ), - Texts( - "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", - fontSize: 12, - ), - SizedBox( - width: 70, - ), - if (widget.item.rxMessage != null) - Row( - children: [ - Text( - projectViewModel.isArabic ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), - style: TextStyle(color: Colors.red, fontSize: 10), - ), - ], - ) - ], +// SizedBox( +// width: 30, +// ), + Text( + "(${widget.item.approvedTotalReviews}${TranslationBase.of(context).review})", + style: TextStyle( + fontWeight: FontWeight.w600, fontSize: 12), + ), + SizedBox( + width: 70, + ), +// if (widget.item.rxMessage != null) +// Row( +// children: [ +// Text( +// projectViewModel.isArabic ? widget.item.rxMessagen.toString() : widget.item.rxMessage.toString(), +// style: TextStyle(color: Colors.red, fontSize: 10), +// ), +// ], +// ) + ], + ), ), ), - ), - ], + ], + ), + ), + SizedBox( + height: 20, ), - ), - SizedBox( - height: 10, - ), - ], + ], + ), ); } + + Color getStatusBackgroundColor() { + if (widget.isStockAvailable) + return Color(0xFF5AB145); + else + return Color(0xFFD02127); + } } diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index 64336d85..52efd3e9 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class ReviewsInfo extends StatelessWidget { @@ -13,6 +15,7 @@ class ReviewsInfo extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return previousModel.productDetailService.length != 0 && previousModel.productDetailService[0].reviews.length != 0 ? ListView.builder( @@ -30,30 +33,54 @@ class ReviewsInfo extends StatelessWidget { Container( child: Row( children: [ - Container( - child: Text( - previousModel.productDetailService[0] - .reviews[index].customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + Expanded( + child: Container( + child: Text(previousModel.productDetailService[0].reviews[index].customer.firstName != null + && previousModel.productDetailService[0].reviews[index].customer.firstName != null + ? previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " + + previousModel.productDetailService[0].reviews[index].customer.lastName.toString() + :"", +// previousModel.productDetailService[0] +// .reviews[index].customerId +// .toString(), + style: TextStyle( + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.w600), + ), ), ), Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: previousModel - .productDetailService[0].reviews[index].rating - .toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + // margin: EdgeInsets.only(left: 210), + child: projectViewModel.isArabic? + Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ): Align( + alignment: Alignment.topRight, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), ), ), ], @@ -62,11 +89,14 @@ class ReviewsInfo extends StatelessWidget { SizedBox( height: 10, ), - Container( - child: Text( - previousModel - .productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + previousModel + .productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), + ), ), ), SizedBox( @@ -77,9 +107,10 @@ class ReviewsInfo extends StatelessWidget { ), ); }, - ) + ) : Container( - padding: EdgeInsets.all(15), + padding: EdgeInsets.fromLTRB(15,15,15,20), + margin: EdgeInsets.only(bottom: 40), alignment: Alignment.center, child: Text( TranslationBase.of(context).noReviewsAvailable, diff --git a/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart b/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart index f2406614..a78f04b8 100644 --- a/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart +++ b/lib/pages/pharmacies/screens/product-details/shared/icon_with_bg.dart @@ -1,15 +1,20 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class IconWithBg extends StatelessWidget { final IconData icon; final Color color; final Function onPress; + final bool hasPadding; - const IconWithBg({Key key, this.icon, this.color, this.onPress}) + IconWithBg( + {Key key, this.icon, this.color, this.onPress, this.hasPadding = false}) : super(key: key); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( width: 40, height: 40, @@ -18,12 +23,21 @@ class IconWithBg extends StatelessWidget { borderRadius: BorderRadius.circular(30), ), child: Center( - child: IconButton( - icon: Icon(icon, size: 20,), - color: color, - onPressed: () async { - onPress(); - }, + child: Padding( + padding: EdgeInsets.only( + left: !projectViewModel.isArabic ? (hasPadding ? 4 : 0) : 0, + right: projectViewModel.isArabic ? (hasPadding ? 4 : 0) : 0 + ), + child: IconButton( + icon: Icon( + icon, + size: 20, + ), + color: color, + onPressed: () async { + onPress(); + }, + ), ), )); } diff --git a/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart b/lib/pages/pharmacies/screens/product-details/shared/product_details_app_bar.dart index f58438cf..d40f222b 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 @@ -3,7 +3,6 @@ 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/landing/landing_page_pharmcy.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/navigation_service.dart'; @@ -57,10 +56,13 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ IconWithBg( - icon: Icons.arrow_back, - color: Colors.grey, + icon: Icons.arrow_back_ios, + hasPadding: true, + color: Color(0xFF2B353E), onPress: () { Navigator.pop(context); }, @@ -74,11 +76,16 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { children: [ IconWithBg( icon: Icons.shopping_cart, - color: Colors.grey[800], + color: Color(0xFF2B353E), onPress: () { - Navigator.pushAndRemoveUntil( - locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 3)), (Route r) => false); + locator() + .navigatorKey + .currentContext, + MaterialPageRoute( + builder: (context) => + LandingPagePharmacy(currentTab: 3)), + (Route r) => false); // Navigator.push( // context, // MaterialPageRoute(builder: (context) => CartOrderPage()), @@ -107,7 +114,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { .quantityCount .toString(), style: "caption", - medium: true, + // medium: true, color: Colors.white, )), ), @@ -119,7 +126,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { ), IconWithBg( icon: FontAwesomeIcons.ellipsisV, - color: Colors.grey, + color: Color(0xFF2B353E), onPress: () { settingModalBottomSheet(context); }, @@ -144,7 +151,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { return Container( child: new Wrap( children: [ - if (product.stockAvailability != 'Out of stock') + if (product.stockAvailability != 'Out of stock' && product.isRx != true) new ListTile( leading: Icon(Icons.shopping_cart), title: Text( @@ -156,15 +163,15 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { await addToCartFunction( quantity: quantity, itemID: itemID, - model: model, - context: context); + model: model); Navigator.of(context).pop(); } } else { - AppToast.showErrorToast(message: TranslationBase.of(context).addQuantity - // "you should add quantity" - ); + AppToast.showErrorToast( + message: TranslationBase.of(context).addQuantity + // "you should add quantity" + ); } }), ListTile( @@ -191,7 +198,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget { ), onTap: () { Provider.of(context, listen: false) - .addItem(specificationData,context); + .addItem(specificationData, context); Navigator.of(context).pop(); }, ), diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index 7ffe8d26..72dc3907 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -54,26 +54,12 @@ class _SearchBrandsPageState extends State { fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'([A-Za-z0-9 a space])') -// ("[\u0621-\u064a-\ ]") - ) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - 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 = TranslationBase.of(context).noResultFound; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, // validator: (value) { diff --git a/lib/pages/pharmacies/widgets/ProductOrderItem.dart b/lib/pages/pharmacies/widgets/ProductOrderItem.dart index 11976175..8d74cb48 100644 --- a/lib/pages/pharmacies/widgets/ProductOrderItem.dart +++ b/lib/pages/pharmacies/widgets/ProductOrderItem.dart @@ -1,4 +1,6 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart'; +import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.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'; @@ -11,8 +13,10 @@ class ProductOrderItem extends StatefulWidget { final ShoppingCart item; final VoidCallback changeCartItems; final VoidCallback deleteCartItems; + final OrderPreviewViewModel model; - ProductOrderItem(this.item, this.changeCartItems, this.deleteCartItems); + ProductOrderItem( + {this.item, this.changeCartItems, this.deleteCartItems, this.model}); @override _ProductOrderItemState createState() => _ProductOrderItemState(); @@ -24,14 +28,14 @@ class _ProductOrderItemState extends State { @override void initState() { - _quantityController.text = "${widget.item.quantity}"; - _totalPrice = - "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; super.initState(); } @override Widget build(BuildContext context) { + _quantityController.text = "${widget.item.quantity}"; + _totalPrice = + "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; ProjectViewModel projectProvider = Provider.of(context); return Column( @@ -40,7 +44,8 @@ class _ProductOrderItemState extends State { leading: InkWell( onTap: () => {widget.deleteCartItems()}, child: Icon( - FontAwesomeIcons.trashAlt,size: 15, + FontAwesomeIcons.trashAlt, + size: 15, color: Colors.grey.shade700, ), ), @@ -50,17 +55,18 @@ class _ProductOrderItemState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - (widget.item.product.images != null && widget.item.product.images.length > 0) + (widget.item.product.images != null && + widget.item.product.images.length > 0) ? Image.network( - widget.item.product.images[0].src, - fit: BoxFit.cover, - height: 80, - ) + widget.item.product.images[0].src, + fit: BoxFit.cover, + height: 80, + ) : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: 80, - ), + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + ), Expanded( child: Container( margin: @@ -101,7 +107,9 @@ class _ProductOrderItemState extends State { width: 25, height: 25, child: Icon( - Icons.remove, color: Colors.grey.shade400, size: 20, + Icons.remove, + color: Colors.grey.shade400, + size: 20, ), decoration: BoxDecoration( border: Border.all( @@ -129,7 +137,8 @@ class _ProductOrderItemState extends State { if (value == null) { widget.item.quantity = 0; } else { - widget.item.quantity = int.parse(text); + widget.item.quantity = + int.parse(text); } _totalPrice = "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; @@ -144,7 +153,9 @@ class _ProductOrderItemState extends State { width: 25, height: 25, child: Icon( - Icons.add, color: Colors.grey.shade400, size: 20, + Icons.add, + color: Colors.grey.shade400, + size: 20, ), decoration: BoxDecoration( border: Border.all( @@ -169,21 +180,21 @@ class _ProductOrderItemState extends State { fontSize: 12, fontWeight: FontWeight.bold, ), - widget.item.product.stockQuantity == 0 ? - Texts( - projectProvider.isArabic - ? widget.item.product.stockAvailabilityn - : widget.item.product.stockAvailability, - fontWeight: FontWeight.normal, - fontSize: 13, - color:Colors.red, - - ): Texts(""), + widget.item.product.stockQuantity == 0 + ? Texts( + projectProvider.isArabic + ? widget.item.product + .stockAvailabilityn + : widget.item.product + .stockAvailability, + fontWeight: FontWeight.normal, + fontSize: 13, + color: Colors.red, + ) + : Texts(""), ], ), ), - - ], ), ) @@ -209,7 +220,7 @@ class _ProductOrderItemState extends State { _quantityOnChangeClick(Operation operation) { int newValue = 0; - setState(() { + setState(() async { switch (operation) { case Operation.inc: { @@ -230,14 +241,20 @@ class _ProductOrderItemState extends State { } if (newValue > 0) { widget.item.quantity = newValue; + await widget.changeCartItems(); + if (widget.model.state == ViewState.ErrorLocal) { + if (operation == Operation.dec) { + newValue = widget.item.quantity + 1; + } else { + newValue = widget.item.quantity - 1; + } + widget.item.quantity = newValue; + } _quantityController.text = "${widget.item.quantity}"; _totalPrice = "${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}"; } }); - if (newValue > 0) { - widget.changeCartItems(); - } } @override diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index cb8560c4..2c0582b7 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -1,15 +1,23 @@ +import 'package:auto_size_text/auto_size_text.dart'; 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/product-details/shared/icon_with_bg.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/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'dart:math' as math; + class ProductTileItem extends StatelessWidget { final AppSharedPreferences sharedPref = AppSharedPreferences(); final PharmacyProduct item; @@ -38,13 +46,13 @@ class ProductTileItem extends StatelessWidget { }); } - if(items.length >= 15){ + if (items.length >= 15) { items.removeAt(0); // lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), ''); } lastVisited = ""; - for(int i = items.length - 1; i >= 0; i--){ + for (int i = items.length - 1; i >= 0; i--) { if (lastVisited == "") { // it means there is no lastVisited yet lastVisited = "${items[i]}"; @@ -54,7 +62,6 @@ class ProductTileItem extends StatelessWidget { } } - if (!isIdExist) { if (lastVisited == "") { // it means there is no lastVisited yet @@ -72,93 +79,176 @@ class ProductTileItem extends StatelessWidget { ProjectViewModel projectProvider = Provider.of(context); return InkWell( onTap: () => productOnClick(context), - splashColor: Theme.of(context).primaryColor, child: Container( margin: EdgeInsets.all(7), decoration: BoxDecoration( - border:Border.all(color: Colors.grey.shade300,width: 0.5), - borderRadius: BorderRadius.circular(8) + border: Border.all(color: Colors.grey.shade300, width: 0.2), + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle, + boxShadow: [ + BoxShadow( + color: Color(0xffF1F1F1), + spreadRadius: 4, + blurRadius: 5.5, + offset: Offset(0, 3), // changes position of shadow + ), + ], ), padding: EdgeInsets.symmetric(horizontal: 4), width: MediaQuery.of(context).size.width / 2.8, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: (item.images != null && item.images.length > 0) - ? Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: itemHeight / 2, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: itemHeight / 2, - ), - ), -// Container( -// width: item.rxMessage != null -// ? MediaQuery.of(context).size.width / 5 -// : 0, -// padding: EdgeInsets.all(4), -// decoration: BoxDecoration( -// color: Color(0xffb23838), -// borderRadius: -// BorderRadius.only(topLeft: Radius.circular(6)), -// ), -// child: item.rxMessage != null -// ? Texts( -// projectProvider.isArabic -// ? item.rxMessagen -// : item.rxMessage, -// color: Colors.white, -// regular: true, -// fontSize: 10, -// fontWeight: FontWeight.w400, -// ) -// : Texts(""), -// ) - ], - ), - Padding( - padding: EdgeInsets.fromLTRB(1,1,1,1), - child: Container( - width: item.rxMessage != null - ? MediaQuery.of(context).size.width / 1.0 - : 0, - padding: EdgeInsets.fromLTRB(8,2,8,2), - decoration: BoxDecoration( - color: Color(0xffb23838), + // Stack( + // children: [ + // Container( + // margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + // alignment: Alignment.center, + // child: (item.images != null && item.images.length > 0) + // ? Image.network( + // item.images[0].src, + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ) + // : Image.asset( + // "assets/images/no_image.png", + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ), + // ), + // ], + // ), - ), - child: item.rxMessage != null - ? Texts( - projectProvider.isArabic - ? item.rxMessagen - : item.rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - : Texts(""), - ), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.3, + padding: + EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 3.5), + color: Colors.white, + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(0.0, + prescriptionRequired: item.rxMessage != null, + isProduct: true, + isEnglish: !projectProvider.isArabic, + lightColor: Colors.transparent, + darkColor: Colors.transparent), + child: Stack( + children: [ + Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Color(0xffF0F0F0), width: 1.0), + borderRadius: BorderRadius.only( + topRight: Radius.circular( + item.rxMessage != null && + projectProvider.isArabic + ? 20 + : 8), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + topLeft: Radius.circular(item.rxMessage != null && + !projectProvider.isArabic + ? 20 + : 8), + ), + ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: (item.images != null && item.images.length > 0) + ? Padding( + padding: EdgeInsets.all(12.0), + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ) + : Padding( + padding: EdgeInsets.all(8.0), + child: Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ), + ), + ], + ), + if (item.rxMessage != null) + projectProvider.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + color: CustomColors.accentColor, + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + child: Padding( + padding: EdgeInsets.all(2.0), + child: Text( + "الوصفة\n مطلوبة", + style: TextStyle( + color: Colors.white, + fontSize: 7.0, + height: 0.8, + fontWeight: FontWeight.w600, + letterSpacing: -0.27, + ), + ), + ), + ), + ), + ) + : Positioned( + left: -24, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + "\n E-Prescription \n Is required", + style: TextStyle( + color: Colors.white, + fontSize: 7.0, + //letterSpacing: -0.27, + height: 1.2, + fontWeight: FontWeight.w600, + ), + ), + ), + ), ), - // SizedBox(height: 4,), + ], + ), + ), + ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), - child: Texts( - projectProvider.isArabic ? item.namen : item.name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w400, + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.075, + child: Texts( + projectProvider.isArabic ? item.namen : item.name, + //regular: true, + fontSize: 10, + color: Color(0xff2B353E), + fontWeight: FontWeight.w600, + ), ), ), + SizedBox( + height: 7.0, + ), Expanded( child: Container( margin: EdgeInsets.symmetric( @@ -167,35 +257,49 @@ class ProductTileItem extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, + //mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: const EdgeInsets.only(top: 2, bottom: 2), + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 2), child: Texts( "SAR ${item.price}", - fontWeight: FontWeight.w600, - fontSize: 14, + fontWeight: FontWeight.w700, + fontSize: 11, + color: Color(0xff2B353E), ), ), - Row( - children: [ - // Expanded( - RatingBar.readOnly( + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + child: Row( + children: [ + // Expanded( + RatingBar.readOnly( initialRating: item.approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], + size: 13.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), isHalfAllowed: true, halfFilledIcon: Icons.star_half, filledIcon: Icons.star, - emptyIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, ), - Texts( - "(${item.approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) + + SizedBox( + width: 9.0, + ), + Icon( + Icons.arrow_forward, + size: 15, + color: Color(0xff2D2F39), + ), + // StarRating( // totalAverage: item.approvedTotalReviews > 0 // ? (item.approvedRatingSum.toDouble() / @@ -203,14 +307,17 @@ class ProductTileItem extends StatelessWidget { // .toDouble() // : 0, // forceStars: true), - // ), - ], + // ), + ], + ), ), ], ), ), ), - SizedBox(height: 5,), + SizedBox( + height: 1, + ), ], ), ), diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6302f263..bf7ca715 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod 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/screens/lacum-activitaion-vida-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-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'; @@ -50,7 +53,7 @@ class _BannerPagerState extends State { (item, index) { return InkWell( onTap: () { - Navigator.push(context, FadePage(page: OffersCategorisePage())); + bannerNavigator(index); }, child: Container( margin: EdgeInsets.symmetric(horizontal: 1.0), @@ -93,4 +96,28 @@ class _BannerPagerState extends State { ], )); } + + bannerNavigator(index){ + switch(index) { + case 1: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + case 2: { + // Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + Navigator.push(context, FadePage(page: LakumMainPage())); + } + break; + case 5: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + + default: { + + } + break; + } + + } } diff --git a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart index 2814bc1c..2fcab506 100644 --- a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart +++ b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart @@ -28,15 +28,17 @@ class BestSellerWidget extends StatelessWidget { productType: 20, )), if (model.state != ViewState.BusyLocal) - Container( - height: MediaQuery.of(context).size.height / 3 + 20, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.bestSellerProduct[i], MediaQuery.of(context).size.height / 4 + 20), - scrollDirection: Axis.horizontal, - itemCount: model.bestSellerProduct.length, - ), - ) else + Container( + height: MediaQuery.of(context).size.height / 3 + 1, + child: ListView.builder( + itemBuilder: (ctx, i) => ProductTileItem( + model.bestSellerProduct[i], + MediaQuery.of(context).size.height / 4 + 20), + scrollDirection: Axis.horizontal, + itemCount: model.bestSellerProduct.length, + ), + ) + else Container( height: 80, child: Center( diff --git a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart index aa160baa..01fea98e 100644 --- a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/material.dart'; @@ -30,7 +31,7 @@ class MostViewedWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - height: MediaQuery.of(context).size.height / 3 + 20, + height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( model.mostViewedProducts[i], diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index 3e7cf5fe..f03c384d 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -18,42 +18,46 @@ class RecentlyViewedWidget extends StatelessWidget { builder: (_, model, wi) => NetworkBaseView( isLocalLoader: true, baseViewModel: model, - child: model.lastVisitedProducts.isNotEmpty ? Container( - child: Column( - children: [ - ViewAllHomeWidget( - TranslationBase.of(context).recentlyViewed, - FinalProductsPage( - id: "", - productType: 3, - )), - if (model.state != ViewState.BusyLocal) - Container( - height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 3 + 20 - : 0, - child: ListView.builder( - itemBuilder: (ctx, i) => - ProductTileItem(model.lastVisitedProducts[i], MediaQuery.of(context).size.height / 4 + 20), - scrollDirection: Axis.horizontal, - itemCount: model.lastVisitedProducts.length, - ), - ) - else - Container( - height: 80, - child: Center( - child:CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: AlwaysStoppedAnimation( - Colors.grey[500], + child: model.lastVisitedProducts.isNotEmpty + ? Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).recentlyViewed, + FinalProductsPage( + id: "", + productType: 3, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 3 + 1 + : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => ProductTileItem( + model.lastVisitedProducts[i], + MediaQuery.of(context).size.height / 4 + + 20), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, + ), + ) + else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), ), - ), - ), + ], ), - ], - ), - ) : Container(), + ) + : Container(), )); } } diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart index 05c57f2e..2b73a15a 100644 --- a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -4,11 +4,9 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/material.dart'; class ViewAllHomeWidget extends StatelessWidget { - final String title; final Widget navigationWidget; - ViewAllHomeWidget(this.title, this.navigationWidget); @override @@ -20,25 +18,36 @@ class ViewAllHomeWidget extends StatelessWidget { children: [ Texts( title, - bold: true, - fontSize: 16, + color: Color(0xff2E303A), + fontWeight: FontWeight.w700, + fontSize: 19, ), - BorderedButton( - TranslationBase.of(context).viewAll, - hasBorder: true, - borderColor: Colors.green, - textColor: Colors.green, - fontWeight: FontWeight.bold, - vPadding: 6, - hPadding: 14, - handler: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - navigationWidget)); + InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => navigationWidget)); }, + child: Texts( + TranslationBase.of(context).viewAll, + color: Color(0xffD02127), + decoration: TextDecoration.underline, + fontWeight: FontWeight.w600, + fontSize: 12.0, + ), ), + // BorderedButton( + // TranslationBase.of(context).viewAll, + // hasBorder: true, + // borderColor: Colors.green, + // textColor: Colors.green, + // fontWeight: FontWeight.bold, + // vPadding: 6, + // hPadding: 14, + // handler: () { + // Navigator.push(context, + // MaterialPageRoute(builder: (context) => navigationWidget)); + // }, + // ), ], ), ); diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart index 7d10b886..29111570 100644 --- a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -59,7 +59,7 @@ class _LakumBannerWidgetState extends State { height: widget.mediaQuery.size.width * 1.0, ), Container( - margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + margin: EdgeInsets.fromLTRB(12, 75, 12, 0), child: Column( children: [ Row( @@ -70,13 +70,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts( widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( "${widget.model.lacumInformation.yahalaAccountNo}", - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -117,7 +117,7 @@ class _LakumBannerWidgetState extends State { ], ), SizedBox( - height: 10, + height: 5, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -127,14 +127,14 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).identificationNumber, // "IDENTIFICATION #", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumInformation .identificationNo, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -145,13 +145,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).MEMBERSINCE, // "MEMBER SINCE", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.formatCreatedDateToString(), - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -160,7 +160,7 @@ class _LakumBannerWidgetState extends State { ], ), SizedBox( - height: 10, + height: 5, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -170,13 +170,13 @@ class _LakumBannerWidgetState extends State { children: [ Texts(TranslationBase.of(context).lakumMobile, // "MOBILE #", - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -187,16 +187,16 @@ class _LakumBannerWidgetState extends State { children: [ Texts( TranslationBase.of(context).language, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.bold, color: Colors.black, ), Texts( widget.model.lacumInformation.prefLang == - "1" + "2" ? TranslationBase.of(context).lanEnglish : TranslationBase.of(context).lanArabic, - fontSize: 16, + fontSize: 13, fontWeight: FontWeight.normal, color: Colors.black, ), @@ -229,13 +229,19 @@ class _LakumBannerWidgetState extends State { width: widget.mediaQuery.size.width * 1.0, height: widget.mediaQuery.size.width * 1.0, ), - Container( - margin: EdgeInsets.fromLTRB(12, 70, 12, 4), - child: widget.model.convertBase64ToBarCodeImage() != - null - ? Image.memory( - widget.model.convertBase64ToBarCodeImage()) - : Container(), + Center( + child: Container( + margin: EdgeInsets.fromLTRB(5, 70, 5, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage(), + fit: BoxFit.fill, + height: 100.0, + width: 180.0 + ) + : Container(), + ), ), ], ), diff --git a/lib/pages/pharmacies/wishlist.dart b/lib/pages/pharmacies/wishlist.dart index 3d1c8114..00088b59 100644 --- a/lib/pages/pharmacies/wishlist.dart +++ b/lib/pages/pharmacies/wishlist.dart @@ -17,6 +17,9 @@ class WishlistPage extends StatelessWidget { isShowAppBar: true, isShowDecPage: false, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.wishListList.length == 0 ? Container( @@ -35,8 +38,8 @@ class WishlistPage extends StatelessWidget { ), Padding( padding: const EdgeInsets.all(8.0), - child: Text( - 'There is no data', + child: Text(TranslationBase.of(context).noData, + // 'There is no data', style: TextStyle(fontSize: 30), ), ) diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 8b3f8502..ef5c9346 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -8,6 +9,7 @@ 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:provider/provider.dart'; dynamic languageID; @@ -15,15 +17,15 @@ class OrderPage extends StatefulWidget { // orderList({this.customerId, this.pageId}); String customerID; + String customerGUID; - OrderPage({@required this.customerID}); + OrderPage({@required this.customerID, this.customerGUID}); @override _OrderPageState createState() => _OrderPageState(); } -class _OrderPageState extends State - with SingleTickerProviderStateMixin { +class _OrderPageState extends State with SingleTickerProviderStateMixin { String pageID = "1"; String customerId = ""; String order = ""; @@ -57,12 +59,16 @@ class _OrderPageState extends State @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getOrder(widget.customerID, pageID), + onModelReady: (model) => + model.getOrder(widget.customerID, widget.customerGUID, pageID), builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).order, baseViewModel: model, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, body: Container( child: Column( children: [ @@ -105,6 +111,8 @@ class _OrderPageState extends State } Widget getDeliveredOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + deliveredOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 30 || model.orders[i].orderStatusId == 997 || @@ -134,9 +142,12 @@ class _OrderPageState extends State FadePage( page: OrderDetailsPage( orderModel: - deliveredOrderList[ - index]), - )); + deliveredOrderList[index]), + )).then((value) { + model.getOrder(widget.customerID, + widget.customerGUID, pageID); + getDeliveredOrder(model); + }); }, child: Row( mainAxisAlignment: @@ -151,7 +162,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, @@ -180,7 +192,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, @@ -207,12 +220,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -236,16 +247,23 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.blue[700], + color: Color(0xFF4CAF50), style: BorderStyle.solid, width: 5.0, ), - color: Colors.blue[700], - borderRadius: - BorderRadius.circular(30.0)), - child: deliveredOrderList[index].orderStatusId == 30 || - deliveredOrderList[index].orderStatusId == 997 || - deliveredOrderList[index].orderStatusId == 994 + color: Color(0xFF4CAF50), + borderRadius: BorderRadius.circular( + 30.0)), + child: deliveredOrderList[ + index] + .orderStatusId == + 30 || + deliveredOrderList[index] + .orderStatusId == + 997 || + deliveredOrderList[index] + .orderStatusId == + 994 // deliveredOrderList[index].orderStatusId == 30 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), @@ -371,6 +389,8 @@ class _OrderPageState extends State } Widget getProcessingOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + processingOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 20 || model.orders[i].orderStatusId == 995 || @@ -379,6 +399,7 @@ class _OrderPageState extends State processingOrderList.add(model.orders[i]); } } + _tabController.index = 1; return Container( width: MediaQuery.of(context).size.width, child: processingOrderList.length != 0 @@ -397,12 +418,20 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - processingOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + processingOrderList[ + index]))) + .then((value) { + model + .getOrder(widget.customerID, + widget.customerGUID, pageID) + .then((value) { + getProcessingOrder(model); + }); + }); }, child: Row( mainAxisAlignment: @@ -417,7 +446,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderNumber, @@ -446,7 +476,8 @@ class _OrderPageState extends State Row( children: [ Container( - margin: EdgeInsets.only(right: 5), + margin: + EdgeInsets.only(right: 5), child: Text( TranslationBase.of(context) .orderDate, @@ -473,12 +504,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -502,17 +531,26 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.green, + color: Colors.grey[500], style: BorderStyle.solid, width: 5.0, ), - color: Colors.green, - borderRadius: - BorderRadius.circular(30.0)), - child: processingOrderList[index].orderStatusId == 20 || - processingOrderList[index].orderStatusId == 995 || - processingOrderList[index].orderStatusId == 998 || - processingOrderList[index].orderStatusId == 999 + color: Colors.grey[500], + borderRadius: BorderRadius.circular( + 30.0)), + child: processingOrderList[ + index] + .orderStatusId == + 20 || + processingOrderList[index] + .orderStatusId == + 995 || + processingOrderList[index] + .orderStatusId == + 998 || + processingOrderList[index] + .orderStatusId == + 999 // processingOrderList[index].orderStatusId == 20 ? Text( // deliveredOrderList[0].orderStatus.toString().substring(12), @@ -817,11 +855,14 @@ class _OrderPageState extends State } Widget getPendingOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + pendingOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 10) { pendingOrderList.add(model.orders[i]); } } + _tabController.animateTo(2); return Container( child: pendingOrderList.length != 0 ? SingleChildScrollView( @@ -840,12 +881,20 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - pendingOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + pendingOrderList[ + index]))) + .then((value) { + model + .getOrder(widget.customerID, + widget.customerGUID, pageID) + .then((value) { + getPendingOrder(model); + }); + }); }, child: Row( mainAxisAlignment: @@ -867,7 +916,8 @@ class _OrderPageState extends State .orderNumber, style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -878,7 +928,8 @@ class _OrderPageState extends State .toString(), style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -918,12 +969,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -1084,9 +1133,11 @@ class _OrderPageState extends State } Widget getCancelledOrder(OrderModelViewModel model) { + ProjectViewModel projectViewModel = Provider.of(context); + cancelledOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 40 || - model.orders[i].orderStatus == 996 || + model.orders[i].orderStatusId == 996 || model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } @@ -1109,12 +1160,13 @@ class _OrderPageState extends State InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: OrderDetailsPage( - orderModel: - cancelledOrderList[ - index]))); + context, + FadePage( + page: OrderDetailsPage( + orderModel: + cancelledOrderList[ + index]))) + ; }, child: Row( mainAxisAlignment: @@ -1136,7 +1188,8 @@ class _OrderPageState extends State .orderNumber, style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -1147,7 +1200,8 @@ class _OrderPageState extends State .toString(), style: TextStyle( fontSize: 16.0, - fontWeight: FontWeight.bold, + fontWeight: + FontWeight.bold, ), ), ), @@ -1187,12 +1241,10 @@ class _OrderPageState extends State ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - languageID == "ar" - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index ee360bb1..5fc7f3b2 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/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'; @@ -16,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/image.dart' as flutterImage; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; dynamic languageID; @@ -67,10 +69,12 @@ class _OrderDetailsPageState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); this.context = context; return BaseView( onModelReady: (model) { - model.getOrderDetails(widget.orderModel.id).then((value) { + model.getOrderDetails(widget.orderModel.id, widget.orderModel.orderGuid).then((value) { setState(() { isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty)); }); @@ -80,6 +84,9 @@ class _OrderDetailsPageState extends State { appBarTitle: TranslationBase.of(context).orderDetail, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isBottomBar: true, baseViewModel: model, body: model.orderListModel.length > 0 ? Container( @@ -132,7 +139,7 @@ class _OrderDetailsPageState extends State { ), ) : Text( - languageID == "ar" ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(), + projectProvider.isArabic ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(), style: TextStyle( color: Colors.white, fontSize: 13.0, @@ -250,7 +257,6 @@ class _OrderDetailsPageState extends State { ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png" : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png", fit: BoxFit.contain, -// height: 100, width: 100, ), ), @@ -337,7 +343,9 @@ class _OrderDetailsPageState extends State { itemBuilder: (context, index) { return Container( child: productTile( - productName: model.orderListModel[0].orderItems[index].product.name.toString(), + productName: projectViewModel.isArabic ? + model.orderListModel[0].orderItems[index].product.namen.toString() + :model.orderListModel[0].orderItems[index].product.name.toString(), productPrice: model.orderListModel[0].orderItems[index].product.price.toString(), productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(), productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews, @@ -525,10 +533,6 @@ class _OrderDetailsPageState extends State { model.orderListModel[0].orderStatusId == 10 ? InkWell( onTap: () { - print(widget.orderModel.toString()); - print(model.orderListModel.toString()); - print("calc = ${5.9 * 3}"); - // TODO MOSA openPayment(model.orderListModel[0], model.user); }, child: Container( @@ -557,8 +561,6 @@ class _OrderDetailsPageState extends State { ? InkWell( onTap: () { presentConfirmDialog(model, widget.orderModel.id); - // model.orderListModel[0].id//(widget.orderModel.id)); -// }, child: Container( // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), @@ -606,9 +608,9 @@ class _OrderDetailsPageState extends State { print(widget.orderModel.orderStatusId); // if(orderStatus == 'delivered') if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) - return Colors.blue[700]; + return Color(0xFF4CAF50); else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) - return Colors.green; + return Colors.grey[500]; else if (widget.orderModel.orderStatusId == 10) return Colors.orange[300]; else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]; @@ -645,18 +647,12 @@ class _OrderDetailsPageState extends State { confirmMessage: TranslationBase.of(context).confirmCancellation, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value) { - print(":D"); - print(value); -// Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: OrderPage( -// customerID: model.ordersList[0].customerId.toString() - customerID: widget.orderModel.customerId.toString())), - ); - }), + okFunction: () { + Navigator.pop(context); + cancelFunction.getCanceledOrder(id, context).then((value) { + Navigator.pop(context); + }); + }, cancelFunction: () => {}); dialog.showAlertDialog(context); } @@ -672,11 +668,6 @@ class _OrderDetailsPageState extends State { } } - /*** - * - * Online payment methods - */ - openPayment( OrderDetailModel order, AuthenticatedUser authenticatedUser, @@ -715,7 +706,7 @@ class _OrderDetailsPageState extends State { Navigator.pop(context); Navigator.pop(context); } else { - AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration\فشلت العملية حاول مره اخرى"); } } } diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart index bb680864..04c67079 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -34,6 +34,8 @@ class _ProductReviewPageState extends State { appBarTitle: TranslationBase.of(context).writeReview, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, body: Container( color: Colors.white, child: !finishReview ? SingleChildScrollView( diff --git a/lib/pages/pharmacy/order/TrackDriver.dart b/lib/pages/pharmacy/order/TrackDriver.dart index 40114c03..21b2572f 100644 --- a/lib/pages/pharmacy/order/TrackDriver.dart +++ b/lib/pages/pharmacy/order/TrackDriver.dart @@ -1,341 +1,341 @@ -import 'dart:async'; -import 'dart:typed_data'; -import 'dart:ui' as ui; - -import 'package:async/async.dart'; -import 'package:diplomaticquarterapp/config/config.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; -import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_animarker/lat_lng_interpolation.dart'; -import 'package:flutter_animarker/models/lat_lng_delta.dart'; -import 'package:flutter_animarker/models/lat_lng_info.dart'; -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:location/location.dart'; - -class TrackDriver extends StatefulWidget { - final OrderDetailModel order; - TrackDriver({this.order}); - - @override - State createState() => _TrackDriverState(); -} - -class _TrackDriverState extends State { - OrderPreviewService _orderServices = locator(); - OrderDetailModel _order; - - Completer _controller = Completer(); - - - double CAMERA_ZOOM = 14; - double CAMERA_TILT = 0; - double CAMERA_BEARING = 30; - LatLng SOURCE_LOCATION = null; - LatLng DEST_LOCATION = null; - - // for my drawn routes on the map - Set _polylines = Set(); - List polylineCoordinates = []; - PolylinePoints polylinePoints; - - Set _markers = Set(); - - BitmapDescriptor sourceIcon; // for my custom marker pins - BitmapDescriptor destinationIcon; // for my custom marker pins - Location location;// wrapper around the location API - - - int locationUpdateFreq = 2; - LatLngInterpolationStream _latLngStream; - StreamGroup subscriptions; - - @override - void initState() { - super.initState(); - - _order = widget.order; - DEST_LOCATION = _order.shippingAddress.getLocation(); - location = new Location(); - polylinePoints = PolylinePoints(); - setSourceAndDestinationIcons(); - - initMarkerUpdateStream(); - startUpdatingDriverLocation(); - - } - - @override - void dispose() { - super.dispose(); - subscriptions.close(); - _latLngStream.cancel(); - stopUpdatingDriverLocation(); - } - - initMarkerUpdateStream(){ - _latLngStream = LatLngInterpolationStream(movementDuration: Duration(seconds: locationUpdateFreq+1)); - subscriptions = StreamGroup(); - - subscriptions.add(_latLngStream.getAnimatedPosition('sourcePin')); - subscriptions.stream.listen((LatLngDelta delta) { - //Update the marker with animation - setState(() { - //Get the marker Id for this animation - var markerId = MarkerId(delta.markerId); - Marker sourceMarker = Marker( - markerId: markerId, - // rotation: delta.rotation, - icon: sourceIcon, - position: LatLng( - delta.from.latitude, - delta.from.longitude, - ), - onTap: onSourceMarkerTap - ); - - _markers.removeWhere((m) => m.markerId.value == 'sourcePin'); - _markers.add(sourceMarker); - }); - }); - } - - @override - Widget build(BuildContext context) { - - return AppScaffold( - appBarTitle: TranslationBase.of(context).deliveryDriverTrack, - isShowAppBar: true, - isPharmacy: true, - showPharmacyCart: false, - showHomeAppBarIcon: false, - body: GoogleMap( - myLocationEnabled: true, - compassEnabled: true, - markers: _markers, - polylines: _polylines, - mapType: MapType.normal, - initialCameraPosition: CameraPosition(target: DEST_LOCATION, zoom: 4), - onMapCreated: (GoogleMapController controller) { - _controller.complete(controller); - // showPinsOnMap(); - }, - ), - // floatingActionButton: FloatingActionButton.extended( - // onPressed: _goToDriver, - // label: Text('To the lake!'), - // icon: Icon(Icons.directions_boat), - // ), - ); - } - - - void setSourceAndDestinationIcons() async { - final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize()); - final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize()); - sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes); - destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes); - } - - CameraPosition _orderDeliveryLocationCamera(){ - if(DEST_LOCATION != null){ - final CameraPosition orderDeliveryLocCamera = CameraPosition( - bearing: CAMERA_BEARING, - target: DEST_LOCATION, - tilt: CAMERA_TILT, - zoom: CAMERA_ZOOM); - return orderDeliveryLocCamera; - } - return null; - } - - CameraPosition _driverLocationCamera(){ - if(DEST_LOCATION != null) { - final CameraPosition driverLocCamera = CameraPosition( - bearing: CAMERA_BEARING, - target: SOURCE_LOCATION, - tilt: CAMERA_TILT, - zoom: CAMERA_ZOOM); - return driverLocCamera; - } - return null; - } - - - Future _goToOrderDeliveryLocation() async { - final GoogleMapController controller = await _controller.future; - final CameraPosition orderDeliveryLocCamera = _orderDeliveryLocationCamera(); - controller.animateCamera(CameraUpdate.newCameraPosition(orderDeliveryLocCamera)); - } - - Future _goToDriver() async { - final GoogleMapController controller = await _controller.future; - final CameraPosition driverLocCamera = _driverLocationCamera(); - controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera)); - } - - - void showPinsOnMap() { - // source pin - if(SOURCE_LOCATION != null){ - setState(() { - var pinPosition = SOURCE_LOCATION; - _markers.removeWhere((m) => m.markerId.value == 'sourcePin'); - _markers.add(Marker( - markerId: MarkerId('sourcePin'), - position: pinPosition, - icon: sourceIcon, - infoWindow: InfoWindow(title: TranslationBase.of(context).driver), - onTap: onSourceMarkerTap - )); - }); - } - - // destination pin - if(DEST_LOCATION != null){ - setState(() { - var destPosition = DEST_LOCATION; - _markers.removeWhere((m) => m.markerId.value == 'destPin'); - _markers.add(Marker( - markerId: MarkerId('destPin'), - position: destPosition, - icon: destinationIcon, - infoWindow: InfoWindow(title: TranslationBase.of(context).deliveryLocation), - onTap: onDestinationMarkerTap - )); - }); - } - // set the route lines on the map from source to destination - // for more info follow this tutorial - // drawRoute(); - } - - void updatePinOnMap() async { - _latLngStream.addLatLng(LatLngInfo(SOURCE_LOCATION.latitude, SOURCE_LOCATION.longitude, "sourcePin")); - drawRoute(); - } - - void drawRoute() async { - return; // Ignore draw Route - - List result = await polylinePoints.getRouteBetweenCoordinates( - GOOGLE_API_KEY, - SOURCE_LOCATION.latitude, - SOURCE_LOCATION.longitude, - DEST_LOCATION.latitude, - DEST_LOCATION.longitude); - if(result.isNotEmpty){ - result.forEach((PointLatLng point){ - polylineCoordinates.add( - LatLng(point.latitude,point.longitude) - ); - }); - setState(() { - _polylines.add(Polyline( - width: 5, // set the width of the polylines - polylineId: PolylineId('poly'), - color: Color.fromARGB(255, 40, 122, 198), - points: polylineCoordinates - )); - }); - } - } - - bool isLocationUpdating = false; - startUpdatingDriverLocation({int frequencyInSeconds = 2}) async{ - isLocationUpdating = true; - int driverId = int.tryParse(_order.driverID); - - Future.doWhile(() async{ - if(isLocationUpdating){ - - await Future.delayed(Duration(seconds: frequencyInSeconds)); - - showLoading(); - LatLng driverLocation = (await _orderServices.getDriverLocation(driverId)); - hideLoading(); - - if(driverLocation != null){ - if(SOURCE_LOCATION == null || DEST_LOCATION == null){ - SOURCE_LOCATION = driverLocation; - DEST_LOCATION = _order.shippingAddress.getLocation(); - showPinsOnMap(); - } - SOURCE_LOCATION = driverLocation; - updatePinOnMap(); - updateMapCamera(); - }else{ - GifLoaderDialogUtils.hideDialog(context); - } - } - return isLocationUpdating; - - }); - } - - showLoading(){ - if(SOURCE_LOCATION == null){ - GifLoaderDialogUtils.showMyDialog(context); - } - } - - hideLoading(){ - if(SOURCE_LOCATION == null){ - GifLoaderDialogUtils.hideDialog(context); - } - } - - stopUpdatingDriverLocation(){ - isLocationUpdating = false; - } - - Future getBytesFromAsset(String path, int width) async { - ByteData data = await rootBundle.load(path); - ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width); - ui.FrameInfo fi = await codec.getNextFrame(); - return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List(); - } - - int getMarkerIconSize(){ - return 140; - } - - updateMapCamera() async{ - if(SOURCE_LOCATION != null && DEST_LOCATION != null){ - - // 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true. - LatLngBounds bound; - if(SOURCE_LOCATION.latitude <= DEST_LOCATION.latitude){ - bound = LatLngBounds(southwest: SOURCE_LOCATION, northeast: DEST_LOCATION); - }else{ - bound = LatLngBounds(southwest: DEST_LOCATION, northeast: SOURCE_LOCATION); - } - - if(bound == null) - return; - - CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, 50); - final GoogleMapController controller = await _controller.future; - controller.animateCamera(camera); - } - } - - bool showSrcMarkerTitle = false; - onSourceMarkerTap() async{ - // showSrcMarkerTitle = !showSrcMarkerTitle; - } - - bool showDestMarkerTitle = false; - onDestinationMarkerTap() async{ - // showDestMarkerTitle = !showDestMarkerTitle; - // Marker m = _markers.firstWhere((m) => m.markerId.value == 'destPin'); - // if(showDestMarkerTitle){ - // } - } -} +// import 'dart:async'; +// import 'dart:typed_data'; +// import 'dart:ui' as ui; +// +// import 'package:async/async.dart'; +// import 'package:diplomaticquarterapp/config/config.dart'; +// import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; +// import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +// import 'package:diplomaticquarterapp/locator.dart'; +// import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// import 'package:flutter_animarker/lat_lng_interpolation.dart'; +// import 'package:flutter_animarker/models/lat_lng_delta.dart'; +// import 'package:flutter_animarker/models/lat_lng_info.dart'; +// import 'package:flutter_polyline_points/flutter_polyline_points.dart'; +// import 'package:google_maps_flutter/google_maps_flutter.dart'; +// import 'package:location/location.dart'; +// +// class TrackDriver extends StatefulWidget { +// final OrderDetailModel order; +// TrackDriver({this.order}); +// +// @override +// State createState() => _TrackDriverState(); +// } +// +// class _TrackDriverState extends State { +// OrderPreviewService _orderServices = locator(); +// OrderDetailModel _order; +// +// Completer _controller = Completer(); +// +// +// double CAMERA_ZOOM = 14; +// double CAMERA_TILT = 0; +// double CAMERA_BEARING = 30; +// LatLng SOURCE_LOCATION = null; +// LatLng DEST_LOCATION = null; +// +// // for my drawn routes on the map +// Set _polylines = Set(); +// List polylineCoordinates = []; +// PolylinePoints polylinePoints; +// +// Set _markers = Set(); +// +// BitmapDescriptor sourceIcon; // for my custom marker pins +// BitmapDescriptor destinationIcon; // for my custom marker pins +// Location location;// wrapper around the location API +// +// +// int locationUpdateFreq = 2; +// LatLngInterpolationStream _latLngStream; +// StreamGroup subscriptions; +// +// @override +// void initState() { +// super.initState(); +// +// _order = widget.order; +// DEST_LOCATION = _order.shippingAddress.getLocation(); +// location = new Location(); +// polylinePoints = PolylinePoints(); +// setSourceAndDestinationIcons(); +// +// initMarkerUpdateStream(); +// startUpdatingDriverLocation(); +// +// } +// +// @override +// void dispose() { +// super.dispose(); +// subscriptions.close(); +// _latLngStream.cancel(); +// stopUpdatingDriverLocation(); +// } +// +// initMarkerUpdateStream(){ +// _latLngStream = LatLngInterpolationStream(movementDuration: Duration(seconds: locationUpdateFreq+1)); +// subscriptions = StreamGroup(); +// +// subscriptions.add(_latLngStream.getAnimatedPosition('sourcePin')); +// subscriptions.stream.listen((LatLngDelta delta) { +// //Update the marker with animation +// setState(() { +// //Get the marker Id for this animation +// var markerId = MarkerId(delta.markerId); +// Marker sourceMarker = Marker( +// markerId: markerId, +// // rotation: delta.rotation, +// icon: sourceIcon, +// position: LatLng( +// delta.from.latitude, +// delta.from.longitude, +// ), +// onTap: onSourceMarkerTap +// ); +// +// _markers.removeWhere((m) => m.markerId.value == 'sourcePin'); +// _markers.add(sourceMarker); +// }); +// }); +// } +// +// @override +// Widget build(BuildContext context) { +// +// return AppScaffold( +// appBarTitle: TranslationBase.of(context).deliveryDriverTrack, +// isShowAppBar: true, +// isPharmacy: true, +// showPharmacyCart: false, +// showHomeAppBarIcon: false, +// body: GoogleMap( +// myLocationEnabled: true, +// compassEnabled: true, +// markers: _markers, +// polylines: _polylines, +// mapType: MapType.normal, +// initialCameraPosition: CameraPosition(target: DEST_LOCATION, zoom: 4), +// onMapCreated: (GoogleMapController controller) { +// _controller.complete(controller); +// // showPinsOnMap(); +// }, +// ), +// // floatingActionButton: FloatingActionButton.extended( +// // onPressed: _goToDriver, +// // label: Text('To the lake!'), +// // icon: Icon(Icons.directions_boat), +// // ), +// ); +// } +// +// +// void setSourceAndDestinationIcons() async { +// final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize()); +// final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize()); +// sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes); +// destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes); +// } +// +// CameraPosition _orderDeliveryLocationCamera(){ +// if(DEST_LOCATION != null){ +// final CameraPosition orderDeliveryLocCamera = CameraPosition( +// bearing: CAMERA_BEARING, +// target: DEST_LOCATION, +// tilt: CAMERA_TILT, +// zoom: CAMERA_ZOOM); +// return orderDeliveryLocCamera; +// } +// return null; +// } +// +// CameraPosition _driverLocationCamera(){ +// if(DEST_LOCATION != null) { +// final CameraPosition driverLocCamera = CameraPosition( +// bearing: CAMERA_BEARING, +// target: SOURCE_LOCATION, +// tilt: CAMERA_TILT, +// zoom: CAMERA_ZOOM); +// return driverLocCamera; +// } +// return null; +// } +// +// +// Future _goToOrderDeliveryLocation() async { +// final GoogleMapController controller = await _controller.future; +// final CameraPosition orderDeliveryLocCamera = _orderDeliveryLocationCamera(); +// controller.animateCamera(CameraUpdate.newCameraPosition(orderDeliveryLocCamera)); +// } +// +// Future _goToDriver() async { +// final GoogleMapController controller = await _controller.future; +// final CameraPosition driverLocCamera = _driverLocationCamera(); +// controller.animateCamera(CameraUpdate.newCameraPosition(driverLocCamera)); +// } +// +// +// void showPinsOnMap() { +// // source pin +// if(SOURCE_LOCATION != null){ +// setState(() { +// var pinPosition = SOURCE_LOCATION; +// _markers.removeWhere((m) => m.markerId.value == 'sourcePin'); +// _markers.add(Marker( +// markerId: MarkerId('sourcePin'), +// position: pinPosition, +// icon: sourceIcon, +// infoWindow: InfoWindow(title: TranslationBase.of(context).driver), +// onTap: onSourceMarkerTap +// )); +// }); +// } +// +// // destination pin +// if(DEST_LOCATION != null){ +// setState(() { +// var destPosition = DEST_LOCATION; +// _markers.removeWhere((m) => m.markerId.value == 'destPin'); +// _markers.add(Marker( +// markerId: MarkerId('destPin'), +// position: destPosition, +// icon: destinationIcon, +// infoWindow: InfoWindow(title: TranslationBase.of(context).deliveryLocation), +// onTap: onDestinationMarkerTap +// )); +// }); +// } +// // set the route lines on the map from source to destination +// // for more info follow this tutorial +// // drawRoute(); +// } +// +// void updatePinOnMap() async { +// _latLngStream.addLatLng(LatLngInfo(SOURCE_LOCATION.latitude, SOURCE_LOCATION.longitude, "sourcePin")); +// drawRoute(); +// } +// +// void drawRoute() async { +// return; // Ignore draw Route +// +// List result = await polylinePoints.getRouteBetweenCoordinates( +// GOOGLE_API_KEY, +// SOURCE_LOCATION.latitude, +// SOURCE_LOCATION.longitude, +// DEST_LOCATION.latitude, +// DEST_LOCATION.longitude); +// if(result.isNotEmpty){ +// result.forEach((PointLatLng point){ +// polylineCoordinates.add( +// LatLng(point.latitude,point.longitude) +// ); +// }); +// setState(() { +// _polylines.add(Polyline( +// width: 5, // set the width of the polylines +// polylineId: PolylineId('poly'), +// color: Color.fromARGB(255, 40, 122, 198), +// points: polylineCoordinates +// )); +// }); +// } +// } +// +// bool isLocationUpdating = false; +// startUpdatingDriverLocation({int frequencyInSeconds = 2}) async{ +// isLocationUpdating = true; +// int driverId = int.tryParse(_order.driverID); +// +// Future.doWhile(() async{ +// if(isLocationUpdating){ +// +// await Future.delayed(Duration(seconds: frequencyInSeconds)); +// +// showLoading(); +// LatLng driverLocation = (await _orderServices.getDriverLocation(driverId)); +// hideLoading(); +// +// if(driverLocation != null){ +// if(SOURCE_LOCATION == null || DEST_LOCATION == null){ +// SOURCE_LOCATION = driverLocation; +// DEST_LOCATION = _order.shippingAddress.getLocation(); +// showPinsOnMap(); +// } +// SOURCE_LOCATION = driverLocation; +// updatePinOnMap(); +// updateMapCamera(); +// }else{ +// GifLoaderDialogUtils.hideDialog(context); +// } +// } +// return isLocationUpdating; +// +// }); +// } +// +// showLoading(){ +// if(SOURCE_LOCATION == null){ +// GifLoaderDialogUtils.showMyDialog(context); +// } +// } +// +// hideLoading(){ +// if(SOURCE_LOCATION == null){ +// GifLoaderDialogUtils.hideDialog(context); +// } +// } +// +// stopUpdatingDriverLocation(){ +// isLocationUpdating = false; +// } +// +// Future getBytesFromAsset(String path, int width) async { +// ByteData data = await rootBundle.load(path); +// ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width); +// ui.FrameInfo fi = await codec.getNextFrame(); +// return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List(); +// } +// +// int getMarkerIconSize(){ +// return 140; +// } +// +// updateMapCamera() async{ +// if(SOURCE_LOCATION != null && DEST_LOCATION != null){ +// +// // 'package:google_maps_flutter_platform_interface/src/types/location.dart': Failed assertion: line 72 pos 16: 'southwest.latitude <= northeast.latitude': is not true. +// LatLngBounds bound; +// if(SOURCE_LOCATION.latitude <= DEST_LOCATION.latitude){ +// bound = LatLngBounds(southwest: SOURCE_LOCATION, northeast: DEST_LOCATION); +// }else{ +// bound = LatLngBounds(southwest: DEST_LOCATION, northeast: SOURCE_LOCATION); +// } +// +// if(bound == null) +// return; +// +// CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, 50); +// final GoogleMapController controller = await _controller.future; +// controller.animateCamera(camera); +// } +// } +// +// bool showSrcMarkerTitle = false; +// onSourceMarkerTap() async{ +// // showSrcMarkerTitle = !showSrcMarkerTitle; +// } +// +// bool showDestMarkerTitle = false; +// onDestinationMarkerTap() async{ +// // showDestMarkerTitle = !showDestMarkerTitle; +// // Marker m = _markers.firstWhere((m) => m.markerId.value == 'destPin'); +// // if(showDestMarkerTitle){ +// // } +// } +// } diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 514ea1a5..5e55d537 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -62,7 +62,7 @@ class _AddAddressPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).changeAddress, - isShowAppBar: true, + isShowAppBar: false, isPharmacy: true, backgroundColor: Colors.white, body: Container( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 21bb77eb..c5edac52 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.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/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; ///TODO Elham* split this to tow files class PharmacyAddressesPage extends StatefulWidget { @@ -34,14 +36,17 @@ class _PharmacyAddressesState extends State { Navigator.push( ctx, FadePage( - page: AddAddressPage(address, (pickResult) { + page: AddAddressPage(address, (pickResult) async { model.addEditAddress(pickResult, address); - }))); + await model.getAddressesList(); + + }))); } Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getAddressesList(), @@ -125,12 +130,17 @@ class _PharmacyAddressesState extends State { GifLoaderDialogUtils.showMyDialog(context); - await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); - await widget.orderPreviewViewModel.getShoppingCart(); - // widget.changeMainState(); - GifLoaderDialogUtils.hideDialog(context); - model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); - _navigateToPaymentOption(model); + await widget.orderPreviewViewModel.getInformationsByAddress(projectProvider.user.patientIdentificationNo); + if (widget.orderPreviewViewModel.error == "") { + await widget.orderPreviewViewModel.getShoppingCart(); + GifLoaderDialogUtils.hideDialog(context); + model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); + _navigateToPaymentOption(model); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.orderPreviewViewModel.error); + return; + } }, ), ), @@ -168,7 +178,7 @@ class _PharmacyAddressesState extends State { } } -class AddressItemWidget extends StatelessWidget { +class AddressItemWidget extends StatefulWidget { final PharmacyAddressesViewModel model; final AddressInfo address; final Function selectAddress; @@ -177,6 +187,11 @@ class AddressItemWidget extends StatelessWidget { AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress); + @override + _AddressItemWidgetState createState() => _AddressItemWidgetState(); +} + +class _AddressItemWidgetState extends State { @override Widget build(BuildContext context) { return Container( @@ -192,14 +207,14 @@ class AddressItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: selectAddress, + onTap: widget.selectAddress, child: Container( margin: EdgeInsets.only(left: 16, right: 16), child: Padding( padding: const EdgeInsets.all(5.0), child: Container( decoration: new BoxDecoration( - color: !isSelected ? Colors.white : Colors.green, + color: !widget.isSelected ? Colors.white : Colors.green, shape: BoxShape.circle, border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0), ), @@ -207,7 +222,7 @@ class AddressItemWidget extends StatelessWidget { padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, - color: isSelected ? Colors.white : Colors.transparent, + color: widget.isSelected ? Colors.white : Colors.transparent, size: 25, ), ), @@ -227,7 +242,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 0), child: Texts( - "${address.firstName} ${address.lastName}", + "${widget.address.firstName} ${widget.address.lastName}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, @@ -236,7 +251,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 4), child: Texts( - "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + "${widget.address.address1} ${widget.address.address2} ${widget.address.address2},, ${widget.address.city}, ${widget.address.country} ${widget.address.zipPostalCode}", fontSize: 12, fontWeight: FontWeight.normal, color: Colors.grey.shade500, @@ -253,7 +268,7 @@ class AddressItemWidget extends StatelessWidget { ), ), Texts( - "${address.phoneNumber}", + "${widget.address.phoneNumber}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.grey, @@ -274,7 +289,7 @@ class AddressItemWidget extends StatelessWidget { borderColor: Colors.transparent, textColor: Color(0x990000FF), handler: () { - onTabEditAddress(address); + widget.onTabEditAddress(widget.address); }, icon: Icon( Icons.edit, @@ -299,19 +314,25 @@ class AddressItemWidget extends StatelessWidget { textColor: Color(0x99FF0000), handler: () { ConfirmDialog dialog = new ConfirmDialog( - context: context, - title: "Are you sure want to delete", - confirmMessage: "${address.address1} ${address.address2}", + // context: context, + title: TranslationBase.of(context).deleteAddress, + //"Are you sure want to delete", + confirmMessage: "${widget.address.address1} ${widget.address.address2}", okText: TranslationBase.of(context).delete, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - model.deleteAddresses(address).then((_) { + widget.model.deleteAddresses(widget.address).then((_) { ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast(message: "Address has been deleted"); + AppToast.showErrorToast(message: TranslationBase.of(context).deletedAddress, + // "Address has been deleted" + ); }) }, cancelFunction: () => {}); dialog.showAlertDialog(context); + setState(() { + widget.model.deleteAddresses(widget.address); + }); }, icon: Icon( Icons.delete, diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart new file mode 100644 index 00000000..a4ce3a56 --- /dev/null +++ b/lib/pages/pharmacy/pharmacyContacts.dart @@ -0,0 +1,258 @@ +import 'dart:io' show Platform; + +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; +import 'dart:io' show Platform; + +class pharmacyContactsPage extends StatefulWidget { + @override + _pharmacyContactsPageState createState() => _pharmacyContactsPageState(); +} + +class _pharmacyContactsPageState extends State { + @override + Widget build(BuildContext context) { + final latitude = "24.704016"; + final longitude = "46.676691"; + final phone = "+966112833400"; + final whatsApp = "+966558434444"; + final whatappURL_android = "whatsapp://send?phone=" + whatsApp; + final whatappURL_ios = "https://wa.me/$whatsApp"; + final locationDescription = "Main Pharmacy OLAYA"; + + return AppScaffold( + appBarTitle: TranslationBase.of(context).contactUs, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isMainPharmacyPages: true, + isBottomBar: true, + body: Column( + children: [ + Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide(color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 8, + ), + child: Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.fromLTRB(5, 15, 5, 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15), + ), + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text(TranslationBase.of(context).contactUsTime, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ), + ), + SizedBox( + height: 35, + ), + Row( + children: [ + InkWell( + onTap: () { + launch("tel://" + phone); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/call.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Text(TranslationBase.of(context).phone, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + SizedBox( + width: 30, + ), + Text("+966 " + " -11- 2833400", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ], + ), + SizedBox( + height: 30, + ), + Row( + children: [ + InkWell( + onTap: () { + // launch('whatsapp://send?phone='+whatsApp); + openWhatsApp(); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/whatsapp.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Text(TranslationBase.of(context).whatsApp, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + SizedBox( + width: 30, + ), + Text("+966 " + " 558434444", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ], + ), + SizedBox( + height: 30, + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + InkWell( + onTap: () { + if (Platform.isIOS) { MapLauncher.showMarker( + mapType: MapType.apple, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription,); + } else { MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription, + // description: location.locationName, + ); } + // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + }, +// MapsLauncher.launchCoordinates( +// double.parse(latitude), +// double.parse(longitude)); +// }, + child: SvgPicture.asset( + 'assets/images/pharmacy/location.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Expanded( + child: Text( + TranslationBase.of(context).contactUsLocation, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.68)), + ), + ], + ), + ), + SizedBox( + height: 50, + ), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: new Image.asset( + 'assets/images/new-design/facebook.png'), + tooltip: 'facebook', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://facebook.com/HMG.pharmacy"); + // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + }); + }, + ), + IconButton( + icon: new Image.asset( + 'assets/images/new-design/twitter.png'), + tooltip: 'Twitter', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://twitter.com/HMG_pharmacy"); + }); + }, + ), + IconButton( + icon: new Image.asset( + 'assets/images/pharmacy/instagram.png'), + tooltip: 'Instagram', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://instagram.com/HMG_pharmacy"); + }); + }, + ), + ]), + ) + ], + ), + ), + ), + ], + ), + ); + } + + openWhatsApp() async { + // bool Platform.isIOS = Theme.of(context).platform == TargetPlatform.iOS; + var whatsapp = "+966558434444"; + var whatsappURL_android = "whatsapp://send?phone=" + whatsapp; + var whatappURL_ios = "https://wa.me/$whatsapp"; + if (Platform.isIOS) { + // for iOS phone only + // if (await canLaunch(whatappURL_ios)) { + await launch(whatappURL_ios, forceSafariVC: false); + // } else {} + } else { + // android + // if (await canLaunch(whatsappURL_android)) { + await launch(whatsappURL_android); + // } else {} + } + } +} diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 8362b2c8..2c72c14e 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -16,9 +16,9 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-con import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyContacts.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/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -29,6 +29,10 @@ import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class PharmacyProfilePage extends StatefulWidget { + final bool moveToOrder; + + PharmacyProfilePage({@required this.moveToOrder}); + @override _ProfilePageState createState() => _ProfilePageState(); } @@ -41,6 +45,7 @@ class _ProfilePageState extends State { bool isLogin = false; String firstName; String customerId; + String customerGUID; String lastName, mobileNo, identificationNo; int languageId; @@ -50,11 +55,15 @@ class _ProfilePageState extends State { getCustomer() async { String custID; + String custGUID; custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + custGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); setState(() { customerId = custID; + customerGUID = custGUID; }); print("customer Id is" + customerId); + print("customer GUID is" + customerGUID); return customerId; } @@ -75,8 +84,6 @@ class _ProfilePageState extends State { ); } } - -// this.isLogin = user != null; } void initState() { @@ -84,556 +91,520 @@ class _ProfilePageState extends State { getLanguageID(); super.initState(); getUser(); + if (widget.moveToOrder) { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + } } @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - GifLoaderDialogUtils.showMyDialog(context); - model.getOrder(customerId, page_id); - GifLoaderDialogUtils.hideDialog(context); - }, - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, - isShowDecPage: true, - isPharmacy: true, - - //isBottomBar: true, - isMainPharmacyPages: true, - body: user != null - ? Container( - color: Colors.white, - child: SingleChildScrollView( - child: Column( + onModelReady: (model) async { + // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + // GifLoaderDialogUtils.showMyDialog(context); + // model.getOrder(customerId, customerGUID, page_id); + // GifLoaderDialogUtils.hideDialog(context); + }, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isMainPharmacyPages: true, + body: user != null + ? Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( children: [ Container( child: Row( children: [ Container( - child: Row( - children: [ - Container( - padding: EdgeInsets.only( - top: 20.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: LargeAvatar( - name: user.firstName.toString(), - url: '', - ), - ), - Column(children: [ - Row(children: [ - Text( - TranslationBase.of(context).welcome, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), - ), - ]), - SizedBox( - height: 10, - ), - Row(children: [ - Text( - languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ]), - ]), - ], + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, ), - ) - ], - ), - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 15, - ), - Container( - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if (customerId == null) { - AppToast.showErrorToast(message: "Customer not found"); - return; - } - Navigator.push(context, FadePage(page: OrderPage(customerID: customerId))); - }, - child: Column( - children: [ -// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), - SvgPicture.asset( - 'assets/images/pharmacy/orders_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).orders, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], + child: LargeAvatar( + name: user.firstName.toString(), + url: '', ), ), - ), - Expanded( - child: InkWell( - onTap: () { - if (customerId == null || customerId == '') - Navigator.push(context, FadePage(page: LakumActivationVidaPage())); - else - Navigator.push(context, FadePage(page: LakumMainPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/lakum_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).lakum, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold), - ), - ], + Column(children: [ + Row(children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), + ), + ]), + SizedBox( + height: 10, ), + Row(children: [ + Text( + languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ]), + ]), + ], + ), + ) + ], + ), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 15, + ), + Container( + child: Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (customerId == null) { + AppToast.showErrorToast(message: "Customer not found"); + return; + } + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + }, + child: Column( + children: [ +// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), + SvgPicture.asset( + 'assets/images/pharmacy/orders_icon.svg', + width: 50, + height: 50, ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: WishlistPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/wishlist_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).wishlist, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), + SizedBox( + height: 5, ), - ), - Expanded( - child: InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: MyReviewsPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/review_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], + Text( + TranslationBase.of(context).orders, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), - ), - ], - )), - SizedBox( - height: 15, - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 10, + ], + ), ), - Container( - padding: EdgeInsets.only(left: 10.0), + ), + Expanded( + child: InkWell( + onTap: () { + if (customerId == null || customerId == '') + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + else + Navigator.push(context, FadePage(page: LakumMainPage())); + }, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + SvgPicture.asset( + 'assets/images/pharmacy/lakum_icon.svg', + width: 50, + height: 50, ), SizedBox( - height: 10, + height: 5, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).lakum, + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/my_prescription_icon.svg', - width: 28, - height: 28, - ), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context) - .myPrescription, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], - ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: WishlistPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/wishlist_icon.svg', + width: 50, + height: 50, ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: ComparePage())); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/compare.png', - width: 35, - height: 35), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context).compare, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).wishlist, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyReviewsPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/medication_refill_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .medicationsRefill, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), - SizedBox( - height: 5, + ], + ), + ), + ), + ], + )), + SizedBox( + height: 15, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).myAccount, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, ), - Divider( - color: Colors.grey, - height: 20, + SizedBox( + width: 15, ), - InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: MyFamily())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/my_family_icon.svg', - width: 20, - height: 20, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).family, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).myPrescription, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: ComparePage())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), SizedBox( - height: 5, - ), - Divider( - color: Colors.grey, - height: 20, + width: 15, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyAddressesPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/shipping_addresses_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .shippingAddresses, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, + Text( + TranslationBase.of(context).medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyFamily())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_family_icon.svg', + width: 20, height: 20, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyTermsConditions())); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context) - .conditionsHMG, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).family, + style: TextStyle( + fontSize: 13.0, ), ), - SizedBox( - height: 5, + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_addresses_icon.svg', + width: 30, + height: 30, ), - Divider( - color: Colors.grey, - height: 20, + SizedBox( + width: 20, ), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: LakumTermsConditions( - this.identificationNo, - this.firstName, - this.lastName, - this.mobileNo, - this.languageId))); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), -// IconButton(icon: Icon(Icons.error_outline), iconSize: 30, -// color: Colors.black,), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context) - .conditions, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).shippingAddresses, + style: TextStyle( + fontSize: 13.0, ), ), ], ), ), SizedBox( - height: 10, + height: 5, ), Divider( - color: Colors.grey[350], + color: Colors.grey, height: 20, - thickness: 5, - indent: 0, - endIndent: 0, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PharmacyTermsConditions())); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), + SizedBox( + width: 10, + ), + Text( TranslationBase.of(context).termOfService, + // TranslationBase.of(context).conditionsHMG, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), ), SizedBox( - height: 10, + height: 5, ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); + }, + child: Row( children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), +// IconButton(icon: Icon(Icons.error_outline), iconSize: 30, +// color: Colors.black,), + SizedBox( + width: 10, + ), Text( - TranslationBase.of(context).reachUs, + TranslationBase.of(context).conditions, style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).reachUs, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: pharmacyContactsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/contact_us_icon.svg', + width: 20, + height: 20, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).contactUs, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: LiveChatPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/contact_us_icon.svg', - width: 20, - height: 20, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).contactUs, - style: TextStyle(fontSize: 13.0), - ), - ], - ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).ourLocations, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, - FadePage(page: FindUsPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/our_locations_icon.svg', - width: 30, - height: 30, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context) - .ourLocations, - style: TextStyle(fontSize: 13.0), - ), - ], - ), - ) ], ), ) ], ), - ), - ) - : Container(), - )); + ) + ], + ), + ), + ) + : Container(), + ), + ); } } diff --git a/lib/pages/pharmacy_categorise.dart b/lib/pages/pharmacy_categorise.dart index 9ed1070f..9a364cf4 100644 --- a/lib/pages/pharmacy_categorise.dart +++ b/lib/pages/pharmacy_categorise.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -277,7 +277,7 @@ class _PharmacyCategorisePageState extends State { /// When give qr we will change this method to get data /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result - String result = await BarcodeScanner.scan(); + String result = (await BarcodeScanner.scan())?.rawContent; var data = json.decode(result); if (data != null) { var qRParkingID = data['QRParkingID']; diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 8ec9f014..d40d490f 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -11,12 +11,14 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'base/base_view.dart'; +import 'package:intl/intl.dart' as international; class SearchProductsPage extends StatefulWidget { @override @@ -27,6 +29,8 @@ class _SearchProductsPageState extends State { final textController = TextEditingController(); final _formKey = GlobalKey(); String msg = ''; + String validText = ""; + bool isTextValid = true; @override Widget build(BuildContext context) { @@ -61,41 +65,27 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'([A-Za-z0-9 a space])')) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - 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; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, -// validator: (value) { -// if (value.isEmpty) { -//// return 'please Enter Product Name'; -// return TranslationBase.of(context).pleaseEnterProductName; -// } -// return null; -// }, ), + // SizedBox( + // width: 10.0, + // ), + // if(!isTextValid) + // AppText( TranslationBase.of(context) + // .noArabicLetters, color: Colors.red,), + // ], + // ), ), ), + SizedBox( width: 10.0, ), @@ -223,16 +213,27 @@ class _SearchProductsPageState extends State { Radius.circular( 6)), ), - child: model.searchList[index].rxMessage != null + child: model.searchList[index] + .rxMessage != + null ? Texts( - projectProvider.isArabic - ? model.searchList[index].rxMessagen - : model.searchList[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ): Texts(""), + projectProvider + .isArabic + ? model + .searchList[ + index] + .rxMessagen + : model + .searchList[ + index] + .rxMessage, + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), // Texts( // model.searchList[index] // .rxMessage != @@ -258,11 +259,16 @@ class _SearchProductsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(projectProvider.isArabic - ? model.searchList[index].namen - :model.searchList[index].name, + Texts( + projectProvider.isArabic + ? model + .searchList[index] + .namen + : model + .searchList[index] + .name, - // model.searchList[index].name, + // model.searchList[index].name, regular: true, fontSize: 12, fontWeight: FontWeight.w400, @@ -338,6 +344,10 @@ class _SearchProductsPageState extends State { ); } + bool isRTL(String text) { + return international.Bidi.detectRtlDirectionality(text); + } + searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { Utils.hideKeyboard(context); if (_formKey.currentState.validate()) diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index f61650e5..e69acb07 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -10,7 +10,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; -import 'package:screen/screen.dart'; +import 'package:screen_brightness/screen_brightness.dart'; class GeneralSettings extends StatefulWidget { @override @@ -275,7 +275,7 @@ class _GeneralSettings extends State with TickerProviderStateMi case 0: { themeNotifier.setTheme(await getTheme(value)); - Screen.setBrightness(1.0); + setBrightness(1.0); } break; case 1: @@ -286,24 +286,33 @@ class _GeneralSettings extends State with TickerProviderStateMi break; case 2: themeNotifier.setTheme(await getTheme(value)); - Screen.setBrightness(0.01); + setBrightness(0.01); break; case 3: { themeNotifier.setTheme(await getTheme(value)); - Screen.setBrightness(1.0); + setBrightness(1.0); } break; default: { themeNotifier.setTheme(await getTheme(value)); - Screen.setBrightness(1.0); + setBrightness(1.0); } break; } permission.setTheme(value); } + setBrightness(double brightness) async { + try { + await ScreenBrightness().setScreenBrightness(brightness); + } catch (e) { + print(e); + throw 'Failed to set brightness'; + } + } + setVibration(value) { permission.setVibrationPermission(value); } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 7f1f6a93..efb4ecae 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -280,7 +280,7 @@ class _ProfileSettings extends State with TickerProviderStateMi TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, + keyboardType: TextInputType.emailAddress, controller: _controller, // onChanged: (value) => {validateForm()}, style: TextStyle( diff --git a/lib/pages/sub_categories_modalsheet.dart b/lib/pages/sub_categories_modalsheet.dart index d6499c8e..ed2403db 100644 --- a/lib/pages/sub_categories_modalsheet.dart +++ b/lib/pages/sub_categories_modalsheet.dart @@ -40,11 +40,13 @@ class _SubCategoriseModalsheetState extends State { builder: (_, model, wi) => AppScaffold( // appBarTitle: titleName, appBarTitle: TranslationBase.of(context).categorise, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, isPharmacy: true, backgroundColor: Colors.white, isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, baseViewModel: model, body: Container( color: Colors.white, @@ -77,7 +79,11 @@ class _SubCategoriseModalsheetState extends State { context, FadePage( page: SubCategorisePage( - title: model.categoriseParent[index].name, + title: projectViewModel + .isArabic + ? model.categoriseParent[index].namen + : model.categoriseParent[index].name, + // title: model.categoriseParent[index].name, id: model.categoriseParent[index].id, parentId: id, )), diff --git a/lib/pages/sub_categorise_page.dart b/lib/pages/sub_categorise_page.dart index b7c5d244..1856aedb 100644 --- a/lib/pages/sub_categorise_page.dart +++ b/lib/pages/sub_categorise_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; @@ -13,11 +14,13 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:rating_bar/rating_bar.dart'; import 'base/base_view.dart'; @@ -55,6 +58,10 @@ class _SubCategorisePageState extends State { color: Colors.blue, size: 29.0, ); + + int pageIndex = 1; + + RefreshController controller = RefreshController(); List entityList = List(); List entityListBrands = List(); @@ -65,19 +72,40 @@ class _SubCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getSubCategorise(i: id), + onModelReady: (model) => model.getSubCategorise( + i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => - PharmacyAppScaffold( + AppScaffold( + isPharmacy: true, appBarTitle: title, - isBottomBar: false, + isBottomBar: true, isShowAppBar: true, backgroundColor: Colors.white, isShowDecPage: false, - //baseViewModel: model, - body: NetworkBaseView( - baseViewModel: model, + showPharmacyCart: false, + showHomeAppBarIcon: false, + baseViewModel: model, + body: SmartRefresher( + controller: controller, + enablePullDown: false, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getSubProducts( + pageIndex: pageIndex, + i: id, + isLoading: true, + context: context); + if (model.state != ViewState.BusyLocal && pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, child: SingleChildScrollView( child: Container( child: Column( @@ -619,16 +647,20 @@ class _SubCategorisePageState extends State { context); await model.getFilteredSubProducts( - min: minField - .text - .toString(), - max: maxField - .text - .toString(), + min: minField.text.isEmpty + ? "" + : minField.text + .toString(), + max: maxField.text.isEmpty + ? "" + : maxField.text + .toString(), categoryId: categoriesId, - brandId: - brandIds); + brandId: brandIds.isEmpty + ? "" + : "&manufacturerids=" + + brandIds); GifLoaderDialogUtils .hideDialog( context); @@ -1191,8 +1223,7 @@ class _SubCategorisePageState extends State { if (model .subProducts[ index] - .rxMessage == - null) { + .isRx == false) { GifLoaderDialogUtils .showMyDialog( context); diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 1030c709..52096746 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -76,38 +76,20 @@ class _MyVaccinesState extends State { bottomSheet: Container( color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).availability, - () { - // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + builder: (cxt) => ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); }, - color: Color(0xffEAEAEA), - textColor: Color(0xff000000), ), - ), - SizedBox(width: 8), - Expanded( - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, - onTapSendEmail: () { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ); - }, - ), - ), - ], - ), + ); + }, + ) ), ), ); diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart index 4c8ac4f5..c85fba95 100644 --- a/lib/pages/webRTC/call_page.dart +++ b/lib/pages/webRTC/call_page.dart @@ -1,5 +1,10 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; +import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart'; @@ -20,10 +25,12 @@ class _CallPageState extends State { _localRenderer.initialize(); _remoteRenderer.initialize(); - signaling.onAddRemoteStream = ((stream) { - _remoteRenderer.srcObject = stream; - setState(() {}); - }); + // signaling.onRemoteStream = ((stream) { + // _remoteRenderer.srcObject = stream; + // setState(() {}); + // }); + + fcmConfigure(); super.initState(); } @@ -35,24 +42,12 @@ class _CallPageState extends State { super.dispose(); } - void _getUserMedia() async { - final Map constraints = { - 'audio': 'false', - 'video': {'facingMode': 'user'}, - }; - - MediaStream stream = await navigator.mediaDevices.getUserMedia(constraints); - setState(() { - _localRenderer.srcObject = stream; - }); - } - - void initializeRenderers() async { - _localRenderer.initialize(); - } - @override Widget build(BuildContext context) { + FirebaseMessaging.instance.getToken().then((value) { + print('FCM_TOKEN: $value'); + }); + return AppScaffold( isShowAppBar: true, showNewAppBar: true, @@ -64,37 +59,14 @@ class _CallPageState extends State { SizedBox(height: 8), Wrap( children: [ - ElevatedButton( - onPressed: () { - setState(() { - signaling.openUserMedia(_localRenderer, _remoteRenderer); - }); - }, - child: Text("Open camera & microphone"), - ), - SizedBox( - width: 8, - ), - ElevatedButton( - onPressed: () async { - roomId = await signaling.createRoom(_remoteRenderer); - textEditingController.text = roomId; - setState(() {}); - }, - child: Text("Create room"), - ), SizedBox( width: 8, ), ElevatedButton( onPressed: () { - // Add roomId - signaling.joinRoom( - textEditingController.text, - _remoteRenderer, - ); + dummyCall(); }, - child: Text("Join room"), + child: Text("Call"), ), SizedBox( width: 8, @@ -144,4 +116,49 @@ class _CallPageState extends State { ), ); } + + dummyCall() async { + final json = { + "callerID": "12345", + "receiverID": "54321", + "msgID": "123", + "notfID": "123", + "notification_foreground": "true", + "count": "1", + "message": "Doctor is calling ", + "AppointmentNo": "123", + "title": "Rayyan Hospital", + "ProjectID": "123", + "NotificationType": "10", + "background": "1", + "doctorname": "Dr Sulaiman Al Habib", + "clinicname": "ENT Clinic", + "speciality": "Speciality", + "appointmentdate": "Sun, 15th Dec, 2019", + "appointmenttime": "09:00", + "type": "video", + "session_id": + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", + "identity": "Haroon1", + "name": "SmallDailyStandup", + "videoUrl": "video", + "picture": "video", + "is_call": "true" + }; + + IncomingCallData incomingCallData = IncomingCallData.fromJson(json); + final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); + } + + fcmConfigure() { + FirebaseMessaging.onMessage.listen((RemoteMessage message) async { + print(message.toString()); + + IncomingCallData incomingCallData; + if (Platform.isAndroid) + incomingCallData = IncomingCallData.fromJson(message.data['data']); + else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data); + if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); + }); + } } diff --git a/lib/pages/webRTC/call_page_bkp.dart b/lib/pages/webRTC/call_page_bkp.dart new file mode 100644 index 00000000..4a31feae --- /dev/null +++ b/lib/pages/webRTC/call_page_bkp.dart @@ -0,0 +1,147 @@ +// import 'package:diplomaticquarterapp/pages/webRTC/signaling_bkp.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// class CallPage extends StatefulWidget { +// @override +// _CallPageState createState() => _CallPageState(); +// } +// +// class _CallPageState extends State { +// Signaling signaling = Signaling(); +// RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// String roomId; +// TextEditingController textEditingController = TextEditingController(text: ''); +// +// @override +// void initState() { +// _localRenderer.initialize(); +// _remoteRenderer.initialize(); +// +// signaling.onAddRemoteStream = ((stream) { +// _remoteRenderer.srcObject = stream; +// setState(() {}); +// }); +// +// super.initState(); +// } +// +// @override +// void dispose() { +// _localRenderer.dispose(); +// _remoteRenderer.dispose(); +// super.dispose(); +// } +// +// void _getUserMedia() async { +// final Map constraints = { +// 'audio': 'false', +// 'video': {'facingMode': 'user'}, +// }; +// +// MediaStream stream = await navigator.mediaDevices.getUserMedia(constraints); +// setState(() { +// _localRenderer.srcObject = stream; +// }); +// } +// +// void initializeRenderers() async { +// _localRenderer.initialize(); +// } +// +// @override +// Widget build(BuildContext context) { +// return AppScaffold( +// isShowAppBar: true, +// showNewAppBar: true, +// showNewAppBarTitle: true, +// isShowDecPage: false, +// appBarTitle: "WebRTC Calling", +// body: Column( +// children: [ +// SizedBox(height: 8), +// Wrap( +// children: [ +// ElevatedButton( +// onPressed: () { +// setState(() { +// signaling.openUserMedia(_localRenderer, _remoteRenderer); +// }); +// }, +// child: Text("Open camera & microphone"), +// ), +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () async { +// roomId = await signaling.createRoom(_remoteRenderer); +// textEditingController.text = roomId; +// setState(() {}); +// }, +// child: Text("Create room"), +// ), +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// // Add roomId +// signaling.joinRoom( +// textEditingController.text, +// _remoteRenderer, +// ); +// }, +// child: Text("Join room"), +// ), +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// signaling.hangUp(_localRenderer); +// }, +// child: Text("Hangup"), +// ) +// ], +// ), +// SizedBox(height: 8), +// Expanded( +// child: Padding( +// padding: const EdgeInsets.all(0.0), +// child: Stack( +// children: [ +// Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), +// Positioned( +// top: 20.0, +// right: 100.0, +// left: 20.0, +// bottom: 300.0, +// child: RTCVideoView(_localRenderer, mirror: true), +// ), +// ], +// ), +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Text("Join the following Room: "), +// Flexible( +// child: TextFormField( +// controller: textEditingController, +// ), +// ) +// ], +// ), +// ), +// SizedBox(height: 8) +// ], +// ), +// ); +// } +// } diff --git a/lib/pages/webRTC/fcm/FCMSendNotification.dart b/lib/pages/webRTC/fcm/FCMSendNotification.dart new file mode 100644 index 00000000..f67537cf --- /dev/null +++ b/lib/pages/webRTC/fcm/FCMSendNotification.dart @@ -0,0 +1,86 @@ + +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:http/http.dart' as http; + +const _serverFCMToken = 'ya29.a0ARrdaM9U7fZtxF64ntg2Y1Nve-cd4rPazyGcWN69cQmOsddUqxAL1X8GUQ8V6sW2gWxM8ln1BIbmh0OrzQtCiTGrsmcL3jZlGXoQhZN51nX3O7F3g1AXCW_Zt_pjiworCJEGSRkl7QirxE7RFzlwBONsOuft'; +const doctorID = '12345'; + +class FCM{ + static Future sendCallNotifcationTo(String token, String patientID, String patientMobile) async{ + var headers = { + 'Authorization': 'Bearer $_serverFCMToken', + 'Content-Type': 'application/json' + }; + + final body = { + "message": { + "token": token, + "notification": { + "title": "Dr Sulaiman Al Habib", + "body": "Doctor is calling" + }, + "apns": { + "payload": { + "aps": { + "sound": "ring_30Sec.mp3", + "token": "466e0f16fecf1e32c51f812cccc84fcbc807f958b15eb55675a5fa971a775829", + "badge": 1 + } + }, + "headers": { + "apns-priority": "10", + "apns-expiration": "0", + "apns-collapse-id": "2561368006" + } + }, + "data": { + "callerID" : doctorID, + "receiverID" : patientID, + "receiverMobile" : patientMobile, + "msgID": "123", + "notfID": "123", + "notification_foreground": "true", + "count": "1", + "message": "Doctor is calling ", + "AppointmentNo": "123", + "title": "Rayyan Hospital", + "ProjectID": "123", + "NotificationType": "10", + "background": "1", + "doctorname": "Dr Sulaiman Al Habib", + "clinicname": "ENT Clinic", + "speciality": "Speciality", + "appointmentdate": "Sun, 15th Dec, 2019", + "appointmenttime": "09:00", + "type": "video", + "session_id": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", + "identity": "Haroon1", + "name": "SmallDailyStandup", + "videoUrl": "video", + "picture": "video", + "is_call": "true" + } + } + }; + + bool success = false; + await BaseAppClient().simplePost('https://fcm.googleapis.com/v1/projects/api-project-815750722565/messages:send', body: body, headers: headers, onSuccess: (data, statusCode){ + success = true; + }, onFailure: (error, statusCode){ + success = false; + }); + + return success; + // final response = await http.post('https://fcm.googleapis.com/v1/projects/api-project-815750722565/messages:send', headers:headers, body: body); + + + } +} + +String toB64(String data){ + var bytes = utf8.encode(data); + var base64Str = base64.encode(bytes); + return base64Str; +} \ No newline at end of file diff --git a/lib/pages/webRTC/signaling.dart b/lib/pages/webRTC/signaling.dart index f987e285..93c30f07 100644 --- a/lib/pages/webRTC/signaling.dart +++ b/lib/pages/webRTC/signaling.dart @@ -1,11 +1,45 @@ import 'dart:convert'; -import 'package:cloud_firestore/cloud_firestore.dart'; +// import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/fcm/FCMSendNotification.dart'; +import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart'; +import 'call_page.dart'; + typedef void StreamStateCallback(MediaStream stream); +typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); +typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); +typedef void RTCSignalingStateCallback(RTCSignalingState state); class Signaling { + + dispose(){ + if(peerConnection != null) + peerConnection.dispose(); + signalR.closeConnection(); + } + + init(){ + // Create Peer Connection + createPeerConnection(configuration).then((value){ + peerConnection = value; + registerPeerConnectionListeners(); + }); + } + + + initializeSignalR(String userName) async{ + if(signalR != null) + await signalR.closeConnection(); + // https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib + signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName"); + final connected = await signalR.openConnection(); + if(!connected) + throw 'Failed to connect SignalR'; + } + Map configuration = { 'iceServers': [ { @@ -14,229 +48,118 @@ class Signaling { ] }; + SignalRUtil signalR; + RTCPeerConnection peerConnection; MediaStream localStream; MediaStream remoteStream; - String roomId; - String currentRoomText; - StreamStateCallback onAddRemoteStream; - - Future createRoom(RTCVideoRenderer remoteRenderer) async { - FirebaseFirestore db = FirebaseFirestore.instance; - DocumentReference roomRef = db.collection('rooms').doc(); + RTCDataChannel dataChannel; - print('Create PeerConnection with configuration: $configuration'); + // Future call(String patientId, String mobile, {@required RTCVideoRenderer localVideo, @required RTCVideoRenderer remoteVideo}) async { + // await initializeSignalR(patientId); + // + // // final isCallPlaced = await FCM.sendCallNotifcationTo(DOCTOR_TOKEN, patientId, mobile); + // if(!isCallPlaced) + // throw 'Failed to notify target for call'; + // + // return isCallPlaced; + // } - peerConnection = await createPeerConnection(configuration); - registerPeerConnectionListeners(); + Future acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream}) async{ + await initializeSignalR(receiver); + signalR.setContributors(caller: caller, receiver: receiver); + await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); - localStream.getTracks().forEach((track) { - peerConnection?.addTrack(track, localStream); - }); + peerConnection.addStream(localMediaStream); - // Code for collecting ICE candidates below - var callerCandidatesCollection = roomRef.collection('callerCandidates'); - - peerConnection?.onIceCandidate = (RTCIceCandidate candidate) { - print('Got candidate: ${candidate.toMap()}'); - callerCandidatesCollection.add(candidate.toMap()); - }; - // Finish Code for collecting ICE candidate - - // Add code for creating a room - RTCSessionDescription offer = await peerConnection.createOffer(); - await peerConnection.setLocalDescription(offer); - print('Created offer: $offer'); - - Map roomWithOffer = {'offer': offer.toMap()}; - - await roomRef.set(roomWithOffer); - var roomId = roomRef.id; - print('New room created with SDK offer. Room ID: $roomId'); - currentRoomText = 'Current room is $roomId - You are the caller!'; - // Created a Room - - peerConnection?.onTrack = (RTCTrackEvent event) { - print('Got remote track: ${event.streams[0]}'); - - event.streams[0].getTracks().forEach((track) { - print('Add a track to the remoteStream $track'); - remoteStream?.addTrack(track); - }); + peerConnection?.onAddStream = (MediaStream stream) { + remoteStream = stream; + onRemoteMediaStream?.call(stream); }; - // Listening for remote session description below - roomRef.snapshots().listen((snapshot) async { - print('Got updated room: ${snapshot.data()}'); - - Map data = snapshot.data() as Map; - if (peerConnection?.getRemoteDescription() != null && data['answer'] != null) { - var answer = RTCSessionDescription( - data['answer']['sdp'], - data['answer']['type'], - ); - - print("Someone tried to connect"); - await peerConnection?.setRemoteDescription(answer); - } - }); - // Listening for remote session description above - - // Listen for remote Ice candidates below - roomRef.collection('calleeCandidates').snapshots().listen((snapshot) { - snapshot.docChanges.forEach((change) { - if (change.type == DocumentChangeType.added) { - Map data = change.doc.data() as Map; - print('Got new remote ICE candidate: ${jsonEncode(data)}'); - peerConnection.addCandidate( - RTCIceCandidate( - data['candidate'], - data['sdpMid'], - data['sdpMLineIndex'], - ), - ); - } - }); - }); - // Listen for remote ICE candidates above - - return roomId; + return true; } - Future joinRoom(String roomId, RTCVideoRenderer remoteVideo) async { - FirebaseFirestore db = FirebaseFirestore.instance; - DocumentReference roomRef = db.collection('rooms').doc('$roomId'); - var roomSnapshot = await roomRef.get(); - print('Got room ${roomSnapshot.exists}'); - - if (roomSnapshot.exists) { - print('Create PeerConnection with configuration: $configuration'); - peerConnection = await createPeerConnection(configuration); - - registerPeerConnectionListeners(); - - localStream.getTracks().forEach((track) { - peerConnection?.addTrack(track, localStream); - }); - - // Code for collecting ICE candidates below - var calleeCandidatesCollection = roomRef.collection('calleeCandidates'); - peerConnection.onIceCandidate = (RTCIceCandidate candidate) { - if (candidate == null) { - print('onIceCandidate: complete!'); - return; - } - print('onIceCandidate: ${candidate.toMap()}'); - calleeCandidatesCollection.add(candidate.toMap()); - }; - // Code for collecting ICE candidate above - - peerConnection?.onTrack = (RTCTrackEvent event) { - print('Got remote track: ${event.streams[0]}'); - event.streams[0].getTracks().forEach((track) { - print('Add a track to the remoteStream: $track'); - remoteStream?.addTrack(track); - }); - }; - - // Code for creating SDP answer below - var data = roomSnapshot.data() as Map; - print('Got offer $data'); - var offer = data['offer']; - await peerConnection?.setRemoteDescription( - RTCSessionDescription(offer['sdp'], offer['type']), - ); - var answer = await peerConnection.createAnswer(); - print('Created Answer $answer'); - - await peerConnection.setLocalDescription(answer); - - Map roomWithAnswer = { - 'answer': {'type': answer.type, 'sdp': answer.sdp} - }; - - await roomRef.update(roomWithAnswer); - // Finished creating SDP answer - - // Listening for remote ICE candidates below - // roomRef.collection('callerCandidates').snapshots().listen((snapshot) { - // snapshot.docChanges.forEach((document) { - // var data = document.doc.data() as Map; - // print(data); - // print('Got new remote ICE candidate: $data'); - // peerConnection.addCandidate( - // RTCIceCandidate( - // data['candidate'], - // data['sdpMid'], - // data['sdpMLineIndex'], - // ), - // ); - // }); - // }); - } + Future hangupCall(String caller, String receiver) async{ + await signalR.hangupCall(caller, receiver); + dispose(); } - Future openUserMedia( - RTCVideoRenderer localVideo, - RTCVideoRenderer remoteVideo, - ) async { - var stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': false}); - - localVideo.srcObject = stream; - localStream = stream; + answerOffer(String sdp) async{ + final offer = jsonDecode(sdp); + final caller = offer['caller']; + final receiver = offer['target']; + final offerSdp = offer['sdp']; + peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)) + .then((value) { + return peerConnection.createAnswer(); + }) + .then((anwser) { + return peerConnection.setLocalDescription(anwser); + }) + .then((value) { + return peerConnection.getLocalDescription(); + }) + .then((answer) { + return signalR.answerOffer(answer, caller, receiver); + }); - remoteVideo.srcObject = await createLocalMediaStream('key'); } Future hangUp(RTCVideoRenderer localVideo) async { - List tracks = localVideo.srcObject.getTracks(); - tracks.forEach((track) { - track.stop(); - }); - if (remoteStream != null) { - remoteStream.getTracks().forEach((track) => track.stop()); - } - if (peerConnection != null) peerConnection.close(); + } - if (roomId != null) { - var db = FirebaseFirestore.instance; - var roomRef = db.collection('rooms').doc(roomId); - var calleeCandidates = await roomRef.collection('calleeCandidates').get(); - calleeCandidates.docs.forEach((document) => document.reference.delete()); + Future createSdpAnswer(String toOfferSdp) async { + final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); + peerConnection.setRemoteDescription(offerSdp); - var callerCandidates = await roomRef.collection('callerCandidates').get(); - callerCandidates.docs.forEach((document) => document.reference.delete()); + final answer = await peerConnection.createAnswer(); + var answerSdp = json.encode(answer); // Send SDP via Push or any channel + return answerSdp; + } - await roomRef.delete(); - } + Future createSdpOffer() async { + final offer = await peerConnection.createOffer(); + await peerConnection.setLocalDescription(offer); + final map = offer.toMap(); + var offerSdp = json.encode(map); // Send SDP via Push or any channel + return offerSdp; + } - localStream.dispose(); - remoteStream?.dispose(); + addCandidate(String candidateJson){ + peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)); } void registerPeerConnectionListeners() { + peerConnection.onIceCandidate = (RTCIceCandidate candidate){ + print(json.encode(candidate.toMap())); + signalR.addIceCandidate(json.encode(candidate.toMap())); + }; + peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { print('ICE gathering state changed: $state'); }; peerConnection?.onConnectionState = (RTCPeerConnectionState state) { - print('Connection state change: $state'); + print('Connection state change: $state ${state.index}'); }; peerConnection?.onSignalingState = (RTCSignalingState state) { print('Signaling state change: $state'); }; + } +} - peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { - print('ICE connection state change: $state'); - }; - peerConnection?.onAddStream = (MediaStream stream) { - print("Add remote stream"); - onAddRemoteStream?.call(stream); - remoteStream = stream; - }; - } +rtcSessionDescriptionFrom(Map sdp){ + return RTCSessionDescription( + sdp['sdp'],sdp['type'], + ); +} + +rtcIceCandidateFrom(String json){ + final map = jsonDecode(json)['candidate']; + return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); } diff --git a/lib/pages/webRTC/signaling_bkp.dart b/lib/pages/webRTC/signaling_bkp.dart new file mode 100644 index 00000000..14319df3 --- /dev/null +++ b/lib/pages/webRTC/signaling_bkp.dart @@ -0,0 +1,242 @@ +import 'dart:convert'; + +// import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +typedef void StreamStateCallback(MediaStream stream); + +class Signaling { + Map configuration = { + 'iceServers': [ + { + 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] + } + ] + }; + + RTCPeerConnection peerConnection; + MediaStream localStream; + MediaStream remoteStream; + String roomId; + String currentRoomText; + StreamStateCallback onAddRemoteStream; + + Future createRoom(RTCVideoRenderer remoteRenderer) async { + // FirebaseFirestore db = FirebaseFirestore.instance; + // DocumentReference roomRef = db.collection('rooms').doc(); + + print('Create PeerConnection with configuration: $configuration'); + + peerConnection = await createPeerConnection(configuration); + + registerPeerConnectionListeners(); + + localStream.getTracks().forEach((track) { + peerConnection?.addTrack(track, localStream); + }); + + // Code for collecting ICE candidates below + // var callerCandidatesCollection = roomRef.collection('callerCandidates'); + + peerConnection?.onIceCandidate = (RTCIceCandidate candidate) { + print('Got candidate: ${candidate.toMap()}'); + // callerCandidatesCollection.add(candidate.toMap()); + }; + // Finish Code for collecting ICE candidate + + // Add code for creating a room + RTCSessionDescription offer = await peerConnection.createOffer(); + await peerConnection.setLocalDescription(offer); + print('Created offer: $offer'); + + Map roomWithOffer = {'offer': offer.toMap()}; + + // await roomRef.set(roomWithOffer); + // var roomId = roomRef.id; + print('New room created with SDK offer. Room ID: $roomId'); + currentRoomText = 'Current room is $roomId - You are the caller!'; + // Created a Room + + peerConnection?.onTrack = (RTCTrackEvent event) { + print('Got remote track: ${event.streams[0]}'); + + event.streams[0].getTracks().forEach((track) { + print('Add a track to the remoteStream $track'); + remoteStream?.addTrack(track); + }); + }; + + // Listening for remote session description below + // roomRef.snapshots().listen((snapshot) async { + // print('Got updated room: ${snapshot.data()}'); + // + // Map data = snapshot.data() as Map; + // if (peerConnection?.getRemoteDescription() != null && data['answer'] != null) { + // var answer = RTCSessionDescription( + // data['answer']['sdp'], + // data['answer']['type'], + // ); + // + // print("Someone tried to connect"); + // await peerConnection?.setRemoteDescription(answer); + // } + // }); + // // Listening for remote session description above + // + // // Listen for remote Ice candidates below + // roomRef.collection('calleeCandidates').snapshots().listen((snapshot) { + // snapshot.docChanges.forEach((change) { + // if (change.type == DocumentChangeType.added) { + // Map data = change.doc.data() as Map; + // print('Got new remote ICE candidate: ${jsonEncode(data)}'); + // peerConnection.addCandidate( + // RTCIceCandidate( + // data['candidate'], + // data['sdpMid'], + // data['sdpMLineIndex'], + // ), + // ); + // } + // }); + // }); + // Listen for remote ICE candidates above + + return roomId; + } + + Future joinRoom(String roomId, RTCVideoRenderer remoteVideo) async { + // FirebaseFirestore db = FirebaseFirestore.instance; + // DocumentReference roomRef = db.collection('rooms').doc('$roomId'); + // var roomSnapshot = await roomRef.get(); + // print('Got room ${roomSnapshot.exists}'); + + // if (roomSnapshot.exists) { + // print('Create PeerConnection with configuration: $configuration'); + // peerConnection = await createPeerConnection(configuration); + // + // registerPeerConnectionListeners(); + // + // localStream.getTracks().forEach((track) { + // peerConnection?.addTrack(track, localStream); + // }); + // + // // Code for collecting ICE candidates below + // // var calleeCandidatesCollection = roomRef.collection('calleeCandidates'); + // peerConnection.onIceCandidate = (RTCIceCandidate candidate) { + // if (candidate == null) { + // print('onIceCandidate: complete!'); + // return; + // } + // print('onIceCandidate: ${candidate.toMap()}'); + // // calleeCandidatesCollection.add(candidate.toMap()); + // }; + // // Code for collecting ICE candidate above + // + // peerConnection?.onTrack = (RTCTrackEvent event) { + // print('Got remote track: ${event.streams[0]}'); + // event.streams[0].getTracks().forEach((track) { + // print('Add a track to the remoteStream: $track'); + // remoteStream?.addTrack(track); + // }); + // }; + // + // // Code for creating SDP answer below + // var data = roomSnapshot.data() as Map; + // print('Got offer $data'); + // var offer = data['offer']; + // await peerConnection?.setRemoteDescription( + // RTCSessionDescription(offer['sdp'], offer['type']), + // ); + // var answer = await peerConnection.createAnswer(); + // print('Created Answer $answer'); + // + // await peerConnection.setLocalDescription(answer); + // + // Map roomWithAnswer = { + // 'answer': {'type': answer.type, 'sdp': answer.sdp} + // }; + // + // await roomRef.update(roomWithAnswer); + // // Finished creating SDP answer + // + // // Listening for remote ICE candidates below + // // roomRef.collection('callerCandidates').snapshots().listen((snapshot) { + // // snapshot.docChanges.forEach((document) { + // // var data = document.doc.data() as Map; + // // print(data); + // // print('Got new remote ICE candidate: $data'); + // // peerConnection.addCandidate( + // // RTCIceCandidate( + // // data['candidate'], + // // data['sdpMid'], + // // data['sdpMLineIndex'], + // // ), + // // ); + // // }); + // // }); + // } + } + + Future openUserMedia( + RTCVideoRenderer localVideo, + RTCVideoRenderer remoteVideo, + ) async { + var stream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': false}); + + localVideo.srcObject = stream; + localStream = stream; + + remoteVideo.srcObject = await createLocalMediaStream('key'); + } + + Future hangUp(RTCVideoRenderer localVideo) async { + List tracks = localVideo.srcObject.getTracks(); + tracks.forEach((track) { + track.stop(); + }); + + if (remoteStream != null) { + remoteStream.getTracks().forEach((track) => track.stop()); + } + if (peerConnection != null) peerConnection.close(); + + if (roomId != null) { + // var db = FirebaseFirestore.instance; + // var roomRef = db.collection('rooms').doc(roomId); + // var calleeCandidates = await roomRef.collection('calleeCandidates').get(); + // calleeCandidates.docs.forEach((document) => document.reference.delete()); + + // var callerCandidates = await roomRef.collection('callerCandidates').get(); + // callerCandidates.docs.forEach((document) => document.reference.delete()); + + // await roomRef.delete(); + } + + localStream.dispose(); + remoteStream?.dispose(); + } + + void registerPeerConnectionListeners() { + peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { + print('ICE gathering state changed: $state'); + }; + + peerConnection?.onConnectionState = (RTCPeerConnectionState state) { + print('Connection state change: $state'); + }; + + peerConnection?.onSignalingState = (RTCSignalingState state) { + print('Signaling state change: $state'); + }; + + peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { + print('ICE connection state change: $state'); + }; + + peerConnection?.onAddStream = (MediaStream stream) { + print("Add remote stream"); + onAddRemoteStream?.call(stream); + remoteStream = stream; + }; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index 72599bb2..ab92ee53 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/TestPage.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/forgot-password.dart'; @@ -21,6 +22,8 @@ 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/pages/webRTC/call_page.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/call_page_bkp.dart'; import 'package:diplomaticquarterapp/splashPage.dart'; const String INIT_ROUTE = '/'; @@ -48,6 +51,8 @@ const String PACKAGES_ORDER_COMPLETED = 'packages-offers-cart'; const String TEST_PAGE = 'test-page'; const String OPENTOK_CALL_PAGE = 'OPENTOK_CALL_PAGE'; const String CART_ORDER_PAGE = 'cart-order-page'; +const String CALL_PAGE = 'CALL_PAGE'; +const String INCOMING_CALL_PAGE = 'INCOMING_CALL_PAGE'; const String HEALTH_WEATHER = 'health-weather'; const APP_UPDATE = 'app-update'; @@ -76,6 +81,8 @@ var routes = { APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), CART_ORDER_PAGE: (_) => CartOrderPage(), + CALL_PAGE: (_) => CallPage(), + INCOMING_CALL_PAGE: (_) => IncomingCall(), OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( apiKey: '46209962', sessionId: '1_MX40NjIwOTk2Mn5-MTYzNDY0ODM3NDY2Nn5PcnpnNGM0R1Q3ODZ6UXlFQ01lMDF5YWJ-fg', diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index a897955a..3b03dabc 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -20,9 +20,10 @@ class OrderDetailsService extends BaseService{ List get orderList => _orderList; - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId, + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$orderGUID", onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index b5632076..ed2391d8 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -5,40 +5,38 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - -class OrderService extends BaseService{ +class OrderService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); AppGlobal appGlobal = new AppGlobal(); AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); List _orderList = List(); + List get orderList => _orderList; - String url =""; + String url = ""; - Future getOrder(customerId, pageId) async { + Future getOrder(customerId, customerGUID, pageId) async { hasError = false; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; - // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; - url =GET_ORDER+"customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId"; + // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; + url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund,order_guid&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; print(url); - await baseAppClient.getPharmacy(url, - onSuccess: (dynamic response, int statusCode) { - _orderList.clear(); + await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { + _orderList.clear(); - response['orders'].forEach((item) { - _orderList.add(Orders.fromJson(item)); - }); - print(_orderList.length); - print(response); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + response['orders'].forEach((item) { + _orderList.add(Orders.fromJson(item)); + }); + print(_orderList.length); + print(response); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - // Future getProductReview(orderId) async { // print("step 1"); // hasError = false; @@ -59,7 +57,6 @@ class OrderService extends BaseService{ // }); // } - // Future getOrder(BuildContext context ) async { // // if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -80,4 +77,4 @@ class OrderService extends BaseService{ // }); // return Future.value(localRes); // } -} \ No newline at end of file +} diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 40d906f3..5329c658 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -15,13 +15,14 @@ class PharmacyAddressService extends BaseService { Future> getAddresses() async { var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); Map queryParams = {'fields': 'addresses'}; hasError = false; Addresses selectedAddress; try { var completer = Completer(); - await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId", onSuccess: (dynamic response, int statusCode) async { + await baseAppClient.getPharmacy("$GET_CUSTOMERS_ADDRESSES$customerId/$customerGUID", onSuccess: (dynamic response, int statusCode) async { addresses.clear(); var savedAddress = await sharedPref.getObject(PHARMACY_SELECTED_ADDRESS); if (savedAddress != null) { @@ -71,7 +72,10 @@ class PharmacyAddressService extends BaseService { } Future addCustomerAddress(AddressInfo address) async { - makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + await makeCustomerAddress(address, ADD_CUSTOMER_ADDRESS); + // if(!hasError) { + selectedAddressIndex = addresses.length +1; + // } } Future editCustomerAddress(AddressInfo address) async { diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e3e0fb7f..d326c130 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -58,8 +58,8 @@ class ProductDetailService extends BaseService { _stockAvailability = response['products'][0]['stock_availability']; _stockAvailabilityn = response['products'][0]['stock_availabilityn']; - // _isStockAvailable = response['products'][0]['IsStockAvailable']; - _isStockAvailable = _stockAvailability == "In stock" ? true : false; + _isStockAvailable = response['products'][0]['IsStockAvailable']; + // _isStockAvailable = _stockAvailability == "In stock" ? true : false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -123,10 +123,11 @@ class ProductDetailService extends BaseService { return Future.value(localRes); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID) async { hasError = false; await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg + AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).notifyMeMsg + // TranslationBase.of(context).notifyMeMsg //'You will be notified when product available' ); }, onFailure: (String error, int statusCode) { diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index ce55a40b..ab347307 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - class WishListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; // Future getWishlist() async { @@ -52,18 +52,17 @@ class WishListService extends BaseService { Future getWishlist() async { //TODO we need to check why the customer id comes null - String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0"; + String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID) ?? "0"; + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2", - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_WISHLIST + customerId + "/$customerGUID/" + "?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index f1c6442f..3d31e84b 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -10,15 +10,17 @@ final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterL class LocalNotification { Function(String payload) _onNotificationClick; static LocalNotification _instance; - static LocalNotification getInstance(){ + + static LocalNotification getInstance() { return _instance; } - static init({Function(String payload) onNotificationClick}){ - if(_instance == null){ + + static init({Function(String payload) onNotificationClick}) { + if (_instance == null) { _instance = LocalNotification(); _instance._onNotificationClick = onNotificationClick; _instance._initialize(); - }else{ + } else { // assert(false,(){ // //TODO fix it // "LocalNotification Already Initialized"; @@ -26,19 +28,20 @@ class LocalNotification { } } - _initialize(){ + _initialize() { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); - var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS); + var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); flutterLocalNotificationsPlugin.initialize(initializationSettings, onSelectNotification: _onNotificationClick); } var _random = new Random(); - _randomNumber({int from = 100000}){ + + _randomNumber({int from = 100000}) { return _random.nextInt(from); } - _vibrationPattern(){ + _vibrationPattern() { var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; vibrationPattern[1] = 1000; @@ -50,10 +53,11 @@ class LocalNotification { Future showNow({@required String title, @required String subtitle, String payload}) { Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', + channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){ + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { print(err); }); }); @@ -67,7 +71,8 @@ class LocalNotification { vibrationPattern[2] = 5000; vibrationPattern[3] = 2000; - var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', 'ActivePrescriptionsDescription', + var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + channelDescription: 'ActivePrescriptionsDescription', // icon: 'secondary_icon', sound: RawResourceAndroidNotificationSound('slow_spring_board'), @@ -81,17 +86,15 @@ class LocalNotification { ledOffMs: 500); var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - ///change it to be as ionic - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule(0, title, description, - // scheduledNotificationDateTime, platformChannelSpecifics); + // /change it to be as ionic + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am Future showDailyAtTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', 'repeatDailyAtTime description'); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); @@ -106,7 +109,7 @@ class LocalNotification { ///Repeat notification weekly on Monday at approximately 10:00:00 am Future showWeeklyAtDayAndTime() async { var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', 'show weekly description'); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); // var platformChannelSpecifics = NotificationDetails( // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); diff --git a/lib/uitl/PlatformBridge.dart b/lib/uitl/PlatformBridge.dart index 56020781..45970e5e 100644 --- a/lib/uitl/PlatformBridge.dart +++ b/lib/uitl/PlatformBridge.dart @@ -1,4 +1,3 @@ - import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/localized_values.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; @@ -89,6 +88,9 @@ class PlatformBridge { static const show_loading_method = "loading"; static const register_Hmg_Geofences = "registerHmgGeofences"; static const un_register_Hmg_Geofences = "unRegisterHmgGeofences"; + static const IS_DRAW_OVER_APPS_PERMISSION_ALLOWED = "isDrawOverAppsPermissionAllowed"; + static const ASK_DRAW_OVER_APPS_PERMISSION = "askDrawOverAppsPermission"; + static const GET_INTENT = "getIntent"; Future connectHMGInternetWifi(String patientId) { try { @@ -142,4 +144,19 @@ class PlatformBridge { void unRegisterHmgGeofences() async { var result = await platform.invokeMethod(un_register_Hmg_Geofences); } + + Future isDrawOverAppsPermissionAllowed() async { + var result = await platform.invokeMethod(IS_DRAW_OVER_APPS_PERMISSION_ALLOWED); + return result as bool; + } + + Future askDrawOverAppsPermission() async { + var result = await platform.invokeMethod(ASK_DRAW_OVER_APPS_PERMISSION); + return result as bool; + } + + Future getIntentData() async { + var result = await platform.invokeMethod(GET_INTENT); + return result as bool; + } } diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index a1a411e0..d9a73a14 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -1,36 +1,57 @@ +import 'dart:convert'; import 'dart:io'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:http/io_client.dart'; import 'package:signalr_core/signalr_core.dart'; class SignalRUtil { String hubName; - BuildContext context; - SignalRUtil({@required this.hubName, @required this.context}); + String sourceUser; + String destinationUser; + setContributors({@required String caller, @required String receiver}){ + this.sourceUser = caller; + this.destinationUser = receiver; + } + + Function(bool) onConnected; + SignalRUtil({@required this.hubName}); + - HubConnection connectionBuilder; + HubConnection connectionHub; - void startSignalRConnection() async { - connectionBuilder = HubConnectionBuilder() + closeConnection() async{ + if(connectionHub != null) { + connectionHub.off('OnIncomingCallAsync'); + connectionHub.off('OnCallDeclinedAsync'); + connectionHub.off('OnCallAcceptedAsync'); + connectionHub.off('nHangUpAsync'); + connectionHub.off('OnIceCandidateAsync'); + connectionHub.off('OnOfferAsync'); + await connectionHub.stop(); + } + } + + Future openConnection() async { + connectionHub = HubConnectionBuilder() .withUrl( - hubName, - HttpConnectionOptions( - client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), - logging: (level, message) => print(message), - )) - .build(); + hubName, + HttpConnectionOptions( + logMessageContent: true, + client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), + logging: (level, message) => print(message), + )).build(); - await connectionBuilder.start(); + await connectionHub.start(); + await Future.delayed(Duration(seconds: 1)); - connectionBuilder.on('ReceiveMessage', (message) { + connectionHub.on('ReceiveMessage', (message) { handleIncomingMessage(message); }); - } - void closeSignalRConnection() { - connectionBuilder.stop(); + return getConnectionState(); } void handleIncomingMessage(List message) { @@ -38,11 +59,115 @@ class SignalRUtil { } void sendMessage(List args) async { - await connectionBuilder.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] + await connectionHub.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] + } + + listen({Function(CallUser) onAcceptCall, Function(CallUser) onHangupCall, Function(String, CallUser) onDeclineCall, Function(String, CallUser) onOffer, Function(String) onCandidate}){ + + connectionHub.on('OnIncomingCallAsync', (arguments) { + print('OnIncomingCallAsync: ${arguments.toString()}'); + }); + + connectionHub.on('OnCallDeclinedAsync', (arguments) { + print('OnCallDeclinedAsync: ${arguments.toString()}'); + onDeclineCall(arguments.first, CallUser.from(arguments.last)); + }); + + connectionHub.on('OnCallAcceptedAsync', (arguments) { + print('OnCallAcceptedAsync: ${arguments.toString()}'); + }); + + connectionHub.on('OnHangUpAsync', (arguments) { + print('nHangUpAsync: ${arguments.toString()}'); + onHangupCall(CallUser.from(arguments.first)); + }); + + connectionHub.on('OnIceCandidateAsync', (arguments) { + print('OnIceCandidateAsync: ${arguments.toString()}'); + onCandidate(arguments.first); + }); + + connectionHub.on('OnOfferAsync', (arguments) { + print('OnOfferAsync: ${arguments.toString()}'); + onOffer(arguments.first, CallUser.from(arguments.last)); + }); + } + // CallUserAsync(string currentUserId, string targerUserId) + Future callUser(String from, to) async{ + return await connectionHub.invoke('CallUserAsync', args: [from, to]); + } + + // CallDeclinedAsync(string currentUserId, string targerUserId) + Future declineCall(String from, to) async{ + return await connectionHub.invoke('CallDeclinedAsync', args: [from, to]); + } + + // AnswerCallAsync(string currentUserId, string targetUserId) + Future answerCall(String from, to) async{ + return await connectionHub.invoke('AnswerCallAsync', args: [from, to]); + } + + // IceCandidateAsync(string targetUserId, string candidate) + Future addIceCandidate(String candidate) async{ + final target = destinationUser; + return await connectionHub.invoke('IceCandidateAsync', args: [target, candidate]); + } + + // OfferAsync(string targetUserId,string currentUserId, string targetOffer) + Future offer(String from, to, offer) async{ + return await connectionHub.invoke('OfferAsync', args: [from, to, offer]); + } + + // AnswerOfferAsync(string targetUserId, string CallerOffer) + Future answerOffer(RTCSessionDescription answerSdp, caller, receiver) async{ + final payload = { + 'target': receiver, + 'caller': caller, + 'sdp': answerSdp.toMap(), + }; + return await connectionHub.invoke('AnswerOfferAsync', args: [caller, jsonEncode(payload)]); + } + + // HangUpAsync(string currentUserId, string targetUserId) + Future hangupCall(String from, to) async{ + return await connectionHub.invoke('HangUpAsync', args: [from, to]); + } + + // CallAccepted(string currentUserId,string targetUserId) + Future acceptCall(String from, to) async{ + // return await connectionHub.send(methodName: 'CallAccepted', args: [from, to]); + return await connectionHub.invoke("CallAccepted", args: [ from, to]); + } + + bool getConnectionState() { - if (connectionBuilder.state == HubConnectionState.connected || connectionBuilder.state == HubConnectionState.connecting) return true; - if (connectionBuilder.state == HubConnectionState.disconnected || connectionBuilder.state == HubConnectionState.disconnecting) return false; + if (connectionHub.state == HubConnectionState.connected) return true; + if (connectionHub.state == HubConnectionState.disconnected) return false; + return false; } } + + +class CallUser{ + String Id; + String UserName; + String Email; + String Phone; + String Title; + dynamic UserStatus; + String Image; + int UnreadMessageCount = 0; + + CallUser.from(Map map){ + Id = map['Id']; + UserName = map['UserName']; + Email = map['Email']; + Phone = map['Phone']; + Title = map['Title']; + UserStatus = map['UserStatus']; + Image = map['Image']; + UnreadMessageCount = map['UnreadMessageCount']; + } +} \ No newline at end of file diff --git a/lib/uitl/app-permissions.dart b/lib/uitl/app-permissions.dart new file mode 100644 index 00000000..c7049d6a --- /dev/null +++ b/lib/uitl/app-permissions.dart @@ -0,0 +1,37 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:permission_handler/permission_handler.dart'; + +import 'PlatformBridge.dart'; + +class AppPermission{ + + + static Future askVideoCallPermission(BuildContext context) async { + if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { + return false; + } + if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { + await _drawOverAppsMessageDialog(context); + return false; + } + return true; + } + + static Future _drawOverAppsMessageDialog(BuildContext context) async { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: "Please select 'Dr. Alh'abib' from the list and allow draw over app permission to use live care.", + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + await PlatformBridge.shared().askDrawOverAppsPermission(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } +} \ No newline at end of file diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 3ea323df..f90a2f98 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -79,7 +79,7 @@ class AppSharedPreferences { } /// Get Object [key] the key was saved - getObject(String key) async { + Future getObject(String key) async { final SharedPreferences prefs = await _prefs; var string = prefs.getString(key); if (string == null) { diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 16aaba3b..30864569 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -1,20 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; +import 'package:fluttertoast/fluttertoast.dart'; class AppToast { - /// show long toast message - /// [message] to show for user - /// [timeInSeconds] how many second the toast will appear to the user - /// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG - /// [toastGravity] the position of the toast in the screen - /// [backgroundColor] the background color of the toast - /// [textColor] the text color of the toast - /// [icon] the icon you want include in the toast - /// [radius] the radius of the toast - /// [elevation] an overlay color will be applied to indicate elevation. - /// [imageSize] image size inside the toast static void showToast({ @required String message, Toast toastLength, @@ -23,34 +12,14 @@ class AppToast { ToastGravity toastGravity, Color backgroundColor, Color textColor, - ICON icon, int radius, int elevation, int imageSize, }) { - FlutterFlexibleToast.showToast( - message: message, - toastLength: toastLength, - timeInSeconds: timeInSeconds, - fontSize: fontSize, - toastGravity: toastGravity, - backgroundColor: backgroundColor, - textColor: textColor, - icon: icon, - radius: radius, - elevation: elevation, - imageSize: imageSize); + Fluttertoast.showToast( + msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize); } - /// show Success toast message - /// [message] to show for user - /// [timeInSeconds] how many second the toast will appear to the user - /// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG - /// [toastGravity] the position of the toast in the screen - /// [textColor] the text color of the toast - /// [radius] the radius of the toast - /// [elevation] an overlay color will be applied to indicate elevation. - /// [imageSize] image size inside the toast static void showSuccessToast({ @required String message, Toast toastLength = Toast.LENGTH_LONG, @@ -62,29 +31,9 @@ class AppToast { int elevation, int imageSize = 32, }) { - FlutterFlexibleToast.showToast( - message: message, - toastLength: toastLength, - timeInSeconds: timeInSeconds = 2, - fontSize: fontSize, - toastGravity: toastGravity, - backgroundColor: Colors.green, - textColor: textColor, - icon: ICON.SUCCESS, - radius: radius, - elevation: elevation, - imageSize: imageSize); + Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); } - /// show Error toast message - /// [message] to show for user - /// [timeInSeconds] how many second the toast will appear to the user - /// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG - /// [toastGravity] the position of the toast in the screen - /// [textColor] the text color of the toast - /// [radius] the radius of the toast - /// [elevation] an overlay color will be applied to indicate elevation. - /// [imageSize] image size inside the toast static void showErrorToast({ @required String message, Toast toastLength = Toast.LENGTH_LONG, @@ -96,30 +45,15 @@ class AppToast { int elevation, int imageSize = 32, }) { - FlutterFlexibleToast.showToast( - message: message, - toastLength: toastLength, - timeInSeconds: timeInSeconds, - fontSize: fontSize, - toastGravity: toastGravity, - backgroundColor: Colors.red, - textColor: textColor, - icon: ICON.CLOSE, - radius: radius, - elevation: elevation, - imageSize: imageSize - ); - + Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize); } - /// cancel toast void cancelToast() { - FlutterFlexibleToast.cancel(); + Fluttertoast.cancel(); } void backWithEmpty() { - AppToast.showErrorToast( - message: TranslationBase.of(AppGlobal.context).empty); + AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).empty); Navigator.of(AppGlobal.context).pop(); } diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index a11b85e6..177b5127 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -131,6 +131,10 @@ class DateUtil { dateObj.year.toString(); } + static String getISODateFormat(DateTime dateTime){ // 2020-04-30T00:00:00.000 + return dateTime.toIso8601String(); + } + /// get month by /// [month] convert month number in to month name static getMonth(int month) { diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index 785a6c6c..eae84e38 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -4,13 +4,13 @@ import '../widgets/Loader/gif_loader_container.dart'; class GifLoaderDialogUtils { static showMyDialog(BuildContext context) { - showDialog(context: context, child: GifLoaderContainer()); + showDialog(context: context, builder: (cxt) => GifLoaderContainer()); } static hideDialog(BuildContext context) { - try{ + try { Navigator.of(context).pop(); - }catch(error){ + } catch (error) { Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).pop()); } } diff --git a/lib/uitl/laser_body_parts_data.dart b/lib/uitl/laser_body_parts_data.dart index b8e8e58e..e52b4870 100644 --- a/lib/uitl/laser_body_parts_data.dart +++ b/lib/uitl/laser_body_parts_data.dart @@ -10,95 +10,98 @@ class LaserBodyParts { factory LaserBodyParts() => _instance; static Widget image(String assetUri) { - return new SvgPicture.asset(assetUri, fit: BoxFit.cover,width: 97,height: 97,); + return new SvgPicture.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88); + } + + static Widget imagePng(String assetUri) { + return Image.asset(assetUri, fit: BoxFit.cover, width: 88, height: 88); } Map maleBodyMap = { - "40": image("assets/images/new/body_parts/male/upper_arm.svg"), - "41": image("assets/images/new/body_parts/male/lower_arm.svg"), - "42": image("assets/images/new/body_parts/male/chest.svg"), - "43": image("assets/images/new/body_parts/male/chest_line.svg"), - "44": image("assets/images/new/body_parts/male/shoulders.svg"), - "45": image("assets/images/new/body_parts/male/back.svg"), - "46": image("assets/images/new/body_parts/male/abdomin.svg"), - "47": image("assets/images/new/body_parts/male/upper_leg.svg"), - "48": image("assets/images/new/body_parts/male/lower_leg.svg"), - "49": image("assets/images/new/body_parts/male/axilla.svg") + "40": imagePng("assets/images/new/body_parts/male/upper_arm.png"), + "41": imagePng("assets/images/new/body_parts/male/lower_arm.png"), + "42": imagePng("assets/images/new/body_parts/male/chest.png"), + "43": imagePng("assets/images/new/body_parts/male/chest_line.png"), + "44": imagePng("assets/images/new/body_parts/male/shoulders.png"), + "45": imagePng("assets/images/new/body_parts/male/back.png"), + "46": imagePng("assets/images/new/body_parts/male/abdomin.png"), + "47": imagePng("assets/images/new/body_parts/male/upper_legs.png"), + "48": imagePng("assets/images/new/body_parts/male/lower_legs.png"), + "49": imagePng("assets/images/new/body_parts/male/axilla.png") }; Map maleFaceMap = { - "62": image("assets/images/new/body_parts/male/hydra_facial.svg"), - "5": image("assets/images/new/body_parts/male/upper_lips.svg"), - "6": image("assets/images/new/body_parts/male/chin.svg"), - "7": image("assets/images/new/body_parts/male/cheek.svg"), - "8": image("assets/images/new/body_parts/male/side_burn.svg"), - "9": image("assets/images/new/body_parts/male/ears.svg"), - "10": image("assets/images/new/body_parts/male/full_neck.svg"), - "11": image("assets/images/new/body_parts/male/half_neck.svg"), - "12": image("assets/images/new/body_parts/male/eyebrows.svg") + "62": image("assets/images/new/body_parts/male/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/male/upper_lips.svg"), + "6": image("assets/images/new/body_parts/male/chin.svg"), + "7": image("assets/images/new/body_parts/male/cheek.svg"), + "8": image("assets/images/new/body_parts/male/side_burn.svg"), + "9": image("assets/images/new/body_parts/male/ears.svg"), + "10": image("assets/images/new/body_parts/male/full_neck.svg"), + "11": image("assets/images/new/body_parts/male/half_neck.svg"), + "12": image("assets/images/new/body_parts/male/eyebrows.svg") }; Map maleBodyRetouchMap = { - "51": image("assets/images/new/body_parts/male/upper_arm.svg"), - "52": image("assets/images/new/body_parts/male/lower_arm.svg"), - "53": image("assets/images/new/body_parts/male/chest.svg"), - "54": image("assets/images/new/body_parts/male/shoulders.svg"), - "55": image("assets/images/new/body_parts/male/back.svg"), - "56": image("assets/images/new/body_parts/male/abdomin.svg"), - "57": image("assets/images/new/body_parts/male/full_leg.svg"), - "58": image("assets/images/new/body_parts/male/upper_leg.svg"), - "59": image("assets/images/new/body_parts/male/lower_leg.svg"), - "60": image("assets/images/new/body_parts/male/bikini.svg"), - "61": image("assets/images/new/body_parts/male/bikini_line.svg") + "51": imagePng("assets/images/new/body_parts/male/upper_arm.png"), + "52": imagePng("assets/images/new/body_parts/male/lower_arm.png"), + "53": imagePng("assets/images/new/body_parts/male/chest.png"), + "54": imagePng("assets/images/new/body_parts/male/shoulders.png"), + "55": imagePng("assets/images/new/body_parts/male/back.png"), + "56": imagePng("assets/images/new/body_parts/male/abdomin.png"), + "57": imagePng("assets/images/new/body_parts/male/full_legs.png"), + "58": imagePng("assets/images/new/body_parts/male/upper_legs.png"), + "59": imagePng("assets/images/new/body_parts/male/lower_legs.png"), + "60": imagePng("assets/images/new/body_parts/male/bikini.png"), + "61": imagePng("assets/images/new/body_parts/male/bikini_line.png") }; Map femaleBodyMap = { - "40": image("assets/images/new/body_parts/female/upper_arm.svg"), - "41": image("assets/images/new/body_parts/female/lower_arm.svg"), - "42": image("assets/images/new/body_parts/female/chest.svg"), - "43": image("assets/images/new/body_parts/female/chest_line.svg"), - "44": image("assets/images/new/body_parts/female/shoulder.svg"), - "45": image("assets/images/new/body_parts/female/back.svg"), - "46": image("assets/images/new/body_parts/female/abdomin.svg"), - "47": image("assets/images/new/body_parts/female/upper_leg.svg"), - "48": image("assets/images/new/body_parts/female/lower_leg.svg"), - "49": image("assets/images/new/body_parts/female/axilla.svg") + "40": imagePng("assets/images/new/body_parts/female/upper_arm.png"), + "41": imagePng("assets/images/new/body_parts/female/lower_arm.png"), + "42": imagePng("assets/images/new/body_parts/female/chest.png"), + "43": imagePng("assets/images/new/body_parts/female/chest_line.png"), + "44": imagePng("assets/images/new/body_parts/female/shoulders.png"), + "45": imagePng("assets/images/new/body_parts/female/back.png"), + "46": imagePng("assets/images/new/body_parts/female/abdomin.png"), + "47": imagePng("assets/images/new/body_parts/female/upper_legs.png"), + "48": imagePng("assets/images/new/body_parts/female/lower_leg.png"), + "49": imagePng("assets/images/new/body_parts/female/axilla.png") }; Map femaleFaceMap = { - "62": image("assets/images/new/body_parts/female/hydra_facial.svg"), - "5": image("assets/images/new/body_parts/female/upper_lips.svg"), - "6": image("assets/images/new/body_parts/female/chin.svg"), - "7": image("assets/images/new/body_parts/female/cheeks.svg"), - "8": image("assets/images/new/body_parts/female/side_burn.svg"), - "9": image("assets/images/new/body_parts/female/ears.svg"), - "10": image("assets/images/new/body_parts/female/full_neck.svg"), - "11": image("assets/images/new/body_parts/female/half_neck.svg"), - "12": image("assets/images/new/body_parts/female/eyebrows.svg") + "62": image("assets/images/new/body_parts/female/hydra_facial.svg"), + "5": image("assets/images/new/body_parts/female/upper_lips.svg"), + "6": image("assets/images/new/body_parts/female/chin.svg"), + "7": image("assets/images/new/body_parts/female/cheeks.svg"), + "8": image("assets/images/new/body_parts/female/side_burn.svg"), + "9": image("assets/images/new/body_parts/female/ears.svg"), + "10": image("assets/images/new/body_parts/female/full_neck.svg"), + "11": image("assets/images/new/body_parts/female/half_neck.svg"), + "12": image("assets/images/new/body_parts/female/eyebrows.svg") }; Map femaleBodyBikiniMap = { - "34": image("assets/images/new/body_parts/female/bikini.svg"), - "36": image("assets/images/new/body_parts/female/bikini_line.svg"), - "38": image("assets/images/new/body_parts/female/buttocks.svg"), - "39": image("assets/images/new/body_parts/female/anal.svg") + "34": imagePng("assets/images/new/body_parts/female/bikini.png"), + "36": imagePng("assets/images/new/body_parts/female/bikini_line.png"), + "38": imagePng("assets/images/new/body_parts/female/buttocks.png"), + "39": imagePng("assets/images/new/body_parts/female/anal.png") }; Map femaleBodyRetouchMap = { - "51": image("assets/images/new/body_parts/female/upper_arm.svg"), - "52": image("assets/images/new/body_parts/female/lower_arm.svg"), - "53": image("assets/images/new/body_parts/female/chest.svg"), - "54": image("assets/images/new/body_parts/female/shoulder.svg"), - "55": image("assets/images/new/body_parts/female/back.svg"), - "56": image("assets/images/new/body_parts/female/abdomin.svg"), - "57": image("assets/images/new/body_parts/female/full_leg.svg"), - "58": image("assets/images/new/body_parts/female/upper_leg.svg"), - "59": image("assets/images/new/body_parts/female/lower_leg.svg"), - "60": image("assets/images/new/body_parts/female/bikini.svg"), - "61": image("assets/images/new/body_parts/female/bikini_line.svg") + "51": imagePng("assets/images/new/body_parts/female/upper_arm.png"), + "52": imagePng("assets/images/new/body_parts/female/lower_arm.png"), + "53": imagePng("assets/images/new/body_parts/female/chest.png"), + "54": imagePng("assets/images/new/body_parts/female/shoulders.png"), + "55": imagePng("assets/images/new/body_parts/female/back.png"), + "56": imagePng("assets/images/new/body_parts/female/abdomin.png"), + "57": imagePng("assets/images/new/body_parts/female/full_legs.png"), + "58": imagePng("assets/images/new/body_parts/female/upper_legs.png"), + "59": imagePng("assets/images/new/body_parts/female/lower_leg.png"), + "60": imagePng("assets/images/new/body_parts/female/bikini.png"), + "61": imagePng("assets/images/new/body_parts/female/bikini_line.png") }; - Widget getCategoryImage(bool isMale, int category, String mappingCode) { if (isMale) { if (category == 1) { diff --git a/lib/uitl/navigation_service.dart b/lib/uitl/navigation_service.dart index d4cd426b..d394fa63 100644 --- a/lib/uitl/navigation_service.dart +++ b/lib/uitl/navigation_service.dart @@ -1,10 +1,21 @@ +import 'package:diplomaticquarterapp/locator.dart'; import 'package:flutter/material.dart'; class NavigationService { final GlobalKey navigatorKey = new GlobalKey(); - Future navigateTo(String routeName) { - return navigatorKey.currentState.pushNamed(routeName); + + static Future navigateTo(String routeName) { + final key = locator().navigatorKey; + return key.currentState.pushNamed(routeName); + } + + static Future navigateToPage(Widget page) { + final key = locator().navigatorKey; + final pageRoute = MaterialPageRoute(builder: (context) => page); + return Navigator.push(key.currentContext, pageRoute); } } + +BuildContext get currentContext => locator().navigatorKey.currentContext; diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart new file mode 100644 index 00000000..c25f8954 --- /dev/null +++ b/lib/uitl/push-notification-handler.dart @@ -0,0 +1,282 @@ + +import 'dart:convert'; +import 'dart:io'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; +import 'package:diplomaticquarterapp/uitl/app-permissions.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huawei_push/huawei_push.dart' as h_push; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:firebase_messaging/firebase_messaging.dart' as fir; +import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'app_shared_preferences.dart'; +import 'navigation_service.dart'; + + +// |--> Push Notification Background +Future backgroundMessageHandler(dynamic message) async{ + + fir.RemoteMessage message_; + if(message is h_push.RemoteMessage){ // if huawei remote message convert it to Firebase Remote Message + message_ = toFirebaseRemoteMessage(message); + } + + if (message_.data != null && message_.data['is_call'] == 'true') { + _incomingCall(message_.data); + return; + } + + + print("Background message is received, sending local notification."); + h_push.Push.localNotification({ + h_push.HMSLocalNotificationAttr.TITLE: 'Background Message', + h_push.HMSLocalNotificationAttr.MESSAGE: "By: BackgroundMessageHandler" + }); + +} +// Push Notification Background <--| + + + +RemoteMessage toFirebaseRemoteMessage(h_push.RemoteMessage message){ + final payload_data = jsonDecode(message.data); + final fire_message = RemoteMessage( + from: message.from, + collapseKey: message.collapseKey, + data: payload_data['data'], + messageId: message.messageId, + sentTime: DateTime.fromMillisecondsSinceEpoch(message.sentTime*1000), + ttl: message.ttl, + category: null, + messageType: message.type, + notification: RemoteNotification( + title: message.notification.title, + titleLocArgs: (message.notification.titleLocalizationArgs ?? []).map((e) => e.toString()).toList(), + titleLocKey: message.notification.titleLocalizationKey, + body: message.notification.body, + bodyLocArgs: (message.notification.bodyLocalizationArgs ?? []).map((e) => e.toString()).toList(), + bodyLocKey: message.notification.bodyLocalizationKey, + android: AndroidNotification( + channelId: message.notification.channelId, + clickAction: message.notification.clickAction, + color: message.notification.color, + count: null, + imageUrl: message.notification.imageUrl.path, + link: message.notification.link.path, + smallIcon: message.notification.icon, + sound: message.notification.sound, + ticker: message.notification.ticker, + tag: message.notification.tag, + ), + ) + ); + return fire_message; +} + +_incomingCall(Map data) async{ + LandingPage.incomingCallData = IncomingCallData.fromJson(data); + if(LandingPage.isOpenCallPage == false){ + LandingPage.isOpenCallPage = true; + final permited = await AppPermission.askVideoCallPermission(currentContext); + if(permited) + await NavigationService.navigateToPage(IncomingCall(incomingCallData: LandingPage.incomingCallData)); + LandingPage.isOpenCallPage = false; + } + await Future.delayed(Duration(milliseconds: 500)); + await AppSharedPreferences().remove('call_data'); +} + +class PushNotificationHandler{ + final BuildContext context; + static PushNotificationHandler _instance; + + PushNotificationHandler(this.context){ + PushNotificationHandler._instance = this; + } + + static PushNotificationHandler getInstance() => _instance; + + init() async{ + if (Platform.isIOS) { + final permission = await FirebaseMessaging.instance.requestPermission(); + if(permission.authorizationStatus == AuthorizationStatus.denied) + return; + } + + if(Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) { // 'Android HMS' (Handle Huawei Push_Kit Streams) + + h_push.Push.enableLogger(); + final result = await h_push.Push.setAutoInitEnabled(true); + + h_push.Push.onNotificationOpenedApp.listen((message){ + newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + h_push.Push.onMessageReceivedStream.listen((message){ + newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + + h_push.Push.getTokenStream.listen((token){ + onToken(token); + }, onError: (e) => print(e.toString())); + await h_push.Push.getToken(''); + + + h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler); + + }else{ // 'Android GMS or iOS' (Handle Firebase Messaging Streams) + + FirebaseMessaging.onMessage.listen((RemoteMessage message) async { + newMessage(message); + }); + + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + newMessage(message); + }); + + FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { + onToken(fcm_token); + }); + + FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); + + final fcmToken = await FirebaseMessaging.instance.getToken(); + if(fcmToken != null) + onToken(fcmToken); + } + } + + + newMessage(RemoteMessage remoteMessage){ + print('RemoteMessage.data:: ${remoteMessage.data}'); + if(remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) + _incomingCall(remoteMessage.data); + + } + + onToken(String token) async{ + print("Push Notification Token: " + token); + AppSharedPreferences().setString(PUSH_TOKEN, token); + DEVICE_TOKEN = token; + } + + onResume() async { + var call_data = await AppSharedPreferences().getObject('call_data'); + if(call_data != null){ + _incomingCall(call_data); + } + } + +} + +/* todo verify all functionality */ +// _firebaseMessaging.configure( +// // onMessage: (Map message) async { +// // // showDialog("onMessage: $message"); +// // print("onMessage: $message"); +// // print(message); +// // print(message['name']); +// // print(message['appointmentdate']); +// // +// // if (Platform.isIOS) { +// // if (message['is_call'] == "true") { +// // var route = ModalRoute.of(context); +// // +// // if (route != null) { +// // print(route.settings.name); +// // } +// //s +// // Map myMap = new Map.from(mesage); +// // print(myMap); +// // LandingPage.isOpenCallPage = true; +// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// // if (!isPageNavigated) { +// // isPageNavigated = true; +// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// // isPageNavigated = false; +// // }); +// // } +// // } else { +// // print("Is Call Not Found iOS"); +// // } +// // } else { +// // print("Is Call Not Found iOS"); +// // } +// // +// // if (Platform.isAndroid) { +// // if (message['data'].containsKey("is_call")) { +// // var route = ModalRoute.of(context); +// // +// // if (route != null) { +// // print(route.settings.name); +// // } +// // +// // Map myMap = new Map.from(message['data']); +// // print(myMap); +// // if (LandingPage.isOpenCallPage) { +// // return; +// // } +// // LandingPage.isOpenCallPage = true; +// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// // if (!isPageNavigated) { +// // isPageNavigated = true; +// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// // Future.delayed(Duration(seconds: 5), () { +// // isPageNavigated = false; +// // }); +// // }); +// // } +// // } else { +// // print("Is Call Not Found Android"); +// // LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']); +// // } +// // } else { +// // print("Is Call Not Found Android"); +// // } +// // }, +// onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, +// onLaunch: (Map message) async { +// print("onLaunch: $message"); +// // showDialog("onLaunch: $message"); +// }, +// onResume: (Map message) async { +// print("onResume: $message"); +// print(message); +// print(message['name']); +// print(message['appointmentdate']); +// +// // showDialog("onResume: $message"); +// +// if (Platform.isIOS) { +// if (message['is_call'] == "true") { +// var route = ModalRoute.of(context); +// +// if (route != null) { +// print(route.settings.name); +// } +// +// Map myMap = new Map.from(message); +// print(myMap); +// LandingPage.isOpenCallPage = true; +// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// if (!isPageNavigated) { +// isPageNavigated = true; +// Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// isPageNavigated = false; +// }); +// } +// } else { +// print("Is Call Not Found iOS"); +// } +// } else { +// print("Is Call Not Found iOS"); +// } +// }, +// ); \ No newline at end of file diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index fb13232b..5fdcbb01 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -71,6 +71,8 @@ class TranslationBase { String get noResultFound => localizedValues['noResultFound'][locale.languageCode]; + String get noSearchResultFound => localizedValues['noSearchResultFound'][locale.languageCode]; + String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode]; String get bookNow => localizedValues['bookNow'][locale.languageCode]; @@ -511,7 +513,7 @@ class TranslationBase { String get switchUser => localizedValues['switch-login'][locale.languageCode]; - String get removeMember => localizedValues['remove-membe'][locale.languageCode]; + String get removeMember => localizedValues['remove-member'][locale.languageCode]; String get allowView => localizedValues['allow-view'][locale.languageCode]; @@ -531,6 +533,8 @@ class TranslationBase { String get expiryDate => localizedValues['expiryDate'][locale.languageCode]; + String get expiryPoints => localizedValues['expiryPoints'][locale.languageCode]; + String get procedureName => localizedValues['procedureName'][locale.languageCode]; String get procedure => localizedValues['procedure'][locale.languageCode]; @@ -589,6 +593,10 @@ class TranslationBase { String get contactUs => localizedValues['ContactUs'][locale.languageCode]; + String get contactUsLocation => localizedValues['contactUsLocation'][locale.languageCode]; + + String get contactUsTime => localizedValues['contactUsTime'][locale.languageCode]; + String get viewAllWaysReachUs => localizedValues['ViewAllWaysReachUs'][locale.languageCode]; String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; @@ -993,10 +1001,18 @@ class TranslationBase { String get edit => localizedValues['edit'][locale.languageCode]; + String get whatsApp => localizedValues['whatsApp'][locale.languageCode]; + + String get phone => localizedValues['phone'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get deleteAddress => localizedValues['deleteAddress'][locale.languageCode]; + + String get deletedAddress => localizedValues['deletedAddress'][locale.languageCode]; + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; String get order => localizedValues['order'][locale.languageCode]; @@ -1115,6 +1131,7 @@ class TranslationBase { String get myPrescription => localizedValues['myPrescription'][locale.languageCode]; String get quantity => localizedValues['quantity'][locale.languageCode]; + String get productQuantity => localizedValues['productQuantity'][locale.languageCode]; String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode]; @@ -1825,6 +1842,7 @@ class TranslationBase { String get needPrescription => localizedValues['needPrescription'][locale.languageCode]; String get outOfStockMsg => localizedValues['outOfStockMsg'][locale.languageCode]; + String get productOutOfStock => localizedValues['productOutOfStock'][locale.languageCode]; String get noArabicLetters => localizedValues['noArabicLetters'][locale.languageCode]; @@ -2789,8 +2807,17 @@ class TranslationBase { String get gr => localizedValues["gr"][locale.languageCode]; String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; - - + String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode]; + + String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode]; + String get syncSuccess => localizedValues["syncSuccess"][locale.languageCode]; + String get useLakumPoints => localizedValues["useLakumPoints"][locale.languageCode]; + String get points => localizedValues["points"][locale.languageCode]; + String get availableBalance => localizedValues["availableBalance"][locale.languageCode]; + String get ordersDashboard => localizedValues["ordersDashboard"][locale.languageCode]; + String get requestedDateLiveCare => localizedValues["requestedDateLiveCare"][locale.languageCode]; + String get yourTurn => localizedValues["yourTurn"][locale.languageCode]; + String get patients => localizedValues["patients"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 832a92b1..ec71ff24 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -32,11 +32,16 @@ Widget getPaymentMethods() { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset("assets/images/new/payment/Mada.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/visa.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/Mastercard.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/Apple_Pay.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/installments.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Mada.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/visa.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/Mastercard.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/Apple_Pay.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/installments.png", + width: 50, height: 50), ], ), ); @@ -48,10 +53,15 @@ Widget getNoDataWidget(BuildContext context) { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - SvgPicture.asset('assets/images/new/not_found.svg', width: 110.0, height: 110.0), + SvgPicture.asset('assets/images/new/not_found.svg', + width: 110.0, height: 110.0), Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), + margin: EdgeInsets.only(top: 15.0), + child: Text(TranslationBase.of(context).noResultFound, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFFBABABA)))), ], ), ), @@ -79,7 +89,8 @@ spacer() { } Future navigateTo(context, page) async { - return await Navigator.push(context, MaterialPageRoute(builder: (context) => page)); + return await Navigator.push( + context, MaterialPageRoute(builder: (context) => page)); } // Future navigateToReplace(context, page) async { @@ -137,7 +148,11 @@ Widget circularAviator( child: Container( width: s, height: s, - decoration: containerColorRadiusBorderWidth(bcColor == null ? Colors.grey[200] : bcColor, 2000, brColor == null ? Colors.blueGrey[800] : brColor, borderWidth == null ? 2 : borderWidth), + decoration: containerColorRadiusBorderWidth( + bcColor == null ? Colors.grey[200] : bcColor, + 2000, + brColor == null ? Colors.blueGrey[800] : brColor, + borderWidth == null ? 2 : borderWidth), child: Icon( icon == null ? Icons.person : icon, size: s / 1.7, @@ -219,13 +234,14 @@ RoundedRectangleBorder buttonShape() { ); } -Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2}) { +Decoration containerRadiusWithGradient(double radius, + {Color color1, Color color2}) { return BoxDecoration( borderRadius: BorderRadius.circular(radius), gradient: LinearGradient( colors: [ - color1?? Color(0xFFF71787E), - color2?? Color(0xFFF2B353E), + color1 ?? Color(0xFFF71787E), + color2 ?? Color(0xFFF2B353E), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -233,7 +249,8 @@ Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2} ); } -Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradient(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomRight: Radius.circular(radius)), gradient: LinearGradient( @@ -247,7 +264,8 @@ Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColo ); } -Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradientForAr(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius)), gradient: LinearGradient( @@ -261,9 +279,24 @@ Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color dar ); } -Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, Color lightColor}) { +Decoration containerRadiusWithGradientServices( + double radius, { + Color darkColor, + Color lightColor, + bool isProduct = false, + bool prescriptionRequired = false, + bool isEnglish = true, +}) { return BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius: !isProduct || !prescriptionRequired + ? BorderRadius.all(Radius.circular(radius)) + : isEnglish + ? BorderRadius.only( + topLeft: Radius.circular(26), + ) + : BorderRadius.only( + topRight: Radius.circular(26), + ), gradient: LinearGradient( colors: [ darkColor == null ? Color(0xFF2B353E) : darkColor, @@ -275,7 +308,11 @@ Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, ); } -Decoration containerBottomRightRadiusWithGradientBorder(double radius, {Color darkColor, Color lightColor, Color borderColor = Colors.transparent, double w = 0}) { +Decoration containerBottomRightRadiusWithGradientBorder(double radius, + {Color darkColor, + Color lightColor, + Color borderColor = Colors.transparent, + double w = 0}) { return BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(radius)), border: Border.all( @@ -304,7 +341,8 @@ Decoration containerRadius(Color background, double radius) { ); } -Decoration containerColorRadiusBorder(Color background, double radius, Color color) { +Decoration containerColorRadiusBorder( + Color background, double radius, Color color) { return BoxDecoration( color: background, border: Border.all( @@ -315,7 +353,8 @@ Decoration containerColorRadiusBorder(Color background, double radius, Color col ); } -Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidth( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( @@ -326,13 +365,14 @@ Decoration containerColorRadiusBorderWidth(Color background, double radius, Colo ); } -Decoration containerColorRadiusBorderWidthCircular(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidthCircular( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: color // <--- border width here - ), + ), // borderRadius: BorderRadius.circular(radius), shape: BoxShape.circle, ); @@ -341,29 +381,36 @@ Decoration containerColorRadiusBorderWidthCircular(Color background, double radi Decoration containerColorRadiusRight(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } Decoration containerColorRadiusLeft(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorder(Color background, double radius, double w) { +Decoration containerColorRadiusRightBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorderc(Color background, double radius, double w, Color borderColor) { +Decoration containerColorRadiusRightBorderc( + Color background, double radius, double w, Color borderColor) { return BoxDecoration( color: background, border: Border.all( @@ -394,21 +441,23 @@ Decoration containerColorRadiusBottom(Color color, double radius) { ); } -Decoration containerColorRadiusLeftBorder(Color background, double radius, double w) { +Decoration containerColorRadiusLeftBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -BoxDecoration cardRadius(double radius,{Color color,double elevation}) { - return BoxDecoration( +BoxDecoration cardRadius(double radius, {Color color, double elevation}) { + return BoxDecoration( shape: BoxShape.rectangle, - color: color??Colors.white, + color: color ?? Colors.white, borderRadius: BorderRadius.all( Radius.circular(radius), ), @@ -416,7 +465,7 @@ BoxDecoration cardRadius(double radius,{Color color,double elevation}) { BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, - blurRadius:elevation?? 27, + blurRadius: elevation ?? 27, offset: Offset(-2, 3), ), ], @@ -433,19 +482,23 @@ ShapeBorder cardRadiusNew(double radius) { ShapeBorder cardRadiusTop(double radius) { return RoundedRectangleBorder( side: BorderSide(color: Colors.transparent, width: 0), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusTop2(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusBottom(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } @@ -568,7 +621,8 @@ FontStyle getFontStyle(String fontStyle) { bool timeCalculator(int startHour, int startMint, int endHour, int endMint) { DateTime now = DateTime.now(); - DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour); + DateTime startDate = + DateTime(now.year, now.month, now.day, startHour, startHour); DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint); if (startDate.isBefore(now) && endDate.isAfter(now)) return true; diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index a9e9c4c1..0fc26907 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -23,7 +23,7 @@ class ImageOptions { icon: Icons.image, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.gallery, imageQuality: 20); + File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20)).path); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); String base64Encode = base64.encode(bytes); @@ -37,7 +37,7 @@ class ImageOptions { icon: Icons.camera_alt, onTap: () async { File _image = - await ImagePicker.pickImage(source: ImageSource.camera, imageQuality: 20); + File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20)).path); 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 14e93d66..affd9a3e 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; extension WithContainer on Widget { Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); @@ -11,8 +12,12 @@ class DefaultButton extends StatelessWidget { final Color color; final Color disabledColor; final IconData iconData; + final String svgIcon; final double fontSize; - DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white, this.iconData, this.fontSize}); + final bool isTextExpanded; + final int count; + + DefaultButton(this.text, this.onPress, {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize}); @override Widget build(BuildContext context) { @@ -22,15 +27,43 @@ class DefaultButton extends StatelessWidget { child: FlatButton( onPressed: onPress, child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ if (iconData != null) Icon(iconData, color: textColor), - Expanded( - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + if (svgIcon != null) SvgPicture.asset(svgIcon,color: textColor), + if (!isTextExpanded) + Padding( + padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), + ), + if (isTextExpanded) + Expanded( + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), ), - ), + if (count > 0) + Align( + alignment: Alignment.topCenter, + child: Container( + margin: EdgeInsets.only(top: 6, bottom: 6), + padding: EdgeInsets.only(left: 5, right: 5), + alignment: Alignment.center, + height: 16, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), + child: Text( + "$count", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: Color(0xffD02127), letterSpacing: -0.6), + ), + ), + ) ], ), // color: Color(0xffD02127), diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index dadabc71..a5ac63aa 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -30,7 +30,7 @@ class SecondaryButton extends StatefulWidget { this.noBorderRadius = false, this.borderRadius, this.disableColor, - this.fontWeight}) + this.fontWeight, this.fontSize}) : super(key: key); final String label; @@ -47,6 +47,7 @@ class SecondaryButton extends StatefulWidget { final double borderRadius; final Color disableColor; final FontWeight fontWeight; + final double fontSize; @override @@ -199,9 +200,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width * 2.2, height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( - shape: BoxShape.circle, + // shape: BoxShape.circle, color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor, ), ), @@ -211,8 +212,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -245,13 +246,15 @@ class _SecondaryButtonState extends State bottom: widget.small ? 4.0 : 3.0), child: Text( widget.label, + textAlign: TextAlign.center, style: TextStyle( color: widget.textColor, - fontSize: widget.small ? 12.0 : 14.0, - fontWeight: FontWeight.w600, + + fontSize: widget.small ? 12.0 : widget.fontSize??14.0, + fontWeight: FontWeight.w700, fontFamily: projectViewModel.isArabic ? 'Cairo' - : 'WorkSans' + : 'Poppins' ), ), ) diff --git a/lib/widgets/charts/custom_line_chart.dart b/lib/widgets/charts/custom_line_chart.dart index cfd1e718..7176846d 100644 --- a/lib/widgets/charts/custom_line_chart.dart +++ b/lib/widgets/charts/custom_line_chart.dart @@ -1,5 +1,3 @@ -import 'dart:math' as math; - import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; @@ -13,6 +11,7 @@ class LineChartModel { class CustomLineChart extends StatefulWidget { final List list; final bool isArabic; + CustomLineChart(this.list, this.isArabic); @override @@ -81,7 +80,7 @@ class _CustomLineChartState extends State { SideTitles left = SideTitles( showTitles: true, interval: 1, - getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTextStyles: (cxt, value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), getTitles: (value) { if (widget.list.isEmpty) { return (value).toInt().toString(); @@ -110,7 +109,7 @@ class _CustomLineChartState extends State { showTitles: true, reservedSize: 22, interval: 1, - getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTextStyles: (cxt, value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), getTitles: (value) { String _title = list[value.toInt()].title; return (_title.length > 3 ? (widget.isArabic ? _title : _title.substring(0, 3)) : _title).toUpperCase(); diff --git a/lib/widgets/charts/show_chart.dart b/lib/widgets/charts/show_chart.dart index 301d45ff..0e89238d 100644 --- a/lib/widgets/charts/show_chart.dart +++ b/lib/widgets/charts/show_chart.dart @@ -102,21 +102,21 @@ class ShowChart extends StatelessWidget { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontSize: 10, ), rotateAngle: -65, margin: 22, getTitles: (value) { - if(isWeeklyOrMonthly) { + if (isWeeklyOrMonthly) { return '${timeSeries[value.toInt()].time.day}/ ${timeSeries[value.toInt()].time.month}'; } else { if (timeSeries.length < 15) { @@ -137,7 +137,7 @@ class ShowChart extends StatelessWidget { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => const TextStyle( + getTextStyles: (cxt, value) => const TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 10, diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index f4081c21..f396a2f4 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -132,7 +132,7 @@ class LabResultWidget extends StatelessWidget { void showConfirmMessage(BuildContext context, String email, String isOutsideKSA) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: email, onTapSendEmail: () { generateCovidCertificate(context, isOutsideKSA); @@ -187,7 +187,7 @@ class LabResultWidget extends StatelessWidget { ), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false), - InkWell( + !checkIfCovidLab(patientLabResultList) ? InkWell( onTap: () { Navigator.push( context, @@ -203,7 +203,7 @@ class LabResultWidget extends StatelessWidget { padding: EdgeInsets.only(left: !projectViewModel.isArabic ? 0 : 12, right: !projectViewModel.isArabic ? 12 : 0), child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), ), - ), + ) : Container(), ], ), ); diff --git a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart index e83cc6ca..992e5659 100644 --- a/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart +++ b/lib/widgets/data_display/medical/LabResult/LineChartCurved.dart @@ -76,14 +76,14 @@ class LineChartCurvedState extends State { touchTooltipData: LineTouchTooltipData( tooltipBgColor: Colors.white, ), - touchCallback: (LineTouchResponse touchResponse) {}, + touchCallback: (touchEvent, LineTouchResponse touchResponse) {}, handleBuiltInTouches: true, ), gridData: FlGridData(show: true, drawVerticalLine: false, drawHorizontalLine: true), titlesData: FlTitlesData( bottomTitles: SideTitles( showTitles: true, - getTextStyles: (value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12), + getTextStyles: (cxt, value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12), margin: 8, rotateAngle: -0, getTitles: (value) { @@ -107,7 +107,7 @@ class LineChartCurvedState extends State { ), leftTitles: SideTitles( showTitles: true, - getTextStyles: (value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12), + getTextStyles: (cxt, value) => TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: 0, height: 18 / 12), getTitles: (value) { return '${value}'; diff --git a/lib/widgets/data_display/text.dart b/lib/widgets/data_display/text.dart index 4a00c9fe..4b9ac2f9 100644 --- a/lib/widgets/data_display/text.dart +++ b/lib/widgets/data_display/text.dart @@ -272,7 +272,7 @@ class _TextsState extends State { style: _getFontStyle().copyWith( color: Theme.of(context).primaryColor, fontWeight: FontWeight.w800, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans', + fontFamily: projectViewModel.isArabic ? 'Poppins' : 'Poppins', ), ), ), diff --git a/lib/widgets/dialogs/radio_selection_dialog.dart b/lib/widgets/dialogs/radio_selection_dialog.dart index 7175d6dc..ffce6c29 100644 --- a/lib/widgets/dialogs/radio_selection_dialog.dart +++ b/lib/widgets/dialogs/radio_selection_dialog.dart @@ -77,27 +77,38 @@ class RadioSelectionDialogState extends State { 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; - }); - }, + return InkWell( + onTap: () { + setState(() { + selectedIndex = widget.listData[index].value; + }); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + 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), - ), - ], + SizedBox(width: 8), + Expanded( + child: Text( + widget.listData[index].title, + // maxLines: 2, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.56), + ), + ), + ], + ), ); }, separatorBuilder: (context, index) => SizedBox(height: 10), @@ -110,7 +121,7 @@ class RadioSelectionDialogState extends State { 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 8b3819f1..b7e00d54 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notificatio import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/call_page_bkp.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index 8ba7b4bd..0e898ee1 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -2,7 +2,7 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -73,9 +73,17 @@ class HospitalLocation extends StatelessWidget { ), Column( children: [ - contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { - MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); - }), + contactButton( + Icons.location_on, + TranslationBase.of(context).locationa, + () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), + title: location.locationName, + ); + }, + ), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { launch("tel://" + location.phoneNumber); diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e24fd6f0..9e363e4d 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -22,19 +22,18 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( inAppWebViewGroupOptions: InAppWebViewGroupOptions(crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true)), crossPlatform: InAppBrowserOptions(hideUrlBar: true), ios: IOSInAppBrowserOptions( - toolbarBottom: false, + hideToolbarBottom: false, )); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - // static String SERVICE_URL = - // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - // static String PREAUTH_SERVICE_URL = - // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + //static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store @@ -48,9 +47,9 @@ class MyInAppBrowser extends InAppBrowser { static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; - static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete']; + static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails']; - static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed']; + static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails']; final Function onExitCallback; final Function onLoadStartCallback; @@ -77,17 +76,17 @@ class MyInAppBrowser extends InAppBrowser { } @override - Future onLoadStart(String url) async { + Future onLoadStart(Uri url) async { if (onLoadStartCallback != null) onLoadStartCallback(url); } @override - Future onLoadStop(String url) async { + Future onLoadStop(Uri url) async { print("\n\nStopped $url\n\n"); } @override - void onLoadError(String url, int code, String message) { + void onLoadError(Uri url, int code, String message) { print("Can't load $url.. Error: $message"); } @@ -100,18 +99,18 @@ class MyInAppBrowser extends InAppBrowser { if (onExitCallback != null) onExitCallback(appo, isPaymentDone); } - @override - Future shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async { - var url = shouldOverrideUrlLoadingRequest.url; - debugPrint("redirecting/overriding to: $url"); - - if (paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL].contains(url)) { - isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL); - close(); - } - - return ShouldOverrideUrlLoadingAction.ALLOW; - } + // @override + // Future shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) async { + // var url = shouldOverrideUrlLoadingRequest.url; + // debugPrint("redirecting/overriding to: $url"); + // + // if (paymentType == _PAYMENT_TYPE.PACKAGES && [PACKAGES_PAYMENT_SUCCESS_URL, PACKAGES_PAYMENT_FAIL_URL].contains(url)) { + // isPaymentDone = (url == PACKAGES_PAYMENT_SUCCESS_URL); + // close(); + // } + // + // return ShouldOverrideUrlLoadingAction.ALLOW; + // } getLanguageID() async { return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); @@ -136,7 +135,7 @@ class MyInAppBrowser extends InAppBrowser { openPackagesPaymentBrowser({@required int customer_id, @required int order_id}) { paymentType = _PAYMENT_TYPE.PACKAGES; var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id'; - this.openUrl(url: full_url, options: _InAppBrowserOptions); + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(full_url)), options: _InAppBrowserOptions); } openPaymentBrowser(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID, @@ -182,9 +181,8 @@ class MyInAppBrowser extends InAppBrowser { service.applePayInsertRequest(applePayInsertRequest, context).then((res) { if (context != null) GifLoaderDialogUtils.hideDialog(context); - var url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; - print(url); - safariBrowser.open(url: url); + String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; + safariBrowser.open(url: Uri.parse(url)); // this.browser.openUrl(url: url, options: _InAppBrowserOptions); }).catchError((err) { print(err); @@ -196,7 +194,7 @@ class MyInAppBrowser extends InAppBrowser { clinicID, doctorID) .then((value) { paymentType = _PAYMENT_TYPE.PATIENT; - this.browser.openUrl(url: value, options: _InAppBrowserOptions); + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value)), options: _InAppBrowserOptions); }); } } @@ -204,15 +202,20 @@ class MyInAppBrowser extends InAppBrowser { openPharmacyPaymentBrowser(OrderDetailModel order, double amount, String orderDesc, String transactionID, String emailId, String paymentMethod, String patientName, dynamic patientID, AuthenticatedUser authenticatedUser, InAppBrowser browser) { this.browser = browser; + MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); getPatientData(); generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) { - this.browser.openUrl(url: value); + if (order.customValuesXml.contains("ApplePay")) { + safariBrowser.open(url: Uri.parse(value)); + } else { + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value))); + } }); } openBrowser(String url) { this.browser = browser; - this.browser.openUrl(url: url, options: _InAppBrowserOptions); + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); } Future generateURL(double amount, String orderDesc, String transactionID, String projId, String emailId, String paymentMethod, dynamic patientType, String patientName, dynamic patientID, @@ -351,7 +354,7 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser { final Function onLoadStartCallback; AppoitmentAllHistoryResultList appo; - MyChromeSafariBrowser(browserFallback, {@required this.onExitCallback, @required this.onLoadStartCallback, @required this.appo}) : super(bFallback: browserFallback); + MyChromeSafariBrowser(browserFallback, {@required this.onExitCallback, @required this.onLoadStartCallback, @required this.appo}); @override void onOpened() { diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 59444b31..5c556efb 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -176,7 +176,7 @@ class DoctorHeader extends StatelessWidget { void showConfirmMessage(BuildContext context, GestureTapCallback onTap, String email) { showDialog( context: context, - child: ConfirmSendEmailDialog( + builder: (cxt) => ConfirmSendEmailDialog( email: email, onTapSendEmail: () { onTap(); diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 80ebc6e7..00be462a 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -1,7 +1,5 @@ -import 'dart:async'; - import 'package:flutter/material.dart'; -import 'package:nfc_in_flutter/nfc_in_flutter.dart'; +import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; void showNfcReader(BuildContext context, {Function onNcfScan}) { showModalBottomSheet( @@ -9,8 +7,7 @@ void showNfcReader(BuildContext context, {Function onNcfScan}) { enableDrag: false, isDismissible: false, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(12), topRight: Radius.circular(12)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), ), backgroundColor: Colors.white, builder: (context) { @@ -30,7 +27,6 @@ class NfcLayout extends StatefulWidget { } class _NfcLayoutState extends State { - StreamSubscription _stream; bool _reading = false; Widget mainWidget; String nfcId; @@ -38,47 +34,28 @@ class _NfcLayoutState extends State { @override void initState() { super.initState(); + readNFC(); + } - setState(() { - // _reading = true; - // Start reading using NFC.readNDEF() - _stream = NFC - .readNDEF( - once: false, - throwOnUserCancel: false, - readerMode: NFCDispatchReaderMode()) - .listen((NDEFMessage message) { - setState(() { - _reading = true; - mainWidget = doneNfc(); - }); - Future.delayed(const Duration(milliseconds: 500), () { - _stream?.cancel(); - widget.onNcfScan(nfcId); - Navigator.pop(context); - }); - print("read NDEF id: ${message.id}"); - print("NFC Record "+message.payload); - print("NFC Record Lenght "+message.records.length.toString()); - print("NFC Record "+message.records.first.id); - print("NFC Record "+message.records.first.payload); - print("NFC Record "+message.records.first.data); - print("NFC Record "+message.records.first.type); - // widget.onNcfScan(message.id); - nfcId = message.id; - }, onError: (e) { - // Check error handling guide below + void readNFC() async { + FlutterNfcKit.poll(timeout: Duration(seconds: 10), androidPlatformSound: false, iosMultipleTagMessage: "Multiple tags found!").then((value) async { + setState(() { + _reading = true; + mainWidget = doneNfc(); }); + Future.delayed(const Duration(milliseconds: 500), () async { + await FlutterNfcKit.finish(); + widget.onNcfScan(nfcId); + Navigator.pop(context); + }); + nfcId = value.id; }); } @override Widget build(BuildContext context) { - (mainWidget == null && !_reading) - ? mainWidget = scanNfc() - : mainWidget = doneNfc(); - return AnimatedSwitcher( - duration: Duration(milliseconds: 500), child: mainWidget); + (mainWidget == null && !_reading) ? mainWidget = scanNfc() : mainWidget = doneNfc(); + return AnimatedSwitcher(duration: Duration(milliseconds: 500), child: mainWidget); } Widget scanNfc() { @@ -125,7 +102,7 @@ class _NfcLayoutState extends State { ), child: RaisedButton( onPressed: () { - _stream?.cancel(); + // _stream?.cancel(); Navigator.pop(context); }, elevation: 0, @@ -189,7 +166,7 @@ class _NfcLayoutState extends State { // Navigator.pop(context); // }, onPressed: null, -elevation: 0, + elevation: 0, child: Text("DONE"), ), ), diff --git a/lib/widgets/offers_packages/PackagesCartItemCard.dart b/lib/widgets/offers_packages/PackagesCartItemCard.dart index 10c7e5b1..d53f9505 100644 --- a/lib/widgets/offers_packages/PackagesCartItemCard.dart +++ b/lib/widgets/offers_packages/PackagesCartItemCard.dart @@ -30,21 +30,20 @@ class PackagesCartItemCardState extends State { wide = !wide; return Container( decoration: cardRadius(15.0), - margin: EdgeInsets.only(left: 21.0, right: 21.0, top: 12.0), - height: 90, + height: 95, + padding: EdgeInsets.all(9), child: Row( mainAxisSize: MainAxisSize.max, children: [ _image(widget.itemModel.product), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _itemName(widget.itemModel.product.getName()), - _itemDescription(widget.itemModel.product.shortDescription), - Container( - padding: const EdgeInsets.only(top: 12.0), - width: MediaQuery.of(context).size.width * 0.65, - child: Row( + SizedBox(width: 7), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _itemName(widget.itemModel.product.getName()), + Expanded(child: _itemDescription(widget.itemModel.product.shortDescription)), + Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -54,11 +53,12 @@ class PackagesCartItemCardState extends State { await widget.viewModel.service.deleteProductFromCart(widget.itemModel.id, context: context, showLoading: false); widget.getCartItems(); }, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.only(left: 5.0, right: 5.0), - child: Text( + child: Padding( + padding: const EdgeInsets.only(right: 3, bottom: 3), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( TranslationBase.of(context).removeMember, style: TextStyle( fontSize: 10, @@ -67,15 +67,16 @@ class PackagesCartItemCardState extends State { letterSpacing: -0.36, ), ), - ), - SvgPicture.asset("assets/images/new-design/delete.svg", color: CustomColors.accentColor), - ], + SizedBox(width: 2), + SvgPicture.asset("assets/images/new-design/delete.svg", color: CustomColors.accentColor), + ], + ), ), ), ], ), - ), - ], + ], + ), ) ], ), @@ -85,52 +86,41 @@ class PackagesCartItemCardState extends State { Widget _image(PackagesResponseModel model) => AspectRatio( aspectRatio: 1 / 1, - child: Padding( - padding: const EdgeInsets.all(9), - child: Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300], width: 0.25), - boxShadow: [BoxShadow(color: Colors.grey[200], blurRadius: 2.0, spreadRadius: 1, offset: Offset(1, 1.5))], - borderRadius: BorderRadius.circular(15), - color: Colors.white, - shape: BoxShape.rectangle, - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: (model.images.isNotEmpty) ? Utils.loadNetworkImage(url: model.images.first.src, fitting: BoxFit.fill) : Container(color: Colors.grey[200])), - ), - ), + child: ClipRRect( + borderRadius: BorderRadius.circular(15), child: (model.images.isNotEmpty) ? Utils.loadNetworkImage(url: model.images.first.src, fitting: BoxFit.fill) : Container(color: Colors.grey[200])), ); -Widget _itemName(String name) => Padding( - padding: const EdgeInsets.only(top: 9.0), - child: Text(name, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.56, - ))); - -Widget _itemDescription(String desc) => Padding( - padding: const EdgeInsets.only(top: 0.0), - child: Text(desc, - style: TextStyle( - fontSize: 10, - // fontWeight: FontWeight.bold, - letterSpacing: -0.4, - ))); +Widget _itemName(String name) => Text( + name, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff2B353E), + letterSpacing: -0.56, + ), + ); -Widget _itemPrice(double price, {@required BuildContext context}) { - final prc = (price ?? 0.0).toStringAsFixed(2); - return Padding( - padding: const EdgeInsets.all(0), - child: Text( - '${prc} ${TranslationBase.of(context).sar}', +Widget _itemDescription(String desc) => Text( + desc, + maxLines: 2, + overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, + fontSize: 10, + fontWeight: FontWeight.w500, + color: Color(0xff535353), letterSpacing: -0.4, ), + ); + +Widget _itemPrice(double price, {@required BuildContext context}) { + final prc = (price ?? 0.0).toStringAsFixed(2); + return Text( + '$prc ${TranslationBase.of(context).sar}', + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff5D5D5D), + letterSpacing: -0.44, ), ); } diff --git a/lib/widgets/offers_packages/PackagesOfferCard.dart b/lib/widgets/offers_packages/PackagesOfferCard.dart index be756caf..3bf66383 100644 --- a/lib/widgets/offers_packages/PackagesOfferCard.dart +++ b/lib/widgets/offers_packages/PackagesOfferCard.dart @@ -2,10 +2,7 @@ import 'package:diplomaticquarterapp/core/model/packages_offers/responses/Packag import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackageDetailPage.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -32,6 +29,103 @@ class PackagesItemCardState extends State { @override Widget build(BuildContext context) { wide = !wide; + return InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OfferAndPackagesDetail(itemModel: widget.itemModel, onCartClick: widget.onCartClick))); + }, + child: AspectRatio( + aspectRatio: 162 / 279, + child: Container( + // width: widget.itemWidth, + // color: Colors.transparent, + decoration: cardRadius(15.0), + padding: const EdgeInsets.all(9.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AspectRatio( + aspectRatio: 144 / 144, + child: ClipRRect( + borderRadius: BorderRadius.circular(12.0), + child: Image.network(widget.itemModel.images.isNotEmpty ? widget.itemModel.images[0].src : "https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), + ), + ), + SizedBox(height: 6), + Text( + widget.itemModel.name, + maxLines: 1, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + letterSpacing: -0.56, + color: Color(0xff2B353E), + ), + ), + Text(widget.itemModel.shortDescription, + maxLines: 2, + style: TextStyle( + fontSize: 12.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + color: Color(0xff535353), + ), + overflow: TextOverflow.ellipsis), + if (widget.itemModel.hasDiscountsApplied) + Container( + margin: const EdgeInsets.only(top: 19.0), + child: Text( + widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle( + fontSize: 9.0, + fontWeight: FontWeight.w600, + letterSpacing: -0.36, + decoration: TextDecoration.lineThrough, + color: Color(0xffA0A0A0), + ), + ), + ), + Container( + margin: widget.itemModel.hasDiscountsApplied ? const EdgeInsets.only(top: 0.0) : const EdgeInsets.only(top: 19.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text( + widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Color(0xff2B353E), letterSpacing: -0.48), + ), + ), + RatingBar.readOnly( + initialRating: 4.5, // todo ask haroon about parameter for rating + size: 18.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], + ), + InkWell( + child: SvgPicture.asset("assets/images/new/add_to_cart.svg"), + onTap: () { + widget.onCartClick(widget.itemModel); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ); + return InkWell( onTap: () { Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => OfferAndPackagesDetail(itemModel: widget.itemModel, onCartClick: widget.onCartClick))); @@ -50,8 +144,15 @@ class PackagesItemCardState extends State { child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), ), Container(margin: const EdgeInsets.only(top: 8.0), child: Text(widget.itemModel.name, maxLines: 1, style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), - Container(width: MediaQuery.of(context).size.width * 0.4, child: Text("Special discount for all HMG Employees and their first…", maxLines: 2, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), overflow: TextOverflow.clip)), - if (widget.itemModel.hasDiscountsApplied) Container(margin: const EdgeInsets.only(top: 19.0), child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, style: TextStyle(fontSize: 9.0, fontWeight: FontWeight.w600, letterSpacing: -0.36, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), + Container( + width: MediaQuery.of(context).size.width * 0.4, + child: Text("Special discount for all HMG Employees and their first…", + maxLines: 2, style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w600, letterSpacing: -0.4, color: CustomColors.textColor), overflow: TextOverflow.clip)), + if (widget.itemModel.hasDiscountsApplied) + Container( + margin: const EdgeInsets.only(top: 19.0), + child: Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 9.0, fontWeight: FontWeight.w600, letterSpacing: -0.36, decoration: TextDecoration.lineThrough, color: CustomColors.grey2))), Container( margin: widget.itemModel.hasDiscountsApplied ? const EdgeInsets.only(top: 0.0) : const EdgeInsets.only(top: 19.0), child: Row( @@ -60,7 +161,10 @@ class PackagesItemCardState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container(margin: const EdgeInsets.only(top: 0.0), child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), + Container( + margin: const EdgeInsets.only(top: 0.0), + child: Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar, + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, letterSpacing: -0.56))), RatingBar.readOnly( initialRating: 4.5, size: 18.0, diff --git a/lib/widgets/offers_packages/offers_packages.dart b/lib/widgets/offers_packages/offers_packages.dart index aed4f699..89d395fa 100644 --- a/lib/widgets/offers_packages/offers_packages.dart +++ b/lib/widgets/offers_packages/offers_packages.dart @@ -104,7 +104,7 @@ class _OffersAndPackagesWidgetState extends State { return Container( child: CarouselSlider.builder( itemCount: widget.models.length, - itemBuilder: (BuildContext context, int itemIndex) { + itemBuilder: (BuildContext context, int itemIndex,int realIndex) { var item = widget.models[itemIndex]; return OfferPackagesItemWidget(model: item); }, diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index c5b45b77..a39b9d6a 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -1,6 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:badges/badges.dart'; -import 'package:barcode_scan_fix/barcode_scan.dart'; +import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -135,8 +134,7 @@ class AppScaffold extends StatefulWidget { } class _AppScaffoldState extends State { - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); AppBarWidget appBar; @override @@ -185,8 +183,7 @@ class _AppScaffoldState extends State { builder: (BuildContext context) { return InkWell( onTap: () { - Provider.of(context, listen: false) - .changeCurrentTab(0); + Provider.of(context, listen: false).changeCurrentTab(0); }, child: Container( height: 2.0, @@ -216,12 +213,9 @@ class _AppScaffoldState extends State { AppGlobal.context = context; PharmacyPagesViewModel pagesViewModel = Provider.of(context); - bool isUserNotLogin = - (!Provider.of(context, listen: false).isLogin && - widget.isShowDecPage); + bool isUserNotLogin = (!Provider.of(context, listen: false).isLogin && widget.isShowDecPage); return Scaffold( - backgroundColor: - widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color, + backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color, // appBar: widget.isShowPharmacyAppbar // ? pharmacyAppbar() @@ -254,8 +248,7 @@ class _AppScaffoldState extends State { isPharmacy: widget.isPharmacy, showPharmacyCart: widget.showPharmacyCart, isOfferPackages: widget.isOfferPackages, - showOfferPackagesCart: - widget.showOfferPackagesCart, + showOfferPackagesCart: widget.showOfferPackagesCart, isShowDecPage: widget.isShowDecPage, backButtonTab: widget.backButtonTab, ) @@ -294,22 +287,17 @@ class _AppScaffoldState extends State { widget.changeCurrentTab(value); } else { Navigator.pushAndRemoveUntil( - locator().navigatorKey.currentContext, - MaterialPageRoute( - builder: (context) => LandingPagePharmacy(currentTab: value)), - (Route r) => false); + locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route r) => false); } } void _scanQrAndGetProduct() async { try { - String result = await BarcodeScanner.scan(); + String result = (await BarcodeScanner.scan())?.rawContent; 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); @@ -319,8 +307,7 @@ class _AppScaffoldState 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) {} } @@ -330,10 +317,7 @@ class _AppScaffoldState extends State { } buildBodyWidget(context) { - return Stack(children: [ - widget.body, - widget.isHelp == true ? RobotIcon() : Container() - ]); + return Stack(children: [widget.body, widget.isHelp == true ? RobotIcon() : Container()]); } } @@ -347,16 +331,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { final List appBarIcons; Function onTap; - NewAppBarWidget( - {Key key, - this.showTitle = false, - this.showDropDown = false, - this.title = "", - this.dropDownList, - this.appBarIcons, - this.dropdownIndexValue, - this.dropDownIndexChange, - this.onTap}) + NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) : super(key: key); @override @@ -381,13 +356,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { title, maxLines: 1, style: TextStyle( - fontSize: 24, - fontFamily: - (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - fontWeight: FontWeight.w700, - color: Color(0xff2B353E), - letterSpacing: -1.44, - height: 35 / 24), + fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), ), ), if (showDropDown) @@ -399,8 +368,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { alignedDropdown: true, child: DropdownButton( iconEnabledColor: CustomColors.grey2, - style: TextStyle( - color: CustomColors.lightGreyColor, fontSize: 12), + style: TextStyle(color: CustomColors.lightGreyColor, fontSize: 12), dropdownColor: CustomColors.lightGreyColor, value: dropdownIndexValue, items: [ @@ -411,9 +379,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { dropDownList[i], style: TextStyle( fontSize: 12, - fontFamily: (projectViewModel.isArabic - ? 'Cairo' - : 'Poppins'), + fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w600, color: Color(0xff2B2E31), letterSpacing: -.48, @@ -455,8 +421,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { } class AppBarWidget extends StatefulWidget with PreferredSizeWidget { - final AuthenticatedUserObject authenticatedUserObject = - locator(); + final AuthenticatedUserObject authenticatedUserObject = locator(); final String appBarTitle; final bool showHomeAppBarIcon; @@ -509,22 +474,12 @@ class AppBarWidgetState extends State { return AppBar( elevation: 0, - backgroundColor: widget.isPharmacy - ? Colors.green - : Theme.of(context).appBarTheme.color, + backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, textTheme: TextTheme( - headline6: TextStyle( - color: Theme.of(context).textTheme.headline1.color, - fontWeight: FontWeight.bold), + headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), ), - title: Text( - widget.authenticatedUserObject.isLogin || !widget.isShowDecPage - ? widget.appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Theme.of(context).textTheme.headline1.color, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), + title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle, + style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { return ArrowBack( @@ -538,8 +493,7 @@ class AppBarWidgetState extends State { ? IconButton( icon: Badge( badgeContent: Text( - orderPreviewViewModel.cartResponse.quantityCount - .toString(), + orderPreviewViewModel.cartResponse.quantityCount.toString(), style: TextStyle(color: Colors.white), ), child: Icon(Icons.shopping_cart)), @@ -554,10 +508,7 @@ class AppBarWidgetState extends State { position: BadgePosition.topStart(top: -15, start: -10), badgeContent: Text( _badgeText, - style: TextStyle( - fontSize: 9, - color: Colors.white, - fontWeight: FontWeight.normal), + style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), ), child: Icon(Icons.shopping_cart)), color: Colors.white, @@ -571,10 +522,7 @@ class AppBarWidgetState extends State { icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route r) => false); + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); // Cart Click Event if (_onCartClick != null) _onCartClick(); diff --git a/lib/widgets/others/entity_checkbox_list.dart b/lib/widgets/others/entity_checkbox_list.dart index c03fe029..0a34778f 100644 --- a/lib/widgets/others/entity_checkbox_list.dart +++ b/lib/widgets/others/entity_checkbox_list.dart @@ -93,24 +93,22 @@ class _ProcedureListWidgetState extends State { historyInfo), activeColor: Colors.red[800], onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); + selectOption(historyInfo); + }), Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts(historyInfo.name, - variant: "bodyText", - bold: true, - color: Colors.black), + child: InkWell( + onTap:(){ + selectOption(historyInfo); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.name, + variant: "bodyText", + bold: true, + color: Colors.black), + ), ), ), ], @@ -142,6 +140,19 @@ class _ProcedureListWidgetState extends State { ); } + + selectOption(historyInfo){ + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + } + void filterSearchResults(String query) { List dummySearchList = List(); dummySearchList.addAll(widget.masterList); diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 8a9274be..b26f4f79 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -54,9 +54,11 @@ 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/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart' show TargetPlatform; import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -269,7 +271,7 @@ class _FloatingSearchButton extends State with TickerProvi } requestPermissions() async { - if (await Permission.microphone.isDenied || await Permission.microphone.isUndetermined) { + if (await Permission.microphone.isDenied || await Permission.microphone.isPermanentlyDenied) { Map statuses = await [ Permission.microphone, ].request(); @@ -896,17 +898,6 @@ class RoboSearch { }); showAlertDialog(BuildContext context) { - //AlertDialog alert = AlertDialog - // AlertDialog alert = AlertDialog(content: MyStatefulBuilder(dispose: () { - // print('dispose!!!!!!!!!!!!'); - // }) - // isClosed = true; - // streamSubscription.cancel(); - // }, builder: (BuildContext context, StateSetter setState) { - // //print(streamSubscription); - // }), - // ); - // show the dialog showDialog( context: context, @@ -918,7 +909,6 @@ class RoboSearch { ); }, ); - print(dialog); } static closeAlertDialog(BuildContext context) { @@ -946,6 +936,7 @@ class _MyStatefulBuilderState extends State { var searchText; static StreamSubscription streamSubscription; static var isClosed = false; + stt.SpeechToText speech = stt.SpeechToText(); @override void initState() { @@ -1006,6 +997,21 @@ class _MyStatefulBuilderState extends State { event.setValue({'startPopUp': 'true'}); }, )) + : SizedBox(), + searchText != 'null' && searchText != null && Theme.of(context).platform == TargetPlatform.iOS + ? Center( + child: DefaultButton( + TranslationBase.of(context).ok, + () { + RoboSearch.closeAlertDialog(context); + speech.stop(); + // event.setValue({"searchText": { + // 'isIOSFeedback':true, + // + // } + // }); + }, + )) : SizedBox() ]), ))); diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index b774b7c6..5e957904 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -125,7 +125,7 @@ class _NotAutPageState extends State { Scaffold( backgroundColor: Color(0xfff8f8f8), - resizeToAvoidBottomPadding: false, + resizeToAvoidBottomInset: false, appBar: AppBar( backgroundColor: Colors.transparent, leading: IconButton( diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index 6fccaec4..afb27530 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -6,7 +7,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; -import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart'; +import 'package:sms_retriever/sms_retriever.dart'; import '../otp_widget.dart'; @@ -58,6 +59,7 @@ class SMSOTP { String _code; dynamic setState; static String signature; + displayDialog(BuildContext context) async { return showDialog( context: context, @@ -84,7 +86,7 @@ class SMSOTP { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SvgPicture.asset( - type == 1 ?"assets/images/new/verify_sms.svg":"assets/images/new/verify_whatsapp.svg", + type == 1 ? "assets/images/new/verify_sms.svg" : "assets/images/new/verify_whatsapp.svg", height: 50, width: 50, ), @@ -236,6 +238,10 @@ class SMSOTP { } static getSignature() async { - return await SmsRetrieved.getAppSignature(); + if (Platform.isAndroid) { + return await SmsRetriever.getAppSignature(); + } else { + return null; + } } } diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 9731f2b1..1d5893fd 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -1,16 +1,16 @@ -import 'package:diplomaticquarterapp/Constants.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../locator.dart'; - class BottomNavPharmacyItem extends StatelessWidget { final String title; final IconData icon; @@ -22,15 +22,10 @@ class BottomNavPharmacyItem extends StatelessWidget { final bool isHome; final IconData activeIcon; - BottomNavPharmacyItem( - {this.icon, - this.changeIndex, - this.index, - this.currentIndex, - this.activeIcon, - this.title, - this.onTap, - this.isHome = false}); + + BottomNavPharmacyItem({this.icon, this.changeIndex, this.index, this.currentIndex, this.activeIcon, this.title, this.onTap, this.isHome = false}); + + AppSharedPreferences sharedPref = AppSharedPreferences(); @override Widget build(BuildContext context) { @@ -39,7 +34,7 @@ class BottomNavPharmacyItem extends StatelessWidget { return Expanded( child: SizedBox( - height: 66.0, + height: 66.0, child: Stack( clipBehavior: Clip.none, children: [ @@ -49,13 +44,8 @@ class BottomNavPharmacyItem extends StatelessWidget { highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () { - if (!Provider.of(context, listen: false) - .isLogin && - (currentIndex == 2 || currentIndex == 3)) - Navigator.push( - context, - FadePage(page: WelcomeLogin()), - ); + if (!Provider.of(context, listen: false).isLogin && (currentIndex == 2 || currentIndex == 3)) + login(context); else changeIndex(currentIndex); }, @@ -63,9 +53,6 @@ class BottomNavPharmacyItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ -// SizedBox( -// height: 15, -// ), currentIndex == index ? Divider( color: Color(0xff5AB133), @@ -93,20 +80,14 @@ class BottomNavPharmacyItem extends StatelessWidget { title, textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, - fontWeight: currentIndex == index - ? FontWeight.normal - : FontWeight.w400, + fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400, fontSize: currentIndex == index ? 11 : 9, ), ], ), ), ), - if (currentIndex == 3 && - Provider.of(context, listen: false) - .cartResponse - .quantityCount != - 0) + if (currentIndex == 3 && Provider.of(context, listen: false).cartResponse.quantityCount != 0) Positioned( top: 11.5, right: -3.5, @@ -131,4 +112,35 @@ class BottomNavPharmacyItem extends StatelessWidget { ), ); } + + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login(BuildContext context) async { + final authService = new AuthProvider(); + 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); + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(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/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index b7293ce1..5e8c4cf7 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,13 +1,16 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.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/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class productTile extends StatelessWidget { @@ -27,30 +30,32 @@ class productTile extends StatelessWidget { final dynamic productID; final Function onDelete; final dynamic approvedTotalReviews; + final dynamic isRx; // 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, - this.approvedTotalReviews, - }); + 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, + this.isRx}); @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( height: 180, width: double.infinity, @@ -87,27 +92,59 @@ class productTile extends StatelessWidget { children: [ Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: productName, - style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), - ), - ), + child: projectViewModel.isArabic + ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ) + : Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: 'SAR $productPrice', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), - ), - ), + child: projectViewModel.isArabic + ? Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ) + : Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), ), this.isOrderDetails == false ? Row( @@ -131,7 +168,10 @@ class productTile extends StatelessWidget { ), Text( '${approvedTotalReviews} ${TranslationBase.of(context).reviews}', - style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 13), + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), ), ], ) @@ -163,10 +203,16 @@ class productTile extends StatelessWidget { color: Colors.green, ), onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, productID, context); - GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage(); + if (isRx == false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, productID, context); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .needPrescription); + } }, ), ], @@ -184,8 +230,13 @@ 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), ), ), ), @@ -211,7 +262,10 @@ 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), ), ), ], @@ -224,7 +278,7 @@ class productTile extends StatelessWidget { : Container(), // this.isOrderDetails == true && model.order[0].orderStatusId == 30? - if (status == 30 && this.isOrderDetails == true) + if (status == 30 || status == 997 && this.isOrderDetails == true) Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, @@ -251,21 +305,33 @@ class productTile extends StatelessWidget { // alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: '${productReviews} ${TranslationBase.of(context).reviews}', + text: + '${productReviews} ${TranslationBase.of(context).reviews}', // 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/pickupLocation/PickupLocationFromMap.dart b/lib/widgets/pickupLocation/PickupLocationFromMap.dart index 73edbe08..9a3ff303 100644 --- a/lib/widgets/pickupLocation/PickupLocationFromMap.dart +++ b/lib/widgets/pickupLocation/PickupLocationFromMap.dart @@ -48,6 +48,7 @@ class PickupLocationFromMap extends StatelessWidget { autocompleteLanguage: projectViewModel.currentLanguage, enableMapTypeButton: true, selectInitialPosition: true, + region: "SA", onPlacePicked: (PickResult result) { print(result.adrAddress); onPick(result); diff --git a/lib/widgets/text/app_texts_widget.dart b/lib/widgets/text/app_texts_widget.dart index a143236f..ea62e89a 100644 --- a/lib/widgets/text/app_texts_widget.dart +++ b/lib/widgets/text/app_texts_widget.dart @@ -60,11 +60,13 @@ class _AppTextState extends State { widget.data, textAlign: widget.textAlign, overflow: TextOverflow.clip, + style: TextStyle( color: widget.color == null ? Theme.of(context).textTheme.bodyText1.color : widget.color, fontWeight: widget.fontWeight, fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2), height: widget.height, + fontFamily: "Poppins", letterSpacing: widget.letterSpacing, // fontFamily: widget.fontFamily == null // ? projectViewModel.isArabic diff --git a/pubspec.yaml b/pubspec.yaml index dba94038..a7996dc8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: A new Flutter application. version: 4.3.5+1 environment: - sdk: ">=2.9.0 <3.0.0" + sdk: ">=2.7.0 <3.0.0" dependencies: flutter: @@ -14,58 +14,61 @@ dependencies: # Localizations flutter_localizations: sdk: flutter - intl: ^0.16.0 + intl: ^0.17.0 # web view - webview_flutter: ^1.0.7 + webview_flutter: ^2.3.1 # http client - http: ^0.12.1 - connectivity: ^0.4.9+3 - async: ^2.4.2 + http: ^0.13.4 + connectivity: ^3.0.6 + async: ^2.8.1 - audio_wave: ^0.0.3 + audio_wave: ^0.1.2 # State Management - provider: ^4.3.2+2 + provider: ^6.0.1 #Dependency Injection - get_it: ^4.0.2 + get_it: ^7.2.0 #Google Fit & Apple HealthKit - fit_kit: ^1.1.2 + health: ^3.0.3 #chart - fl_chart: ^0.12.3 + fl_chart: ^0.40.2 + + #Camera Preview + camera: ^0.9.4+5 # Permissions - permission_handler: ^5.0.0+hotfix.3 - device_info: ^0.4.2+4 + permission_handler: ^8.3.0 # Flutter Html View - flutter_html: ^1.2.0 + flutter_html: ^2.1.5 # Pagnation - pull_to_refresh: 1.6.2 + pull_to_refresh: ^2.0.0 # Native - flutter_device_type: ^0.2.0 - local_auth: ^0.6.2+3 - localstorage: ^3.0.3+6 - maps_launcher: ^1.2.1 - url_launcher: ^5.5.0 - shared_preferences: ^0.5.8 - flutter_flexible_toast: ^0.1.4 - firebase_messaging: ^7.0.3 - firebase_analytics: ^6.3.0 - cloud_firestore: ^0.14.3 + local_auth: ^1.1.8 + localstorage: ^4.0.0+1 + maps_launcher: ^2.0.1 + url_launcher: ^6.0.15 + shared_preferences: ^2.0.9 +# flutter_flexible_toast: ^0.1.4 + fluttertoast: ^8.0.8 + firebase_messaging: ^11.1.0 + firebase_analytics: ^8.3.4 + + # Progress bar progress_hud_v2: ^2.0.0 - percent_indicator: ^2.1.5 + percent_indicator: ^3.4.0 # Icons font_awesome_flutter: any cupertino_icons: ^1.0.0 # Image Attachments - image_picker: ^0.6.7+1 + image_picker: ^0.8.4+4 #GIF image flutter_gifimage: ^1.0.1 @@ -81,125 +84,127 @@ dependencies: # flutter_local_notifications: # charts - charts_flutter: ^0.9.0 + charts_flutter: ^0.12.0 - google_maps_flutter: ^1.0.3 - huawei_map: ^5.0.3+303 + google_maps_flutter: ^2.1.1 + + # Huawei + huawei_map: ^6.0.1+304 + huawei_push: ^5.3.0+304 # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 - flutter_polyline_points: ^0.1.0 - location: ^2.3.5 + flutter_polyline_points: ^1.0.0 + location: ^4.3.0 # Qr code Scanner - barcode_scan_fix: ^1.0.2 +# barcode_scan_fix: ^1.0.2 + barcode_scan2: ^4.1.4 # Rating Stars rating_bar: ^0.2.0 # Calendar - syncfusion_flutter_calendar: ^18.4.49 + syncfusion_flutter_calendar: ^19.3.55 # SVG Images - flutter_svg: ^0.19.0 + flutter_svg: ^0.23.0+1 #Calendar Events - manage_calendar_events: ^1.0.2 + manage_calendar_events: ^2.0.1 #InAppBrowser - flutter_inappwebview: ^4.0.0+4 + flutter_inappwebview: ^5.3.2 #Circular progress bar for reverse timer - circular_countdown_timer: ^0.0.5 + circular_countdown_timer: ^0.2.0 #Just Audio to play ringing for incoming video call - just_audio: ^0.3.4 + just_audio: ^0.9.18 #hijri hijri: ^2.0.3 #datetime_picker - flutter_datetime_picker: ^1.4.0 + flutter_datetime_picker: ^1.5.1 # Carousel carousel_pro: ^1.0.0 #local_notifications - flutter_local_notifications: ^1.5.0 - - #rxdart - rxdart: ^0.24.1 + flutter_local_notifications: ^9.1.4 #device_calendar - device_calendar: ^3.1.0 + device_calendar: ^4.0.1 #Handle Geolocation - geolocator: ^6.1.10 + geolocator: ^7.7.1 - jiffy: ^3.0.0 + jiffy: ^4.1.0 #Flutter WebRTC - flutter_webrtc: ^0.5.9 + flutter_webrtc: ^0.8.0 - screen: ^0.0.5 + screen_brightness: ^0.1.2 #google maps places - google_maps_place_picker: ^1.0.0 + google_maps_place_picker: ^2.1.0-nullsafety.3 + map_launcher: ^1.1.3 #countdown timer for Upcoming List - flutter_countdown_timer: ^1.6.0 + flutter_countdown_timer: ^4.1.0 #Dependencies for video call implementation - native_device_orientation: ^0.3.0 - enum_to_string: ^1.0.9 - wakelock: ^0.2.1+1 - after_layout: ^1.0.7 - twilio_programmable_video: ^0.6.2 - cached_network_image: ^2.4.1 + native_device_orientation: ^1.0.0 + wakelock: ^0.5.6 + after_layout: ^1.1.0 +# twilio_programmable_video: ^0.11.0+1 + cached_network_image: ^3.1.0+1 flutter_tts: path: flutter_tts-voice_enhancement - # flutter_tts: ^1.2.6 - sms_otp_auto_verify: ^1.2.2 wifi: ^0.1.5 vibration: ^1.7.3 - nfc_in_flutter: ^2.0.5 + + flutter_nfc_kit: ^3.2.0 speech_to_text: path: speech_to_text - in_app_update: ^1.1.15 + in_app_update: ^2.0.0 - in_app_review: ^1.0.4 + in_app_review: ^2.0.3 - badges: ^1.1.4 - syncfusion_flutter_sliders: ^18.4.49-beta + badges: ^2.0.1 + syncfusion_flutter_sliders: ^19.3.55 + searchable_dropdown: ^1.1.3 + dropdown_search: 0.4.9 # Dep by Zohaib - shimmer: ^1.1.2 - carousel_slider: ^2.3.1 - flutter_material_pickers: 1.7.4 - flutter_staggered_grid_view: 0.3.4 - flutter_hms_gms_availability: ^1.0.0 - huawei_location: - path: ./hms-plugins/flutter-hms-location - + shimmer: ^2.0.0 + carousel_slider: ^4.0.0 + flutter_material_pickers: ^3.1.2 + flutter_staggered_grid_view: ^0.4.1 + flutter_hms_gms_availability: ^2.0.0 + huawei_location: ^6.0.0+302 # Marker Animation - flutter_animarker: ^1.0.0 - auto_size_text: ^2.0.1 - equatable: ^1.2.5 - signalr_core: ^1.0.8 - wave: ^0.1.0 + flutter_animarker: ^3.2.0 + auto_size_text: ^3.0.0 + equatable: ^2.0.3 + signalr_core: ^1.1.1 + wave: ^0.2.0 + sms_retriever: ^1.0.0 + +dependency_overrides: + provider : ^5.0.0 + permission_handler : ^6.0.1+1 dev_dependencies: flutter_test: sdk: flutter - build_runner: any - + build_runner: ^2.1.5 flutter: - uses-material-design: true - # assets: assets: - assets/images/ diff --git a/speech_to_text/pubspec.yaml b/speech_to_text/pubspec.yaml index 34b3da29..831c9181 100644 --- a/speech_to_text/pubspec.yaml +++ b/speech_to_text/pubspec.yaml @@ -10,15 +10,15 @@ environment: dependencies: flutter: sdk: flutter - json_annotation: ^3.0.0 - clock: ^1.0.1 + json_annotation: ^4.3.0 + clock: ^1.1.0 dev_dependencies: flutter_test: sdk: flutter - build_runner: ^1.0.0 - json_serializable: ^3.0.0 - fake_async: ^1.0.1 + build_runner: ^2.1.5 + json_serializable: ^6.0.1 + fake_async: ^1.2.0 flutter: plugin: