diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 1d0e8453..347ab714 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("com.google.gms.google-services") version "4.4.1" // Add the version here id("dev.flutter.flutter-gradle-plugin") id("com.huawei.agconnect") + id("kotlin-parcelize") // id("com.mapbox.gradle.application") // id("com.mapbox.gradle.plugins.ndk") } @@ -191,6 +192,9 @@ dependencies { implementation(files("libs/PenNavUI.aar")) implementation(files("libs/Penguin.aar")) implementation(files("libs/PenguinRenderer.aar")) + api(files("libs/samsung-health-data-api.aar")) + implementation("com.huawei.hms:health:6.11.0.300") + implementation("com.huawei.hms:hmscoreinstaller:6.6.0.300") implementation("com.github.kittinunf.fuel:fuel:2.3.1") implementation("com.github.kittinunf.fuel:fuel-android:2.3.1") diff --git a/android/app/libs/samsung-health-data-api.aar b/android/app/libs/samsung-health-data-api.aar new file mode 100644 index 00000000..1fd24034 Binary files /dev/null and b/android/app/libs/samsung-health-data-api.aar differ diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 0e77b6b6..ffa3a908 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -124,6 +124,7 @@ , + grantResults: IntArray + ) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) + + val granted = grantResults.all { it == PackageManager.PERMISSION_GRANTED } + val intent = Intent("PERMISSION_RESULT_ACTION").apply { + putExtra("PERMISSION_GRANTED", granted) + } + sendBroadcast(intent) + + // Log the request code and permission results + Log.d("PermissionsResult", "Request Code: $requestCode") + Log.d("PermissionsResult", "Permissions: ${permissions.joinToString()}") + Log.d("PermissionsResult", "Grant Results: ${grantResults.joinToString()}") + + } + + override fun onResume() { + super.onResume() + } + +// override fun onActivityResult(requestCode: Int, resultCode: Int, @Nullable data: Intent?) { +// super.onActivityResult(requestCode, resultCode, data) +// +// // Process only the response result of the authorization process. +// if (requestCode == 1002) { +// // Obtain the authorization response result from the intent. +// val result: HealthKitAuthResult? = huaweiWatch?.mSettingController?.parseHealthKitAuthResultFromIntent(data) +// if (result == null) { +// Log.w(huaweiWatch?.TAG, "authorization fail") +// return +// } +// +// if (result.isSuccess) { +// Log.i(huaweiWatch?.TAG, "authorization success") +// if (result.getAuthAccount() != null && result.authAccount.authorizedScopes != null) { +// val authorizedScopes: MutableSet = result.authAccount.authorizedScopes +// if(authorizedScopes.isNotEmpty()) { +// huaweiWatch?.getHealthAppAuthorization() +// } +// } +// } else { +// Log.w("MainActivty", "authorization fail, errorCode:" + result.getErrorCode()) +// } +// } +// } +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PenguinInPlatformBridge.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PenguinInPlatformBridge.kt new file mode 100644 index 00000000..5fae68ca --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PenguinInPlatformBridge.kt @@ -0,0 +1,60 @@ +package com.cloudsolutions.HMGPatientApp + +import android.os.Build +import android.util.Log +import androidx.annotation.RequiresApi +import com.cloudsolutions.HMGPatientApp.penguin.PenguinView +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import com.cloudsolutions.HMGPatientApp.PermissionManager.HostNotificationPermissionManager +import com.cloudsolutions.HMGPatientApp.PermissionManager.HostBgLocationManager +import com.cloudsolutions.HMGPatientApp.PermissionManager.HostGpsStateManager +import io.flutter.plugin.common.MethodChannel + +class PenguinInPlatformBridge( + private var flutterEngine: FlutterEngine, + private var mainActivity: MainActivity +) { + + private lateinit var channel: MethodChannel + + companion object { + private const val CHANNEL = "launch_penguin_ui" + } + + @RequiresApi(Build.VERSION_CODES.O) + fun create() { +// openTok = OpenTok(mainActivity, flutterEngine) + channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) + channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> + when (call.method) { + "launchPenguin" -> { + print("the platform channel is being called") + + if (HostNotificationPermissionManager.isNotificationPermissionGranted(mainActivity)) + else HostNotificationPermissionManager.requestNotificationPermission(mainActivity) + HostBgLocationManager.requestLocationBackgroundPermission(mainActivity) + HostGpsStateManager.requestLocationPermission(mainActivity) + val args = call.arguments as Map? + Log.d("TAG", "configureFlutterEngine: $args") + println("args") + args?.let { + PenguinView( + mainActivity, + 100, + args, + flutterEngine.dartExecutor.binaryMessenger, + activity = mainActivity, + channel + ) + } + } + + else -> { + result.notImplemented() + } + } + } + } + +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/AppPreferences.java b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/AppPreferences.java new file mode 100644 index 00000000..2f6c9722 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/AppPreferences.java @@ -0,0 +1,139 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager; + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Handler; +import android.os.HandlerThread; + +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; + + +/** + * This preferences for app level + */ + +public class AppPreferences { + + public static final String PREF_NAME = "PenguinINUI_AppPreferences"; + public static final int MODE = Context.MODE_PRIVATE; + + public static final String campusIdKey = "campusId"; + + public static final String LANG = "Lang"; + + public static final String settingINFO = "SETTING-INFO"; + + public static final String userName = "userName"; + public static final String passWord = "passWord"; + + private static HandlerThread handlerThread; + private static Handler handler; + + static { + handlerThread = new HandlerThread("PreferencesHandlerThread"); + handlerThread.start(); + handler = new Handler(handlerThread.getLooper()); + } + + + + public static SharedPreferences getPreferences(final Context context) { + return context.getSharedPreferences(AppPreferences.PREF_NAME, AppPreferences.MODE); + } + + public static SharedPreferences.Editor getEditor(final Context context) { + return getPreferences(context).edit(); + } + + + public static void writeInt(final Context context, final String key, final int value) { + handler.post(() -> { + SharedPreferences.Editor editor = getEditor(context); + editor.putInt(key, value); + editor.apply(); + }); + } + + + public static int readInt(final Context context, final String key, final int defValue) { + Callable callable = () -> { + SharedPreferences preferences = getPreferences(context); + return preferences.getInt(key, -1); + }; + + Future future = new FutureTask<>(callable); + handler.post((Runnable) future); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); // Handle the exception appropriately + } + + return -1; // Return the default value in case of an error + } + + public static int getCampusId(final Context context) { + return readInt(context,campusIdKey,-1); + } + + + + public static void writeString(final Context context, final String key, final String value) { + handler.post(() -> { + SharedPreferences.Editor editor = getEditor(context); + editor.putString(key, value); + editor.apply(); + }); + } + + + public static String readString(final Context context, final String key, final String defValue) { + Callable callable = () -> { + SharedPreferences preferences = getPreferences(context); + return preferences.getString(key, defValue); + }; + + Future future = new FutureTask<>(callable); + handler.post((Runnable) future); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); // Handle the exception appropriately + } + + return defValue; // Return the default value in case of an error + } + + + public static void writeBoolean(final Context context, final String key, final boolean value) { + handler.post(() -> { + SharedPreferences.Editor editor = getEditor(context); + editor.putBoolean(key, value); + editor.apply(); + }); + } + + public static boolean readBoolean(final Context context, final String key, final boolean defValue) { + Callable callable = () -> { + SharedPreferences preferences = getPreferences(context); + return preferences.getBoolean(key, defValue); + }; + + Future future = new FutureTask<>(callable); + handler.post((Runnable) future); + + try { + return future.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); // Handle the exception appropriately + } + + return defValue; // Return the default value in case of an error + } + +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostBgLocationManager.java b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostBgLocationManager.java new file mode 100644 index 00000000..da0d8138 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostBgLocationManager.java @@ -0,0 +1,136 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager; + +import android.Manifest; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.provider.Settings; + +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import com.peng.pennavmap.PlugAndPlaySDK; +import com.peng.pennavmap.R; +import com.peng.pennavmap.enums.InitializationErrorType; + +/** + * Manages background location permission requests and handling for the application. + */ +public class HostBgLocationManager { + /** + * Request code for background location permission + */ + public static final int REQUEST_ACCESS_BACKGROUND_LOCATION_CODE = 301; + + /** + * Request code for navigating to app settings + */ + private static final int REQUEST_CODE_SETTINGS = 11234; + + /** + * Alert dialog for denied permissions + */ + private static AlertDialog deniedAlertDialog; + + /** + * Checks if the background location permission has been granted. + * + * @param context the context of the application or activity + * @return true if the permission is granted, false otherwise + */ + + public static boolean isLocationBackgroundGranted(Context context) { + return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_BACKGROUND_LOCATION) + == PackageManager.PERMISSION_GRANTED; + } + + /** + * Requests the background location permission from the user. + * + * @param activity the activity from which the request is made + */ + public static void requestLocationBackgroundPermission(Activity activity) { + // Check if the ACCESS_BACKGROUND_LOCATION permission is already granted + if (!isLocationBackgroundGranted(activity)) { + // Permission is not granted, so request it + ActivityCompat.requestPermissions(activity, + new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION}, + REQUEST_ACCESS_BACKGROUND_LOCATION_CODE); + } + } + + /** + * Displays a dialog prompting the user to grant the background location permission. + * + * @param activity the activity where the dialog is displayed + */ + public static void showLocationBackgroundPermission(Activity activity) { + AlertDialog alertDialog = new AlertDialog.Builder(activity) + .setCancelable(false) + .setMessage(activity.getString(R.string.com_penguin_nav_ui_geofence_alert_msg)) + .setPositiveButton(activity.getString(R.string.com_penguin_nav_ui_go_to_settings), (dialog, which) -> { + if (activity.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_BACKGROUND_LOCATION)) { + HostBgLocationManager.requestLocationBackgroundPermission(activity); + } else { + openAppSettings(activity); + } + if (dialog != null) { + dialog.dismiss(); + } + }) + .setNegativeButton(activity.getString(R.string.com_penguin_nav_ui_later), (dialog, which) -> { + dialog.cancel(); + }) + .create(); + + alertDialog.show(); + } + + /** + * Handles the scenario where permissions are denied by the user. + * Displays a dialog to guide the user to app settings or exit the activity. + * + * @param activity the activity where the dialog is displayed + */ + public static synchronized void handlePermissionsDenied(Activity activity) { + if (deniedAlertDialog != null && deniedAlertDialog.isShowing()) { + deniedAlertDialog.dismiss(); + } + + AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setCancelable(false) + .setMessage(activity.getString(R.string.com_penguin_nav_ui_permission_denied_dialog_msg)) + .setNegativeButton(activity.getString(R.string.com_penguin_nav_ui_cancel), (dialogInterface, i) -> { + if (PlugAndPlaySDK.externalPenNavUIDelegate != null) { + PlugAndPlaySDK.externalPenNavUIDelegate.onPenNavInitializationError( + InitializationErrorType.permissions.getTypeKey(), + InitializationErrorType.permissions); + } + activity.finish(); + }) + .setPositiveButton(activity.getString(R.string.com_penguin_nav_ui_go_settings), (dialogInterface, i) -> { + dialogInterface.dismiss(); + openAppSettings(activity); + }); + deniedAlertDialog = builder.create(); + deniedAlertDialog.show(); + } + + /** + * Opens the application's settings screen to allow the user to modify permissions. + * + * @param activity the activity from which the settings screen is launched + */ + private static void openAppSettings(Activity activity) { + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + Uri uri = Uri.fromParts("package", activity.getPackageName(), null); + intent.setData(uri); + + if (intent.resolveActivity(activity.getPackageManager()) != null) { + activity.startActivityForResult(intent, REQUEST_CODE_SETTINGS); + } + } +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostGpsStateManager.java b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostGpsStateManager.java new file mode 100644 index 00000000..f7f39c97 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostGpsStateManager.java @@ -0,0 +1,68 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager; + +import android.Manifest; +import android.app.Activity; +import android.content.Context; +import android.content.pm.PackageManager; +import android.location.LocationManager; + +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import com.peng.pennavmap.managers.permissions.managers.BgLocationManager; + +public class HostGpsStateManager { + private static final int LOCATION_PERMISSION_REQUEST_CODE = 1; + + + public boolean checkGPSEnabled(Activity activity) { + LocationManager gpsStateManager = (LocationManager) activity.getSystemService(Context.LOCATION_SERVICE); + return gpsStateManager.isProviderEnabled(LocationManager.GPS_PROVIDER); + } + + public static boolean isGpsGranted(Activity activity) { + return BgLocationManager.isLocationBackgroundGranted(activity) + || ContextCompat.checkSelfPermission( + activity, + Manifest.permission.ACCESS_FINE_LOCATION + ) == PackageManager.PERMISSION_GRANTED + && ContextCompat.checkSelfPermission( + activity, + Manifest.permission.ACCESS_COARSE_LOCATION + ) == PackageManager.PERMISSION_GRANTED; + } + + + /** + * Checks if the location permission is granted. + * + * @param activity the Activity context + * @return true if permission is granted, false otherwise + */ + public static boolean isLocationPermissionGranted(Activity activity) { + return ContextCompat.checkSelfPermission( + activity, + Manifest.permission.ACCESS_FINE_LOCATION + ) == PackageManager.PERMISSION_GRANTED && + ContextCompat.checkSelfPermission( + activity, + Manifest.permission.ACCESS_COARSE_LOCATION + ) == PackageManager.PERMISSION_GRANTED; + } + + /** + * Requests the location permission. + * + * @param activity the Activity context + */ + public static void requestLocationPermission(Activity activity) { + ActivityCompat.requestPermissions( + activity, + new String[]{ + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.ACCESS_COARSE_LOCATION, + }, + LOCATION_PERMISSION_REQUEST_CODE + ); + } +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostNotificationPermissionManager.java b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostNotificationPermissionManager.java new file mode 100644 index 00000000..2dac16ca --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/HostNotificationPermissionManager.java @@ -0,0 +1,73 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager; + +import android.app.Activity; +import android.content.pm.PackageManager; +import android.os.Build; + +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.core.app.NotificationManagerCompat; + +public class HostNotificationPermissionManager { + private static final int REQUEST_NOTIFICATION_PERMISSION = 100; + + + /** + * Checks if the notification permission is granted. + * + * @return true if the notification permission is granted, false otherwise. + */ + public static boolean isNotificationPermissionGranted(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + try { + return ActivityCompat.checkSelfPermission(activity, android.Manifest.permission.POST_NOTIFICATIONS) + == PackageManager.PERMISSION_GRANTED; + } catch (Exception e) { + // Handle cases where the API is unavailable + e.printStackTrace(); + return NotificationManagerCompat.from(activity).areNotificationsEnabled(); + } + } else { + // Permissions were not required below Android 13 for notifications + return NotificationManagerCompat.from(activity).areNotificationsEnabled(); + } + } + + /** + * Requests the notification permission. + */ + public static void requestNotificationPermission(Activity activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + if (!isNotificationPermissionGranted(activity)) { + ActivityCompat.requestPermissions(activity, + new String[]{android.Manifest.permission.POST_NOTIFICATIONS}, + REQUEST_NOTIFICATION_PERMISSION); + } + } + } + + /** + * Handles the result of the permission request. + * + * @param requestCode The request code passed in requestPermissions(). + * @param permissions The requested permissions. + * @param grantResults The grant results for the corresponding permissions. + */ + public static boolean handlePermissionResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + if (permissions.length > 0 && + permissions[0].equals(android.Manifest.permission.POST_NOTIFICATIONS) && + grantResults.length > 0 && + grantResults[0] == PackageManager.PERMISSION_GRANTED) { + // Permission granted + System.out.println("Notification permission granted."); + return true; + } else { + // Permission denied + System.out.println("Notification permission denied."); + return false; + } + + } + + +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionHelper.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionHelper.kt new file mode 100644 index 00000000..9a033f36 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionHelper.kt @@ -0,0 +1,27 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager + +import android.Manifest + +object PermissionHelper { + + fun getRequiredPermissions(): Array { + val permissions = mutableListOf( + Manifest.permission.INTERNET, + Manifest.permission.ACCESS_FINE_LOCATION, + Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_NETWORK_STATE, + Manifest.permission.BLUETOOTH, + Manifest.permission.BLUETOOTH_ADMIN, +// Manifest.permission.ACTIVITY_RECOGNITION + ) + + // For Android 12 (API level 31) and above, add specific permissions +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { // Android 12 (API 31) and above + permissions.add(Manifest.permission.BLUETOOTH_SCAN) + permissions.add(Manifest.permission.BLUETOOTH_CONNECT) + permissions.add(Manifest.permission.HIGH_SAMPLING_RATE_SENSORS) +// } + + return permissions.toTypedArray() + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionManager.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionManager.kt new file mode 100644 index 00000000..6dadddb1 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionManager.kt @@ -0,0 +1,50 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager + +import android.app.Activity +import android.content.Context +import android.content.pm.PackageManager +import android.os.Build +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat + +class PermissionManager( + private val context: Context, + val listener: PermissionListener, + private val requestCode: Int, + vararg permissions: String +) { + + private val permissionsArray = permissions + + interface PermissionListener { + fun onPermissionGranted() + fun onPermissionDenied() + } + + fun arePermissionsGranted(): Boolean { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + permissionsArray.all { + ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED + } + } else { + true + } + } + + fun requestPermissions(activity: Activity) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + ActivityCompat.requestPermissions(activity, permissionsArray, requestCode) + } + } + + fun handlePermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + if (this.requestCode == requestCode) { + val allGranted = grantResults.all { it == PackageManager.PERMISSION_GRANTED } + if (allGranted) { + listener.onPermissionGranted() + } else { + listener.onPermissionDenied() + } + } + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionResultReceiver.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionResultReceiver.kt new file mode 100644 index 00000000..7c2df4cb --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/PermissionManager/PermissionResultReceiver.kt @@ -0,0 +1,15 @@ +package com.cloudsolutions.HMGPatientApp.PermissionManager + +// PermissionResultReceiver.kt +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent + +class PermissionResultReceiver( + private val callback: (Boolean) -> Unit +) : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + val granted = intent?.getBooleanExtra("PERMISSION_GRANTED", false) ?: false + callback(granted) + } +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinMethod.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinMethod.kt new file mode 100644 index 00000000..4807bcc7 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinMethod.kt @@ -0,0 +1,13 @@ +package com.cloudsolutions.HMGPatientApp.penguin + +enum class PenguinMethod { + // initializePenguin("initializePenguin"), + // configurePenguin("configurePenguin"), + // showPenguinUI("showPenguinUI"), + // onPenNavUIDismiss("onPenNavUIDismiss"), + // onReportIssue("onReportIssue"), + // onPenNavSuccess("onPenNavSuccess"), + onPenNavInitializationError // onLocationOffCampus("onLocationOffCampus"), + // navigateToPOI("navigateToPOI"), + // openSharedLocation("openSharedLocation"); +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinNavigator.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinNavigator.kt new file mode 100644 index 00000000..29cc82df --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinNavigator.kt @@ -0,0 +1,97 @@ +package com.cloudsolutions.HMGPatientApp.penguin + +import android.content.Context +import com.google.gson.Gson +import com.peng.pennavmap.PlugAndPlaySDK +import com.peng.pennavmap.connections.ApiController +import com.peng.pennavmap.interfaces.RefIdDelegate +import com.peng.pennavmap.models.TokenModel +import com.peng.pennavmap.models.postmodels.PostToken +import com.peng.pennavmap.utils.AppSharedData +import okhttp3.ResponseBody +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response +import android.util.Log + + +class PenguinNavigator() { + + fun navigateTo(mContext: Context, refID: String, delegate: RefIdDelegate,clientID : String,clientKey : String ) { + val postToken = PostToken(clientID, clientKey) + getToken(mContext, postToken, object : RefIdDelegate { + override fun onRefByIDSuccess(PoiId: String?) { + Log.e("navigateTo", "PoiId is+++++++ $refID") + + PlugAndPlaySDK.navigateTo(mContext, refID, object : RefIdDelegate { + override fun onRefByIDSuccess(PoiId: String?) { + Log.e("navigateTo", "PoiId 2is+++++++ $PoiId") + + delegate.onRefByIDSuccess(refID) + + } + + override fun onGetByRefIDError(error: String?) { + delegate.onRefByIDSuccess(error) + } + + }) + + + } + + override fun onGetByRefIDError(error: String?) { + delegate.onRefByIDSuccess(error) + } + + }) + + } + + fun getToken(mContext: Context, postToken: PostToken?, apiTokenCallBack: RefIdDelegate) { + try { + // Create the API call + val purposesCall: Call = ApiController.getInstance(mContext) + .apiMethods + .getToken(postToken) + + // Enqueue the call for asynchronous execution + purposesCall.enqueue(object : Callback { + override fun onResponse( + call: Call, + response: Response + ) { + if (response.isSuccessful() && response.body() != null) { + try { + response.body()?.use { responseBody -> + val responseBodyString: String = responseBody.string() // Use `string()` to get the actual response content + if (responseBodyString.isNotEmpty()) { + val tokenModel = Gson().fromJson(responseBodyString, TokenModel::class.java) + if (tokenModel != null && tokenModel.token != null) { + AppSharedData.apiToken = tokenModel.token + apiTokenCallBack.onRefByIDSuccess(tokenModel.token) + } else { + apiTokenCallBack.onGetByRefIDError("Failed to parse token model") + } + } else { + apiTokenCallBack.onGetByRefIDError("Response body is empty") + } + } + } catch (e: Exception) { + apiTokenCallBack.onGetByRefIDError("An error occurred: ${e.message}") + } + } else { + apiTokenCallBack.onGetByRefIDError("Unsuccessful response: " + response.code()) + } + } + + override fun onFailure(call: Call, t: Throwable) { + apiTokenCallBack.onGetByRefIDError(t.message) + } + }) + } catch (error: Exception) { + apiTokenCallBack.onGetByRefIDError("Exception during API call: $error") + } + } + +} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinView.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinView.kt new file mode 100644 index 00000000..2122e01c --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/penguin/PenguinView.kt @@ -0,0 +1,376 @@ +package com.cloudsolutions.HMGPatientApp.penguin + +import android.app.Activity +import android.content.Context +import android.content.Context.RECEIVER_EXPORTED +import android.content.IntentFilter +import android.graphics.Color +import android.os.Build +import android.util.Log +import android.view.View +import android.view.ViewGroup +import android.widget.RelativeLayout +import android.widget.Toast +import androidx.annotation.RequiresApi +import com.cloudsolutions.HMGPatientApp.PermissionManager.PermissionManager +import com.cloudsolutions.HMGPatientApp.PermissionManager.PermissionResultReceiver +import com.cloudsolutions.HMGPatientApp.MainActivity +import com.cloudsolutions.HMGPatientApp.PermissionManager.PermissionHelper +import com.peng.pennavmap.PlugAndPlayConfiguration +import com.peng.pennavmap.PlugAndPlaySDK +import com.peng.pennavmap.enums.InitializationErrorType +import com.peng.pennavmap.interfaces.PenNavUIDelegate +import com.peng.pennavmap.utils.Languages +import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugin.platform.PlatformView +import com.peng.pennavmap.interfaces.PIEventsDelegate +import com.peng.pennavmap.interfaces.PILocationDelegate +import com.peng.pennavmap.interfaces.RefIdDelegate +import com.peng.pennavmap.models.LocationMessage +import com.peng.pennavmap.models.PIReportIssue +import java.util.ArrayList +import penguin.com.pennav.renderer.PIRendererSettings + +/** + * Custom PlatformView for displaying Penguin UI components within a Flutter app. + * Implements `PlatformView` for rendering the view, `MethodChannel.MethodCallHandler` for handling method calls, + * and `PenNavUIDelegate` for handling SDK events. + */ +@RequiresApi(Build.VERSION_CODES.O) +internal class PenguinView( + context: Context, + id: Int, + val creationParams: Map, + messenger: BinaryMessenger, + activity: MainActivity, + val channel: MethodChannel +) : PlatformView, MethodChannel.MethodCallHandler, PenNavUIDelegate, PIEventsDelegate, + PILocationDelegate { + // The layout for displaying the Penguin UI + private val mapLayout: RelativeLayout = RelativeLayout(context) + private val _context: Context = context + + private val permissionResultReceiver: PermissionResultReceiver + private val permissionIntentFilter = IntentFilter("PERMISSION_RESULT_ACTION") + + private companion object { + const val PERMISSIONS_REQUEST_CODE = 1 + } + + private lateinit var permissionManager: PermissionManager + + // Reference to the main activity + private var _activity: Activity = activity + + private lateinit var mContext: Context + + lateinit var navigator: PenguinNavigator + + init { + // Set layout parameters for the mapLayout + mapLayout.layoutParams = ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT + ) + + mContext = context + + + permissionResultReceiver = PermissionResultReceiver { granted -> + if (granted) { + onPermissionsGranted() + } else { + onPermissionsDenied() + } + } + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + mContext.registerReceiver( + permissionResultReceiver, + permissionIntentFilter, + RECEIVER_EXPORTED + ) + } else { + mContext.registerReceiver( + permissionResultReceiver, + permissionIntentFilter, + ) + } + + // Set the background color of the layout + mapLayout.setBackgroundColor(Color.RED) + + permissionManager = PermissionManager( + context = mContext, + listener = object : PermissionManager.PermissionListener { + override fun onPermissionGranted() { + // Handle permissions granted + onPermissionsGranted() + } + + override fun onPermissionDenied() { + // Handle permissions denied + onPermissionsDenied() + } + }, + requestCode = PERMISSIONS_REQUEST_CODE, + PermissionHelper.getRequiredPermissions().get(0) + ) + + if (!permissionManager.arePermissionsGranted()) { + permissionManager.requestPermissions(_activity) + } else { + // Permissions already granted + permissionManager.listener.onPermissionGranted() + } + + + } + + private fun onPermissionsGranted() { + // Handle the actions when permissions are granted + Log.d("PermissionsResult", "onPermissionsGranted") + // Register the platform view factory for creating custom views + + // Initialize the Penguin SDK + initPenguin() + + + } + + private fun onPermissionsDenied() { + // Handle the actions when permissions are denied + Log.d("PermissionsResult", "onPermissionsDenied") + + } + + /** + * Returns the view associated with this PlatformView. + * + * @return The main view for this PlatformView. + */ + override fun getView(): View { + return mapLayout + } + + /** + * Cleans up resources associated with this PlatformView. + */ + override fun dispose() { + // Cleanup code if needed + } + + /** + * Handles method calls from Dart code. + * + * @param call The method call from Dart. + * @param result The result callback to send responses back to Dart. + */ + override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { + // Handle method calls from Dart code here + } + + /** + * Initializes the Penguin SDK with custom configuration and delegates. + */ + private fun initPenguin() { + navigator = PenguinNavigator() + // Configure the PlugAndPlaySDK + val language = when (creationParams["languageCode"] as String) { + "ar" -> Languages.ar + "en" -> Languages.en + else -> { + Languages.en + } + } + + +// PlugAndPlaySDK.configuration = Builder() +// .setClientData(MConstantsDemo.CLIENT_ID, MConstantsDemo.CLIENT_KEY) +// .setLanguageID(selectedLanguage) +// .setBaseUrl(MConstantsDemo.DATA_URL, MConstantsDemo.POSITION_URL) +// .setServiceName(MConstantsDemo.DATA_SERVICE_NAME, MConstantsDemo.POSITION_SERVICE_NAME) +// .setUserName(name) +// .setSimulationModeEnabled(isSimulation) +// .setCustomizeColor(if (MConstantsDemo.APP_COLOR != null) MConstantsDemo.APP_COLOR else "#2CA0AF") +// .setEnableBackButton(MConstantsDemo.SHOW_BACK_BUTTON) +// .setCampusId(MConstantsDemo.selectedCampusId) +// +// .setShowUILoader(true) +// .build() + + PIRendererSettings.styleUri = "mapbox://styles/rwaid/cm3h30b36007v01qz7ik8a0sk" + + PlugAndPlaySDK.configuration = PlugAndPlayConfiguration.Builder() + .setBaseUrl( + creationParams["dataURL"] as String, + creationParams["positionURL"] as String + ) + .setServiceName( + creationParams["dataServiceName"] as String, + creationParams["positionServiceName"] as String + ) + .setClientData( + creationParams["clientID"] as String, + creationParams["clientKey"] as String + ) + .setUserName(creationParams["username"] as String) +// .setLanguageID(Languages.en) + .setLanguageID(language) + .setSimulationModeEnabled(creationParams["isSimulationModeEnabled"] as Boolean) + .setEnableBackButton(true) +// .setDeepLinkData("deeplink") + .setCustomizeColor("#2CA0AF") + .setDeepLinkSchema("", "") + .setIsEnableReportIssue(true) + .setDeepLinkData("") + .setEnableSharedLocationCallBack(false) + .setShowUILoader(true) + .setCampusId(creationParams["projectID"] as Int) + .build() + + + Log.d( + "TAG", + "initPenguin: ${creationParams["projectID"]}" + ) + + Log.d( + "TAG", + "initPenguin: creation param are ${creationParams}" + ) + + // Set location delegate to handle location updates +// PlugAndPlaySDK.setPiLocationDelegate { + // Example code to handle location updates + // Uncomment and modify as needed + // if (location.size() > 0) + // Toast.makeText(_context, "Location Info Latitude: ${location[0]}, Longitude: ${location[1]}", Toast.LENGTH_SHORT).show() +// } + + // Set events delegate for reporting issues +// PlugAndPlaySDK.setPiEventsDelegate(new PIEventsDelegate() { +// @Override +// public void onReportIssue(PIReportIssue issue) { +// Log.e("Issue Reported: ", issue.getReportType()); +// } +// // Implement issue reporting logic here } +// @Override +// public void onSharedLocation(String link) { +// // Implement Shared location logic here +// } +// }) + + // Start the Penguin SDK + PlugAndPlaySDK.setPiEventsDelegate(this) + PlugAndPlaySDK.setPiLocationDelegate(this) + PlugAndPlaySDK.start(mContext, this) + } + + + /** + * Navigates to the specified reference ID. + * + * @param refID The reference ID to navigate to. + */ + fun navigateTo(refID: String) { + try { + if (refID.isBlank()) { + Log.e("navigateTo", "Invalid refID: The reference ID is blank.") + } +// referenceId = refID + navigator.navigateTo(mContext, refID,object : RefIdDelegate { + override fun onRefByIDSuccess(PoiId: String?) { + Log.e("navigateTo", "PoiId is penguin view+++++++ $PoiId") + +// channelFlutter.invokeMethod( +// PenguinMethod.navigateToPOI.name, +// "navigateTo Success" +// ) + } + + override fun onGetByRefIDError(error: String?) { + Log.e("navigateTo", "error is penguin view+++++++ $error") + +// channelFlutter.invokeMethod( +// PenguinMethod.navigateToPOI.name, +// "navigateTo Failed: Invalid refID" +// ) + } + } , creationParams["clientID"] as String, creationParams["clientKey"] as String ) + + } catch (e: Exception) { + Log.e("navigateTo", "Exception occurred during navigation: ${e.message}", e) +// channelFlutter.invokeMethod( +// PenguinMethod.navigateToPOI.name, +// "Failed: Exception - ${e.message}" +// ) + } + } + + /** + * Called when Penguin UI setup is successful. + * + * @param warningCode Optional warning code received from the SDK. + */ + override fun onPenNavSuccess(warningCode: String?) { + val clinicId = creationParams["clinicID"] as String + + if(clinicId.isEmpty()) return + + navigateTo(clinicId) +// navigateTo("3-1") + } + + /** + * Called when there is an initialization error with Penguin UI. + * + * @param description Description of the error. + * @param errorType Type of initialization error. + */ + override fun onPenNavInitializationError( + description: String?, + errorType: InitializationErrorType? + ) { + val arguments: Map = mapOf( + "description" to description, + "type" to errorType?.name + ) + Log.d( + "description", + "description : ${description}" + ) + + channel.invokeMethod(PenguinMethod.onPenNavInitializationError.name, arguments) + Toast.makeText(mContext, "Navigation Error: $description", Toast.LENGTH_SHORT).show() + } + + /** + * Called when Penguin UI is dismissed. + */ + override fun onPenNavUIDismiss() { + // Handle UI dismissal if needed + try { + mContext.unregisterReceiver(permissionResultReceiver) + dispose(); + } catch (e: IllegalArgumentException) { + Log.e("PenguinView", "Receiver not registered: $e") + } + } + + override fun onReportIssue(issue: PIReportIssue?) { + TODO("Not yet implemented") + } + + override fun onSharedLocation(link: String?) { + TODO("Not yet implemented") + } + + override fun onLocationOffCampus(location: ArrayList?) { + TODO("Not yet implemented") + } + + override fun onLocationMessage(locationMessage: LocationMessage?) { + TODO("Not yet implemented") + } +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/SamsungWatch.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/SamsungWatch.kt new file mode 100644 index 00000000..336651e4 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/SamsungWatch.kt @@ -0,0 +1,402 @@ +package com.cloudsolutions.HMGPatientApp.watch.samsung_watch + + + +import android.os.Build +import android.util.Log +import androidx.annotation.RequiresApi +import com.cloudsolutions.HMGPatientApp.MainActivity +import com.cloudsolutions.HMGPatientApp.watch.samsung_watch.model.Vitals +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import com.samsung.android.sdk.health.data.HealthDataService +import com.samsung.android.sdk.health.data.HealthDataStore +import com.samsung.android.sdk.health.data.data.AggregatedData +import com.samsung.android.sdk.health.data.data.HealthDataPoint +import com.samsung.android.sdk.health.data.permission.AccessType +import com.samsung.android.sdk.health.data.permission.Permission +import com.samsung.android.sdk.health.data.request.DataType +import com.samsung.android.sdk.health.data.request.DataTypes +import com.samsung.android.sdk.health.data.request.LocalTimeFilter +import com.samsung.android.sdk.health.data.request.LocalTimeGroup +import com.samsung.android.sdk.health.data.request.LocalTimeGroupUnit +import com.samsung.android.sdk.health.data.request.Ordering +import com.samsung.android.sdk.health.data.response.DataResponse +import io.flutter.plugin.common.MethodChannel +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.cancel +import kotlinx.coroutines.launch +import java.time.LocalDateTime +import java.time.LocalTime + +class SamsungWatch( + private var flutterEngine: FlutterEngine, + private var mainActivity: MainActivity +) { + + private lateinit var channel: MethodChannel + private lateinit var dataStore: HealthDataStore + private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO) + private val TAG = "SamsungWatch" + + + private lateinit var vitals: MutableMap> + companion object { + private const val CHANNEL = "samsung_watch" + + } + init{ + create() + } + + @RequiresApi(Build.VERSION_CODES.O) + fun create() { + Log.d(TAG, "create: is called") +// openTok = OpenTok(mainActivity, flutterEngine) + channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) + channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> + when (call.method) { + "init" -> { + Log.d(TAG, "onMethodCall: init called") + dataStore = HealthDataService.getStore(mainActivity) + vitals = mutableMapOf() + result.success("initialized") + } + + "getPermission"->{ + if(!this::dataStore.isInitialized) + result.error("DataStoreNotInitialized", "Please call init before requesting permissions", null) + val permSet = setOf( + Permission.of(DataTypes.HEART_RATE, AccessType.READ), + Permission.of(DataTypes.STEPS, AccessType.READ), + Permission.of(DataTypes.BLOOD_OXYGEN, AccessType.READ), + Permission.of(DataTypes.ACTIVITY_SUMMARY, AccessType.READ), + Permission.of(DataTypes.SLEEP, AccessType.READ), + Permission.of(DataTypes.BODY_TEMPERATURE, AccessType.READ), + Permission.of(DataTypes.EXERCISE, AccessType.READ), +// Permission.of(DataTypes.SKIN_TEMPERATURE, AccessType.READ), +// Permission.of(DataTypes.NUTRITION, AccessType.READ), + + ) + scope.launch { + try { + var granted = dataStore.getGrantedPermissions(permSet) + + if (granted.containsAll(permSet)) { + result.success("Permission Granted") + return@launch + } + + granted = dataStore.requestPermissions(permSet, mainActivity) + + if (granted.containsAll(permSet)) { + result.success("Permission Granted") // adapt result as needed + return@launch + } + result.error("PermissionError", "Permission Not Granted", null) // adapt result as needed + } catch (e: Exception) { + Log.e(TAG, "create: getPermission failed", e) + result.error("PermissionError", e.message, null) + } + } + } + + "getHeartRate"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.HEART_RATE.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val heartRateList = dataStore.readData(readRequest).dataList + processHeartVital(heartRateList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + } + + + "getSleepData" -> { + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.SLEEP.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.ASC) + .build() + scope.launch { + val sleepData = dataStore.readData(readRequest).dataList + processSleepVital(sleepData) + print("the data is $vitals") + Log.d(TAG, "the data is $vitals") + result.success("Data is obtained") + } + + } + + "steps"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val aggregateRequest = DataType.StepsType.TOTAL.requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.ASC) + .build() + + scope.launch { + val steps = dataStore.aggregateData(aggregateRequest) + processStepsCount(steps) + print("the data is $vitals") + Log.d(TAG, "the data is $vitals") + result.success("Data is obtained") + } + } + + "activitySummary"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val readRequest = DataType.ActivitySummaryType.TOTAL_ACTIVE_CALORIES_BURNED + .requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val activityResult = dataStore.aggregateData(readRequest).dataList + processActivity(activityResult) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + +// val readRequest = DataTypes.EXERCISE.readDataRequestBuilder +// .setLocalTimeFilter(localTimeFilter) +// .build() +// +// scope.launch{ +// try { +// val readResult = dataStore.readData(readRequest) +// val dataPoints = readResult.dataList +// +// processActivity(dataPoints) +// +// +// } catch (e: Exception) { +// e.printStackTrace() +// } +// result.success("Data is obtained") +// } + } + + "bloodOxygen"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.BLOOD_OXYGEN.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val bloodOxygenList = dataStore.readData(readRequest).dataList + processBloodOxygen(bloodOxygenList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals["bloodOxygen"]}") + result.success("Data is obtained") + } + } + + + "bodyTemperature"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.BODY_TEMPERATURE.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val bodyTemperatureList = dataStore.readData(readRequest).dataList + processBodyTemperature(bodyTemperatureList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals["bodyTemperature"]}") + result.success("Data is obtained") + } + } + + "distance"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val readRequest = DataType.ActivitySummaryType.TOTAL_DISTANCE.requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val activityResult = dataStore.aggregateData(readRequest).dataList + processDistance(activityResult) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + } + + "retrieveData"->{ + if(vitals.isEmpty()){ + result.error("NoDataFound", "No Data was obtained", null) + return@setMethodCallHandler + } + result.success(""" + { + "heartRate": ${vitals["heartRate"]}, + "steps": ${vitals["steps"]}, + "sleep": ${vitals["sleep"]}, + "activity": ${vitals["activity"]}, + "bloodOxygen": ${vitals["bloodOxygen"]}, + "bodyTemperature": ${vitals["bodyTemperature"]}, + "distance": ${vitals["distance"]} + } + """.trimIndent()) + } + + + "closeCoroutineScope"->{ + destroy() + result.success("Coroutine Scope Cancelled") + } + + else -> { + result.notImplemented() + } + } + } + } + + private fun CoroutineScope.processDistance(activityResult: List>) { + vitals["distance"] = mutableListOf() + activityResult.forEach { stepData -> + val vitalData = Vitals().apply { + + value = stepData.value.toString() + timeStamp = stepData.startTime.toString() + } + (vitals["distance"] as MutableList).add(vitalData) + } + } + + private fun CoroutineScope.processBodyTemperature( bodyTemperatureList :List) { + vitals["bodyTemperature"] = mutableListOf() + bodyTemperatureList.forEach { stepData -> + val vitalData = Vitals().apply { + value = stepData.getValue(DataType.BodyTemperatureType.BODY_TEMPERATURE).toString() + timeStamp = stepData.endTime.toString() + } + (vitals["bodyTemperature"] as MutableList).add(vitalData) + } + } + + private fun CoroutineScope.processBloodOxygen( bloodOxygenList :List) { + vitals["bloodOxygen"] = mutableListOf() + bloodOxygenList.forEach { stepData -> + val vitalData = Vitals().apply { + value = stepData.getValue(DataType.BloodOxygenType.OXYGEN_SATURATION).toString() + timeStamp = stepData.endTime.toString() + } + (vitals["bloodOxygen"] as MutableList).add(vitalData) + } + } + + +// private fun CoroutineScope.processActivity(activityResult: List>) { +// +// vitals["activity"] = mutableListOf() +// activityResult.forEach { stepData -> +// val vitalData = Vitals().apply { +// +// value = stepData.value.toString() +// timeStamp = stepData.startTime.toString() +// } +// (vitals["activity"] as MutableList).add(vitalData) +// } +// } + private fun CoroutineScope.processActivity(activityResult: List>) { + + vitals["activity"] = mutableListOf() + activityResult.forEach { stepData -> + val vitalData = Vitals().apply { + + value = stepData.value.toString() + timeStamp = stepData.startTime.toString() + } + (vitals["activity"] as MutableList).add(vitalData) + } + +// dataPoints.forEach { dataPoint -> +// val sessions = dataPoint.getValue(DataType.ExerciseType.SESSIONS) +// +// sessions?.forEach { session -> +// +// val exerciseSessionCalories = session.calories +// val vitalData = Vitals().apply { +// value = exerciseSessionCalories.toString() +// timeStamp = session.startTime.toString() +// } +// (vitals["activity"] as MutableList).add(vitalData) +// } +// } + } + + private fun CoroutineScope.processStepsCount(result: DataResponse>) { + val stepCount = ArrayList>() + var totalSteps: Long = 0 + vitals["steps"] = mutableListOf() + result.dataList.forEach { stepData -> + val vitalData = Vitals().apply { + value = (stepData.value as Long).toString() + timeStamp = stepData.startTime.toString() + } + (vitals["steps"] as MutableList).add(vitalData) + } + + } + + private fun CoroutineScope.processSleepVital(sleepData: List) { + vitals["sleep"] = mutableListOf() + sleepData.forEach { + (vitals["sleep"] as MutableList).add( + Vitals().apply { + timeStamp = it.startTime.toString() + value = (it.getValue(DataType.SleepType.DURATION)?.toMillis().toString()) + } + ) + } + } + + private suspend fun CoroutineScope.processHeartVital( + heartRateList: List, + ) { + vitals["heartRate"] = mutableListOf() + heartRateList.forEach { + (vitals["heartRate"] as MutableList).add(processHeartRateData(it)) + } + } + + private fun processHeartRateData(heartRateData: HealthDataPoint) = + Vitals().apply { + heartRateData.getValue(DataType.HeartRateType.MAX_HEART_RATE)?.let { + value = it.toString() + } + timeStamp = heartRateData.startTime.toString() + } + + + fun destroy() { + scope.cancel() + } + +} diff --git a/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/model/Vitals.kt b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/model/Vitals.kt new file mode 100644 index 00000000..577ab283 --- /dev/null +++ b/android/app/src/main/kotlin/com/cloudsolutions/HMGPatientApp/watch/samsung_watch/model/Vitals.kt @@ -0,0 +1,13 @@ +package com.cloudsolutions.HMGPatientApp.watch.samsung_watch.model + +data class Vitals( + var value : String = "", + var timeStamp :String = "" +){ + override fun toString(): String { + return """{ + "value": "$value", + "timeStamp": "$timeStamp"} + """.trimIndent() + } +} \ No newline at end of file diff --git a/android/app/src/main2/AndroidManifest.xml b/android/app/src/main2/AndroidManifest.xml new file mode 100644 index 00000000..e07739b9 --- /dev/null +++ b/android/app/src/main2/AndroidManifest.xml @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/app/src/main2/kotlin/com/ejada/hmg/MainActivity.kt b/android/app/src/main2/kotlin/com/ejada/hmg/MainActivity.kt new file mode 100644 index 00000000..ece584b2 --- /dev/null +++ b/android/app/src/main2/kotlin/com/ejada/hmg/MainActivity.kt @@ -0,0 +1,84 @@ +package com.ejada.hmg + +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import android.util.Log +import android.view.WindowManager +import androidx.annotation.NonNull +import androidx.annotation.Nullable +import androidx.annotation.RequiresApi +import com.ejada.hmg.penguin.PenguinInPlatformBridge +import com.ejada.hmg.watch.huawei.HuaweiWatch +import com.ejada.hmg.watch.huawei.samsung_watch.SamsungWatch +import com.huawei.hms.hihealth.result.HealthKitAuthResult +import com.huawei.hms.support.api.entity.auth.Scope +import io.flutter.embedding.android.FlutterFragmentActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugins.GeneratedPluginRegistrant + + +class MainActivity: FlutterFragmentActivity() { + + private var huaweiWatch : HuaweiWatch? = null + @RequiresApi(Build.VERSION_CODES.O) + 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) + + PenguinInPlatformBridge(flutterEngine, this).create() + SamsungWatch(flutterEngine, this) + huaweiWatch = HuaweiWatch(flutterEngine, this) + } + + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults) + + val granted = grantResults.all { it == PackageManager.PERMISSION_GRANTED } + val intent = Intent("PERMISSION_RESULT_ACTION").apply { + putExtra("PERMISSION_GRANTED", granted) + } + sendBroadcast(intent) + + // Log the request code and permission results + Log.d("PermissionsResult", "Request Code: $requestCode") + Log.d("PermissionsResult", "Permissions: ${permissions.joinToString()}") + Log.d("PermissionsResult", "Grant Results: ${grantResults.joinToString()}") + + } + + override fun onResume() { + super.onResume() + } + +// override fun onActivityResult(requestCode: Int, resultCode: Int, @Nullable data: Intent?) { +// super.onActivityResult(requestCode, resultCode, data) +// +// // Process only the response result of the authorization process. +// if (requestCode == 1002) { +// // Obtain the authorization response result from the intent. +// val result: HealthKitAuthResult? = huaweiWatch?.mSettingController?.parseHealthKitAuthResultFromIntent(data) +// if (result == null) { +// Log.w(huaweiWatch?.TAG, "authorization fail") +// return +// } +// +// if (result.isSuccess) { +// Log.i(huaweiWatch?.TAG, "authorization success") +// if (result.getAuthAccount() != null && result.authAccount.authorizedScopes != null) { +// val authorizedScopes: MutableSet = result.authAccount.authorizedScopes +// if(authorizedScopes.isNotEmpty()) { +// huaweiWatch?.getHealthAppAuthorization() +// } +// } +// } else { +// Log.w("MainActivty", "authorization fail, errorCode:" + result.getErrorCode()) +// } +// } +// } +} diff --git a/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/SamsungWatch.kt b/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/SamsungWatch.kt new file mode 100644 index 00000000..09aafff2 --- /dev/null +++ b/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/SamsungWatch.kt @@ -0,0 +1,402 @@ +package com.ejada.hmg.watch.huawei.samsung_watch + + + +import com.ejada.hmg.MainActivity +import android.os.Build +import android.util.Log +import androidx.annotation.RequiresApi +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import com.ejada.hmg.watch.huawei.samsung_watch.model.Vitals +import com.samsung.android.sdk.health.data.HealthDataService +import com.samsung.android.sdk.health.data.HealthDataStore +import com.samsung.android.sdk.health.data.data.AggregatedData +import com.samsung.android.sdk.health.data.data.HealthDataPoint +import com.samsung.android.sdk.health.data.permission.AccessType +import com.samsung.android.sdk.health.data.permission.Permission +import com.samsung.android.sdk.health.data.request.DataType +import com.samsung.android.sdk.health.data.request.DataTypes +import com.samsung.android.sdk.health.data.request.LocalTimeFilter +import com.samsung.android.sdk.health.data.request.LocalTimeGroup +import com.samsung.android.sdk.health.data.request.LocalTimeGroupUnit +import com.samsung.android.sdk.health.data.request.Ordering +import com.samsung.android.sdk.health.data.response.DataResponse +import io.flutter.plugin.common.MethodChannel +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.cancel +import kotlinx.coroutines.launch +import java.time.LocalDateTime +import java.time.LocalTime + +class SamsungWatch( + private var flutterEngine: FlutterEngine, + private var mainActivity: MainActivity +) { + + private lateinit var channel: MethodChannel + private lateinit var dataStore: HealthDataStore + private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO) + private val TAG = "SamsungWatch" + + + private lateinit var vitals: MutableMap> + companion object { + private const val CHANNEL = "samsung_watch" + + } + init{ + create() + } + + @RequiresApi(Build.VERSION_CODES.O) + fun create() { + Log.d(TAG, "create: is called") +// openTok = OpenTok(mainActivity, flutterEngine) + channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) + channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> + when (call.method) { + "init" -> { + Log.d(TAG, "onMethodCall: init called") + dataStore = HealthDataService.getStore(mainActivity) + vitals = mutableMapOf() + result.success("initialized") + } + + "getPermission"->{ + if(!this::dataStore.isInitialized) + result.error("DataStoreNotInitialized", "Please call init before requesting permissions", null) + val permSet = setOf( + Permission.of(DataTypes.HEART_RATE, AccessType.READ), + Permission.of(DataTypes.STEPS, AccessType.READ), + Permission.of(DataTypes.BLOOD_OXYGEN, AccessType.READ), + Permission.of(DataTypes.ACTIVITY_SUMMARY, AccessType.READ), + Permission.of(DataTypes.SLEEP, AccessType.READ), + Permission.of(DataTypes.BODY_TEMPERATURE, AccessType.READ), + Permission.of(DataTypes.EXERCISE, AccessType.READ), +// Permission.of(DataTypes.SKIN_TEMPERATURE, AccessType.READ), +// Permission.of(DataTypes.NUTRITION, AccessType.READ), + + ) + scope.launch { + try { + var granted = dataStore.getGrantedPermissions(permSet) + + if (granted.containsAll(permSet)) { + result.success("Permission Granted") + return@launch + } + + granted = dataStore.requestPermissions(permSet, mainActivity) + + if (granted.containsAll(permSet)) { + result.success("Permission Granted") // adapt result as needed + return@launch + } + result.error("PermissionError", "Permission Not Granted", null) // adapt result as needed + } catch (e: Exception) { + Log.e(TAG, "create: getPermission failed", e) + result.error("PermissionError", e.message, null) + } + } + } + + "getHeartRate"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.HEART_RATE.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val heartRateList = dataStore.readData(readRequest).dataList + processHeartVital(heartRateList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + } + + + "getSleepData" -> { + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.SLEEP.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.ASC) + .build() + scope.launch { + val sleepData = dataStore.readData(readRequest).dataList + processSleepVital(sleepData) + print("the data is $vitals") + Log.d(TAG, "the data is $vitals") + result.success("Data is obtained") + } + + } + + "steps"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val aggregateRequest = DataType.StepsType.TOTAL.requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.ASC) + .build() + + scope.launch { + val steps = dataStore.aggregateData(aggregateRequest) + processStepsCount(steps) + print("the data is $vitals") + Log.d(TAG, "the data is $vitals") + result.success("Data is obtained") + } + } + + "activitySummary"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val readRequest = DataType.ActivitySummaryType.TOTAL_ACTIVE_CALORIES_BURNED + .requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val activityResult = dataStore.aggregateData(readRequest).dataList + processActivity(activityResult) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + +// val readRequest = DataTypes.EXERCISE.readDataRequestBuilder +// .setLocalTimeFilter(localTimeFilter) +// .build() +// +// scope.launch{ +// try { +// val readResult = dataStore.readData(readRequest) +// val dataPoints = readResult.dataList +// +// processActivity(dataPoints) +// +// +// } catch (e: Exception) { +// e.printStackTrace() +// } +// result.success("Data is obtained") +// } + } + + "bloodOxygen"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.BLOOD_OXYGEN.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val bloodOxygenList = dataStore.readData(readRequest).dataList + processBloodOxygen(bloodOxygenList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals["bloodOxygen"]}") + result.success("Data is obtained") + } + } + + + "bodyTemperature"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val readRequest = DataTypes.BODY_TEMPERATURE.readDataRequestBuilder + .setLocalTimeFilter(localTimeFilter) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val bodyTemperatureList = dataStore.readData(readRequest).dataList + processBodyTemperature(bodyTemperatureList) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals["bodyTemperature"]}") + result.success("Data is obtained") + } + } + + "distance"->{ + val dateTime = LocalDateTime.now().with(LocalTime.MIDNIGHT).minusDays(365) + val localTimeFilter = LocalTimeFilter.of(dateTime, LocalDateTime.now()) + val localTimeGroup = LocalTimeGroup.of(LocalTimeGroupUnit.HOURLY, 1) + val readRequest = DataType.ActivitySummaryType.TOTAL_DISTANCE.requestBuilder + .setLocalTimeFilterWithGroup(localTimeFilter, localTimeGroup) + .setOrdering(Ordering.DESC) + .build() + + scope.launch { + val activityResult = dataStore.aggregateData(readRequest).dataList + processDistance(activityResult) + Log.d("TAG"," the data is ${vitals}") + print("the data is ${vitals}") + result.success("Data is obtained") + } + } + + "retrieveData"->{ + if(vitals.isEmpty()){ + result.error("NoDataFound", "No Data was obtained", null) + return@setMethodCallHandler + } + result.success(""" + { + "heartRate": ${vitals["heartRate"]}, + "steps": ${vitals["steps"]}, + "sleep": ${vitals["sleep"]}, + "activity": ${vitals["activity"]}, + "bloodOxygen": ${vitals["bloodOxygen"]}, + "bodyTemperature": ${vitals["bodyTemperature"]}, + "distance": ${vitals["distance"]} + } + """.trimIndent()) + } + + + "closeCoroutineScope"->{ + destroy() + result.success("Coroutine Scope Cancelled") + } + + else -> { + result.notImplemented() + } + } + } + } + + private fun CoroutineScope.processDistance(activityResult: List>) { + vitals["distance"] = mutableListOf() + activityResult.forEach { stepData -> + val vitalData = Vitals().apply { + + value = stepData.value.toString() + timeStamp = stepData.startTime.toString() + } + (vitals["distance"] as MutableList).add(vitalData) + } + } + + private fun CoroutineScope.processBodyTemperature( bodyTemperatureList :List) { + vitals["bodyTemperature"] = mutableListOf() + bodyTemperatureList.forEach { stepData -> + val vitalData = Vitals().apply { + value = stepData.getValue(DataType.BodyTemperatureType.BODY_TEMPERATURE).toString() + timeStamp = stepData.endTime.toString() + } + (vitals["bodyTemperature"] as MutableList).add(vitalData) + } + } + + private fun CoroutineScope.processBloodOxygen( bloodOxygenList :List) { + vitals["bloodOxygen"] = mutableListOf() + bloodOxygenList.forEach { stepData -> + val vitalData = Vitals().apply { + value = stepData.getValue(DataType.BloodOxygenType.OXYGEN_SATURATION).toString() + timeStamp = stepData.endTime.toString() + } + (vitals["bloodOxygen"] as MutableList).add(vitalData) + } + } + + +// private fun CoroutineScope.processActivity(activityResult: List>) { +// +// vitals["activity"] = mutableListOf() +// activityResult.forEach { stepData -> +// val vitalData = Vitals().apply { +// +// value = stepData.value.toString() +// timeStamp = stepData.startTime.toString() +// } +// (vitals["activity"] as MutableList).add(vitalData) +// } +// } + private fun CoroutineScope.processActivity(activityResult: List>) { + + vitals["activity"] = mutableListOf() + activityResult.forEach { stepData -> + val vitalData = Vitals().apply { + + value = stepData.value.toString() + timeStamp = stepData.startTime.toString() + } + (vitals["activity"] as MutableList).add(vitalData) + } + +// dataPoints.forEach { dataPoint -> +// val sessions = dataPoint.getValue(DataType.ExerciseType.SESSIONS) +// +// sessions?.forEach { session -> +// +// val exerciseSessionCalories = session.calories +// val vitalData = Vitals().apply { +// value = exerciseSessionCalories.toString() +// timeStamp = session.startTime.toString() +// } +// (vitals["activity"] as MutableList).add(vitalData) +// } +// } + } + + private fun CoroutineScope.processStepsCount(result: DataResponse>) { + val stepCount = ArrayList>() + var totalSteps: Long = 0 + vitals["steps"] = mutableListOf() + result.dataList.forEach { stepData -> + val vitalData = Vitals().apply { + value = (stepData.value as Long).toString() + timeStamp = stepData.startTime.toString() + } + (vitals["steps"] as MutableList).add(vitalData) + } + + } + + private fun CoroutineScope.processSleepVital(sleepData: List) { + vitals["sleep"] = mutableListOf() + sleepData.forEach { + (vitals["sleep"] as MutableList).add( + Vitals().apply { + timeStamp = it.startTime.toString() + value = (it.getValue(DataType.SleepType.DURATION)?.toMillis().toString()) + } + ) + } + } + + private suspend fun CoroutineScope.processHeartVital( + heartRateList: List, + ) { + vitals["heartRate"] = mutableListOf() + heartRateList.forEach { + (vitals["heartRate"] as MutableList).add(processHeartRateData(it)) + } + } + + private fun processHeartRateData(heartRateData: HealthDataPoint) = + Vitals().apply { + heartRateData.getValue(DataType.HeartRateType.MAX_HEART_RATE)?.let { + value = it.toString() + } + timeStamp = heartRateData.startTime.toString() + } + + + fun destroy() { + scope.cancel() + } + +} diff --git a/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/model/Vitals.kt b/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/model/Vitals.kt new file mode 100644 index 00000000..3b5cdfe4 --- /dev/null +++ b/android/app/src/main2/kotlin/com/ejada/hmg/watch/samsung_watch/model/Vitals.kt @@ -0,0 +1,13 @@ +package com.ejada.hmg.watch.huawei.samsung_watch.model + +data class Vitals( + var value : String = "", + var timeStamp :String = "" +){ + override fun toString(): String { + return """{ + "value": "$value", + "timeStamp": "$timeStamp"} + """.trimIndent() + } +} \ No newline at end of file diff --git a/android/app/src/main2/res/drawable-v21/launch_background.xml b/android/app/src/main2/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/android/app/src/main2/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main2/res/drawable/app_icon.png b/android/app/src/main2/res/drawable/app_icon.png new file mode 100755 index 00000000..2d394f83 Binary files /dev/null and b/android/app/src/main2/res/drawable/app_icon.png differ diff --git a/android/app/src/main2/res/drawable/food.png b/android/app/src/main2/res/drawable/food.png new file mode 100644 index 00000000..41b394d3 Binary files /dev/null and b/android/app/src/main2/res/drawable/food.png differ diff --git a/android/app/src/main2/res/drawable/launch_background.xml b/android/app/src/main2/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/android/app/src/main2/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main2/res/drawable/me.png b/android/app/src/main2/res/drawable/me.png new file mode 100644 index 00000000..ba75bc55 Binary files /dev/null and b/android/app/src/main2/res/drawable/me.png differ diff --git a/android/app/src/main2/res/drawable/sample_large_icon.png b/android/app/src/main2/res/drawable/sample_large_icon.png new file mode 100644 index 00000000..f354ca23 Binary files /dev/null and b/android/app/src/main2/res/drawable/sample_large_icon.png differ diff --git a/android/app/src/main2/res/drawable/secondary_icon.png b/android/app/src/main2/res/drawable/secondary_icon.png new file mode 100644 index 00000000..9de9ff41 Binary files /dev/null and b/android/app/src/main2/res/drawable/secondary_icon.png differ diff --git a/android/app/src/main2/res/layout/activity_whats_app_code.xml b/android/app/src/main2/res/layout/activity_whats_app_code.xml new file mode 100644 index 00000000..3cd824c9 --- /dev/null +++ b/android/app/src/main2/res/layout/activity_whats_app_code.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/android/app/src/main2/res/layout/local_video.xml b/android/app/src/main2/res/layout/local_video.xml new file mode 100644 index 00000000..f47c48cd --- /dev/null +++ b/android/app/src/main2/res/layout/local_video.xml @@ -0,0 +1,14 @@ + + + + + \ No newline at end of file diff --git a/android/app/src/main2/res/layout/remote_video.xml b/android/app/src/main2/res/layout/remote_video.xml new file mode 100644 index 00000000..cfdbeb0d --- /dev/null +++ b/android/app/src/main2/res/layout/remote_video.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/package/device_calendar_plus/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main2/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from package/device_calendar_plus/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to android/app/src/main2/res/mipmap-hdpi/ic_launcher.png diff --git a/android/app/src/main2/res/mipmap-hdpi/ic_launcher_local.png b/android/app/src/main2/res/mipmap-hdpi/ic_launcher_local.png new file mode 100644 index 00000000..348b5116 Binary files /dev/null and b/android/app/src/main2/res/mipmap-hdpi/ic_launcher_local.png differ diff --git a/package/device_calendar_plus/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main2/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from package/device_calendar_plus/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to android/app/src/main2/res/mipmap-mdpi/ic_launcher.png diff --git a/android/app/src/main2/res/mipmap-mdpi/ic_launcher_local.png b/android/app/src/main2/res/mipmap-mdpi/ic_launcher_local.png new file mode 100644 index 00000000..410b1b1e Binary files /dev/null and b/android/app/src/main2/res/mipmap-mdpi/ic_launcher_local.png differ diff --git a/package/device_calendar_plus/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main2/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from package/device_calendar_plus/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to android/app/src/main2/res/mipmap-xhdpi/ic_launcher.png diff --git a/android/app/src/main2/res/mipmap-xhdpi/ic_launcher_local.png b/android/app/src/main2/res/mipmap-xhdpi/ic_launcher_local.png new file mode 100644 index 00000000..bb9943af Binary files /dev/null and b/android/app/src/main2/res/mipmap-xhdpi/ic_launcher_local.png differ diff --git a/package/device_calendar_plus/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main2/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from package/device_calendar_plus/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to android/app/src/main2/res/mipmap-xxhdpi/ic_launcher.png diff --git a/android/app/src/main2/res/mipmap-xxhdpi/ic_launcher_local.png b/android/app/src/main2/res/mipmap-xxhdpi/ic_launcher_local.png new file mode 100644 index 00000000..0b9d9359 Binary files /dev/null and b/android/app/src/main2/res/mipmap-xxhdpi/ic_launcher_local.png differ diff --git a/package/device_calendar_plus/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main2/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from package/device_calendar_plus/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to android/app/src/main2/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/android/app/src/main2/res/mipmap-xxxhdpi/ic_launcher_local.png b/android/app/src/main2/res/mipmap-xxxhdpi/ic_launcher_local.png new file mode 100644 index 00000000..aaa9808d Binary files /dev/null and b/android/app/src/main2/res/mipmap-xxxhdpi/ic_launcher_local.png differ diff --git a/android/app/src/main2/res/raw/keep.xml b/android/app/src/main2/res/raw/keep.xml new file mode 100644 index 00000000..944a7ace --- /dev/null +++ b/android/app/src/main2/res/raw/keep.xml @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/android/app/src/main2/res/raw/slow_spring_board.mp3 b/android/app/src/main2/res/raw/slow_spring_board.mp3 new file mode 100644 index 00000000..60dbf979 Binary files /dev/null and b/android/app/src/main2/res/raw/slow_spring_board.mp3 differ diff --git a/android/app/src/main2/res/values-night/styles.xml b/android/app/src/main2/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/android/app/src/main2/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main2/res/values/mapbox_access_token.xml b/android/app/src/main2/res/values/mapbox_access_token.xml new file mode 100644 index 00000000..65bc4b37 --- /dev/null +++ b/android/app/src/main2/res/values/mapbox_access_token.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/android/app/src/main2/res/values/strings.xml b/android/app/src/main2/res/values/strings.xml new file mode 100644 index 00000000..2d103337 --- /dev/null +++ b/android/app/src/main2/res/values/strings.xml @@ -0,0 +1,23 @@ + + HMG Patient App + + + Unknown error: the Geofence service is not available now. + + + Geofence service is not available now. Go to Settings>Location>Mode and choose High accuracy. + + + Your app has registered too many geofences. + + + You have provided too many PendingIntents to the addGeofences() call. + + + App do not have permission to access location service. + + + Geofence requests happened too frequently. + + pk.eyJ1IjoicndhaWQiLCJhIjoiY2x5cGo4aHNjMGNsbTJyc2djempobGQxaSJ9.RCaC6WrUt4A4YnZNfxnONQ + diff --git a/android/app/src/main2/res/values/styles.xml b/android/app/src/main2/res/values/styles.xml new file mode 100644 index 00000000..1f83a33f --- /dev/null +++ b/android/app/src/main2/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/gradle.properties b/android/gradle.properties index f018a618..647291d1 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,10 @@ -org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError -android.useAndroidX=true +#org.gradle.jvmargs=-xmx4608m +android.enableR8=true android.enableJetifier=true +android.useDeprecatedNdk=true +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.configureondemand=true +android.useAndroidX=true +android.enableImpeller=false diff --git a/assets/images/svg/biometric_lock_icon.svg b/assets/images/svg/biometric_lock_icon.svg new file mode 100644 index 00000000..dd123157 --- /dev/null +++ b/assets/images/svg/biometric_lock_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/bluetooth.svg b/assets/images/svg/bluetooth.svg new file mode 100644 index 00000000..5fe2cf0c --- /dev/null +++ b/assets/images/svg/bluetooth.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/globe_other.svg b/assets/images/svg/globe_other.svg new file mode 100644 index 00000000..1b9734b3 --- /dev/null +++ b/assets/images/svg/globe_other.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/image_icon.svg b/assets/images/svg/image_icon.svg new file mode 100644 index 00000000..73945847 --- /dev/null +++ b/assets/images/svg/image_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/watch_activity.svg b/assets/images/svg/watch_activity.svg new file mode 100644 index 00000000..8da915fa --- /dev/null +++ b/assets/images/svg/watch_activity.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/watch_activity_trailing.svg b/assets/images/svg/watch_activity_trailing.svg new file mode 100644 index 00000000..dc09c058 --- /dev/null +++ b/assets/images/svg/watch_activity_trailing.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/images/svg/watch_bmi.svg b/assets/images/svg/watch_bmi.svg new file mode 100644 index 00000000..4d34d5d0 --- /dev/null +++ b/assets/images/svg/watch_bmi.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/svg/watch_bmi_trailing.svg b/assets/images/svg/watch_bmi_trailing.svg new file mode 100644 index 00000000..772d18a4 --- /dev/null +++ b/assets/images/svg/watch_bmi_trailing.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/watch_height.svg b/assets/images/svg/watch_height.svg new file mode 100644 index 00000000..e70b4b89 --- /dev/null +++ b/assets/images/svg/watch_height.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/watch_sleep.svg b/assets/images/svg/watch_sleep.svg new file mode 100644 index 00000000..dd21f628 --- /dev/null +++ b/assets/images/svg/watch_sleep.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/watch_sleep_trailing.svg b/assets/images/svg/watch_sleep_trailing.svg new file mode 100644 index 00000000..dff5ab36 --- /dev/null +++ b/assets/images/svg/watch_sleep_trailing.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/watch_steps.svg b/assets/images/svg/watch_steps.svg new file mode 100644 index 00000000..730c1892 --- /dev/null +++ b/assets/images/svg/watch_steps.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/svg/watch_steps_trailing.svg b/assets/images/svg/watch_steps_trailing.svg new file mode 100644 index 00000000..2c1b2f20 --- /dev/null +++ b/assets/images/svg/watch_steps_trailing.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/svg/watch_weight.svg b/assets/images/svg/watch_weight.svg new file mode 100644 index 00000000..3acddca5 --- /dev/null +++ b/assets/images/svg/watch_weight.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/watch_weight_trailing.svg b/assets/images/svg/watch_weight_trailing.svg new file mode 100644 index 00000000..3e2b3dd8 --- /dev/null +++ b/assets/images/svg/watch_weight_trailing.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index f929b1ae..99dc2440 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -435,7 +435,6 @@ "serviceInformation": "معلومات الخدمة", "homeHealthCare": "الرعاية الصحية المنزلية", "noAppointmentAvailable": "لا توجد مواعيد متاحة", - "homeHealthCareText": "تقدم هذه الخدمة مجموعة من خدمات الرعاية الصحية المنزلية، والمتابعة المستمرة والشاملة في أماكن إقامتهم لأولئك الذين لا يمكنهم الوصول إلى المرافق الصحية، مثل (تحليلات المختبر - الأشعة - التطعيمات - العلاج الطبيعي)، إلخ.", "loginRegister": "تسجيل الدخول / التسجيل", "orderLog": "سجل الطلب", "infoLab": "تتيح لك هذه الخدمة عرض نتائج جميع الفحوصات المخبرية التي أجريت في مجموعة الحبيب الطبية بالإضافة إلى إرسال التقرير عبر البريد الإلكتروني.", @@ -448,7 +447,7 @@ "lakumPoint": "نقطة", "wishlist": "قائمة الرغبات", "products": "المنتجات", - "reviews": "التقييمات", + "reviews": "التعليقات", "brands": "العلامات التجارية", "productDetails": "تفاصيل المنتج", "medicationRefill": "إعادة تعبئة الدواء", @@ -753,6 +752,11 @@ "erConsultation": "تتيح لك هذه الخدمة إجراء استشارة افتراضية عبر الإنترنت عبر مكالمة فيديو مباشرة مع الطبيب من أي مكان وفي أي وقت.", "myInvoice": "القائمة", "invoiceList": "فواتيري", + "allInvoices": "كل الفواتير", + "hospitals": "المستشفيات", + "clinics": "العيادات", + "doctors": "الأطباء", + "selectDoctor": "اختر الطبيب", "thisItemIsNotAvailable": "هذا العنصر غير متوفر", "beforeAfterImages": "صور قبل وبعد", "clinicAcceptLivecare": "لا حاجة للانتظار أو الزيارة يمكنك الآن الحصول على استشارة طبية عبر مكالمة فيديو (لايف كير) في اسم العيادة وسيتصل بك الطبيب على الفور", @@ -812,7 +816,7 @@ "awaitingApproval": "انتظر القبول", "news": "أخبار", "ready": "جاهز", - "enterValidNationalId": "الرجاء إدخال رقم الهوية الوطنية أو رقم الملف الصحيح", + "enterValidNationalId": "رقم الهوية أو رقم الملف غير صحيح", "enterValidPhoneNumber": "الرجاء إدخال رقم هاتف صالح", "cannotEnterSaudiOrUAENumber": "لا يمكنك إدخال أرقام هواتف السعودية (00966) أو الإمارات (00971) عند اختيار دولة 'أخرى'", "medicalCentersWithCount": "{count} مراكز طبية", @@ -904,6 +908,7 @@ "general": "عام", "liveCare": "لايف كير", "recentVisits": "الزيارات الأخيرة", + "favouriteDoctors": "الأطباء المفضلون", "searchByClinic": "البحث حسب العيادة", "tapToSelectClinic": "انقر لاختيار العيادة", "searchByDoctor": "البحث حسب الطبيب", @@ -1275,7 +1280,7 @@ "noVitalSignsRecordedYet": "لا توجد علامات حيوية مسجلة بعد", "appointmentsAndVisits": "المواعيد والزيارات", "labAndRadiology": "المختبر والأشعة", - "activeMedicationsAndPrescriptions": "الأدوية النشطة والوصفات الطبية", + "activeMedicationsAndPrescriptions": "الوصفات الطبية", "allPrescriptions": "جميع الوصفات", "allMedications": "جميع الأدوية", "youDontHaveAnyPrescriptionsYet": "ليس لديك أي وصفات طبية بعد.", @@ -1580,8 +1585,35 @@ "reschedulingAppo": "إعادة جدولة الموعد، يرجى الانتظار...", "invalidEligibility": "لا يمكنك إجراء الدفع عبر الإنترنت لأنك غير مؤهل لاستخدام الخدمة المقدمة.", "invalidInsurance": "لا يمكنك إجراء الدفع عبر الإنترنت لأنه ليس لديك تأمين صالح.", + "continueCash": "تواصل نقدا", + "applewatch": "ساعة آبل", + "applehealthapplicationshouldbeinstalledinyourphone": "يجب تثبيت تطبيق Apple Health على هاتفك", + "unabletodetectapplicationinstalledpleasecomebackonceinstalled": "لا يمكننا اكتشاف التطبيق المثبت على جهازك. يرجى العودة إلى هنا بمجرد تثبيت هذا التطبيق.", + "applewatchshouldbeconnected": "يجب توصيل ساعة آبل", + "samsungwatch": "ساعة سامسونج", + "samsunghealthapplicationshouldbeinstalledinyourphone": "يجب تثبيت تطبيق Samsung Health على هاتفك", + "samsungwatchshouldbeconnected": "يجب توصيل ساعة سامسونج", + "huaweiwatch": "ساعة هواوي", + "huaweihealthapplicationshouldbeinstalledinyourphone": "يجب تثبيت تطبيق Huawei Health على هاتفك", + "huaweiwatchshouldbeconnected": "يجب توصيل ساعة هواوي", + "whoopwatch": "ساعة Whoop", + "whoophealthapplicationshouldbeinstalledinyourphone": "يجب تثبيت تطبيق Whoop Health على هاتفك", + "whoopwatchshouldbeconnected": "يجب توصيل ساعة Whoop", + "updatetheinformation": "سيتيح ذلك جمع أحدث المعلومات من ساعة آبل الخاصة بك", "continueCash": "متابعة الدفع نقدًا", "timeFor": "الوقت", "hmgPolicies": "سياسات مجموعة الحبيب الطبية", - "darkMode": "المظهر الداكن" + "darkMode": "المظهر الداكن", + "featureComingSoonDescription": "هذه الميزة ستتوفر قريباً. نحن نعمل جاهدين لإضافة ميزات أكثر تميزاً إلى التطبيق. انتظرونا لمتابعة التحديثات.", + "generateAiAnalysisResult": "قم بإجراء تحليل لهذا المختبر AI", + "ratings": "التقييمات", + "hmgPharmacyText": "صيدلية الحبيب، المتجر الصيدلاني الإلكتروني المتكامل الذي تقدمه لكم مجموعة خدمات الدكتور سليمان الحبيب الطبية.", + "insuranceRequestSubmittedSuccessfully": "تم إرسال طلب تحديث بيانات التأمين بنجاح. سيتم إعلامك بمجرد الانتهاء.", + "updatingEmailAddress": "جارٍ تحديث عنوان البريد الإلكتروني، يرجى الانتظار...", + "verifyInsurance": "التحقق من التأمين", + "tests": "تحليل", + "calendarPermissionAlert": "يرجى منح إذن الوصول إلى التقويم من إعدادات التطبيق لضبط تذكير تناول الدواء.", + "sortByLocation": "الترتيب حسب الموقع", + "timeForFirstReminder": "وقت التذكير الأول", + "reminderRemovalNote": "يمكنك إزالتها من التقويم الخاص بك لاحقاً عن طريق إيقاف تشغيل التذكير" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index b1cc5b08..e4b63077 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -744,6 +744,11 @@ "erConsultation": "This service allows you to make an online virtual consultation via video call directly with the doctor from anywhere at any time.", "myInvoice": "List", "invoiceList": "My Invoice", + "allInvoices": "All Invoices", + "hospitals": "Hospitals", + "clinics": "Clinics", + "doctors": "Doctors", + "selectDoctor": "Select Doctor", "thisItemIsNotAvailable": "This item is not available", "beforeAfterImages": "Before & After Images", "clinicAcceptLivecare": "No need to wait or visit You can now get medical consultation via Video call (LiveCare service) in The name of the clinic clinic and the doctor will contact you immediately", @@ -802,7 +807,7 @@ "notNow": "Not Now", "pendingActivation": "Pending Activation", "awaitingApproval": "Awaiting Approval", - "enterValidNationalId": "Please enter a valid national ID or file number", + "enterValidNationalId": "Invalid Identification or file number", "enterValidPhoneNumber": "Please enter a valid phone number", "cannotEnterSaudiOrUAENumber": "You cannot enter Saudi Arabia (00966) or UAE (00971) phone numbers when 'Others' country is selected", "ready": "Ready", @@ -897,6 +902,7 @@ "general": "General", "liveCare": "LiveCare", "recentVisits": "Recent Visits", + "favouriteDoctors": "Favourite Doctors", "searchByClinic": "Search By Clinic", "tapToSelectClinic": "Tap to select clinic", "searchByDoctor": "Search By Doctor", @@ -1266,7 +1272,7 @@ "noVitalSignsRecordedYet": "No vital signs recorded yet", "appointmentsAndVisits": "Appointments & visits", "labAndRadiology": "Lab & Radiology", - "activeMedicationsAndPrescriptions": "Active Medications & Prescriptions", + "activeMedicationsAndPrescriptions": "Recent Prescriptions", "allPrescriptions": "All Prescriptions", "allMedications": "All Medications", "youDontHaveAnyPrescriptionsYet": "You don't have any prescriptions yet.", @@ -1574,7 +1580,33 @@ "invalidEligibility": "You cannot make online payment because you are not eligible to use the provided service.", "invalidInsurance": "You cannot make online payment because you do not have a valid insurance.", "continueCash": "Continue as cash", + "applewatch": "Apple Watch", + "applehealthapplicationshouldbeinstalledinyourphone": "Apple Health application should be installed in your phone", + "unabletodetectapplicationinstalledpleasecomebackonceinstalled": "We are unable to detect the application installed in your device. Please come back here once you have installed this application.", + "applewatchshouldbeconnected": "Apple Watch should be connected", + "samsungwatch": "Samsung Watch", + "samsunghealthapplicationshouldbeinstalledinyourphone": "Samsung Health application should be installed in your phone", + "samsungwatchshouldbeconnected": "Samsung Watch should be connected", + "huaweiwatch": "Huawei Watch", + "huaweihealthapplicationshouldbeinstalledinyourphone": "Huawei Health application should be installed in your phone", + "huaweiwatchshouldbeconnected": "Huawei Watch should be connected", + "whoopwatch": "Whoop Watch", + "whoophealthapplicationshouldbeinstalledinyourphone": "Whoop Health application should be installed in your phone", + "whoopwatchshouldbeconnected": "Whoop Watch should be connected", + "updatetheinformation": "This will allow to gather the most up to date information from your apple watch", "timeFor": "Time For", "hmgPolicies": "HMG Policies", - "darkMode": "Dark Mode" + "featureComingSoonDescription": "Feature is coming soon. We are actively working to bring more exciting features into the app. Stay tuned for updates.", + "darkMode": "Dark Mode", + "generateAiAnalysisResult": "Generate AI analysis for this result", + "ratings": "Ratings", + "hmgPharmacyText": "Al Habib Pharmacy, the complete online Pharmaceutical store brought to you by Dr. Sulaiman Al Habib Medical Services Group.", + "insuranceRequestSubmittedSuccessfully": "Your insurance update request has been successfully submitted. You will be notified once completed.", + "updatingEmailAddress": "Updating email address, Please wait...", + "verifyInsurance": "Verify Insurance", + "tests": "tests", + "calendarPermissionAlert": "Please grant calendar access permission from app settings to set medication reminder.", + "sortByLocation": "Sort by location", + "timeForFirstReminder": "Time for 1st reminder", + "reminderRemovalNote": "You can remove it from your calendar later by switching off the reminder" } diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 00000000..02c8b5da --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,543 @@ +PODS: + - amazon_payfort (1.1.4): + - Flutter + - PayFortSDK + - audio_session (0.0.1): + - Flutter + - barcode_scan2 (0.0.1): + - Flutter + - SwiftProtobuf (~> 1.33) + - connectivity_plus (0.0.1): + - Flutter + - CryptoSwift (1.8.4) + - device_calendar (0.0.1): + - Flutter + - device_calendar_plus_ios (0.0.1): + - Flutter + - device_info_plus (0.0.1): + - Flutter + - DKImagePickerController/Core (4.3.9): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.9) + - DKImagePickerController/PhotoGallery (4.3.9): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.9) + - DKPhotoGallery (0.0.19): + - DKPhotoGallery/Core (= 0.0.19) + - DKPhotoGallery/Model (= 0.0.19) + - DKPhotoGallery/Preview (= 0.0.19) + - DKPhotoGallery/Resource (= 0.0.19) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.19): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.19): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Firebase/Analytics (11.15.0): + - Firebase/Core + - Firebase/Core (11.15.0): + - Firebase/CoreOnly + - FirebaseAnalytics (~> 11.15.0) + - Firebase/CoreOnly (11.15.0): + - FirebaseCore (~> 11.15.0) + - Firebase/Messaging (11.15.0): + - Firebase/CoreOnly + - FirebaseMessaging (~> 11.15.0) + - firebase_analytics (11.6.0): + - Firebase/Analytics (= 11.15.0) + - firebase_core + - Flutter + - firebase_core (3.15.2): + - Firebase/CoreOnly (= 11.15.0) + - Flutter + - firebase_messaging (15.2.10): + - Firebase/Messaging (= 11.15.0) + - firebase_core + - Flutter + - FirebaseAnalytics (11.15.0): + - FirebaseAnalytics/Default (= 11.15.0) + - FirebaseCore (~> 11.15.0) + - FirebaseInstallations (~> 11.0) + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/MethodSwizzler (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - nanopb (~> 3.30910.0) + - FirebaseAnalytics/Default (11.15.0): + - FirebaseCore (~> 11.15.0) + - FirebaseInstallations (~> 11.0) + - GoogleAppMeasurement/Default (= 11.15.0) + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/MethodSwizzler (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - nanopb (~> 3.30910.0) + - FirebaseCore (11.15.0): + - FirebaseCoreInternal (~> 11.15.0) + - GoogleUtilities/Environment (~> 8.1) + - GoogleUtilities/Logger (~> 8.1) + - FirebaseCoreInternal (11.15.0): + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - FirebaseInstallations (11.15.0): + - FirebaseCore (~> 11.15.0) + - GoogleUtilities/Environment (~> 8.1) + - GoogleUtilities/UserDefaults (~> 8.1) + - PromisesObjC (~> 2.4) + - FirebaseMessaging (11.15.0): + - FirebaseCore (~> 11.15.0) + - FirebaseInstallations (~> 11.0) + - GoogleDataTransport (~> 10.0) + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/Environment (~> 8.1) + - GoogleUtilities/Reachability (~> 8.1) + - GoogleUtilities/UserDefaults (~> 8.1) + - nanopb (~> 3.30910.0) + - FLAnimatedImage (1.0.17) + - Flutter (1.0.0) + - flutter_callkit_incoming (0.0.1): + - CryptoSwift + - Flutter + - flutter_inappwebview_ios (0.0.1): + - Flutter + - flutter_inappwebview_ios/Core (= 0.0.1) + - OrderedSet (~> 6.0.3) + - flutter_inappwebview_ios/Core (0.0.1): + - Flutter + - OrderedSet (~> 6.0.3) + - flutter_ios_voip_kit_karmm (0.8.0): + - Flutter + - flutter_local_notifications (0.0.1): + - Flutter + - flutter_nfc_kit (3.6.0): + - Flutter + - flutter_zoom_videosdk (0.0.1): + - Flutter + - ZoomVideoSDK/CptShare (= 2.1.10) + - ZoomVideoSDK/zm_annoter_dynamic (= 2.1.10) + - ZoomVideoSDK/zoomcml (= 2.1.10) + - ZoomVideoSDK/ZoomVideoSDK (= 2.1.10) + - fluttertoast (0.0.2): + - Flutter + - geolocator_apple (1.2.0): + - Flutter + - FlutterMacOS + - Google-Maps-iOS-Utils (5.0.0): + - GoogleMaps (~> 8.0) + - google_maps_flutter_ios (0.0.1): + - Flutter + - Google-Maps-iOS-Utils (< 7.0, >= 5.0) + - GoogleMaps (< 11.0, >= 8.4) + - GoogleAdsOnDeviceConversion (2.1.0): + - GoogleUtilities/Logger (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - nanopb (~> 3.30910.0) + - GoogleAppMeasurement/Core (11.15.0): + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/MethodSwizzler (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - nanopb (~> 3.30910.0) + - GoogleAppMeasurement/Default (11.15.0): + - GoogleAdsOnDeviceConversion (= 2.1.0) + - GoogleAppMeasurement/Core (= 11.15.0) + - GoogleAppMeasurement/IdentitySupport (= 11.15.0) + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/MethodSwizzler (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - nanopb (~> 3.30910.0) + - GoogleAppMeasurement/IdentitySupport (11.15.0): + - GoogleAppMeasurement/Core (= 11.15.0) + - GoogleUtilities/AppDelegateSwizzler (~> 8.1) + - GoogleUtilities/MethodSwizzler (~> 8.1) + - GoogleUtilities/Network (~> 8.1) + - "GoogleUtilities/NSData+zlib (~> 8.1)" + - nanopb (~> 3.30910.0) + - GoogleDataTransport (10.1.0): + - nanopb (~> 3.30910.0) + - PromisesObjC (~> 2.4) + - GoogleMaps (8.4.0): + - GoogleMaps/Maps (= 8.4.0) + - GoogleMaps/Base (8.4.0) + - GoogleMaps/Maps (8.4.0): + - GoogleMaps/Base + - GoogleUtilities/AppDelegateSwizzler (8.1.0): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Privacy + - GoogleUtilities/Environment (8.1.0): + - GoogleUtilities/Privacy + - GoogleUtilities/Logger (8.1.0): + - GoogleUtilities/Environment + - GoogleUtilities/Privacy + - GoogleUtilities/MethodSwizzler (8.1.0): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilities/Network (8.1.0): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Privacy + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (8.1.0)": + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (8.1.0) + - GoogleUtilities/Reachability (8.1.0): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilities/UserDefaults (8.1.0): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - health (13.1.4): + - Flutter + - image_picker_ios (0.0.1): + - Flutter + - just_audio (0.0.1): + - Flutter + - FlutterMacOS + - local_auth_darwin (0.0.1): + - Flutter + - FlutterMacOS + - location (0.0.1): + - Flutter + - manage_calendar_events (0.0.1): + - Flutter + - map_launcher (0.0.1): + - Flutter + - MapboxCommon (23.11.0) + - MapboxCoreMaps (10.19.1): + - MapboxCommon (~> 23.11) + - MapboxCoreNavigation (2.19.0): + - MapboxDirections (~> 2.14) + - MapboxNavigationNative (< 207.0.0, >= 206.0.1) + - MapboxDirections (2.14.3): + - Polyline (~> 5.0) + - Turf (~> 2.8.0) + - MapboxMaps (10.19.0): + - MapboxCommon (= 23.11.0) + - MapboxCoreMaps (= 10.19.1) + - MapboxMobileEvents (= 2.0.0) + - Turf (= 2.8.0) + - MapboxMobileEvents (2.0.0) + - MapboxNavigation (2.19.0): + - MapboxCoreNavigation (= 2.19.0) + - MapboxMaps (~> 10.18) + - MapboxSpeech (~> 2.0) + - Solar-dev (~> 3.0) + - MapboxNavigationNative (206.2.2): + - MapboxCommon (~> 23.10) + - MapboxSpeech (2.1.1) + - nanopb (3.30910.0): + - nanopb/decode (= 3.30910.0) + - nanopb/encode (= 3.30910.0) + - nanopb/decode (3.30910.0) + - nanopb/encode (3.30910.0) + - network_info_plus (0.0.1): + - Flutter + - open_filex (0.0.2): + - Flutter + - OrderedSet (6.0.3) + - package_info_plus (0.4.5): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - PayFortSDK (3.2.1) + - permission_handler_apple (9.3.0): + - Flutter + - Polyline (5.1.0) + - PromisesObjC (2.4.0) + - SDWebImage (5.21.5): + - SDWebImage/Core (= 5.21.5) + - SDWebImage/Core (5.21.5) + - share_plus (0.0.1): + - Flutter + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - Solar-dev (3.0.1) + - sqflite_darwin (0.0.4): + - Flutter + - FlutterMacOS + - SwiftProtobuf (1.33.3) + - SwiftyGif (5.4.5) + - Turf (2.8.0) + - url_launcher_ios (0.0.1): + - Flutter + - video_player_avfoundation (0.0.1): + - Flutter + - FlutterMacOS + - wakelock_plus (0.0.1): + - Flutter + - webview_flutter_wkwebview (0.0.1): + - Flutter + - FlutterMacOS + - ZoomVideoSDK/CptShare (2.1.10) + - ZoomVideoSDK/zm_annoter_dynamic (2.1.10) + - ZoomVideoSDK/zoomcml (2.1.10) + - ZoomVideoSDK/ZoomVideoSDK (2.1.10) + +DEPENDENCIES: + - amazon_payfort (from `.symlinks/plugins/amazon_payfort/ios`) + - audio_session (from `.symlinks/plugins/audio_session/ios`) + - barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - device_calendar (from `.symlinks/plugins/device_calendar/ios`) + - device_calendar_plus_ios (from `.symlinks/plugins/device_calendar_plus_ios/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - file_picker (from `.symlinks/plugins/file_picker/ios`) + - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) + - firebase_core (from `.symlinks/plugins/firebase_core/ios`) + - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) + - FLAnimatedImage + - Flutter (from `Flutter`) + - flutter_callkit_incoming (from `.symlinks/plugins/flutter_callkit_incoming/ios`) + - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) + - flutter_ios_voip_kit_karmm (from `.symlinks/plugins/flutter_ios_voip_kit_karmm/ios`) + - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) + - flutter_nfc_kit (from `.symlinks/plugins/flutter_nfc_kit/ios`) + - flutter_zoom_videosdk (from `.symlinks/plugins/flutter_zoom_videosdk/ios`) + - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - geolocator_apple (from `.symlinks/plugins/geolocator_apple/darwin`) + - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) + - health (from `.symlinks/plugins/health/ios`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + - just_audio (from `.symlinks/plugins/just_audio/darwin`) + - local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`) + - location (from `.symlinks/plugins/location/ios`) + - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) + - map_launcher (from `.symlinks/plugins/map_launcher/ios`) + - MapboxMaps (= 10.19.0) + - MapboxNavigation (= 2.19.0) + - network_info_plus (from `.symlinks/plugins/network_info_plus/ios`) + - open_filex (from `.symlinks/plugins/open_filex/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - share_plus (from `.symlinks/plugins/share_plus/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) + - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`) + +SPEC REPOS: + trunk: + - CryptoSwift + - DKImagePickerController + - DKPhotoGallery + - Firebase + - FirebaseAnalytics + - FirebaseCore + - FirebaseCoreInternal + - FirebaseInstallations + - FirebaseMessaging + - FLAnimatedImage + - Google-Maps-iOS-Utils + - GoogleAdsOnDeviceConversion + - GoogleAppMeasurement + - GoogleDataTransport + - GoogleMaps + - GoogleUtilities + - MapboxCommon + - MapboxCoreMaps + - MapboxCoreNavigation + - MapboxDirections + - MapboxMaps + - MapboxMobileEvents + - MapboxNavigation + - MapboxNavigationNative + - MapboxSpeech + - nanopb + - OrderedSet + - PayFortSDK + - Polyline + - PromisesObjC + - SDWebImage + - Solar-dev + - SwiftProtobuf + - SwiftyGif + - Turf + - ZoomVideoSDK + +EXTERNAL SOURCES: + amazon_payfort: + :path: ".symlinks/plugins/amazon_payfort/ios" + audio_session: + :path: ".symlinks/plugins/audio_session/ios" + barcode_scan2: + :path: ".symlinks/plugins/barcode_scan2/ios" + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + device_calendar: + :path: ".symlinks/plugins/device_calendar/ios" + device_calendar_plus_ios: + :path: ".symlinks/plugins/device_calendar_plus_ios/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + firebase_analytics: + :path: ".symlinks/plugins/firebase_analytics/ios" + firebase_core: + :path: ".symlinks/plugins/firebase_core/ios" + firebase_messaging: + :path: ".symlinks/plugins/firebase_messaging/ios" + Flutter: + :path: Flutter + flutter_callkit_incoming: + :path: ".symlinks/plugins/flutter_callkit_incoming/ios" + flutter_inappwebview_ios: + :path: ".symlinks/plugins/flutter_inappwebview_ios/ios" + flutter_ios_voip_kit_karmm: + :path: ".symlinks/plugins/flutter_ios_voip_kit_karmm/ios" + flutter_local_notifications: + :path: ".symlinks/plugins/flutter_local_notifications/ios" + flutter_nfc_kit: + :path: ".symlinks/plugins/flutter_nfc_kit/ios" + flutter_zoom_videosdk: + :path: ".symlinks/plugins/flutter_zoom_videosdk/ios" + fluttertoast: + :path: ".symlinks/plugins/fluttertoast/ios" + geolocator_apple: + :path: ".symlinks/plugins/geolocator_apple/darwin" + google_maps_flutter_ios: + :path: ".symlinks/plugins/google_maps_flutter_ios/ios" + health: + :path: ".symlinks/plugins/health/ios" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" + just_audio: + :path: ".symlinks/plugins/just_audio/darwin" + local_auth_darwin: + :path: ".symlinks/plugins/local_auth_darwin/darwin" + location: + :path: ".symlinks/plugins/location/ios" + manage_calendar_events: + :path: ".symlinks/plugins/manage_calendar_events/ios" + map_launcher: + :path: ".symlinks/plugins/map_launcher/ios" + network_info_plus: + :path: ".symlinks/plugins/network_info_plus/ios" + open_filex: + :path: ".symlinks/plugins/open_filex/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" + share_plus: + :path: ".symlinks/plugins/share_plus/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite_darwin: + :path: ".symlinks/plugins/sqflite_darwin/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + video_player_avfoundation: + :path: ".symlinks/plugins/video_player_avfoundation/darwin" + wakelock_plus: + :path: ".symlinks/plugins/wakelock_plus/ios" + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" + +SPEC CHECKSUMS: + amazon_payfort: 4ad7a3413acc1c4c4022117a80d18fee23c572d3 + audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0 + barcode_scan2: 4e4b850b112f4e29017833e4715f36161f987966 + connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd + CryptoSwift: e64e11850ede528a02a0f3e768cec8e9d92ecb90 + device_calendar: b55b2c5406cfba45c95a59f9059156daee1f74ed + device_calendar_plus_ios: 2c04ad7643c6e697438216e33693b84e8ca45ded + device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe + DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c + DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 + file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be + Firebase: d99ac19b909cd2c548339c2241ecd0d1599ab02e + firebase_analytics: 0e25ca1d4001ccedd40b4e5b74c0ec34e18f6425 + firebase_core: 995454a784ff288be5689b796deb9e9fa3601818 + firebase_messaging: f4a41dd102ac18b840eba3f39d67e77922d3f707 + FirebaseAnalytics: 6433dfd311ba78084fc93bdfc145e8cb75740eae + FirebaseCore: efb3893e5b94f32b86e331e3bd6dadf18b66568e + FirebaseCoreInternal: 9afa45b1159304c963da48addb78275ef701c6b4 + FirebaseInstallations: 317270fec08a5d418fdbc8429282238cab3ac843 + FirebaseMessaging: 3b26e2cee503815e01c3701236b020aa9b576f09 + FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + flutter_callkit_incoming: cb8138af67cda6dd981f7101a5d709003af21502 + flutter_inappwebview_ios: b89ba3482b96fb25e00c967aae065701b66e9b99 + flutter_ios_voip_kit_karmm: 371663476722afb631d5a13a39dee74c56c1abd0 + flutter_local_notifications: a5a732f069baa862e728d839dd2ebb904737effb + flutter_nfc_kit: e1b71583eafd2c9650bc86844a7f2d185fb414f6 + flutter_zoom_videosdk: 0f59e71685a03ddb0783ecc43bf3155b8599a7f5 + fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 + geolocator_apple: ab36aa0e8b7d7a2d7639b3b4e48308394e8cef5e + Google-Maps-iOS-Utils: 66d6de12be1ce6d3742a54661e7a79cb317a9321 + google_maps_flutter_ios: 3213e1e5f5588b6134935cb8fc59acb4e6d88377 + GoogleAdsOnDeviceConversion: 2be6297a4f048459e0ae17fad9bfd2844e10cf64 + GoogleAppMeasurement: 700dce7541804bec33db590a5c496b663fbe2539 + GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7 + GoogleMaps: 8939898920281c649150e0af74aa291c60f2e77d + GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1 + health: 32d2fbc7f26f9a2388d1a514ce168adbfa5bda65 + image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 + just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed + local_auth_darwin: c3ee6cce0a8d56be34c8ccb66ba31f7f180aaebb + location: 155caecf9da4f280ab5fe4a55f94ceccfab838f8 + manage_calendar_events: fe1541069431af035ced925ebd9def8b4b271254 + map_launcher: 8051ad5783913cafce93f2414c6858f2904fd8df + MapboxCommon: 119f3759f7dc9457f0695848108ab323eb643cb4 + MapboxCoreMaps: ca17f67baced23f8c952166ac6314c35bad3f66c + MapboxCoreNavigation: 3be9990fae3ed732a101001746d0e3b4234ec023 + MapboxDirections: d9ad8452e8927d95ed21e35f733834dbca7e0eb1 + MapboxMaps: b7f29ec7c33f7dc6d2947c1148edce6db81db9a7 + MapboxMobileEvents: d044b9edbe0ec7df60f6c2c9634fe9a7f449266b + MapboxNavigation: da9cf3d773ed5b0fa0fb388fccdaa117ee681f31 + MapboxNavigationNative: 629e359f3d2590acd1ebbacaaf99e1a80ee57e42 + MapboxSpeech: cd25ef99c3a3d2e0da72620ff558276ea5991a77 + nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 + network_info_plus: cf61925ab5205dce05a4f0895989afdb6aade5fc + open_filex: 432f3cd11432da3e39f47fcc0df2b1603854eff1 + OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 + package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 + path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880 + PayFortSDK: 233eabe9a45601fdbeac67fa6e5aae46ed8faf82 + permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d + Polyline: 2a1f29f87f8d9b7de868940f4f76deb8c678a5b1 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838 + share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a + shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb + Solar-dev: 4612dc9878b9fed2667d23b327f1d4e54e16e8d0 + sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 + SwiftProtobuf: e1b437c8e31a4c5577b643249a0bb62ed4f02153 + SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 + Turf: aa2ede4298009639d10db36aba1a7ebaad072a5e + url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b + video_player_avfoundation: dd410b52df6d2466a42d28550e33e4146928280a + wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556 + webview_flutter_wkwebview: 8ebf4fded22593026f7dbff1fbff31ea98573c8d + ZoomVideoSDK: 94e939820e57a075c5e712559f927017da0de06a + +PODFILE CHECKSUM: 8235407385ddd5904afc2563d65406117a51993e + +COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e031a976..9f1f6de9 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,12 @@ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 478CFA942E638C8E0064F3D7 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 478CFA932E638C8E0064F3D7 /* GoogleService-Info.plist */; }; + 47C1AAC72F425ACF00DA1231 /* Penguin.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC12F425AC800DA1231 /* Penguin.xcframework */; }; + 47C1AAC82F425ACF00DA1231 /* Penguin.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC12F425AC800DA1231 /* Penguin.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 47C1AAC92F425AD000DA1231 /* PenguinINRenderer.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC22F425AC800DA1231 /* PenguinINRenderer.xcframework */; }; + 47C1AACA2F425AD000DA1231 /* PenguinINRenderer.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC22F425AC800DA1231 /* PenguinINRenderer.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 47C1AACB2F425AD100DA1231 /* PenNavUI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC32F425AC800DA1231 /* PenNavUI.xcframework */; }; + 47C1AACC2F425AD100DA1231 /* PenNavUI.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 47C1AAC32F425AC800DA1231 /* PenNavUI.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 61243B492EC5FA3700D46FA0 /* PenguinModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B422EC5FA3700D46FA0 /* PenguinModel.swift */; }; 61243B4C2EC5FA3700D46FA0 /* HMGPenguinInPlatformBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B3D2EC5FA3700D46FA0 /* HMGPenguinInPlatformBridge.swift */; }; 61243B502EC5FA3700D46FA0 /* PenguinView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B452EC5FA3700D46FA0 /* PenguinView.swift */; }; @@ -18,12 +24,6 @@ 61243B562EC5FA3700D46FA0 /* PenguinNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B432EC5FA3700D46FA0 /* PenguinNavigator.swift */; }; 61243B572EC5FA3700D46FA0 /* PenguinViewFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61243B462EC5FA3700D46FA0 /* PenguinViewFactory.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 765A5A8C2F35CD8B0003FF7D /* Penguin.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A802F35CD730003FF7D /* Penguin.xcframework */; }; - 765A5A8D2F35CD8B0003FF7D /* Penguin.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A802F35CD730003FF7D /* Penguin.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 765A5A8E2F35CD8B0003FF7D /* PenguinINRenderer.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A812F35CD730003FF7D /* PenguinINRenderer.xcframework */; }; - 765A5A8F2F35CD8B0003FF7D /* PenguinINRenderer.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A812F35CD730003FF7D /* PenguinINRenderer.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 765A5A902F35CD8B0003FF7D /* PenNavUI.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A822F35CD730003FF7D /* PenNavUI.xcframework */; }; - 765A5A912F35CD8B0003FF7D /* PenNavUI.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 765A5A822F35CD730003FF7D /* PenNavUI.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 76AA18AE2F3B2A4D00DC8DFC /* ring_30Sec.caf in Resources */ = {isa = PBXBuildFile; fileRef = 76AA18AC2F3B2A4D00DC8DFC /* ring_30Sec.caf */; }; 76AA18AF2F3B2A4D00DC8DFC /* ring_30Sec.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 76AA18AD2F3B2A4D00DC8DFC /* ring_30Sec.mp3 */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -49,9 +49,9 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 765A5A8F2F35CD8B0003FF7D /* PenguinINRenderer.xcframework in Embed Frameworks */, - 765A5A8D2F35CD8B0003FF7D /* Penguin.xcframework in Embed Frameworks */, - 765A5A912F35CD8B0003FF7D /* PenNavUI.xcframework in Embed Frameworks */, + 47C1AACA2F425AD000DA1231 /* PenguinINRenderer.xcframework in Embed Frameworks */, + 47C1AAC82F425ACF00DA1231 /* Penguin.xcframework in Embed Frameworks */, + 47C1AACC2F425AD100DA1231 /* PenNavUI.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -66,6 +66,9 @@ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 478CFA932E638C8E0064F3D7 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 478CFA952E6E20A60064F3D7 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 47C1AAC12F425AC800DA1231 /* Penguin.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Penguin.xcframework; sourceTree = ""; }; + 47C1AAC22F425AC800DA1231 /* PenguinINRenderer.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = PenguinINRenderer.xcframework; sourceTree = ""; }; + 47C1AAC32F425AC800DA1231 /* PenNavUI.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = PenNavUI.xcframework; sourceTree = ""; }; 61243B3D2EC5FA3700D46FA0 /* HMGPenguinInPlatformBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMGPenguinInPlatformBridge.swift; sourceTree = ""; }; 61243B422EC5FA3700D46FA0 /* PenguinModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinModel.swift; sourceTree = ""; }; 61243B432EC5FA3700D46FA0 /* PenguinNavigator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PenguinNavigator.swift; sourceTree = ""; }; @@ -75,9 +78,6 @@ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7595037DD52211B91157B0F3 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 765A5A802F35CD730003FF7D /* Penguin.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = Penguin.xcframework; sourceTree = ""; }; - 765A5A812F35CD730003FF7D /* PenguinINRenderer.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = PenguinINRenderer.xcframework; sourceTree = ""; }; - 765A5A822F35CD730003FF7D /* PenNavUI.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = PenNavUI.xcframework; sourceTree = ""; }; 769C9BF82E6F106D009F68A9 /* RunnerDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerDebug.entitlements; sourceTree = ""; }; 76AA18AC2F3B2A4D00DC8DFC /* ring_30Sec.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ring_30Sec.caf; sourceTree = ""; }; 76AA18AD2F3B2A4D00DC8DFC /* ring_30Sec.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = ring_30Sec.mp3; sourceTree = ""; }; @@ -99,9 +99,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 765A5A8C2F35CD8B0003FF7D /* Penguin.xcframework in Frameworks */, - 765A5A902F35CD8B0003FF7D /* PenNavUI.xcframework in Frameworks */, - 765A5A8E2F35CD8B0003FF7D /* PenguinINRenderer.xcframework in Frameworks */, + 47C1AAC92F425AD000DA1231 /* PenguinINRenderer.xcframework in Frameworks */, + 47C1AACB2F425AD100DA1231 /* PenNavUI.xcframework in Frameworks */, + 47C1AAC72F425ACF00DA1231 /* Penguin.xcframework in Frameworks */, DE1EF78253E64BE86845D2CC /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -140,9 +140,9 @@ 766D8CB22EC60BE600D05E07 /* Frameworks */ = { isa = PBXGroup; children = ( - 765A5A802F35CD730003FF7D /* Penguin.xcframework */, - 765A5A812F35CD730003FF7D /* PenguinINRenderer.xcframework */, - 765A5A822F35CD730003FF7D /* PenNavUI.xcframework */, + 47C1AAC12F425AC800DA1231 /* Penguin.xcframework */, + 47C1AAC22F425AC800DA1231 /* PenguinINRenderer.xcframework */, + 47C1AAC32F425AC800DA1231 /* PenNavUI.xcframework */, D562310E31D1DDEFA02A6C12 /* Pods_Runner.framework */, ); name = Frameworks; @@ -523,10 +523,11 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Dr. Alhabib"; IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -709,10 +710,11 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Dr. Alhabib"; IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -738,10 +740,11 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 15; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = "Dr. Alhabib"; IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 64d7428e..308891a7 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -16,11 +16,11 @@ import GoogleMaps return super.application(application, didFinishLaunchingWithOptions: launchOptions) } func initializePlatformChannels(){ - if let mainViewController = window?.rootViewController as? FlutterViewController{ // platform initialization suppose to be in foreground - - HMGPenguinInPlatformBridge.initialize(flutterViewController: mainViewController) - - } +// if let mainViewController = window?.rootViewController as? FlutterViewController{ // platform initialization suppose to be in foreground +// +//// HMGPenguinInPlatformBridge.initialize(flutterViewController: mainViewController) +// +// } } override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:Data){ // Messaging.messaging().apnsToken = deviceToken diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index 1eb27a20..65b74d7e 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,128 +1 @@ -{ - "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 - } -} +{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"}]} \ No newline at end of file diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 9c805ac5..bbe54c9a 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -13,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - Dr. Alhabib Beta + Dr. Alhabib CFBundlePackageType APPL CFBundleShortVersionString @@ -101,7 +101,6 @@ audio fetch - location remote-notification voip diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 116e0733..2de4ce5c 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -184,15 +184,15 @@ class ApiClientImp implements ApiClient { body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; } - if (url.contains("HMGAI_Lab_Analyze_Orders_API")) { - url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyze_Orders_API"; - body['TokenID'] = "@dm!n"; - } - - if (url.contains("HMGAI_Lab_Analyzer_API")) { - url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyzer_API"; - body['TokenID'] = "@dm!n"; - } + // if (url.contains("HMGAI_Lab_Analyze_Orders_API")) { + // url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyze_Orders_API"; + // body['TokenID'] = "@dm!n"; + // } + // + // if (url.contains("HMGAI_Lab_Analyzer_API")) { + // url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyzer_API"; + // body['TokenID'] = "@dm!n"; + // } if (url == 'https://uat.hmgwebservices.com/Services/NHIC.svc/REST/GetPatientInfo') { url = "https://hmgwebservices.com/Services/NHIC.svc/REST/GetPatientInfo"; @@ -200,7 +200,7 @@ class ApiClientImp implements ApiClient { } // body['TokenID'] = "@dm!n"; - // body['PatientID'] = 809289; + // body['PatientID'] = 1231755; // body['PatientTypeID'] = 1; // body['PatientOutSA'] = 0; // body['SessionID'] = "45786230487560q"; @@ -359,7 +359,8 @@ class ApiClientImp implements ApiClient { onFailure( parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode, - failureType: ServerFailure("Error While Fetching data"), + // failureType: ServerFailure("Error While Fetching data"), + failureType: ServerFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']), ); logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 57c88c13..6c8a147f 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -234,7 +234,8 @@ class ApiConsts { static String getAiOverViewLabOrder = "Services/Patients.svc/REST/HMGAI_Lab_Analyzer_API"; // ************ static values for Api **************** - static final double appVersionID = 20.2; + static final double appVersionID = 20.5; + // static final double appVersionID = 50.7; static final int appChannelId = 3; static final String appIpAddress = "10.20.10.20"; @@ -471,6 +472,9 @@ var GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; //URL to check if doctor is favorite var IS_FAVOURITE_DOCTOR = "Services/Patients.svc/REST/Patient_IsFavouriteDoctor"; +//URL to get favorite doctors list +var GET_FAVOURITE_DOCTOR = "Services/Patients.svc/REST/Patient_GetFavouriteDoctor"; + //URL to insert favorite doctor var INSERT_FAVOURITE_DOCTOR = "Services/Patients.svc/REST/Patient_InsertFavouriteDoctor"; @@ -784,8 +788,7 @@ var GET_CUSTOMER_INFO = "VerifyCustomer"; //Pharmacy -var GET_PHARMACY_CATEGORISE = - 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; +var GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0'; var GET_OFFERS_CATEGORISE = 'discountcategories'; var GET_OFFERS_PRODUCTS = 'offerproducts/'; var GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id='; @@ -927,6 +930,10 @@ const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; const SEND_PATIENT_IMMEDIATE_UPDATE_INSURANCE_REQUEST = 'Services/OUTPs.svc/REST/PatientCompanyUpdate'; +const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate'; + +const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo'; + class ApiKeyConstants { static final String googleMapsApiKey = 'AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng'; } diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index de192d23..d4d19602 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -17,6 +17,8 @@ class AppAssets { static const String email = '$svgBasePath/email.svg'; static const String globe = '$svgBasePath/globe.svg'; static const String globeOther = '$svgBasePath/globe_other.svg'; + + // static const String globeOther = '$svgBasePath/globe_other.svg'; static const String cancel = '$svgBasePath/cancel.svg'; static const String bell = '$svgBasePath/bell.svg'; static const String login1 = '$svgBasePath/login1.svg'; @@ -233,6 +235,21 @@ class AppAssets { static const String forward_top_nav_icon = '$svgBasePath/forward_top_nav_icon.svg'; static const String back_top_nav_icon = '$svgBasePath/back_top_nav_icon.svg'; + static const String bluetooth = '$svgBasePath/bluetooth.svg'; + + //smartwatch + static const String watchActivity = '$svgBasePath/watch_activity.svg'; + static const String watchActivityTrailing = '$svgBasePath/watch_activity_trailing.svg'; + static const String watchSteps= '$svgBasePath/watch_steps.svg'; + static const String watchStepsTrailing= '$svgBasePath/watch_steps_trailing.svg'; + static const String watchSleep= '$svgBasePath/watch_sleep.svg'; + static const String watchSleepTrailing= '$svgBasePath/watch_sleep_trailing.svg'; + static const String watchBmi= '$svgBasePath/watch_bmi.svg'; + static const String watchBmiTrailing= '$svgBasePath/watch_bmi_trailing.svg'; + static const String watchWeight= '$svgBasePath/watch_weight.svg'; + static const String watchWeightTrailing= '$svgBasePath/watch_weight_trailing.svg'; + static const String watchHeight= '$svgBasePath/watch_height.svg'; + //bottom navigation// static const String homeBottom = '$svgBasePath/home_bottom.svg'; @@ -335,6 +352,8 @@ class AppAssets { static const String changeLanguageHomePageIcon = '$svgBasePath/change_language_home_page.svg'; static const String aiOverView = '$svgBasePath/ai_overview.svg'; static const String darkModeIcon = '$svgBasePath/dark_mode_icon.svg'; + static const String biometricLockIcon = '$svgBasePath/biometric_lock_icon.svg'; + static const String imageIcon = '$svgBasePath/image_icon.svg'; // PNGS // static const String hmgLogo = '$pngBasePath/hmg_logo.png'; diff --git a/lib/core/common_models/smart_watch.dart b/lib/core/common_models/smart_watch.dart new file mode 100644 index 00000000..b9259f5a --- /dev/null +++ b/lib/core/common_models/smart_watch.dart @@ -0,0 +1,18 @@ +enum SmartWatchTypes{ + apple, + samsung, + huawei, + whoop +} + + +class SmartwatchDetails { + final SmartWatchTypes watchType; + final String watchIcon; + final String smallIcon; + final String detailsTitle; + final String details; + final String secondTitle; + + SmartwatchDetails(this.watchType, this.watchIcon, this.smallIcon, this.detailsTitle, this.details, this.secondTitle); +} \ No newline at end of file diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index 4266aa3b..657d03ea 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -50,6 +50,7 @@ import 'package:hmg_patient_app_new/features/payfort/payfort_repo.dart'; import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_repo.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; +import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_repo.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/features/qr_parking/qr_parking_repo.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart'; @@ -172,6 +173,7 @@ class AppDependencies { getIt.registerLazySingleton(() => NotificationsRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => AskDoctorRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => ServicesPriceListRepoImp(loggerService: getIt(), apiClient: getIt())); + getIt.registerLazySingleton(() => ProfileSettingsRepoImp(loggerService: getIt(), apiClient: getIt())); // ViewModels // Global/shared VMs → LazySingleton @@ -224,7 +226,11 @@ class AppDependencies { authenticationRepo: getIt(), cacheService: getIt(), navigationService: getIt(), dialogService: getIt(), appState: getIt(), errorHandlerService: getIt(), localAuthService: getIt()), ); - getIt.registerLazySingleton(() => ProfileSettingsViewModel(cacheService: getIt())); + getIt.registerLazySingleton(() => ProfileSettingsViewModel( + cacheService: getIt(), + profileSettingsRepo: getIt(), + errorHandlerService: getIt(), + )); getIt.registerLazySingleton(() => DateRangeSelectorRangeViewModel()); diff --git a/lib/core/location_util.dart b/lib/core/location_util.dart index cf26d24e..95b154ba 100644 --- a/lib/core/location_util.dart +++ b/lib/core/location_util.dart @@ -94,7 +94,27 @@ class LocationUtils { permissionGranted = await Geolocator.requestPermission(); if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) { appState.resetLocation(); - onFailure?.call(); + if (onFailure == null && isShowConfirmDialog) { + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), + navigationService.navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: "Please grant location permission from app settings to see better results", + isShowActionButtons: true, + onCancelTap: () { + navigationService.pop(); + }, + onConfirmTap: () async { + navigationService.pop(); + openAppSettings(); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } else { + onFailure?.call(); + } return; } } else if (permissionGranted == LocationPermission.deniedForever) { diff --git a/lib/core/utils/calender_utils_new.dart b/lib/core/utils/calender_utils_new.dart index 9edfdced..6f043e26 100644 --- a/lib/core/utils/calender_utils_new.dart +++ b/lib/core/utils/calender_utils_new.dart @@ -1,9 +1,16 @@ import 'dart:async'; import 'package:device_calendar_plus/device_calendar_plus.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:jiffy/jiffy.dart' show Jiffy; import 'package:manage_calendar_events/manage_calendar_events.dart' hide Calendar; +import 'package:permission_handler/permission_handler.dart'; class CalenderUtilsNew { final DeviceCalendar calender = DeviceCalendar.instance; @@ -17,7 +24,26 @@ class CalenderUtilsNew { Future getCalenders() async { CalendarPermissionStatus result = await DeviceCalendar.instance.hasPermissions(); - if (result != CalendarPermissionStatus.granted) await DeviceCalendar.instance.requestPermissions(); + if (result != CalendarPermissionStatus.granted) { + // await DeviceCalendar.instance.requestPermissions(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: GetIt.instance().navigatorKey.currentContext!), + GetIt.instance().navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: LocaleKeys.calendarPermissionAlert.tr(), + isShowActionButtons: true, + onCancelTap: () { + GetIt.instance().pop(); + }, + onConfirmTap: () async { + GetIt.instance().pop(); + openAppSettings(); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } var calenders = await calender.listCalendars(); calenders.forEach((calender) { if (!calender.readOnly) { @@ -75,9 +101,11 @@ class CalenderUtilsNew { required String itemDescriptionN, required String route, Function(String)? onFailure, - String? prescriptionNumber}) async { + String? prescriptionNumber, + DateTime? scheduleDateTime, + }) async { DateTime currentDay = DateTime.now(); - DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); + DateTime actualDate = scheduleDateTime??DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0); print("the frequency is $frequencyNumber"); frequencyNumber ??= 2; //Some time frequency number is null so by default will be 2 int interval = calculateIntervalAsPerFrequency(frequencyNumber); diff --git a/lib/core/utils/date_util.dart b/lib/core/utils/date_util.dart index 87af0a27..6c4e7bec 100644 --- a/lib/core/utils/date_util.dart +++ b/lib/core/utils/date_util.dart @@ -1,7 +1,10 @@ import 'package:device_calendar/device_calendar.dart'; import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:intl/intl.dart'; +import '../app_state.dart' show AppState; + class DateUtil { /// convert String To Date function /// [date] String we want to convert @@ -198,6 +201,10 @@ class DateUtil { } } + static getMonthDayAsOfLang(int month){ + return getIt.get().isArabic()?getMonthArabic(month):getMonth(month); + } + /// get month by /// [month] convert month number in to month name in Arabic static getMonthArabic(int month) { @@ -268,6 +275,10 @@ class DateUtil { return date ?? DateTime.now(); } + static getWeekDayAsOfLang(int weekDay){ + return getIt.get().isArabic()?getWeekDayArabic(weekDay):getWeekDayEnglish(weekDay); + } + /// get month by /// [weekDay] convert week day in int to week day name static getWeekDay(int weekDay) { @@ -580,6 +591,14 @@ class DateUtil { return weekDayName; // Return as-is if not recognized } } + + static String millisToHourMin(int milliseconds) { + int totalMinutes = (milliseconds / 60000).floor(); // convert ms → min + int hours = totalMinutes ~/ 60; // integer division + int minutes = totalMinutes % 60; // remaining minutes + + return '${hours} hr ${minutes} min'; + } } extension OnlyDate on DateTime { diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index 0d600bd7..ac8c152a 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -405,6 +405,7 @@ class Utils { static Widget getWarningWidget({ String? loadingText, bool isShowActionButtons = false, + bool showOkButton = false, Widget? bodyWidget, Function? onConfirmTap, Function? onCancelTap, @@ -457,7 +458,26 @@ class Utils { ), ], ) - : SizedBox.shrink(), + : showOkButton? + Row( + children: [ + Expanded( + child: CustomButton( + text: LocaleKeys.ok.tr(), + onPressed: () async { + if (onConfirmTap != null) { + onConfirmTap(); + } + }, + backgroundColor: AppColors.bgGreenColor, + borderColor: AppColors.bgGreenColor, + textColor: Colors.white, + // icon: AppAssets.confirm, + ), + ), + ], + ) + :SizedBox.shrink(), ], ).center; } diff --git a/lib/core/utils/validation_utils.dart b/lib/core/utils/validation_utils.dart index a8bc03d3..b5651648 100644 --- a/lib/core/utils/validation_utils.dart +++ b/lib/core/utils/validation_utils.dart @@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; @@ -32,6 +33,13 @@ class ValidationUtils { isCorrectID = false; } + if(nationalId!.length == 10) { + if (Utils.isSAUDIIDValid(nationalId!) == false) { + _dialogService.showExceptionBottomSheet(message: LocaleKeys.enterValidNationalId.tr(), onOkPressed: onOkPress); + isCorrectID = false; + } + } + if (nationalId != null && nationalId.isNotEmpty && selectedCountry != null) { if (selectedCountry == CountryEnum.saudiArabia) { if (!validateIqama(nationalId)) { diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 3f9327fc..3ad0ad92 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -18,6 +18,7 @@ extension CapExtension on String { String get needTranslation => this; String get capitalizeFirstofEach => trim().isNotEmpty ? trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; + } extension EmailValidator on String { @@ -258,12 +259,12 @@ extension EmailValidator on String { style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 17.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, fontFamily: isEnglishOnly ? "Poppins" : getIt.get().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'), ); - Widget toText18({Color? color, FontWeight? weight, bool isBold = false, bool isCenter = false, int? maxlines, TextOverflow? textOverflow}) => Text( + Widget toText18({Color? color, FontWeight? weight, bool isBold = false, bool isCenter = false, int? maxlines, TextOverflow? textOverflow, bool isEnglishOnly = false,}) => Text( maxLines: maxlines, textAlign: isCenter ? TextAlign.center : null, this, overflow: textOverflow, - style: TextStyle(fontSize: 18.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), + style: TextStyle(fontSize: 18.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4, fontFamily: (isEnglishOnly ? "Poppins" : getIt.get().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),), ); Widget toText19({Color? color, bool isBold = false}) => Text( @@ -320,9 +321,9 @@ extension EmailValidator on String { height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 32.f, letterSpacing: -1, fontFamily: isEnglishOnly ? "Poppins" : getIt.get().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins', fontWeight: isBold ? FontWeight.bold : weight ?? FontWeight.normal), ); - Widget toText44({Color? color, bool isBold = false}) => Text( + Widget toText44({Color? color, bool isBold = false, bool isEnglishOnly = false,}) => Text( this, - style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + style: TextStyle(height: 32 / 32, color: color ?? AppColors.blackColor, fontSize: 44.f, letterSpacing: -1, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, fontFamily: (isEnglishOnly ? "Poppins" : getIt.get().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),), ); Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 64672f5f..866c26a4 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:shimmer/shimmer.dart'; import 'package:sizer/sizer.dart'; @@ -152,6 +154,7 @@ extension SmoothContainerExtension on ShapeBorder { BorderSide? side, BorderRadius? customBorder, bool hasShadow = false, + bool hasDenseShadow = false, }) { final bgColor = backgroundColor ?? color; return ShapeDecoration( @@ -161,17 +164,17 @@ extension SmoothContainerExtension on ShapeBorder { smoothness: 1, side: side ?? BorderSide.none, ), - shadows: - // hasShadow - // ? [ - // BoxShadow( - // color: const Color(0xff000000).withOpacity(.05), - // blurRadius: 32, - // offset: const Offset(0, 0), - // ) - // ] - // : - [], + shadows: hasShadow + ? [ + BoxShadow( + // color: hasDenseShadow ? const Color(0xff000000).withOpacity(.06) : const Color(0xff000000).withOpacity(.1), + color: getIt.get().isDarkMode ? Color(0xff3a3a3a).withOpacity(1.0) : Color(0xffE1E1E1).withOpacity(1.0), + blurRadius: 0, + spreadRadius: 0, + offset: const Offset(1, 0), + ) + ] + : [], ); } } diff --git a/lib/features/ask_doctor/ask_doctor_repo.dart b/lib/features/ask_doctor/ask_doctor_repo.dart index 4e4a4006..bd6af5b8 100644 --- a/lib/features/ask_doctor/ask_doctor_repo.dart +++ b/lib/features/ask_doctor/ask_doctor_repo.dart @@ -47,7 +47,7 @@ class AskDoctorRepoImp implements AskDoctorRepo { try { final list = response['PatientDoctorAppointmentResultList']; - final clinicsList = list.map((item) => AskDoctorAppointmentHistoryList.fromJson(item as Map)).toList().cast(); + final clinicsList = list != null ? list.map((item) => AskDoctorAppointmentHistoryList.fromJson(item as Map)).toList().cast() : []; apiResponse = GenericApiModel>( messageStatus: messageStatus, diff --git a/lib/features/ask_doctor/models/ask_doctor_appointments_list.dart b/lib/features/ask_doctor/models/ask_doctor_appointments_list.dart index 7f40d71c..6b337662 100644 --- a/lib/features/ask_doctor/models/ask_doctor_appointments_list.dart +++ b/lib/features/ask_doctor/models/ask_doctor_appointments_list.dart @@ -143,7 +143,7 @@ class AskDoctorAppointmentHistoryList { noOfPatientsRate = json['NoOfPatientsRate']; projectName = json['ProjectName']; qR = json['QR']; - speciality = json['Speciality'].cast(); + // speciality = json['Speciality'].cast(); } Map toJson() { diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index 91f304bc..1c9f5e16 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -317,7 +317,13 @@ class AuthenticationRepoImp implements AuthenticationRepo { } if (appState.getSuperUserID == responseID) { + // switchRequest['LoginType'] = 0; switchRequest['PatientIdentificationID'] = ""; + // switchRequest["PatientID"] = responseID; + // switchRequest["SuperUser"] = responseID; + // switchRequest["PatientID"] = appState.getAuthenticatedUser()?.patientId ?? 0; + + // switchRequest["PatientMobileNumber"] = newRequest.patientMobileNumber?.toString().startsWith('0') == true ? newRequest.patientMobileNumber.toString() : '0${newRequest.patientMobileNumber}'; switchRequest.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ProjectOutSA', 'ForRegisteration'].contains(key)); } } diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 276d8ddb..c6422bc0 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -28,6 +28,7 @@ import 'package:hmg_patient_app_new/features/authentication/models/resp_models/a import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; +import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; @@ -619,7 +620,7 @@ class AuthenticationViewModel extends ChangeNotifier { } else { activation.list!.first.isParentUser = true; } - activation.list!.first.bloodGroup = activation.patientBlodType; + activation.list!.first.bloodGroup = activation.patientBloodType; activation.list!.first.zipCode = selectedCountrySignup == CountryEnum.others ? '0' : selectedCountrySignup.countryCode; _appState.setAuthenticatedUser(activation.list!.first); _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); @@ -649,6 +650,7 @@ class AuthenticationViewModel extends ChangeNotifier { await clearDefaultInputValues(); myAppointmentsVM.setIsAppointmentDataToBeLoaded(true); getIt.get().setIsInsuranceDataToBeLoaded(true); + getIt.get().setHasVitalSignDataLoaded(false); if (isUserAgreedBefore) { LoaderBottomSheet.hideLoader(); navigateToHomeScreen(); diff --git a/lib/features/authentication/widgets/otp_verification_screen.dart b/lib/features/authentication/widgets/otp_verification_screen.dart index 7ddccda8..9e80dbb9 100644 --- a/lib/features/authentication/widgets/otp_verification_screen.dart +++ b/lib/features/authentication/widgets/otp_verification_screen.dart @@ -20,6 +20,8 @@ import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; import 'package:provider/provider.dart'; import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart'; +import 'dart:ui' as ui; + typedef OnDone = void Function(String text); class ProvidedPinBoxTextAnimation { @@ -564,23 +566,27 @@ class _OTPVerificationScreenState extends State { SizedBox(height: 16.h), Center( - child: OTPWidget( - maxLength: _otpLength, - controller: _otpController, - pinBoxWidth: 70.h, - pinBoxHeight: 100.h, - pinBoxRadius: 16, - pinBoxBorderWidth: 0, - pinBoxOuterPadding: EdgeInsets.symmetric(horizontal: 4.h), - defaultBorderColor: Colors.transparent, - textBorderColor: Colors.transparent, - pinBoxColor: AppColors.whiteColor, - autoFocus: true, - onTextChanged: _onOtpChanged, - pinTextStyle: TextStyle( - fontSize: 40.f, - fontWeight: FontWeight.bold, - color: AppColors.whiteColor, + child: Directionality( + textDirection: ui.TextDirection.ltr, + child: OTPWidget( + maxLength: _otpLength, + controller: _otpController, + pinBoxWidth: 70.h, + pinBoxHeight: 100.h, + pinBoxRadius: 16, + pinBoxBorderWidth: 0, + pinBoxOuterPadding: EdgeInsets.symmetric(horizontal: 4.h), + defaultBorderColor: Colors.transparent, + textBorderColor: Colors.transparent, + pinBoxColor: AppColors.whiteColor, + autoFocus: true, + onTextChanged: _onOtpChanged, + pinTextStyle: TextStyle( + fontSize: 40.f, + fontWeight: FontWeight.bold, + color: AppColors.whiteColor, + fontFamily: "Poppins" + ), ), ), ), @@ -601,7 +607,7 @@ class _OTPVerificationScreenState extends State { children: [ LocaleKeys.resendIn.tr(context: context).toText16(color: AppColors.inputLabelTextColor), SizedBox(width: 2.h), - ' ($minutes:$seconds). '.toText16(color: AppColors.inputLabelTextColor) + ' ($minutes:$seconds). '.toText16(color: AppColors.inputLabelTextColor, isEnglishOnly: true) ], ); }, diff --git a/lib/features/book_appointments/book_appointments_repo.dart b/lib/features/book_appointments/book_appointments_repo.dart index b56fa024..7a984399 100644 --- a/lib/features/book_appointments/book_appointments_repo.dart +++ b/lib/features/book_appointments/book_appointments_repo.dart @@ -1163,7 +1163,7 @@ class BookAppointmentsRepoImp implements BookAppointmentsRepo { messageStatus: messageStatus, statusCode: statusCode, errorMessage: null, - data: response, + data: response["IsFavouriteDoctor"], ); if (onSuccess != null) { onSuccess(response); diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index aefc0b79..afc9b568 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -49,6 +49,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { bool isDoctorSearchByNameStarted = false; bool isAppointmentNearestGateLoading = false; + bool isLiveCareSelectedFromHomePage = false; bool isLiveCareSchedule = false; bool isGetDocForHealthCal = false; bool showSortFilterButtons = false; @@ -320,6 +321,11 @@ class BookAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } + setIsLiveCareSelectedFromHomePage(bool isLiveCareSelectedFromHomePage) { + this.isLiveCareSelectedFromHomePage = isLiveCareSelectedFromHomePage; + notifyListeners(); + } + setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) { this.isWaitingAppointmentSelected = isWaitingAppointmentSelected; notifyListeners(); @@ -425,9 +431,25 @@ class BookAppointmentsViewModel extends ChangeNotifier { calculationID = null; isGetDocForHealthCal = false; selectedTabIndex = index; + checkLiveCareSymptomCheckerStatus(); notifyListeners(); } + bool checkLiveCareSymptomCheckerStatus() { + bool isAllowed = false; + + if (selectedTabIndex == 1) { + if (_appState.isAuthenticated) { + isAllowed = true; + } else { + isAllowed = false; + } + } else { + isAllowed = true; + } + return isAllowed; + } + /// this function will decide which clinic api to be called /// either api for region flow or the select clinic api Future getClinics() async { @@ -538,6 +560,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { clearSearchFilters(); getFiltersFromDoctorList(); _groupDoctorsList(); + setIsNearestAppointmentSelected(true); notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -1552,7 +1575,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } } else if (apiResponse.messageStatus == 1) { // Check the response for IsFavouriteDoctor flag - bool isFavorite = apiResponse.data['IsFavouriteDoctor'] ?? false; + bool isFavorite = apiResponse.data; setIsFavouriteDoctor(isFavorite); if (onSuccess != null) { onSuccess(apiResponse.data); diff --git a/lib/features/book_appointments/models/resp_models/get_favorite_doctors_list.dart b/lib/features/book_appointments/models/resp_models/get_favorite_doctors_list.dart new file mode 100644 index 00000000..b3048e67 --- /dev/null +++ b/lib/features/book_appointments/models/resp_models/get_favorite_doctors_list.dart @@ -0,0 +1,81 @@ +import 'dart:convert'; + +class GetFavoriteDoctorsListModel { + int? id; + int? projectId; + int? clinicId; + int? doctorId; + int? patientId; + bool? patientOutSa; + bool? isActive; + String? createdOn; + dynamic modifiedOn; + String? doctorImageUrl; + String? doctorName; + String? doctorTitle; + String? nationalityFlagUrl; + String? nationalityId; + String? nationalityName; + List? speciality; + + GetFavoriteDoctorsListModel({ + this.id, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.patientOutSa, + this.isActive, + this.createdOn, + this.modifiedOn, + this.doctorImageUrl, + this.doctorName, + this.doctorTitle, + this.nationalityFlagUrl, + this.nationalityId, + this.nationalityName, + this.speciality, + }); + + factory GetFavoriteDoctorsListModel.fromRawJson(String str) => GetFavoriteDoctorsListModel.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory GetFavoriteDoctorsListModel.fromJson(Map json) => GetFavoriteDoctorsListModel( + id: json["ID"], + projectId: json["ProjectID"], + clinicId: json["ClinicID"], + doctorId: json["DoctorID"], + patientId: json["PatientID"], + patientOutSa: json["PatientOutSA"], + isActive: json["IsActive"], + createdOn: json["CreatedOn"], + modifiedOn: json["ModifiedOn"], + doctorImageUrl: json["DoctorImageURL"], + doctorName: json["DoctorName"], + doctorTitle: json["DoctorTitle"], + nationalityFlagUrl: json["NationalityFlagURL"], + nationalityId: json["NationalityID"], + nationalityName: json["NationalityName"], + speciality: json["Speciality"] == null ? [] : List.from(json["Speciality"]!.map((x) => x)), + ); + + Map toJson() => { + "ID": id, + "ProjectID": projectId, + "ClinicID": clinicId, + "DoctorID": doctorId, + "PatientID": patientId, + "PatientOutSA": patientOutSa, + "IsActive": isActive, + "CreatedOn": createdOn, + "ModifiedOn": modifiedOn, + "DoctorImageURL": doctorImageUrl, + "DoctorName": doctorName, + "DoctorTitle": doctorTitle, + "NationalityFlagURL": nationalityFlagUrl, + "NationalityID": nationalityId, + "NationalityName": nationalityName, + "Speciality": speciality == null ? [] : List.from(speciality!.map((x) => x)), + }; +} diff --git a/lib/features/contact_us/contact_us_view_model.dart b/lib/features/contact_us/contact_us_view_model.dart index d627c55e..34657a85 100644 --- a/lib/features/contact_us/contact_us_view_model.dart +++ b/lib/features/contact_us/contact_us_view_model.dart @@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_p import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_status_coc_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; +import 'package:permission_handler/permission_handler.dart'; class ContactUsViewModel extends ChangeNotifier { ContactUsRepo contactUsRepo; @@ -22,6 +23,7 @@ class ContactUsViewModel extends ChangeNotifier { bool isHMGHospitalsListSelected = true; bool isLiveChatProjectsListLoading = false; bool isSendFeedbackTabSelected = true; + bool hasLocationEnabled = false; List hmgHospitalsLocationsList = []; List hmgPharmacyLocationsList = []; @@ -52,11 +54,12 @@ class ContactUsViewModel extends ChangeNotifier { ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState}); - initContactUsViewModel() { + initContactUsViewModel() async { isHMGLocationsListLoading = true; isHMGHospitalsListSelected = true; isLiveChatProjectsListLoading = true; isCOCItemsListLoading = true; + hasLocationEnabled = false; hmgHospitalsLocationsList.clear(); hmgPharmacyLocationsList.clear(); liveChatProjectsList.clear(); @@ -65,6 +68,18 @@ class ContactUsViewModel extends ChangeNotifier { selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'); setPatientFeedbackSelectedAppointment(null); getHMGLocations(); + + if (await Permission.location.isGranted) { + setHasLocationEnabled(true); + } else { + setHasLocationEnabled(false); + } + + notifyListeners(); + } + + setHasLocationEnabled(bool hasLocationEnabled) { + this.hasLocationEnabled = hasLocationEnabled; notifyListeners(); } @@ -128,6 +143,8 @@ class ContactUsViewModel extends ChangeNotifier { hmgPharmacyLocationsList.add(location); } } + + sortHMGLocations(hasLocationEnabled); isHMGLocationsListLoading = false; notifyListeners(); if (onSuccess != null) { @@ -138,6 +155,17 @@ class ContactUsViewModel extends ChangeNotifier { ); } + sortHMGLocations(bool isByLocation) { + if (isByLocation) { + hmgHospitalsLocationsList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers)); + hmgPharmacyLocationsList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers)); + } else { + hmgHospitalsLocationsList.sort((a, b) => a.locationName!.compareTo(b.locationName!)); + hmgPharmacyLocationsList.sort((a, b) => a.locationName!.compareTo(b.locationName!)); + } + notifyListeners(); + } + Future getLiveChatProjectsList({Function(dynamic)? onSuccess, Function(String)? onError}) async { isLiveChatProjectsListLoading = true; liveChatProjectsList.clear(); diff --git a/lib/features/habib_wallet/habib_wallet_repo.dart b/lib/features/habib_wallet/habib_wallet_repo.dart index 659510de..c89a85be 100644 --- a/lib/features/habib_wallet/habib_wallet_repo.dart +++ b/lib/features/habib_wallet/habib_wallet_repo.dart @@ -3,6 +3,7 @@ import 'package:hmg_patient_app_new/core/api/api_client.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; +import 'package:hmg_patient_app_new/features/habib_wallet/models/patient_advance_balance_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart'; @@ -40,18 +41,22 @@ class HabibWalletRepoImp implements HabibWalletRepo { }, onSuccess: (response, statusCode, {messageStatus, errorMessage}) { try { - // final list = response['ListPLO']; + final list = response['List_PatientAdvanceBalanceAmount']; // if (list == null || list.isEmpty) { // throw Exception("lab list is empty"); // } - // final labOrders = list.map((item) => PatientLabOrdersResponseModel.fromJson(item as Map)).toList().cast(); + final List balanceAmountList = list.map((item) => PatientAdvanceBalanceResponseModel.fromJson(item as Map)).toList().cast(); + + for (var element in balanceAmountList) { + element.totalAmount = response['TotalAdvanceBalanceAmount']; + } apiResponse = GenericApiModel( messageStatus: messageStatus, statusCode: statusCode, errorMessage: null, - data: response["TotalAdvanceBalanceAmount"], + data: balanceAmountList, ); } catch (e) { failure = DataParsingFailure(e.toString()); diff --git a/lib/features/habib_wallet/habib_wallet_view_model.dart b/lib/features/habib_wallet/habib_wallet_view_model.dart index 2f338957..3d72f651 100644 --- a/lib/features/habib_wallet/habib_wallet_view_model.dart +++ b/lib/features/habib_wallet/habib_wallet_view_model.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_repo.dart'; +import 'package:hmg_patient_app_new/features/habib_wallet/models/patient_advance_balance_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; @@ -30,6 +31,8 @@ class HabibWalletViewModel extends ChangeNotifier { num selectedRechargeType = 1; + List habibWalletBalanceList = []; + HabibWalletViewModel({required this.habibWalletRepo, required this.errorHandlerService}); initHabibWalletProvider() { @@ -39,6 +42,7 @@ class HabibWalletViewModel extends ChangeNotifier { walletRechargeAmount = 0; selectedRechargeType = 1; advancePaymentHospitals.clear(); + habibWalletBalanceList.clear(); selectedHospital = null; fileNumber = ''; depositorName = ''; @@ -103,7 +107,13 @@ class HabibWalletViewModel extends ChangeNotifier { if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { - habibWalletAmount = apiResponse.data!; + habibWalletBalanceList = apiResponse.data; + habibWalletAmount = habibWalletBalanceList.first.totalAmount ?? 0.0; + + habibWalletBalanceList.sort((a, b) => b.patientAdvanceBalanceAmount!.compareTo(a.patientAdvanceBalanceAmount!)); + + habibWalletBalanceList.removeWhere((element) => element.patientAdvanceBalanceAmount == 0); + isWalletAmountLoading = false; notifyListeners(); if (onSuccess != null) { diff --git a/lib/features/habib_wallet/models/patient_advance_balance_response_model.dart b/lib/features/habib_wallet/models/patient_advance_balance_response_model.dart new file mode 100644 index 00000000..55594555 --- /dev/null +++ b/lib/features/habib_wallet/models/patient_advance_balance_response_model.dart @@ -0,0 +1,27 @@ +class PatientAdvanceBalanceResponseModel { + num? distanceInKilometers; + num? patientAdvanceBalanceAmount; + String? projectDescription; + int? projectID; + num? totalAmount; + + PatientAdvanceBalanceResponseModel({this.distanceInKilometers, this.patientAdvanceBalanceAmount, this.projectDescription, this.projectID, this.totalAmount}); + + PatientAdvanceBalanceResponseModel.fromJson(Map json) { + distanceInKilometers = json['DistanceInKilometers']; + patientAdvanceBalanceAmount = json['PatientAdvanceBalanceAmount']; + projectDescription = json['ProjectDescription']; + projectID = json['ProjectID']; + totalAmount = json['TotalAmount']; + } + + Map toJson() { + final Map data = Map(); + data['DistanceInKilometers'] = distanceInKilometers; + data['PatientAdvanceBalanceAmount'] = patientAdvanceBalanceAmount; + data['ProjectDescription'] = projectDescription; + data['ProjectID'] = projectID; + data['TotalAmount'] = totalAmount; + return data; + } +} diff --git a/lib/features/hmg_services/hmg_services_view_model.dart b/lib/features/hmg_services/hmg_services_view_model.dart index 5bf450ba..7b32cc6e 100644 --- a/lib/features/hmg_services/hmg_services_view_model.dart +++ b/lib/features/hmg_services/hmg_services_view_model.dart @@ -85,6 +85,11 @@ class HmgServicesViewModel extends ChangeNotifier { List covidTestProcedureList = []; Covid19GetPaymentInfo? covidPaymentInfo; + void setHasVitalSignDataLoaded(bool hasVitalSignDataLoaded) { + this.hasVitalSignDataLoaded = hasVitalSignDataLoaded; + notifyListeners(); + } + Future getOrdersList() async {} // HHC multiple services selection diff --git a/lib/features/insurance/insurance_view_model.dart b/lib/features/insurance/insurance_view_model.dart index 515743c6..28210d39 100644 --- a/lib/features/insurance/insurance_view_model.dart +++ b/lib/features/insurance/insurance_view_model.dart @@ -13,6 +13,7 @@ class InsuranceViewModel extends ChangeNotifier { bool isInsuranceHistoryLoading = false; bool isInsuranceDetailsLoading = false; bool isInsuranceUpdateDetailsLoading = false; + bool isInsuranceExpiryBannerShown = false; bool isInsuranceDataToBeLoaded = true; bool isInsuranceApprovalsLoading = false; @@ -49,6 +50,11 @@ class InsuranceViewModel extends ChangeNotifier { notifyListeners(); } + setIsInsuranceExpiryBannerShown(bool isInsuranceExpiryBannerShown) { + this.isInsuranceExpiryBannerShown = isInsuranceExpiryBannerShown; + notifyListeners(); + } + setIsInsuranceHistoryLoading(bool val) { isInsuranceHistoryLoading = val; notifyListeners(); @@ -88,9 +94,10 @@ class InsuranceViewModel extends ChangeNotifier { (failure) async { debugPrint("InsuranceViewModel: API call failed - ${failure.toString()}"); isInsuranceLoading = false; - isInsuranceDataToBeLoaded = false; + isInsuranceDataToBeLoaded = true; isInsuranceExpired = false; isInsuranceActive = false; + isInsuranceExpiryBannerShown = false; notifyListeners(); }, (apiResponse) { @@ -111,6 +118,8 @@ class InsuranceViewModel extends ChangeNotifier { debugPrint("InsuranceViewModel: Insurance card expired: $isInsuranceExpired"); } + isInsuranceExpiryBannerShown = isInsuranceExpired; + isInsuranceActive = patientInsuranceList.first.isActive ?? false; // isInsuranceActive = true; @@ -148,6 +157,9 @@ class InsuranceViewModel extends ChangeNotifier { } Future getPatientInsuranceDetailsForUpdate(String patientID, String identificationNo, {Function(dynamic)? onSuccess, Function(String)? onError}) async { + patientInsuranceUpdateResponseModel = null; + notifyListeners(); + final result = await insuranceRepo.getPatientInsuranceDetailsForUpdate(patientId: patientID, identificationNo: identificationNo); result.fold( @@ -214,7 +226,7 @@ class InsuranceViewModel extends ChangeNotifier { (failure) async { notifyListeners(); if (onError != null) { - onError(failure.toString()); + onError(failure.message.toString()); } }, (apiResponse) { diff --git a/lib/features/lab/lab_view_model.dart b/lib/features/lab/lab_view_model.dart index 07cbbde3..0e7efdb3 100644 --- a/lib/features/lab/lab_view_model.dart +++ b/lib/features/lab/lab_view_model.dart @@ -106,6 +106,11 @@ class LabViewModel extends ChangeNotifier { notifyListeners(); } + closeAILabResultAnalysis() { + labOrderResponseByAi = null; + notifyListeners(); + } + void setIsSortByClinic(bool value) { isSortByClinic = value; patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; @@ -144,21 +149,26 @@ class LabViewModel extends ChangeNotifier { isLabOrdersLoading = false; isLabResultsLoading = false; - // --- Build groups by clinic and by hospital (projectName) --- - final clinicMap = >{}; - final hospitalMap = >{}; - for (var order in patientLabOrders) { - final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); - clinicMap.putIfAbsent(clinicKey, () => []).add(order); - - final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); - hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); + order.testDetails!.sort((a, b) => a.description!.compareTo(b.description!)); } - patientLabOrdersByClinic = clinicMap.values.toList(); - patientLabOrdersByHospital = hospitalMap.values.toList(); - patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; + // --- Build groups by clinic and by hospital (projectName) --- + // final clinicMap = >{}; + // final hospitalMap = >{}; + // + // for (var order in patientLabOrders) { + // final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); + // clinicMap.putIfAbsent(clinicKey, () => []).add(order); + // + // final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); + // hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); + // } + + // patientLabOrdersByClinic = clinicMap.values.toList(); + // patientLabOrdersByHospital = hospitalMap.values.toList(); + // patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; + // patientLabOrdersViewList = patientLabOrdersByClinic; filterSuggestions(); getUniqueTestDescription(); @@ -377,7 +387,8 @@ class LabViewModel extends ChangeNotifier { LoaderBottomSheet.hideLoader(); if (apiResponse.messageStatus == 2) { } else if (apiResponse.messageStatus == 1) { - var recentThree = sort(apiResponse.data!); + var sortedResult = sort(apiResponse.data!); + var recentThree = sortedResult.take(3).toList(); mainLabResults = recentThree; double highRefrenceValue = double.negativeInfinity; @@ -385,11 +396,12 @@ class LabViewModel extends ChangeNotifier { double lowRefenceValue = double.infinity; String? flagForLowReferenceRange; - recentThree.reversed.forEach((element) { + sortedResult.take(3).toList().reversed.forEach((element) { try { var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!); var resultValue = double.parse(element.resultValue!); - var transformedValue = transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag ?? ""); + // var transformedValue = transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag ?? ""); + var transformedValue = resultValue; if (resultValue > maxY) { maxY = resultValue; maxX = maxY; @@ -421,9 +433,9 @@ class LabViewModel extends ChangeNotifier { highRefrenceValue = maxY; lowRefenceValue = minY; } - + // if (minY > lowRefenceValue) { - minY = lowRefenceValue - 25; + minY = lowRefenceValue - getInterval(); } this.flagForHighReferenceRange = flagForHighReferenceRange; @@ -432,12 +444,16 @@ class LabViewModel extends ChangeNotifier { lowTransformedReferenceValue = double.parse(transformValueInRange(lowRefenceValue, flagForLowReferenceRange ?? "").toStringAsFixed(1)); this.highRefrenceValue = double.parse(highRefrenceValue.toStringAsFixed(1)); this.lowRefenceValue = double.parse(lowRefenceValue.toStringAsFixed(1)); - - if (maxY < highRefrenceValue) { + if(maxY=1.0 && maxX < 5.0) return .3; + if(maxX >=5.0 && maxX < 10.0) return 1.5; + if(maxX >=10.0 && maxX < 50.0) return 2.5; + if(maxX >=50.0 && maxX < 100.0) return 5; + if(maxX >=100.0 && maxX < 200.0) return 10; + return 15; + } void checkIfGraphShouldBeDisplayed(LabResult recentResult) { shouldShowGraph = recentResult.checkIfGraphShouldBeDisplayed(); @@ -576,7 +603,8 @@ class LabViewModel extends ChangeNotifier { try { var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!); var resultValue = double.parse(element.resultValue!); - var transformedValue = transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag ?? ""); + // var transformedValue = transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag ?? ""); + var transformedValue = double.parse(element.resultValue!); if (resultValue > maxY) { maxY = resultValue; } diff --git a/lib/features/my_appointments/my_appointments_repo.dart b/lib/features/my_appointments/my_appointments_repo.dart index 567714c6..ccf76ce0 100644 --- a/lib/features/my_appointments/my_appointments_repo.dart +++ b/lib/features/my_appointments/my_appointments_repo.dart @@ -8,6 +8,7 @@ import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_favorite_doctors_list.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/rate_appointment_resp_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart'; @@ -51,6 +52,8 @@ abstract class MyAppointmentsRepo { Future>>> getPatientDoctorsList(); + Future>>> getFavouriteDoctorsList(); + Future>> insertLiveCareVIDARequest({required clientRequestID, required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}); Future>> getTamaraInstallmentsDetails(); @@ -531,6 +534,54 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo { } } + @override + Future>>> getFavouriteDoctorsList() async { + Map mapDevice = {}; + + try { + GenericApiModel>? apiResponse; + Failure? failure; + await apiClient.post( + GET_FAVOURITE_DOCTOR, + body: mapDevice, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final list = response['Patient_GetFavouriteDoctorList']; + + if (list == null || list.isEmpty) { + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: [], + ); + return; + } + + final appointmentsList = (list as List).map((item) => GetFavoriteDoctorsListModel.fromJson(item as Map)).toList().cast(); + + apiResponse = GenericApiModel>( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: appointmentsList, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, + ); + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + return Left(UnknownFailure(e.toString())); + } + } + @override Future> insertLiveCareVIDARequest({required clientRequestID, required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}) async { Map requestBody = { diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index d2296a66..aa56d440 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -5,6 +5,7 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_favorite_doctors_list.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/appointemnet_filters.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/ask_doctor_request_type_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart'; @@ -37,6 +38,8 @@ class MyAppointmentsViewModel extends ChangeNotifier { bool isAppointmentPatientShareLoading = false; bool isTimeLineAppointmentsLoading = false; bool isPatientMyDoctorsLoading = false; + bool isPatientFavouriteDoctorsLoading = false; + bool isFavouriteDoctorsDataFetched = false; bool isAppointmentDataToBeLoaded = true; @@ -64,6 +67,8 @@ class MyAppointmentsViewModel extends ChangeNotifier { List patientMyDoctorsList = []; + List patientFavouriteDoctorsList = []; + List patientEyeMeasurementsAppointmentsHistoryList = []; // Grouping by Clinic and Hospital @@ -634,6 +639,7 @@ class MyAppointmentsViewModel extends ChangeNotifier { Future getPatientMyDoctors({Function(dynamic)? onSuccess, Function(String)? onError}) async { // if (!isAppointmentDataToBeLoaded) return; isPatientMyDoctorsLoading = true; + patientMyDoctorsList.clear(); notifyListeners(); final result = await myAppointmentsRepo.getPatientDoctorsList(); @@ -658,6 +664,51 @@ class MyAppointmentsViewModel extends ChangeNotifier { ); } + Future getPatientFavouriteDoctors({bool forceRefresh = false, Function(dynamic)? onSuccess, Function(String)? onError}) async { + // If data is already fetched and not forcing refresh, skip API call + if (isFavouriteDoctorsDataFetched && !forceRefresh) { + return; + } + + isPatientFavouriteDoctorsLoading = true; + patientFavouriteDoctorsList.clear(); + notifyListeners(); + + final result = await myAppointmentsRepo.getFavouriteDoctorsList(); + + result.fold( + (failure) async { + isPatientFavouriteDoctorsLoading = false; + notifyListeners(); + }, + (apiResponse) { + if (apiResponse.messageStatus == 2) { + isPatientFavouriteDoctorsLoading = false; + notifyListeners(); + } else if (apiResponse.messageStatus == 1) { + patientFavouriteDoctorsList = apiResponse.data!; + isFavouriteDoctorsDataFetched = true; + isPatientFavouriteDoctorsLoading = false; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } + }, + ); + } + + // Method to force refresh favorite doctors list + void refreshFavouriteDoctors() { + isFavouriteDoctorsDataFetched = false; + getPatientFavouriteDoctors(forceRefresh: true); + } + + // Method to reset favorite doctors cache + void resetFavouriteDoctorsCache() { + isFavouriteDoctorsDataFetched = false; + } + Future insertLiveCareVIDARequest( {required clientRequestID, required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async { final result = await myAppointmentsRepo.insertLiveCareVIDARequest(clientRequestID: clientRequestID, patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel); diff --git a/lib/features/my_invoices/my_invoices_view_model.dart b/lib/features/my_invoices/my_invoices_view_model.dart index 20d7869f..d51ea086 100644 --- a/lib/features/my_invoices/my_invoices_view_model.dart +++ b/lib/features/my_invoices/my_invoices_view_model.dart @@ -5,6 +5,8 @@ import 'package:hmg_patient_app_new/features/my_invoices/my_invoices_repo.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; +enum InvoiceFilterType { all, hospital, clinic, doctor } + class MyInvoicesViewModel extends ChangeNotifier { bool isInvoicesListLoading = false; bool isInvoiceDetailsLoading = false; @@ -14,13 +16,23 @@ class MyInvoicesViewModel extends ChangeNotifier { NavigationService navServices; List allInvoicesList = []; + List _originalInvoicesList = []; + InvoiceFilterType currentFilter = InvoiceFilterType.all; late GetInvoiceDetailsResponseModel invoiceDetailsResponseModel; + // Filter bottom sheet properties + List filterDisplayList = []; + List _filterOriginalList = []; + TextEditingController filterSearchController = TextEditingController(); + String? selectedFilterItem; + MyInvoicesViewModel({required this.myInvoicesRepo, required this.errorHandlerService, required this.navServices}); setInvoicesListLoading() { isInvoicesListLoading = true; allInvoicesList.clear(); + _originalInvoicesList.clear(); + currentFilter = InvoiceFilterType.all; notifyListeners(); } @@ -41,9 +53,10 @@ class MyInvoicesViewModel extends ChangeNotifier { if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { - allInvoicesList = apiResponse.data!; + _originalInvoicesList = apiResponse.data!; + _originalInvoicesList.sort((a, b) => b.appointmentDate!.compareTo(a.appointmentDate!)); + allInvoicesList = List.from(_originalInvoicesList); isInvoicesListLoading = false; - allInvoicesList.sort((a, b) => b.appointmentDate!.compareTo(a.appointmentDate!)); notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); @@ -60,6 +73,9 @@ class MyInvoicesViewModel extends ChangeNotifier { (failure) async { isInvoiceDetailsLoading = false; notifyListeners(); + if (onError != null) { + onError(failure.message); + } }, (apiResponse) { if (apiResponse.messageStatus == 2) { @@ -96,4 +112,128 @@ class MyInvoicesViewModel extends ChangeNotifier { }, ); } + + void filterInvoices(InvoiceFilterType filterType) { + currentFilter = filterType; + + switch (filterType) { + case InvoiceFilterType.all: + allInvoicesList = List.from(_originalInvoicesList); + break; + case InvoiceFilterType.hospital: + allInvoicesList = _originalInvoicesList.where((invoice) { + return invoice.projectName != null && invoice.projectName!.isNotEmpty; + }).toList(); + // Group by hospital (projectName) and sort + allInvoicesList.sort((a, b) { + int projectComparison = (a.projectName ?? '').compareTo(b.projectName ?? ''); + if (projectComparison != 0) return projectComparison; + return b.appointmentDate!.compareTo(a.appointmentDate!); + }); + break; + case InvoiceFilterType.clinic: + allInvoicesList = _originalInvoicesList.where((invoice) { + return invoice.clinicName != null && invoice.clinicName!.isNotEmpty; + }).toList(); + // Group by clinic (clinicName) and sort + allInvoicesList.sort((a, b) { + int clinicComparison = (a.clinicName ?? '').compareTo(b.clinicName ?? ''); + if (clinicComparison != 0) return clinicComparison; + return b.appointmentDate!.compareTo(a.appointmentDate!); + }); + break; + case InvoiceFilterType.doctor: + allInvoicesList = _originalInvoicesList.where((invoice) { + return invoice.doctorName != null && invoice.doctorName!.isNotEmpty; + }).toList(); + // Group by doctor (doctorName) and sort + allInvoicesList.sort((a, b) { + int doctorComparison = (a.doctorName ?? '').compareTo(b.doctorName ?? ''); + if (doctorComparison != 0) return doctorComparison; + return b.appointmentDate!.compareTo(a.appointmentDate!); + }); + break; + } + + notifyListeners(); + } + + void filterInvoicesByHospital(String hospitalName) { + currentFilter = InvoiceFilterType.hospital; + allInvoicesList = _originalInvoicesList + .where((invoice) => invoice.projectName == hospitalName) + .toList(); + allInvoicesList.sort((a, b) => b.appointmentDate!.compareTo(a.appointmentDate!)); + notifyListeners(); + } + + void filterInvoicesByClinic(String clinicName) { + currentFilter = InvoiceFilterType.clinic; + allInvoicesList = _originalInvoicesList + .where((invoice) => invoice.clinicName == clinicName) + .toList(); + allInvoicesList.sort((a, b) => b.appointmentDate!.compareTo(a.appointmentDate!)); + notifyListeners(); + } + + void filterInvoicesByDoctor(String doctorName) { + currentFilter = InvoiceFilterType.doctor; + allInvoicesList = _originalInvoicesList + .where((invoice) => invoice.doctorName == doctorName) + .toList(); + allInvoicesList.sort((a, b) => b.appointmentDate!.compareTo(a.appointmentDate!)); + notifyListeners(); + } + + List getOriginalInvoicesList() { + return _originalInvoicesList; + } + + // Filter bottom sheet methods + void prepareFilterList(InvoiceFilterType filterType) { + Set uniqueItems = {}; + + for (var invoice in _originalInvoicesList) { + String? itemName; + if (filterType == InvoiceFilterType.hospital) { + itemName = invoice.projectName; + } else if (filterType == InvoiceFilterType.clinic) { + itemName = invoice.clinicName; + } else if (filterType == InvoiceFilterType.doctor) { + itemName = invoice.doctorName; + } + + if (itemName != null && itemName.isNotEmpty) { + uniqueItems.add(itemName); + } + } + + _filterOriginalList = uniqueItems.toList()..sort(); + filterDisplayList = List.from(_filterOriginalList); + filterSearchController.clear(); + selectedFilterItem = null; + notifyListeners(); + } + + void searchFilterItems(String query) { + if (query.isEmpty) { + filterDisplayList = List.from(_filterOriginalList); + } else { + filterDisplayList = _filterOriginalList + .where((item) => item.toLowerCase().contains(query.toLowerCase())) + .toList(); + } + notifyListeners(); + } + + void clearFilterSearch() { + filterSearchController.clear(); + filterDisplayList = List.from(_filterOriginalList); + notifyListeners(); + } + + void selectFilterItem(String item) { + selectedFilterItem = item; + notifyListeners(); + } } diff --git a/lib/features/prescriptions/prescriptions_view_model.dart b/lib/features/prescriptions/prescriptions_view_model.dart index c0f9c7b5..b9c29072 100644 --- a/lib/features/prescriptions/prescriptions_view_model.dart +++ b/lib/features/prescriptions/prescriptions_view_model.dart @@ -19,6 +19,7 @@ import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/map/map_utility_screen.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:permission_handler/permission_handler.dart'; class PrescriptionsViewModel extends ChangeNotifier { bool isPrescriptionsOrdersLoading = false; @@ -51,6 +52,8 @@ class PrescriptionsViewModel extends ChangeNotifier { bool isPrescriptionsDataNeedsReloading = true; List prescriptionsOrderList = []; + DateTime? selectedReminderTime; + PrescriptionsViewModel({required this.prescriptionsRepo, required this.errorHandlerService, required this.navServices}); initPrescriptionsViewModel() { @@ -68,9 +71,10 @@ class PrescriptionsViewModel extends ChangeNotifier { notifyListeners(); } - - checkIfReminderExistForPrescription(int index) async { + Future checkIfReminderExistForPrescription(int index) async { prescriptionDetailsList[index].hasReminder = await CalenderUtilsNew.instance.checkIfEventExist(prescriptionDetailsList[index].itemID?.toString() ?? ""); + notifyListeners(); + return prescriptionDetailsList[index].hasReminder ?? false; } setPrescriptionsDetailsLoading() { @@ -157,14 +161,16 @@ class PrescriptionsViewModel extends ChangeNotifier { (failure) async { onError!(failure.message); }, - (apiResponse) { + (apiResponse) async { if (apiResponse.messageStatus == 2) { // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); } else if (apiResponse.messageStatus == 1) { prescriptionDetailsList = apiResponse.data!; - prescriptionDetailsList.forEach((element) async { - await checkIfReminderExistForPrescription(prescriptionDetailsList.indexOf(element)); - }); + if (await Permission.calendarFullAccess.isGranted && await Permission.calendarWriteOnly.isGranted) { + prescriptionDetailsList.forEach((element) async { + await checkIfReminderExistForPrescription(prescriptionDetailsList.indexOf(element)); + }); + } isPrescriptionsDetailsLoading = false; notifyListeners(); if (onSuccess != null) { @@ -305,4 +311,9 @@ class PrescriptionsViewModel extends ChangeNotifier { }, ); } + + void serSelectedTime(DateTime dateTime) { + selectedReminderTime = dateTime; + notifyListeners(); + } } diff --git a/lib/features/profile_settings/profile_settings_repo.dart b/lib/features/profile_settings/profile_settings_repo.dart new file mode 100644 index 00000000..253bf505 --- /dev/null +++ b/lib/features/profile_settings/profile_settings_repo.dart @@ -0,0 +1,100 @@ +import 'package:dartz/dartz.dart'; +import 'package:hmg_patient_app_new/core/api/api_client.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; +import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; +import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; +import 'package:hmg_patient_app_new/services/logger_service.dart'; + +abstract class ProfileSettingsRepo { + /// Updates general patient info (name, phone, etc.). + Future>> updatePatientInfo({ + required Map patientInfo, + }); + + /// Deactivates (deletes) the patient's account. + Future>> deactivateAccount(); +} + +class ProfileSettingsRepoImp implements ProfileSettingsRepo { + final ApiClient apiClient; + final LoggerService loggerService; + + ProfileSettingsRepoImp({ + required this.loggerService, + required this.apiClient, + }); + + @override + Future>> updatePatientInfo({ + required Map patientInfo, + }) async { + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + SAVE_SETTING, + body: patientInfo, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: response, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + return Left(UnknownFailure(e.toString())); + } + } + + @override + Future>> deactivateAccount() async { + final Map body = {}; + + try { + GenericApiModel? apiResponse; + Failure? failure; + + await apiClient.post( + // TODO: Replace with actual deactivate-account endpoint once available + 'Services/Patients.svc/REST/Patient_DeactivateAccount', + body: body, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: errorMessage, + data: response, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, + ); + + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + return Left(UnknownFailure(e.toString())); + } + } +} + diff --git a/lib/features/profile_settings/profile_settings_view_model.dart b/lib/features/profile_settings/profile_settings_view_model.dart index e001d1bd..92f11528 100644 --- a/lib/features/profile_settings/profile_settings_view_model.dart +++ b/lib/features/profile_settings/profile_settings_view_model.dart @@ -1,18 +1,42 @@ import 'package:flutter/foundation.dart'; +import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_repo.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; +import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; class ProfileSettingsViewModel extends ChangeNotifier { static const String _darkModeKey = 'is_dark_mode'; final CacheService _cacheService; + final ProfileSettingsRepo profileSettingsRepo; + final ErrorHandlerService errorHandlerService; + // ── Dark-mode state ────────────────────────────────────────────────── bool _isDarkMode = false; - bool get isDarkMode => _isDarkMode; - ProfileSettingsViewModel({required CacheService cacheService}) - : _cacheService = cacheService; + // ── Update email state ─────────────────────────────────────────────── + bool isUpdateEmailLoading = false; + bool isUpdateEmailSuccess = false; + String? updateEmailError; + + // ── Update patient info state ──────────────────────────────────────── + bool isUpdatePatientInfoLoading = false; + bool isUpdatePatientInfoSuccess = false; + String? updatePatientInfoError; + + // ── Deactivate account state ───────────────────────────────────────── + bool isDeactivateAccountLoading = false; + bool isDeactivateAccountSuccess = false; + String? deactivateAccountError; + + ProfileSettingsViewModel({ + required CacheService cacheService, + required this.profileSettingsRepo, + required this.errorHandlerService, + }) : _cacheService = cacheService; + + // ── Dark mode ──────────────────────────────────────────────────────── /// Call once at app startup (before the first frame) to restore the /// persisted dark-mode preference. @@ -30,6 +54,75 @@ class ProfileSettingsViewModel extends ChangeNotifier { notifyListeners(); } + // ── Update patient info ────────────────────────────────────────────── + + Future updatePatientInfo({ + required Map patientInfo, + Function(dynamic)? onSuccess, + Function(String)? onError, + }) async { + isUpdatePatientInfoLoading = true; + isUpdatePatientInfoSuccess = false; + updatePatientInfoError = null; + notifyListeners(); + + final result = await profileSettingsRepo.updatePatientInfo(patientInfo: patientInfo); + + result.fold( + (failure) { + isUpdatePatientInfoLoading = false; + updatePatientInfoError = failure.message; + notifyListeners(); + if (onError != null) { + onError(failure.message); + } else { + errorHandlerService.handleError(failure: failure); + } + }, + (response) { + isUpdatePatientInfoLoading = false; + isUpdatePatientInfoSuccess = true; + notifyListeners(); + onSuccess?.call(response.data); + }, + ); + } + + // ── Deactivate account ─────────────────────────────────────────────── + + Future deactivateAccount({ + Function(dynamic)? onSuccess, + Function(String)? onError, + }) async { + isDeactivateAccountLoading = true; + isDeactivateAccountSuccess = false; + deactivateAccountError = null; + notifyListeners(); + + final result = await profileSettingsRepo.deactivateAccount(); + + result.fold( + (failure) { + isDeactivateAccountLoading = false; + deactivateAccountError = failure.message; + notifyListeners(); + if (onError != null) { + onError(failure.message); + } else { + errorHandlerService.handleError(failure: failure); + } + }, + (response) { + isDeactivateAccountLoading = false; + isDeactivateAccountSuccess = true; + notifyListeners(); + onSuccess?.call(response.data); + }, + ); + } + + // ── Helpers ────────────────────────────────────────────────────────── + void notify() { notifyListeners(); } diff --git a/lib/features/radiology/radiology_view_model.dart b/lib/features/radiology/radiology_view_model.dart index ee5c970f..fa43a96d 100644 --- a/lib/features/radiology/radiology_view_model.dart +++ b/lib/features/radiology/radiology_view_model.dart @@ -68,17 +68,17 @@ class RadiologyViewModel extends ChangeNotifier { filteredRadiologyOrders = List.from(patientRadiologyOrders); tempRadiologyOrders = [...patientRadiologyOrders]; - final clinicMap = >{}; - final hospitalMap = >{}; - for (var order in patientRadiologyOrders) { - final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); - clinicMap.putIfAbsent(clinicKey, () => []).add(order); - final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); - hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); - } - patientRadiologyOrdersByClinic = clinicMap.values.toList(); - patientRadiologyOrdersByHospital = hospitalMap.values.toList(); - patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital; + // final clinicMap = >{}; + // final hospitalMap = >{}; + // for (var order in patientRadiologyOrders) { + // final clinicKey = (order.clinicDescription ?? 'Unknown').trim(); + // clinicMap.putIfAbsent(clinicKey, () => []).add(order); + // final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim(); + // hospitalMap.putIfAbsent(hospitalKey, () => []).add(order); + // } + // patientRadiologyOrdersByClinic = clinicMap.values.toList(); + // patientRadiologyOrdersByHospital = hospitalMap.values.toList(); + // patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital; isRadiologyOrdersLoading = false; filterSuggestions(); @@ -173,7 +173,7 @@ class RadiologyViewModel extends ChangeNotifier { } filterSuggestions() { - final List labels = patientRadiologyOrders.map((detail) => detail.description).whereType().toList(); + final List labels = patientRadiologyOrders.map((detail) => detail.procedureName.toString().trim()).whereType().toList(); _radiologySuggestionsList = labels.toSet().toList(); notifyListeners(); } @@ -193,7 +193,7 @@ class RadiologyViewModel extends ChangeNotifier { patientRadiologyOrdersByHospital = hospitalMap.values.toList(); patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital; } else { - filteredRadiologyOrders = filteredRadiologyOrders.where((desc) => (desc.description ?? "").toLowerCase().contains(query.toLowerCase())).toList(); + filteredRadiologyOrders = filteredRadiologyOrders.where((desc) => (desc.procedureName ?? "").toLowerCase().contains(query.toLowerCase())).toList(); final clinicMap = >{}; final hospitalMap = >{}; @@ -206,6 +206,8 @@ class RadiologyViewModel extends ChangeNotifier { patientRadiologyOrdersByClinic = clinicMap.values.toList(); patientRadiologyOrdersByHospital = hospitalMap.values.toList(); patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital; + + patientRadiologyOrders = filteredRadiologyOrders; } notifyListeners(); } diff --git a/lib/features/smartwatch_health_data/HealthDataTransformation.dart b/lib/features/smartwatch_health_data/HealthDataTransformation.dart new file mode 100644 index 00000000..ffda4f4f --- /dev/null +++ b/lib/features/smartwatch_health_data/HealthDataTransformation.dart @@ -0,0 +1,134 @@ +import 'dart:math'; + +import 'package:hmg_patient_app_new/core/common_models/data_points.dart'; +import 'package:intl/intl.dart'; + +import 'model/Vitals.dart'; + +enum Durations { + daily("daily"), + weekly("weekly"), + monthly("monthly"), + halfYearly("halfYearly"), + yearly("yearly"); + + final String value; + const Durations(this.value); +} + +class HealthDataTransformation { + Map> transformVitalsToDataPoints(VitalsWRTType vitals, String filterType, String selectedSection,) { + final Map> dataPointMap = {}; + Map> data = vitals.getVitals(); + // Group data based on the filter type + Map> groupedData = {}; + // List > items = data.values.toList(); + List keys = data.keys.toList(); + var count = 0; + List item = data[selectedSection] ?? []; + // for(var item in items) { + List dataPoints = []; + + for (var vital in item) { + String key = ""; + if (vital.value == "" || vital.timestamp == "") continue; + var parseDate = DateTime.parse(vital.timestamp); + var currentDate = normalizeToStartOfDay(DateTime.now()); + if (filterType == Durations.daily.value) { + if(isBetweenInclusive(parseDate, currentDate, DateTime.now())) { + key = DateFormat('yyyy-MM-dd HH').format(DateTime.parse(vital.timestamp)); + groupedData.putIfAbsent(key, () => []).add(vital); + }// Group by hour + } else if (filterType == Durations.weekly.value) { + if(isBetweenInclusive(parseDate, currentDate.subtract(Duration(days: 7)), DateTime.now())) { + key = DateFormat('yyyy-MM-dd').format(DateTime.parse(vital.timestamp)); + groupedData.putIfAbsent(key, () => []).add(vital); + + } // Group by day + } else if (filterType == Durations.monthly.value) { + if(isBetweenInclusive(parseDate, currentDate.subtract(Duration(days: 30)), DateTime.now())) { + print("the value for the monthly filter is ${vital.value} with the timestamp ${vital.timestamp} and the current date is $currentDate and the parse date is $parseDate"); + key = DateFormat('yyyy-MM-dd').format(DateTime.parse(vital.timestamp)); + groupedData.putIfAbsent(key, () => []).add(vital); + + } // Group by day + } else if (filterType == Durations.halfYearly.value || filterType == Durations.yearly.value) { + if(isBetweenInclusive(parseDate, currentDate.subtract(Duration(days: filterType == Durations.halfYearly.value?180: 365)), DateTime.now())) { + key = DateFormat('yyyy-MM').format(DateTime.parse(vital.timestamp)); + groupedData.putIfAbsent(key, () => []).add(vital); + + } // Group by month + } else { + throw ArgumentError('Invalid filter type'); + } + } + print("the size of groupData is ${groupedData.values.length}"); + + // Process grouped data + groupedData.forEach((key, values) { + double sum = values.fold(0, (acc, v) => acc + num.parse(v.value)); + double mean = sum / values.length; + if(selectedSection == "bodyOxygen" || selectedSection == "bodyTemperature") { + mean = sum / values.length; + }else { + mean = sum; + } + + double finalValue = mean; + print("the final value is $finalValue for the key $key with the original values ${values.map((v) => v.value).toList()} and uom is ${values.first.unitOfMeasure}"); + dataPoints.add(DataPoint( + value: smartScale(finalValue), + label: key, + actualValue: finalValue.toStringAsFixed(2), + displayTime: key, + unitOfMeasurement:values.first.unitOfMeasure , + time: DateTime.parse(values.first.timestamp), + )); + }); + + dataPointMap[filterType] = dataPoints; + // } + return dataPointMap; + } + + double smartScale(double number) { + // if (number <= 0) return 0; + // final _random = Random(); + // double ratio = number / 100; + // + // double scalingFactor = ratio > 1 ? 100 / number : 100; + // + // double result = (number / 100) * scalingFactor; + // print("the ratio is ${ratio.toInt()+1}"); + // double max = (100+_random.nextInt(ratio.toInt()+10)).toDouble(); + // + // return result.clamp(0, max); + + if (number <= 0) return 0; + + final random = Random(); + + // Smooth compression scaling + double baseScaled = number <20 ? number:100 * (number / (number + 100)); + + // Random factor between 0.9 and 1.1 (±10%) + double randomFactor = number <20 ? random.nextDouble() * 1.5: 0.9 + random.nextDouble() * 0.2; + + double result = baseScaled * randomFactor; + + return result.clamp(0, 100); + } + + DateTime normalizeToStartOfDay(DateTime date) { + return DateTime(date.year, date.month, date.day); + } + bool isBetweenInclusive( + DateTime target, + DateTime start, + DateTime end, + ) { + return !normalizeToStartOfDay(target).isBefore(start) && !normalizeToStartOfDay(target).isAfter(end); + } + + +} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/health_provider.dart b/lib/features/smartwatch_health_data/health_provider.dart index 0acb25bb..963c0352 100644 --- a/lib/features/smartwatch_health_data/health_provider.dart +++ b/lib/features/smartwatch_health_data/health_provider.dart @@ -1,6 +1,18 @@ import 'package:flutter/foundation.dart'; import 'package:health/health.dart'; +import 'package:hmg_patient_app_new/core/common_models/smart_watch.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/loading_utils.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_service.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; + +import '../../core/common_models/data_points.dart'; +import '../../core/dependencies.dart'; +import '../../presentation/smartwatches/activity_detail.dart' show ActivityDetails; +import '../../presentation/smartwatches/smart_watch_activity.dart' show SmartWatchActivity; +import '../../services/navigation_service.dart' show NavigationService; +import 'HealthDataTransformation.dart'; +import 'model/Vitals.dart'; class HealthProvider with ChangeNotifier { final HealthService _healthService = HealthService(); @@ -10,13 +22,27 @@ class HealthProvider with ChangeNotifier { String selectedTimeRange = '7D'; int selectedTabIndex = 0; - String selectedWatchType = 'apple'; + SmartWatchTypes? selectedWatchType ; String selectedWatchURL = 'assets/images/png/smartwatches/apple-watch-5.jpg'; + HealthDataTransformation healthDataTransformation = HealthDataTransformation(); + + String selectedSection = ""; + Map> daily = {}; + Map> weekly = {}; + Map> monthly = {}; + Map> halgyearly = {}; + Map> yearly = {}; + Map> selectedData = {}; + Durations selectedDuration = Durations.daily; + VitalsWRTType? vitals; + double? averageValue; + String? averageValueString; - setSelectedWatchType(String type, String imageURL) { + setSelectedWatchType(SmartWatchTypes type, String imageURL) { selectedWatchType = type; selectedWatchURL = imageURL; notifyListeners(); + _healthService.addWatchHelper(type); } void onTabChanged(int index) { @@ -40,9 +66,7 @@ class HealthProvider with ChangeNotifier { final startTime = _getStartDate(); final endTime = DateTime.now(); - healthData = await _healthService.getAllHealthData(startTime, endTime); - isLoading = false; notifyListeners(); } catch (e) { @@ -91,4 +115,176 @@ class HealthProvider with ChangeNotifier { return DateTime.now().subtract(const Duration(days: 7)); } } + + void initDevice() async { + LoaderBottomSheet.showLoader(); + notifyListeners(); + final result = await _healthService.initDevice(); + isLoading = false; + LoaderBottomSheet.hideLoader(); + if (result.isError) { + error = 'Error initializing device: ${result.asError}'; + } else { + LoaderBottomSheet.showLoader(); + await getVitals(); + // LoaderBottomSheet.hideLoader(); + // await Future.delayed(Duration(seconds: 5)); + getIt.get().pushPage(page: SmartWatchActivity()); + print('Device initialized successfully'); + } + notifyListeners(); + } + + Future getVitals() async { + + final result = await _healthService.getVitals(); + vitals = result; + LoaderBottomSheet.hideLoader(); + + notifyListeners(); + } + + mapValuesForFilters( + Durations filter, + String selectedSection, + ) { + if (vitals == null) return {}; + + switch (filter) { + case Durations.daily: + if (daily.isNotEmpty) { + selectedData = daily; + break; + } + selectedData = daily = healthDataTransformation.transformVitalsToDataPoints(vitals!, Durations.daily.value, selectedSection); + break; + case Durations.weekly: + if (weekly.isNotEmpty) { + selectedData = weekly; + break; + } + selectedData = weekly = healthDataTransformation.transformVitalsToDataPoints(vitals!, Durations.weekly.value, selectedSection); + break; + case Durations.monthly: + if (monthly.isNotEmpty) { + selectedData = monthly; + break; + } + selectedData = monthly = healthDataTransformation.transformVitalsToDataPoints(vitals!, Durations.monthly.value, selectedSection); + break; + case Durations.halfYearly: + if (halgyearly.isNotEmpty) { + selectedData = halgyearly; + break; + } + selectedData = halgyearly = healthDataTransformation.transformVitalsToDataPoints(vitals!, Durations.halfYearly.value, selectedSection); + break; + case Durations.yearly: + if (yearly.isNotEmpty) { + selectedData = yearly; + break; + } + selectedData = yearly = healthDataTransformation.transformVitalsToDataPoints(vitals!, Durations.yearly.value, selectedSection); + break; + default: + {} + ; + } + notifyListeners(); + } + + void navigateToDetails(String value, {required String sectionName, required String uom}) { + getIt.get().pushPage(page: ActivityDetails(selectedActivity: value, sectionName:sectionName, uom: uom,)); + } + + void saveSelectedSection(String value) { + // if(selectedSection == value) return; + selectedSection = value; + } + + void deleteDataIfSectionIsDifferent(String value) { + // if(selectedSection == value){ + // return; + // } + daily.clear(); + weekly.clear(); + halgyearly.clear(); + monthly.clear(); + yearly.clear(); + selectedSection = ""; + selectedSection = ""; + averageValue = null; + averageValueString = null; + selectedDuration = Durations.daily; + } + + void fetchData() { + // if(selectedSection == value) return; + mapValuesForFilters(selectedDuration, selectedSection); + getAverageForData(); + transformValueIfSleepIsSelected(); + } + + void setDurations(Durations duration) { + selectedDuration = duration; + } + + void getAverageForData() { + if (selectedData.isEmpty) { + averageValue = 0.0; + notifyListeners(); + return; + } + double total = 0; + int count = 0; + selectedData.forEach((key, dataPoints) { + for (var dataPoint in dataPoints) { + total += num.parse(dataPoint.actualValue); + count++; + } + }); + print("total count is $count and total is $total"); + averageValue = count > 0 ? total / count : null; + notifyListeners(); + } + + void transformValueIfSleepIsSelected() { + if (selectedSection != "sleep") return; + if (averageValue == null) { + averageValueString = null; + return; + } + averageValueString = DateUtil.millisToHourMin(averageValue?.toInt() ?? 0); + averageValue = null; + notifyListeners(); + } + + String firstNonEmptyValue(List dataPoints) { + try { + return dataPoints.firstWhere((dp) => dp.value != null && dp.value!.trim().isNotEmpty).value; + } catch (e) { + return "0"; // no non-empty value found + } + } + + String sumOfNonEmptyData(List list) { + final now = DateTime.now().toLocal(); + final today = DateTime(now.year, now.month, now.day); + + var data = double.parse(list + .where((dp) { + final localDate = DateTime.parse(dp.timestamp); + final normalized = DateTime(localDate.year, localDate.month, localDate.day); + + return normalized.isAtSameMomentAs(today); + }) + .fold("0", (sum, dp) => (double.parse(sum) + double.parse(dp.value)).toString()) + .toString()); + var formattedString = data.toStringAsFixed(2); + + if (formattedString.endsWith('.00')) { + return formattedString.substring(0, formattedString.length - 3); + } + return formattedString; + } } diff --git a/lib/features/smartwatch_health_data/health_service.dart b/lib/features/smartwatch_health_data/health_service.dart index d3815b3b..7d42092d 100644 --- a/lib/features/smartwatch_health_data/health_service.dart +++ b/lib/features/smartwatch_health_data/health_service.dart @@ -1,9 +1,17 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:developer'; import 'dart:io'; import 'package:health/health.dart'; +import 'package:hmg_patient_app_new/core/common_models/smart_watch.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/model/Vitals.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart'; import 'package:permission_handler/permission_handler.dart'; import 'health_utils.dart'; +import 'package:async/async.dart'; class HealthService { static final HealthService _instance = HealthService._internal(); @@ -14,6 +22,8 @@ class HealthService { final Health health = Health(); + WatchHelper? watchHelper; + final List _healthMetrics = [ HealthDataType.HEART_RATE, // HealthDataType.STEPS, @@ -161,4 +171,42 @@ class HealthService { return []; } } + + void addWatchHelper(SmartWatchTypes watchType){ + watchHelper = CreateWatchHelper.getWatchName(watchType) ; + } + + Future> initDevice() async { + if(watchHelper == null){ + return Result.error('No watch helper found'); + } + return await watchHelper!.initDevice(); + } + + Future getVitals() async { + if (watchHelper == null) { + print('No watch helper found'); + return null; + } + try { + await watchHelper!.getHeartRate(); + await watchHelper!.getSleep(); + await watchHelper!.getSteps(); + await watchHelper!.getActivity(); + await watchHelper!.getBodyTemperature(); + await watchHelper!.getDistance(); + await watchHelper!.getBloodOxygen(); + Result data = await watchHelper!.retrieveData(); + if(data.isError) { + print('Unable to get the data'); + } + var response = jsonDecode(data.asValue?.value?.toString()?.trim().replaceAll("\n", "")??""); + VitalsWRTType vitals = VitalsWRTType.fromMap(response); + log("the data is ${vitals}"); + return vitals; + }catch(e){ + print('Error getting heart rate: $e'); + } + return null; + } } diff --git a/lib/features/smartwatch_health_data/model/Vitals.dart b/lib/features/smartwatch_health_data/model/Vitals.dart new file mode 100644 index 00000000..96386f2d --- /dev/null +++ b/lib/features/smartwatch_health_data/model/Vitals.dart @@ -0,0 +1,103 @@ +class Vitals { + String value; + final String timestamp; + final String unitOfMeasure; + + Vitals({ + required this.value, + required this.timestamp, + this.unitOfMeasure = "", + }); + + factory Vitals.fromMap(Map map) { + return Vitals( + value: map['value'] ?? "", + timestamp: map['timeStamp'] ?? "", + unitOfMeasure: map['uom'] ?? "", + ); + } + + + toString(){ + return "{\"value\": \"$value\", \"timeStamp\": \"$timestamp\", \"uom\": \"$unitOfMeasure\"}"; + } +} + +class VitalsWRTType { + final List heartRate; + final List sleep; + final List step; + final List distance; + final List activity; + final List bodyOxygen; + final List bodyTemperature; + double maxHeartRate = double.negativeInfinity; + double maxSleep = double.negativeInfinity; + double maxStep= double.negativeInfinity; + double maxActivity = double.negativeInfinity; + double maxBloodOxygen = double.negativeInfinity; + double maxBodyTemperature = double.negativeInfinity; + + + VitalsWRTType({required this.distance, required this.bodyOxygen, required this.bodyTemperature, required this.heartRate, required this.sleep, required this.step, required this.activity}); + + factory VitalsWRTType.fromMap(Map map) { + List activity = []; + List steps = []; + List sleeps = []; + List heartRate = []; + List bodyOxygen = []; + List distance = []; + List bodyTemperature = []; + map["activity"].forEach((element) { + element["uom"] = "Kcal"; + var data = Vitals.fromMap(element); + activity.add(data); + }); + map["steps"].forEach((element) { + element["uom"] = ""; + + steps.add(Vitals.fromMap(element)); + }); + map["sleep"].forEach((element) { + element["uom"] = "hr"; + sleeps.add(Vitals.fromMap(element)); + }); + map["heartRate"].forEach((element) { + element["uom"] = "bpm"; + + heartRate.add(Vitals.fromMap(element)); + }); + map["bloodOxygen"].forEach((element) { + element["uom"] = ""; + + bodyOxygen.add(Vitals.fromMap(element)); + }); + + map["bodyTemperature"].forEach((element) { + element["uom"] = "C"; + bodyTemperature.add(Vitals.fromMap(element)); + }); + + map["distance"].forEach((element) { + element["uom"] = "km"; + var data = Vitals.fromMap(element); + data.value = (double.parse(data.value)/1000).toStringAsFixed(2); + distance.add(data); + }); + + return VitalsWRTType(bodyTemperature: bodyTemperature, bodyOxygen: bodyOxygen, heartRate: heartRate, sleep: sleeps, step: steps, activity: activity, distance: distance); + } + + Map> getVitals() { + return { + "heartRate": heartRate , + "sleep": sleep, + "steps": step, + "activity": activity, + "bodyOxygen": bodyOxygen, + "bodyTemperature": bodyTemperature, + "distance": distance, + }; + } +} diff --git a/lib/features/smartwatch_health_data/platform_channel/samsung_platform_channel.dart b/lib/features/smartwatch_health_data/platform_channel/samsung_platform_channel.dart new file mode 100644 index 00000000..a36cda39 --- /dev/null +++ b/lib/features/smartwatch_health_data/platform_channel/samsung_platform_channel.dart @@ -0,0 +1,90 @@ + +import 'dart:async'; + +import 'package:async/async.dart'; +import 'package:flutter/services.dart'; +class SamsungPlatformChannel { + final MethodChannel _channel = MethodChannel('samsung_watch'); + Future> initDevice() async { + try{ + await _channel.invokeMethod('init'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + + Future> getRequestedPermission() async { + try{ + await _channel.invokeMethod('getPermission'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + Future> getHeartRate() async { + try{ + await _channel.invokeMethod('getHeartRate'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + Future> getSleep() async { + try{ + await _channel.invokeMethod('getSleepData'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + Future> getSteps() async { + try{ + await _channel.invokeMethod('steps'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + + Future> getActivity() async { + try{ + await _channel.invokeMethod('activitySummary'); + return Result.value(true); + }catch(e){ + return Result.error(e); + } + } + + Future> retrieveData() async { + try{ + return Result.value(await _channel.invokeMethod('retrieveData')); + }catch(e){ + return Result.error(e); + } + } + + Future> getBloodOxygen() async { + try{ + return Result.value(await _channel.invokeMethod('bloodOxygen')); + }catch(e){ + return Result.error(e); + } + } + + Future> getBodyTemperature() async { + try{ + return Result.value(await _channel.invokeMethod('bodyTemperature')); + }catch(e){ + return Result.error(e); + } + } + + Future> getDistance() async { + try{ + return Result.value(await _channel.invokeMethod('distance')); + }catch(e){ + return Result.error(e); + } + } +} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart b/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart new file mode 100644 index 00000000..8abb2136 --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/create_watch_helper.dart @@ -0,0 +1,22 @@ +import 'dart:io'; + +import 'package:hmg_patient_app_new/core/common_models/smart_watch.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/samsung_health.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart'; + +class CreateWatchHelper { + static WatchHelper getWatchName(SmartWatchTypes watchType) { + /// if running device is ios + if(Platform.isIOS) return HealthConnectHelper(); + switch(watchType){ + case SmartWatchTypes.samsung: + return SamsungHealth(); + case SmartWatchTypes.huawei: + return HuaweiHealthDataConnector(); + default: + return SamsungHealth(); + } + } +} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart b/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart new file mode 100644 index 00000000..87e1cf3a --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/health_connect_helper.dart @@ -0,0 +1,188 @@ +import 'dart:async'; +import 'dart:io'; +import 'package:async/src/result/result.dart'; +import 'package:flutter/material.dart'; +import 'package:health/health.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart' show WatchHelper; +import 'package:permission_handler/permission_handler.dart'; + +import '../model/Vitals.dart'; + +class HealthConnectHelper extends WatchHelper { + final Health health = Health(); + + final List _healthPermissions = [ + HealthDataType.ACTIVE_ENERGY_BURNED, + HealthDataType.HEART_RATE, + HealthDataType.STEPS, + HealthDataType.BLOOD_OXYGEN, + HealthDataType.BODY_TEMPERATURE, + HealthDataType.DISTANCE_WALKING_RUNNING, + HealthDataType.TOTAL_CALORIES_BURNED + ]; + + Map> mappedData = {}; + + @override + FutureOr getHeartRate() async { + try { + final types = HealthDataType.HEART_RATE; + final endDate = DateTime.now(); + // final startDate = endDate.subtract(Duration(days: 365)); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getHeartData(startDate, endDate, types); + addDataToMap("heartRate",data ); + } catch (e) { + print('Error getting heart rate: $e'); + } + } + + @override + FutureOr getSleep() async { + try { + final types = HealthDataType.SLEEP_IN_BED; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMap("sleep",data ); + } catch (e) { + print('Error getting sleep data: $e'); + } + } + + @override + FutureOr getSteps() async { + try { + final types = HealthDataType.STEPS; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMap("steps",data ); + debugPrint('Steps Data: $data'); + } catch (e) { + debugPrint('Error getting steps: $e'); + } + } + + @override + Future getActivity() async { + try { + final types = HealthDataType.ACTIVE_ENERGY_BURNED; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMap("activity",data ); + debugPrint('Activity Data: $data'); + } catch (e) { + debugPrint('Error getting activity: $e'); + } + } + + @override + Future retrieveData() async { + return Result.value(getMappedData()); + } + + @override + Future getBloodOxygen() async { + try { + final types = HealthDataType.BLOOD_OXYGEN; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMapBloodOxygen("bloodOxygen", data); + } catch (e) { + debugPrint('Error getting blood oxygen: $e'); + } + } + + @override + Future getBodyTemperature() async { + try { + final types = HealthDataType.BODY_TEMPERATURE; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMap("bodyTemperature",data ); + } catch (e) { + debugPrint('Error getting body temp erature: $e'); + } + } + + @override + FutureOr getDistance() async { + try { + final types = HealthDataType.DISTANCE_WALKING_RUNNING; + final endDate = DateTime.now(); + final startDate = endDate.subtract(Duration(days: 365)); + final data = await getData(startDate, endDate, types); + addDataToMap("distance",data ); + } catch (e) { + debugPrint('Error getting distance: $e'); + } + } + + @override + Future> initDevice() async { + try { + final types = _healthPermissions; + final granted = await health.requestAuthorization(types); + await Permission.activityRecognition.request(); + await Permission.location.request(); + await Health().requestHealthDataHistoryAuthorization(); + return Result.value(granted); + } catch (e) { + debugPrint('Authorization error: $e'); + return Result.error(false); + } + } + + getData(startTime, endTime,type) async { + return await health.getHealthIntervalDataFromTypes( + startDate: startTime, + endDate: endTime, + types: [type], + interval: 3600, + ); + } + + void addDataToMap(String s, data) { + mappedData[s] = []; + for (var point in data) { + if (point.value is NumericHealthValue) { + final numericValue = (point.value as NumericHealthValue).numericValue; + Vitals vitals = Vitals( + value: (point.value as NumericHealthValue).numericValue.toStringAsFixed(2), + timestamp: point.dateFrom.toString() + ); + mappedData[s]?.add(vitals); + } + } + } + + void addDataToMapBloodOxygen(String s, data) { + mappedData[s] = []; + for (var point in data) { + if (point.value is NumericHealthValue) { + final numericValue = (point.value as NumericHealthValue).numericValue; + point.value = NumericHealthValue( + numericValue: numericValue * 100, + ); + Vitals vitals = Vitals(value: (point.value as NumericHealthValue).numericValue.toStringAsFixed(2), timestamp: point.dateFrom.toString()); + mappedData[s]?.add(vitals); + } + } + } + + getMappedData() { + return " { \"heartRate\": ${mappedData["heartRate"] ?? []}, \"sleep\": ${mappedData["sleep"] ?? []}, \"steps\": ${mappedData["steps"] ?? []}, \"activity\": ${mappedData["activity"] ?? []}, \"bloodOxygen\": ${mappedData["bloodOxygen"] ?? []}, \"bodyTemperature\": ${mappedData["bodyTemperature"] ?? []}, \"distance\": ${mappedData["distance"] ?? []} }"; + } + + getHeartData(DateTime startDate, DateTime endDate, HealthDataType types) async { + return await health.getHealthDataFromTypes( + startTime: startDate, + endTime: endDate, + types: [types], + ); + } +} diff --git a/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart b/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart new file mode 100644 index 00000000..a8300e2d --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/huawei_watch_connecter.dart @@ -0,0 +1,86 @@ +import 'dart:async'; + +import 'package:async/src/result/result.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart'; +import 'package:huawei_health/huawei_health.dart'; + +class HuaweiHealthDataConnector extends WatchHelper{ + final MethodChannel _channel = MethodChannel('huawei_watch'); + @override + Future> initDevice() async{ + try{ + await _channel.invokeMethod('init'); + + }catch(e){ + + } + // List of scopes to ask for authorization. + // Note: These scopes should also be authorized on the Huawei Developer Console. + List scopes = [ + Scope.HEALTHKIT_STEP_READ, Scope.HEALTHKIT_OXYGEN_SATURATION_READ, // View and store height and weight data in Health Service Kit. + Scope.HEALTHKIT_HEARTRATE_READ, Scope.HEALTHKIT_SLEEP_READ, + Scope.HEALTHKIT_BODYTEMPERATURE_READ, Scope.HEALTHKIT_CALORIES_READ + ]; + try { + bool? result = await SettingController.getHealthAppAuthorization(); + debugPrint( + 'Granted Scopes for result == is $result}', + ); + return Result.value(true); + } catch (e) { + debugPrint('Error on authorization, Error:${e.toString()}'); + return Result.error(false); + } + } + + @override + Future getActivity() async { + DataType dataTypeResult = await SettingController.readDataType( + DataType.DT_CONTINUOUS_STEPS_DELTA.name + ); + + + } + + @override + Future getBloodOxygen() { + throw UnimplementedError(); + + } + + @override + Future getBodyTemperature() { + + throw UnimplementedError(); + } + + @override + FutureOr getHeartRate() { + throw UnimplementedError(); + } + + @override + FutureOr getSleep() { + throw UnimplementedError(); + } + + @override + FutureOr getSteps() { + throw UnimplementedError(); + } + + + @override + Future retrieveData() { + throw UnimplementedError(); + } + + @override + FutureOr getDistance() { + // TODO: implement getDistance + throw UnimplementedError(); + } + +} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/watch_connectors/samsung_health.dart b/lib/features/smartwatch_health_data/watch_connectors/samsung_health.dart new file mode 100644 index 00000000..d3cbcfc9 --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/samsung_health.dart @@ -0,0 +1,98 @@ +import 'dart:async'; + +import 'package:async/src/result/result.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/platform_channel/samsung_platform_channel.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/watch_connectors/watch_helper.dart' show WatchHelper; + +class SamsungHealth extends WatchHelper { + + final SamsungPlatformChannel platformChannel = SamsungPlatformChannel(); + + @override + FutureOr getHeartRate() async { + try { + await platformChannel.getHeartRate(); + + }catch(e){ + print('Error getting heart rate: $e'); + } + + + } + + @override + Future> initDevice() async { + var result = await platformChannel.initDevice(); + if(result.isError){ + return result; + } + return await platformChannel.getRequestedPermission(); + } + + @override + FutureOr getSleep() async { + try { + await platformChannel.getSleep(); + + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + @override + FutureOr getSteps() async{ + try { + await platformChannel.getSteps(); + + }catch(e){ + print('Error getting heart rate: $e'); + } + } + @override + Future getActivity() async{ + try { + await platformChannel.getActivity(); + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + @override + Future retrieveData() async{ + try { + return await platformChannel.retrieveData(); + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + @override + Future getBloodOxygen() async{ + try { + return await platformChannel.getBloodOxygen(); + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + @override + Future getBodyTemperature() async { + try { + return await platformChannel.getBodyTemperature(); + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + @override + FutureOr getDistance() async{ + try { + return await platformChannel.getDistance(); + }catch(e){ + print('Error getting heart rate: $e'); + } + } + + + +} \ No newline at end of file diff --git a/lib/features/smartwatch_health_data/watch_connectors/watch_helper.dart b/lib/features/smartwatch_health_data/watch_connectors/watch_helper.dart new file mode 100644 index 00000000..a09064d8 --- /dev/null +++ b/lib/features/smartwatch_health_data/watch_connectors/watch_helper.dart @@ -0,0 +1,14 @@ +import 'dart:async'; +import 'package:async/async.dart'; +abstract class WatchHelper { + Future> initDevice(); + FutureOr getHeartRate(); + FutureOr getSleep(); + FutureOr getSteps(); + FutureOr getDistance(); + Future getActivity(); + Future retrieveData(); + Future getBodyTemperature(); + Future getBloodOxygen(); + +} \ No newline at end of file diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 1a33df93..3923b4b4 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -436,7 +436,6 @@ abstract class LocaleKeys { static const serviceInformation = 'serviceInformation'; static const homeHealthCare = 'homeHealthCare'; static const noAppointmentAvailable = 'noAppointmentAvailable'; - static const homeHealthCareText = 'homeHealthCareText'; static const loginRegister = 'loginRegister'; static const orderLog = 'orderLog'; static const infoLab = 'infoLab'; @@ -746,11 +745,17 @@ abstract class LocaleKeys { static const infoTodo = 'infoTodo'; static const familyInfo = 'familyInfo'; static const rrtdDetails = 'rrtdDetails'; + static const homeHealthCareText = 'homeHealthCareText'; static const onlineCheckInAgreement = 'onlineCheckInAgreement'; static const infoEreferral = 'infoEreferral'; static const erConsultation = 'erConsultation'; static const myInvoice = 'myInvoice'; static const invoiceList = 'invoiceList'; + static const allInvoices = 'allInvoices'; + static const hospitals = 'hospitals'; + static const clinics = 'clinics'; + static const doctors = 'doctors'; + static const selectDoctor = 'selectDoctor'; static const thisItemIsNotAvailable = 'thisItemIsNotAvailable'; static const beforeAfterImages = 'beforeAfterImages'; static const clinicAcceptLivecare = 'clinicAcceptLivecare'; @@ -901,6 +906,7 @@ abstract class LocaleKeys { static const vat15 = 'vat15'; static const liveCare = 'liveCare'; static const recentVisits = 'recentVisits'; + static const favouriteDoctors = 'favouriteDoctors'; static const searchByClinic = 'searchByClinic'; static const tapToSelectClinic = 'tapToSelectClinic'; static const searchByDoctor = 'searchByDoctor'; @@ -1574,8 +1580,34 @@ abstract class LocaleKeys { static const invalidEligibility = 'invalidEligibility'; static const invalidInsurance = 'invalidInsurance'; static const continueCash = 'continueCash'; + static const applewatch = 'applewatch'; + static const applehealthapplicationshouldbeinstalledinyourphone = 'applehealthapplicationshouldbeinstalledinyourphone'; + static const unabletodetectapplicationinstalledpleasecomebackonceinstalled = 'unabletodetectapplicationinstalledpleasecomebackonceinstalled'; + static const applewatchshouldbeconnected = 'applewatchshouldbeconnected'; + static const samsungwatch = 'samsungwatch'; + static const samsunghealthapplicationshouldbeinstalledinyourphone = 'samsunghealthapplicationshouldbeinstalledinyourphone'; + static const samsungwatchshouldbeconnected = 'samsungwatchshouldbeconnected'; + static const huaweiwatch = 'huaweiwatch'; + static const huaweihealthapplicationshouldbeinstalledinyourphone = 'huaweihealthapplicationshouldbeinstalledinyourphone'; + static const huaweiwatchshouldbeconnected = 'huaweiwatchshouldbeconnected'; + static const whoopwatch = 'whoopwatch'; + static const whoophealthapplicationshouldbeinstalledinyourphone = 'whoophealthapplicationshouldbeinstalledinyourphone'; + static const whoopwatchshouldbeconnected = 'whoopwatchshouldbeconnected'; + static const updatetheinformation = 'updatetheinformation'; static const timeFor = 'timeFor'; static const hmgPolicies = 'hmgPolicies'; static const darkMode = 'darkMode'; + static const generateAiAnalysisResult = 'generateAiAnalysisResult'; + static const ratings = 'ratings'; + static const hmgPharmacyText = 'hmgPharmacyText'; + static const insuranceRequestSubmittedSuccessfully = 'insuranceRequestSubmittedSuccessfully'; + static const updatingEmailAddress = 'updatingEmailAddress'; + static const verifyInsurance = 'verifyInsurance'; + static const tests = 'tests'; + static const calendarPermissionAlert = 'calendarPermissionAlert'; + static const sortByLocation = 'sortByLocation'; + static const timeForFirstReminder = 'timeForFirstReminder'; + static const reminderRemovalNote = 'reminderRemovalNote'; + static const featureComingSoonDescription = 'featureComingSoonDescription'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index cafb740e..072cb04a 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/ask_doctor/ask_doctor_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; @@ -31,6 +32,8 @@ import 'package:hmg_patient_app_new/presentation/appointments/appointment_paymen import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/ask_doctor_request_type_select.dart'; +import 'package:hmg_patient_app_new/presentation/ask_doctor/ask_doctor_page.dart'; +import 'package:hmg_patient_app_new/presentation/ask_doctor/doctor_response_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_detail_page.dart'; @@ -69,12 +72,12 @@ class _AppointmentDetailsPageState extends State { @override void initState() { scheduleMicrotask(() async { - CalenderUtilsNew calendarUtils = await CalenderUtilsNew.instance; - var doesExist = await calendarUtils.checkIfEventExist("${widget.patientAppointmentHistoryResponseModel.appointmentNo}"); - myAppointmentsViewModel.setAppointmentReminder(doesExist, widget.patientAppointmentHistoryResponseModel); - setState((){ - - }); + if (!AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)) { + CalenderUtilsNew calendarUtils = await CalenderUtilsNew.instance; + var doesExist = await calendarUtils.checkIfEventExist("${widget.patientAppointmentHistoryResponseModel.appointmentNo}"); + myAppointmentsViewModel.setAppointmentReminder(doesExist, widget.patientAppointmentHistoryResponseModel); + setState(() {}); + } }); super.initState(); @@ -556,6 +559,22 @@ class _AppointmentDetailsPageState extends State { // ), // ); }), + MedicalFileCard( + label: LocaleKeys.doctorResponses.tr(context: context), + textColor: AppColors.blackColor, + backgroundColor: AppColors.whiteColor, + svgIcon: AppAssets.ask_doctor_medical_file_icon, + isLargeText: true, + iconSize: 36.w, + ).onPress(() { + getIt.get().initAskDoctorViewModel(); + getIt.get().getDoctorResponses(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorResponsePage(), + ), + ); + }), ], ), // Column( @@ -839,8 +858,8 @@ class _AppointmentDetailsPageState extends State { onPressed: () { openDoctorScheduleCalendar(); }, - backgroundColor: AppColors.successColor, - borderColor: AppColors.successColor, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, textColor: Colors.white, fontSize: 16.f, fontWeight: FontWeight.w500, diff --git a/lib/presentation/appointments/my_doctors_page.dart b/lib/presentation/appointments/my_doctors_page.dart index d1ea0e98..002f537c 100644 --- a/lib/presentation/appointments/my_doctors_page.dart +++ b/lib/presentation/appointments/my_doctors_page.dart @@ -93,8 +93,6 @@ class _MyDoctorsPageState extends State { borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, - - ), SizedBox(width: 8.h), CustomButton( @@ -280,7 +278,7 @@ class _MyDoctorsPageState extends State { runSpacing: 4.h, children: [ AppCustomChipWidget( - labelText: isSortByClinic ? (doctor?.clinicName ?? "") : (doctor?.projectName ?? ""), + labelText: isSortByClinic ? (doctor?.projectName ?? "") : (doctor?.clinicName ?? ""), ), ], ), diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart index 89a18bf5..52a1c219 100644 --- a/lib/presentation/appointments/widgets/appointment_card.dart +++ b/lib/presentation/appointments/widgets/appointment_card.dart @@ -104,8 +104,8 @@ class AppointmentCard extends StatelessWidget { AppCustomChipWidget( labelText: isLoading ? 'OutPatient' : (appState.isArabic() ? patientAppointmentHistoryResponseModel.isInOutPatientDescriptionN! : patientAppointmentHistoryResponseModel.isInOutPatientDescription!), - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1), - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.warningColorYellow.withValues(alpha: 0.1), + textColor: AppColors.warningColorYellow, ).toShimmer2(isShow: isLoading), AppCustomChipWidget( labelText: isLoading ? 'Booked' : AppointmentType.getAppointmentStatusType(patientAppointmentHistoryResponseModel.patientStatusType!), @@ -161,9 +161,13 @@ class AppointmentCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (isLoading ? 'John Doe' : "${patientAppointmentHistoryResponseModel.doctorTitle} ${patientAppointmentHistoryResponseModel.doctorNameObj!}") - .toText16(isBold: true, maxlines: 1) - .toShimmer2(isShow: isLoading), + Row( + children: [ + (isLoading ? 'Dr' : "${patientAppointmentHistoryResponseModel.doctorTitle}").toText16(isBold: true, maxlines: 1), + (isLoading ? 'John Doe' : " ${patientAppointmentHistoryResponseModel.doctorNameObj!.truncate(20)}") + .toText16(isBold: true, maxlines: 1, isEnglishOnly: !Utils.isArabicText(patientAppointmentHistoryResponseModel.doctorNameObj ?? "John Doe")) + ], + ).toShimmer2(isShow: isLoading), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, @@ -325,12 +329,19 @@ class AppointmentCard extends StatelessWidget { flex: 1, child: Container( height: (isFoldable || isTablet) ? 50.h : 40.h, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.textColor, borderRadius: 10.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.transparent, + borderRadius: 10.h, + side: BorderSide( + color: AppColors.textColor, + width: 1.2, + ), + ), child: Transform.flip( flipX: appState.isArabic(), child: Utils.buildSvgWithAssets( icon: AppAssets.forward_arrow_icon, - iconColor: AppColors.whiteColor, + iconColor: AppColors.textColor, width: 24.w, height: 24.h, fit: BoxFit.contain, @@ -397,9 +408,10 @@ class AppointmentCard extends StatelessWidget { return CustomButton( text: LocaleKeys.rebookSameDoctor.tr(context: context), onPressed: () => openDoctorScheduleCalendar(context), - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, + backgroundColor: AppColors.transparent, + borderColor: AppColors.textColor, textColor: AppColors.blackColor, + borderWidth: 1.h, fontSize: (isFoldable || isTablet) ? 12.f : 14.f, fontWeight: FontWeight.w500, borderRadius: 12.r, @@ -420,7 +432,9 @@ class AppointmentCard extends StatelessWidget { ), ); } else { - bookAppointmentsViewModel.getAppointmentNearestGate(projectID: patientAppointmentHistoryResponseModel.projectID, clinicID: patientAppointmentHistoryResponseModel.clinicID); + if (!AppointmentType.isArrived(patientAppointmentHistoryResponseModel)) { + bookAppointmentsViewModel.getAppointmentNearestGate(projectID: patientAppointmentHistoryResponseModel.projectID, clinicID: patientAppointmentHistoryResponseModel.clinicID); + } Navigator.of(context) .push( CustomPageRoute( diff --git a/lib/presentation/appointments/widgets/appointment_doctor_card.dart b/lib/presentation/appointments/widgets/appointment_doctor_card.dart index 298e8732..5a47708e 100644 --- a/lib/presentation/appointments/widgets/appointment_doctor_card.dart +++ b/lib/presentation/appointments/widgets/appointment_doctor_card.dart @@ -16,11 +16,7 @@ import 'dart:ui' as ui; class AppointmentDoctorCard extends StatelessWidget { const AppointmentDoctorCard( - {super.key, - required this.patientAppointmentHistoryResponseModel, - required this.onRescheduleTap, - required this.onCancelTap, - required this.onAskDoctorTap, this.renderWidgetForERDisplay = false}); + {super.key, required this.patientAppointmentHistoryResponseModel, required this.onRescheduleTap, required this.onCancelTap, required this.onAskDoctorTap, this.renderWidgetForERDisplay = false}); final PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel; final VoidCallback onRescheduleTap; @@ -82,7 +78,7 @@ class AppointmentDoctorCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - patientAppointmentHistoryResponseModel.doctorNameObj!.toText16(isBold: true), + patientAppointmentHistoryResponseModel.doctorNameObj!.toText16(isBold: true, isEnglishOnly: !Utils.isArabicText(patientAppointmentHistoryResponseModel.doctorNameObj ?? "")), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, @@ -107,20 +103,16 @@ class AppointmentDoctorCard extends StatelessWidget { richText: "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang( DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false, - )}".toText10(isEnglishOnly: true), + )}" + .toText10(isEnglishOnly: true), ), ), AppCustomChipWidget( labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), - icon: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! - ? AppAssets.walkin_appointment_icon - : AppAssets.small_livecare_icon, + icon: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppAssets.walkin_appointment_icon : AppAssets.small_livecare_icon, iconColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white, - labelText: patientAppointmentHistoryResponseModel.isLiveCareAppointment! - ? LocaleKeys.livecare.tr(context: context) - : LocaleKeys.walkin.tr(context: context), - backgroundColor: - !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor, + labelText: patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? LocaleKeys.livecare.tr(context: context) : LocaleKeys.walkin.tr(context: context), + backgroundColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor, textColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white, ), ], @@ -163,25 +155,27 @@ class AppointmentDoctorCard extends StatelessWidget { icon: AppAssets.ask_doctor_icon, iconColor: AppColors.primaryRedColor, ) - : !patientAppointmentHistoryResponseModel.isLiveCareAppointment! - ? CustomButton( - text: LocaleKeys.rebookSameDoctor.tr(), - onPressed: () { - onRescheduleTap(); - }, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 12.f, - fontWeight: FontWeight.w500, - borderRadius: 12.r, - padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), - height: 40.h, - icon: AppAssets.rebook_appointment_icon, - iconColor: AppColors.blackColor, - iconSize: 14.h, - ) - : SizedBox.shrink(); + : + // !patientAppointmentHistoryResponseModel.isLiveCareAppointment! + // ? CustomButton( + // text: LocaleKeys.rebookSameDoctor.tr(), + // onPressed: () { + // onRescheduleTap(); + // }, + // backgroundColor: AppColors.greyColor, + // borderColor: AppColors.greyColor, + // textColor: AppColors.blackColor, + // fontSize: 12.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.r, + // padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), + // height: 40.h, + // icon: AppAssets.rebook_appointment_icon, + // iconColor: AppColors.blackColor, + // iconSize: 14.h, + // ) + // : + SizedBox.shrink(); } else { return patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? CustomButton( diff --git a/lib/presentation/authentication/quick_login.dart b/lib/presentation/authentication/quick_login.dart index fbcb17d8..19e90d64 100644 --- a/lib/presentation/authentication/quick_login.dart +++ b/lib/presentation/authentication/quick_login.dart @@ -65,7 +65,8 @@ class QuickLoginState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(AppAssets.lockIcon, height: 100), + // Image.asset(AppAssets.lockIcon, height: 100), + Utils.buildSvgWithAssets(icon: AppAssets.biometricLockIcon, iconColor: AppColors.textColor, width: 100.h, height: 100.h), SizedBox(height: 10.h), LocaleKeys.enableQuickLogin.tr(context: context).toText26(isBold: true), // Text( diff --git a/lib/presentation/authentication/saved_login_screen.dart b/lib/presentation/authentication/saved_login_screen.dart index e9f201ad..96db5187 100644 --- a/lib/presentation/authentication/saved_login_screen.dart +++ b/lib/presentation/authentication/saved_login_screen.dart @@ -206,7 +206,7 @@ class _SavedLogin extends State { }, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, - textColor: AppColors.whiteColor, + textColor: AppColors.textColor, icon: AppAssets.sms), ), Row( @@ -232,6 +232,7 @@ class _SavedLogin extends State { textColor: AppColors.textColor, icon: AppAssets.whatsapp, iconColor: null, + applyThemeColor: false, ), ), ], diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index ab548449..6f5384c0 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -59,9 +59,21 @@ class _BookAppointmentPageState extends State { bookAppointmentsViewModel.initBookAppointmentViewModel(); bookAppointmentsViewModel.getLocation(); immediateLiveCareViewModel.initImmediateLiveCare(); + if (appState.isAuthenticated) { + getIt.get().getPatientMyDoctors(); + getIt.get().getPatientFavouriteDoctors(); + } }); WidgetsBinding.instance.addPostFrameCallback((_) { - showUnKnownClinicBottomSheet(); + if (bookAppointmentsViewModel.selectedTabIndex == 1) { + if (appState.isAuthenticated) { + getIt.get().getPatientMyDoctors(); + getIt.get().getPatientFavouriteDoctors(); + showUnKnownClinicBottomSheet(); + } + } else { + showUnKnownClinicBottomSheet(); + } }); super.initState(); } @@ -196,6 +208,136 @@ class _BookAppointmentPageState extends State { ], ); }), + // Favorite Doctors Section + Consumer(builder: (context, myAppointmentsVM, child) { + // Show shimmer loading state + if (myAppointmentsVM.isPatientFavouriteDoctorsLoading) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + LocaleKeys.favouriteDoctors.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.w, 0.h), + SizedBox(height: 16.h), + SizedBox( + height: 110.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: 3, // Show 3 shimmer items + shrinkWrap: true, + padding: EdgeInsets.only(left: 24.w, right: 24.w), + itemBuilder: (context, index) { + return SizedBox( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 64.h, + height: 64.h, + decoration: BoxDecoration( + color: Colors.grey[300], + shape: BoxShape.circle, + ), + ).toShimmer2(isShow: true, radius: 50.r), + SizedBox(height: 8.h), + SizedBox( + width: 80.w, + child: Container( + height: 12.h, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(4.r), + ), + ).toShimmer2(isShow: true), + ), + ], + ), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h), + ), + ), + ], + ); + } + + // Show empty state or actual list + return myAppointmentsVM.patientFavouriteDoctorsList.isEmpty + ? SizedBox() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + LocaleKeys.favouriteDoctors.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.w, 0.h), + SizedBox(height: 16.h), + SizedBox( + height: 110.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: myAppointmentsVM.patientFavouriteDoctorsList.length, + shrinkWrap: true, + padding: EdgeInsets.only(left: 24.w, right: 24.w), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: SizedBox( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.network( + myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!, + width: 64.h, + height: 64.h, + fit: BoxFit.cover, + ).circle(100).toShimmer2(isShow: false, radius: 50.r), + SizedBox(height: 8.h), + SizedBox( + width: 80.w, + child: (myAppointmentsVM.patientFavouriteDoctorsList[index].doctorName) + .toString() + .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) + .toShimmer2(isShow: false), + ), + ], + ), + ).onPress(() async { + bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( + clinicID: myAppointmentsVM.patientFavouriteDoctorsList[index].clinicId, + projectID: myAppointmentsVM.patientFavouriteDoctorsList[index].projectId, + doctorID: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorId, + )); + LoaderBottomSheet.showLoader(); + await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: DoctorProfilePage(), + ), + ); + }, onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }), + ), + ), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 8.h), + ), + ), + ], + ); + }), ], ], ); @@ -203,7 +345,9 @@ class _BookAppointmentPageState extends State { ), ), ), - _buildSymptomsBottomCard(), + Consumer(builder: (context, bookAppointmentsVM, child) { + return _buildSymptomsBottomCard(); + }), ], ), ); @@ -414,12 +558,13 @@ class _BookAppointmentPageState extends State { } Widget _buildSymptomsBottomCard() { - return Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), - child: Row( - children: [ - Expanded( - child: Column( + return bookAppointmentsViewModel.checkLiveCareSymptomCheckerStatus() + ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Row( + children: [ + Expanded( + child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -442,7 +587,8 @@ class _BookAppointmentPageState extends State { ) ], ).paddingAll(24.w), - ); + ) + : SizedBox.shrink(); } void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) { @@ -491,7 +637,7 @@ class _BookAppointmentPageState extends State { } }, onHospitalSearch: (value) { - data.searchHospitals(value ?? ""); + data.searchHospitals(value); }, selectedFacility: data.selectedFacility, hmcCount: data.hmcCount, @@ -502,7 +648,7 @@ class _BookAppointmentPageState extends State { // Navigator.of(context).pop(); bookAppointmentsViewModel.setIsClinicsListLoading(true); bookAppointmentsViewModel.setLoadSpecificClinic(true); - bookAppointmentsViewModel.setProjectID(regionalViewModel.selectedHospital?.hospitalList.first?.mainProjectID.toString()); + bookAppointmentsViewModel.setProjectID(regionalViewModel.selectedHospital!.hospitalList.first!.mainProjectID.toString()); } else { SizedBox.shrink(); } diff --git a/lib/presentation/book_appointment/doctor_profile_page.dart b/lib/presentation/book_appointment/doctor_profile_page.dart index f79aa770..d5fe0709 100644 --- a/lib/presentation/book_appointment/doctor_profile_page.dart +++ b/lib/presentation/book_appointment/doctor_profile_page.dart @@ -1,4 +1,3 @@ - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,6 +8,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_rating_details.dart'; @@ -53,8 +53,9 @@ class DoctorProfilePage extends StatelessWidget { doctorID: viewModel.doctorsProfileResponseModel.doctorID ?? 0, isActive: viewModel.isFavouriteDoctor, onSuccess: (response) { - // Successfully added/removed favorite - print( + // Successfully added/removed favorite - refresh the favorites list + getIt.get().refreshFavouriteDoctors(); + print( viewModel.isFavouriteDoctor ? "Doctor added to favorites" : "Doctor removed from favorites", ); }, @@ -132,18 +133,12 @@ class DoctorProfilePage extends StatelessWidget { children: [ Column( children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.doctor_profile_rating_icon, - width: 48.w, - height: 48.h, - fit: BoxFit.contain, - applyThemeColor: false - ), + Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_rating_icon, width: 48.w, height: 48.h, fit: BoxFit.contain, applyThemeColor: false), SizedBox(height: 16.h), - "Ratings".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + LocaleKeys.ratings.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), bookAppointmentsViewModel.doctorsProfileResponseModel.decimalDoctorRate .toString() - .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor), + .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor, fontFamily: "Poppins"), ], ).onPress(() { bookAppointmentsViewModel.getDoctorRatingDetails(); @@ -159,18 +154,12 @@ class DoctorProfilePage extends StatelessWidget { SizedBox(width: 36.w), Column( children: [ - Utils.buildSvgWithAssets( - icon: AppAssets.doctor_profile_reviews_icon, - width: 48.w, - height: 48.h, - fit: BoxFit.contain, - applyThemeColor: false - ), + Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_reviews_icon, width: 48.w, height: 48.h, fit: BoxFit.contain, applyThemeColor: false), SizedBox(height: 16.h), - "Reviews".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + LocaleKeys.reviews.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), bookAppointmentsViewModel.doctorsProfileResponseModel.noOfPatientsRate .toString() - .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor), + .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor, fontFamily: "Poppins"), ], ).onPress(() { bookAppointmentsViewModel.getDoctorRatingDetails(); diff --git a/lib/presentation/book_appointment/select_doctor_page.dart b/lib/presentation/book_appointment/select_doctor_page.dart index 1fc9d9ad..7947fa05 100644 --- a/lib/presentation/book_appointment/select_doctor_page.dart +++ b/lib/presentation/book_appointment/select_doctor_page.dart @@ -46,7 +46,7 @@ class _SelectDoctorPageState extends State { void initState() { _scrollController = ScrollController(); scheduleMicrotask(() { - bookAppointmentsViewModel.setIsNearestAppointmentSelected(false); + bookAppointmentsViewModel.setIsNearestAppointmentSelected(true); if (bookAppointmentsViewModel.isLiveCareSchedule) { bookAppointmentsViewModel.getLiveCareDoctorsList(); } else { diff --git a/lib/presentation/book_appointment/widgets/appointment_calendar.dart b/lib/presentation/book_appointment/widgets/appointment_calendar.dart index 9124a16b..57a045cc 100644 --- a/lib/presentation/book_appointment/widgets/appointment_calendar.dart +++ b/lib/presentation/book_appointment/widgets/appointment_calendar.dart @@ -90,59 +90,64 @@ class _AppointmentCalendarState extends State { // ), SizedBox( height: 350.h, - child: SfCalendar( - controller: _calendarController, - minDate: DateTime.now(), - showNavigationArrow: true, - headerHeight: 60.h, - headerStyle: CalendarHeaderStyle( - backgroundColor: AppColors.scaffoldBgColor, - textAlign: TextAlign.start, - textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor, fontFamily: "Poppins"), - ), - viewHeaderStyle: ViewHeaderStyle( - backgroundColor: AppColors.scaffoldBgColor, - dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor), - ), - view: CalendarView.month, - todayHighlightColor: Colors.transparent, - todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold), - selectionDecoration: ShapeDecoration( - color: AppColors.transparent, - shape: SmoothRectangleBorder( - borderRadius: BorderRadius.circular(10.r), - smoothness: 1, - side: BorderSide(color: AppColors.primaryRedColor, width: 1.5), + child: Localizations.override( + context: context, + locale: const Locale('en'), + child: SfCalendar( + controller: _calendarController, + minDate: DateTime.now(), + showNavigationArrow: true, + headerHeight: 60.h, + headerStyle: CalendarHeaderStyle( + backgroundColor: AppColors.scaffoldBgColor, + textAlign: TextAlign.start, + textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor, fontFamily: "Poppins"), ), - ), - cellBorderColor: AppColors.transparent, - dataSource: MeetingDataSource(_getDataSource()), - monthCellBuilder: (context, details) => Padding( - padding: EdgeInsets.all(12.h), - child: details.date.day.toString().toText14( - isCenter: true, - color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor, - ), - ), - monthViewSettings: MonthViewSettings( - dayFormat: "EEE", - appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, - showTrailingAndLeadingDates: false, - appointmentDisplayCount: 1, - monthCellStyle: MonthCellStyle( - textStyle: TextStyle(fontSize: 19.f), + viewHeaderStyle: ViewHeaderStyle( + backgroundColor: AppColors.scaffoldBgColor, + dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor, fontFamily: "Poppins"), ), + view: CalendarView.month, + todayHighlightColor: Colors.transparent, + todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold, fontFamily: "Poppins"), + selectionDecoration: ShapeDecoration( + color: AppColors.transparent, + shape: SmoothRectangleBorder( + borderRadius: BorderRadius.circular(10.r), + smoothness: 1, + side: BorderSide(color: AppColors.primaryRedColor, width: 1.5), + ), + ), + cellBorderColor: AppColors.transparent, + dataSource: MeetingDataSource(_getDataSource()), + monthCellBuilder: (context, details) => Padding( + padding: EdgeInsets.all(12.h), + child: details.date.day.toString().toText14( + isCenter: true, + color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor, + isEnglishOnly: true, + ), + ), + monthViewSettings: MonthViewSettings( + dayFormat: "EEE", + appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, + showTrailingAndLeadingDates: false, + appointmentDisplayCount: 1, + monthCellStyle: MonthCellStyle( + textStyle: TextStyle(fontSize: 19.f), + ), + ), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date!); + }, ), - onTap: (CalendarTapDetails details) { - _calendarController.selectedDate = details.date; - _onDaySelected(details.date!); - }, ), ), SizedBox(height: 10.h), Transform.translate( offset: const Offset(0.0, -10.0), - child: selectedDateDisplay.toText16(weight: FontWeight.w500), + child: selectedDateDisplay.toText16(weight: FontWeight.w500, isEnglishOnly: true), ), //TODO: Add Next Day Span here dayEvents.isNotEmpty @@ -153,23 +158,23 @@ class _AppointmentCalendarState extends State { child: Wrap( direction: Axis.horizontal, alignment: WrapAlignment.start, - spacing: 6.h, - runSpacing: 6.h, - children: List.generate( - dayEvents.length, // Generate a large number of items to ensure scrolling - (index) => TimeSlotChip( - label: dayEvents[index].isoTime!, - isSelected: index == selectedButtonIndex, - onTap: () { - setState(() { - selectedButtonIndex = index; - selectedTime = dayEvents[index].isoTime!; - }); - }, + spacing: 6.h, + runSpacing: 6.h, + children: List.generate( + dayEvents.length, // Generate a large number of items to ensure scrolling + (index) => TimeSlotChip( + label: dayEvents[index].isoTime!, + isSelected: index == selectedButtonIndex, + onTap: () { + setState(() { + selectedButtonIndex = index; + selectedTime = dayEvents[index].isoTime!; + }); + }, + ), + ), + ), ), - ), - ), - ), ) : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noFreeSlot.tr(context: context)), @@ -179,7 +184,7 @@ class _AppointmentCalendarState extends State { isDisabled: dayEvents.isEmpty, onPressed: () async { if (appState.isAuthenticated) { - if(selectedTime == LocaleKeys.waitingAppointment.tr(context: context)){ + if (selectedTime == LocaleKeys.waitingAppointment.tr(context: context)) { bookAppointmentsViewModel.setWaitingAppointmentProjectID(bookAppointmentsViewModel.selectedDoctor.projectID!); bookAppointmentsViewModel.setWaitingAppointmentDoctor(bookAppointmentsViewModel.selectedDoctor); @@ -351,26 +356,20 @@ class TimeSlotChip extends StatelessWidget { side: BorderSide(color: isSelected ? AppColors.warningColorYellow : AppColors.borderOnlyColor.withOpacity(0.2), width: 1), ), ), - child: label.toText12( - color: isSelected ? AppColors.whiteColor : Colors.black87, - fontWeight: FontWeight.w500, - ), + child: label.toText12(color: isSelected ? AppColors.whiteColor : Colors.black87, fontWeight: FontWeight.w500, isEnglishOnly: true), ) : Container( padding: EdgeInsets.symmetric(horizontal: 14.h, vertical: 8.h), decoration: ShapeDecoration( - color: AppColors.whiteColor, - shape: SmoothRectangleBorder( - borderRadius: BorderRadius.circular(8.h), - smoothness: 1, - side: BorderSide(color: isSelected ? AppColors.primaryRedColor : AppColors.borderOnlyColor.withOpacity(0.2), width: 1), - ), - ), - child: label.toText12( - color: isSelected ? AppColors.primaryRedColor : AppColors.textColor, - fontWeight: FontWeight.w500, - ), - ), + color: AppColors.whiteColor, + shape: SmoothRectangleBorder( + borderRadius: BorderRadius.circular(8.h), + smoothness: 1, + side: BorderSide(color: isSelected ? AppColors.primaryRedColor : AppColors.borderOnlyColor.withOpacity(0.2), width: 1), + ), + ), + child: label.toText12(color: isSelected ? AppColors.primaryRedColor : AppColors.textColor, fontWeight: FontWeight.w500, isEnglishOnly: true), + ), ); } } diff --git a/lib/presentation/book_appointment/widgets/doctor_card.dart b/lib/presentation/book_appointment/widgets/doctor_card.dart index 6eecf5f8..02b2e55d 100644 --- a/lib/presentation/book_appointment/widgets/doctor_card.dart +++ b/lib/presentation/book_appointment/widgets/doctor_card.dart @@ -109,7 +109,7 @@ class DoctorCard extends StatelessWidget { : doctorsListResponseModel.speciality!.first) : "") .toString() - .toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor, maxLine: 2) + .toText12(fontWeight: FontWeight.w500, color: AppColors.textColor, maxLine: 2, isEnglishOnly: true) .toShimmer2(isShow: isLoading), ), SizedBox(width: 6.w), diff --git a/lib/presentation/book_appointment/widgets/doctor_rating_details.dart b/lib/presentation/book_appointment/widgets/doctor_rating_details.dart index 6d9e1cb2..1a5eedfe 100644 --- a/lib/presentation/book_appointment/widgets/doctor_rating_details.dart +++ b/lib/presentation/book_appointment/widgets/doctor_rating_details.dart @@ -20,13 +20,20 @@ class DoctorRatingDetails extends StatelessWidget { : Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - bookAppointmentsVM.doctorsProfileResponseModel.actualDoctorRate!.ceilToDouble().toString().toText44(isBold: true), + bookAppointmentsVM.doctorsProfileResponseModel.actualDoctorRate!.ceilToDouble().toString().toText44(isBold: true, isEnglishOnly: true), SizedBox(height: 4.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "${bookAppointmentsVM.doctorsProfileResponseModel.noOfPatientsRate} ${LocaleKeys.reviews.tr(context: context)}" - .toText16(weight: FontWeight.w500, color: AppColors.greyInfoTextColor), + Row( + children: [ + "${bookAppointmentsVM.doctorsProfileResponseModel.noOfPatientsRate} " + .toText16(weight: FontWeight.w500, color: AppColors.greyInfoTextColor, isEnglishOnly: true), + LocaleKeys.reviews.tr(context: context) + .toText16(weight: FontWeight.w500, color: AppColors.greyInfoTextColor,), + ], + ), + RatingBar( initialRating: bookAppointmentsVM.doctorsProfileResponseModel.actualDoctorRate!.toDouble(), direction: Axis.horizontal, @@ -75,7 +82,7 @@ class DoctorRatingDetails extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text("${getRatingWidth(bookAppointmentsVM.doctorDetailsList[0].ratio).round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600)), + child: Text("${getRatingWidth(bookAppointmentsVM.doctorDetailsList[0].ratio).round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600, fontFamily: "Poppins")), ), ], ), @@ -95,7 +102,7 @@ class DoctorRatingDetails extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text("${bookAppointmentsVM.doctorDetailsList[1].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600)), + child: Text("${bookAppointmentsVM.doctorDetailsList[1].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600, fontFamily: "Poppins")), ), ], ), @@ -115,7 +122,7 @@ class DoctorRatingDetails extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text("${bookAppointmentsVM.doctorDetailsList[2].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600)), + child: Text("${bookAppointmentsVM.doctorDetailsList[2].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600, fontFamily: "Poppins")), ), ], ), @@ -135,7 +142,7 @@ class DoctorRatingDetails extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text("${bookAppointmentsVM.doctorDetailsList[3].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600)), + child: Text("${bookAppointmentsVM.doctorDetailsList[3].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600, fontFamily: "Poppins")), ), ], ), @@ -156,7 +163,7 @@ class DoctorRatingDetails extends StatelessWidget { ), Container( margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), - child: Text("${bookAppointmentsVM.doctorDetailsList[4].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600)), + child: Text("${bookAppointmentsVM.doctorDetailsList[4].ratio.round()}%", style: TextStyle(fontSize: 14.0, color: AppColors.textColor, fontWeight: FontWeight.w600, fontFamily: "Poppins")), ), ], ), diff --git a/lib/presentation/contact_us/contact_us.dart b/lib/presentation/contact_us/contact_us.dart index fd0a439b..70ef6e3f 100644 --- a/lib/presentation/contact_us/contact_us.dart +++ b/lib/presentation/contact_us/contact_us.dart @@ -17,6 +17,7 @@ import 'package:hmg_patient_app_new/presentation/contact_us/live_chat_page.dart' import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class ContactUs extends StatelessWidget { ContactUs({super.key}); @@ -33,6 +34,15 @@ class ContactUs extends StatelessWidget { contactUsViewModel = Provider.of(context); return Column( children: [ + checkInOptionCard( + AppAssets.call_fill, + LocaleKeys.callNow.tr(), + // LocaleKeys.viewNearestHMGLocationsviewNearestHMGLocations.tr(), + "Call for immediate assistance", + ).onPress(() { + launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); + }), + SizedBox(height: 16.h), checkInOptionCard( AppAssets.location, LocaleKeys.findUs.tr(), @@ -46,26 +56,25 @@ class ContactUs extends StatelessWidget { page: FindUsPage(), ), ); + }, onFailure: () { + contactUsViewModel.initContactUsViewModel(); + Navigator.pop(context); + Navigator.of(context).push( + CustomPageRoute( + page: FindUsPage(), + ), + ); + }, onLocationDeniedForever: () { + contactUsViewModel.initContactUsViewModel(); + Navigator.pop(context); + Navigator.of(context).push( + CustomPageRoute( + page: FindUsPage(), + ), + ); }); }), SizedBox(height: 16.h), - checkInOptionCard( - AppAssets.feedbackFill, - LocaleKeys.feedback.tr(), - LocaleKeys.provideFeedbackOnServices.tr(), - ).onPress(() { - contactUsViewModel.setSelectedFeedbackType( - FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'), - ); - contactUsViewModel.setIsSendFeedbackTabSelected(true); - Navigator.pop(context); - Navigator.of(context).push( - CustomPageRoute( - page: FeedbackPage(), - ), - ); - }), - SizedBox(height: 16.h), checkInOptionCard( AppAssets.ask_doctor_icon, LocaleKeys.liveChat.tr(), diff --git a/lib/presentation/contact_us/find_us_page.dart b/lib/presentation/contact_us/find_us_page.dart index 5957bb83..9091f74d 100644 --- a/lib/presentation/contact_us/find_us_page.dart +++ b/lib/presentation/contact_us/find_us_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; @@ -20,11 +21,14 @@ class FindUsPage extends StatelessWidget { late AppState appState; late ContactUsViewModel contactUsViewModel; + late LocationUtils locationUtils; @override Widget build(BuildContext context) { contactUsViewModel = Provider.of(context); appState = getIt.get(); + locationUtils = getIt.get(); + locationUtils.isShowConfirmDialog = true; return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( @@ -47,8 +51,48 @@ class FindUsPage extends StatelessWidget { contactUsVM.setHMGHospitalsListSelected(index == 0); }, ).paddingSymmetrical(24.h, 0.h), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.sortByLocation.tr(context: context).toText14(isBold: true), + SizedBox(height: 4.h), + "Sort the locations by nearest to your location".toText11(color: AppColors.textColorLight, weight: FontWeight.w500), + ], + ), + const Spacer(), + Switch( + activeThumbColor: AppColors.successColor, + activeTrackColor: AppColors.successColor.withValues(alpha: .15), + value: contactUsVM.hasLocationEnabled, + onChanged: (newValue) async { + if (newValue) { + locationUtils.getCurrentLocation( + onSuccess: (value) { + // if (contactUsVM.hmgHospitalsLocationsList.isNotEmpty) { + // contactUsVM.sortHMGLocations(true); + // contactUsVM.setHasLocationEnabled(newValue); + // } else { + contactUsVM.initContactUsViewModel(); + contactUsVM.setHasLocationEnabled(newValue); + contactUsVM.sortHMGLocations(true); + // } + }, + onFailure: () {}, + ); + } else { + contactUsVM.sortHMGLocations(false); + contactUsVM.setHasLocationEnabled(newValue); + } + // bookAppointmentsVM.setIsNearestAppointmentSelected(newValue); + }, + ), + ], + ).paddingSymmetrical(24.h, 12.h), ListView.separated( - padding: EdgeInsets.only(top: 16.h), + padding: EdgeInsets.only(top: 4.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: contactUsVM.isHMGLocationsListLoading diff --git a/lib/presentation/contact_us/widgets/find_us_item_card.dart b/lib/presentation/contact_us/widgets/find_us_item_card.dart index 4738a63a..521775bc 100644 --- a/lib/presentation/contact_us/widgets/find_us_item_card.dart +++ b/lib/presentation/contact_us/widgets/find_us_item_card.dart @@ -6,24 +6,30 @@ import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_hmg_locations.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:map_launcher/map_launcher.dart'; +import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; class FindUsItemCard extends StatelessWidget { FindUsItemCard({super.key, required this.getHMGLocationsModel}); late AppState appState; + late ContactUsViewModel contactUsViewModel; GetHMGLocationsModel getHMGLocationsModel; @override Widget build(BuildContext context) { appState = getIt.get(); + contactUsViewModel = getIt.get(); return DecoratedBox( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, @@ -45,71 +51,108 @@ class FindUsItemCard extends StatelessWidget { ); } - Widget get hospitalName => Row( + Widget get hospitalName => Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.network( - getHMGLocationsModel.projectImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - width: 40.h, - height: 40.h, - fit: BoxFit.cover, - ).circle(100).toShimmer2(isShow: false).paddingOnly(right: 10), - Expanded( - child: Text( - getHMGLocationsModel.locationName!, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16, - color: AppColors.blackColor, - ), - ), - ) + (getHMGLocationsModel.distanceInKilometers != 0 && contactUsViewModel.hasLocationEnabled) + ? Column( + children: [ + AppCustomChipWidget( + labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km", + labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.w), + icon: AppAssets.location_red, + // iconColor: AppColors.primaryRedColor, + // backgroundColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.errorColor, + ), + SizedBox( + height: 16.h, + ), + ], + ) + : SizedBox.shrink(), + Row( + children: [ + Image.network( + getHMGLocationsModel.projectImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + width: 40.h, + height: 40.h, + fit: BoxFit.cover, + ).circle(100).toShimmer2(isShow: false).paddingOnly(right: 10), + Expanded( + child: Text( + getHMGLocationsModel.locationName!, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + color: AppColors.blackColor, + ), + ), + ) + ], + ), ], ); Widget get distanceInfo => Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AppCustomChipWidget( - labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km", - icon: AppAssets.location_red, - iconColor: AppColors.primaryRedColor, - backgroundColor: AppColors.secondaryLightRedColor, - textColor: AppColors.errorColor, - ), - Row( - children: [ - AppCustomChipWidget( - labelText: LocaleKeys.getDirections.tr(), - icon: AppAssets.directions_icon, - iconColor: AppColors.whiteColor, - backgroundColor: AppColors.textColor.withValues(alpha: 0.8), - textColor: AppColors.whiteColor, - onChipTap: () async { - await MapLauncher.showMarker( - mapType: MapType.google, + Expanded( + flex: 7, + child: CustomButton( + text: LocaleKeys.getDirections.tr(), + onPressed: () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0")), + title: getHMGLocationsModel.locationName ?? "Hospital", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, coords: Coords(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0")), title: getHMGLocationsModel.locationName ?? "Hospital", - ).catchError((err) { - MapLauncher.showMarker( - mapType: Platform.isIOS ? MapType.apple : MapType.google, - coords: Coords(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0")), - title: getHMGLocationsModel.locationName ?? "Hospital", - ); - }); - }, + ); + }); + }, + backgroundColor: AppColors.transparent, + borderColor: AppColors.textColor, + textColor: AppColors.blackColor, + borderWidth: 1.h, + fontSize: (isFoldable || isTablet) ? 12.f : 14.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 40.h, + icon: AppAssets.directions_icon, + iconColor: AppColors.blackColor, + iconSize: 16.h, + ), + ), + SizedBox(width: 8.w), + Expanded( + flex: 1, + child: Container( + height: (isFoldable || isTablet) ? 50.h : 40.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.transparent, + borderRadius: 10.h, + side: BorderSide( + color: AppColors.textColor, + width: 1.2, + ), ), - SizedBox(width: 4.w), - AppCustomChipWidget( - labelText: LocaleKeys.callNow.tr(), - icon: AppAssets.call_fill, - iconColor: Colors.white, - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 1.0), - textColor: Colors.white, - onChipTap: () { - launchUrl(Uri.parse("tel://" + "${getHMGLocationsModel.phoneNumber}")); - }, + child: Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.call_fill, + iconColor: AppColors.textColor, + width: 5.w, + height: 5.h, + fit: BoxFit.scaleDown, + ), ), - ], + ).onPress(() { + launchUrl(Uri.parse("tel://" + "${getHMGLocationsModel.phoneNumber}")); + }), ), ], ); diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart index 41597e40..7970d819 100644 --- a/lib/presentation/emergency_services/emergency_services_page.dart +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -35,7 +35,7 @@ class EmergencyServicesPage extends StatelessWidget { return CollapsingListView( title: LocaleKeys.emergencyServices.tr(), - requests: () { + history: () { emergencyServicesViewModel.changeOrderDisplayItems(OrderDislpay.ALL); Navigator.of(context).push(CustomPageRoute(page: ErHistoryListing(), direction: AxisDirection.up)); }, diff --git a/lib/presentation/habib_wallet/habib_wallet_page.dart b/lib/presentation/habib_wallet/habib_wallet_page.dart index c90003a8..2a3da660 100644 --- a/lib/presentation/habib_wallet/habib_wallet_page.dart +++ b/lib/presentation/habib_wallet/habib_wallet_page.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -26,6 +28,16 @@ class HabibWalletPage extends StatefulWidget { class _HabibWalletState extends State { late HabibWalletViewModel habibWalletVM; + @override + void initState() { + scheduleMicrotask(() async { + habibWalletVM.initHabibWalletProvider(); + habibWalletVM.getPatientBalanceAmount(); + }); + + super.initState(); + } + @override Widget build(BuildContext context) { habibWalletVM = Provider.of(context, listen: false); @@ -44,8 +56,10 @@ class _HabibWalletState extends State { width: double.infinity, height: 180.h, decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.blackBgColor, - borderRadius: 24, + // color: AppColors.blackBgColor, + color: Color(0xFF2E3039), + borderRadius: 24.r, + hasShadow: true ), child: Padding( padding: EdgeInsets.all(16.h), @@ -59,18 +73,18 @@ class _HabibWalletState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}".toText19(isBold: true, color: AppColors.whiteColor), + "${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}".toText19(isBold: true, color: Colors.white), "MRN: ${_appState.getAuthenticatedUser()!.patientId!}".toText14(weight: FontWeight.w500, color: AppColors.greyTextColor), ], ).expanded, - Utils.buildSvgWithAssets(icon: AppAssets.habiblogo, width: 24.h, height: 24.h), + Utils.buildSvgWithAssets(icon: AppAssets.habiblogo, width: 24.h, height: 24.h, applyThemeColor: false), ], ), Spacer(), - LocaleKeys.balanceAmount.tr(context: context).toText14(weight: FontWeight.w500, color: AppColors.whiteColor), + LocaleKeys.balanceAmount.tr(context: context).toText14(weight: FontWeight.w500, color: Colors.white), SizedBox(height: 4.h), Consumer(builder: (context, habibWalletVM, child) { - return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, textColor: AppColors.whiteColor, iconColor: AppColors.whiteColor, iconSize: 13, isExpanded: false) + return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, textColor: Colors.white, iconColor: Colors.white, iconSize: 16, isExpanded: false) .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.h, width: 80.h, height: 24.h); }), ], @@ -86,7 +100,7 @@ class _HabibWalletState extends State { icon: AppAssets.recharge_icon, iconSize: 24.w, backgroundColor: AppColors.infoColor, - textColor: AppColors.whiteColor, + textColor: Colors.white, text: LocaleKeys.recharge.tr(context: context), borderWidth: 0.w, fontWeight: FontWeight.w500, @@ -99,12 +113,42 @@ class _HabibWalletState extends State { page: RechargeWalletPage(), )) .then((val) { + habibWalletVM.initHabibWalletProvider(); habibWalletVM.getPatientBalanceAmount(); }); }, ), ], ), + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, + ), + child: Consumer(builder: (context, habibWalletVM, child) { + return ListView.separated( + itemCount: habibWalletVM.habibWalletBalanceList.length, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.only(top: 8, bottom: 8), + shrinkWrap: true, + itemBuilder: (context, index) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded(child: habibWalletVM.habibWalletBalanceList[index].projectDescription!.toText16(weight: FontWeight.w500, color: AppColors.textColor)), + Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletBalanceList[index].patientAdvanceBalanceAmount!, textColor: AppColors.textColor, iconColor: AppColors.textColor, iconSize: 18.h, isExpanded: false, fontSize: 28.f, fontWeight: FontWeight.w500), + ], + ).paddingSymmetrical(0, 12.h); + }, + separatorBuilder: (BuildContext context, int index) { + return Divider(height: 1, color: AppColors.textColor.withAlpha(20)); + }, + ).paddingSymmetrical(16.h, 24.h).toShimmer2(isShow: habibWalletVM.isWalletAmountLoading); + }), + ), + SizedBox(height: 24.h), ], ), ), diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart index 4996850b..de3235aa 100644 --- a/lib/presentation/hmg_services/services_page.dart +++ b/lib/presentation/hmg_services/services_page.dart @@ -294,11 +294,11 @@ class ServicesPage extends StatelessWidget { true, route: null, onTap: () async { - if (getIt.get().isAuthenticated) { + // if (getIt.get().isAuthenticated) { getIt.get().pushPageRoute(AppRoutes.smartWatches); - } else { - await getIt.get().onLoginPressed(); - } + // } else { + // await getIt.get().onLoginPressed(); + // } }, // route: AppRoutes.huaweiHealthExample, ), diff --git a/lib/presentation/home/app_update_page.dart b/lib/presentation/home/app_update_page.dart index 5e6481bd..18382838 100644 --- a/lib/presentation/home/app_update_page.dart +++ b/lib/presentation/home/app_update_page.dart @@ -83,13 +83,15 @@ class AppUpdatePage extends StatelessWidget { }).catchError((e) { print(e.toString()); Utils.openWebView( - url: "https://play.google.com/store/apps/details?id=com.ejada.hmg", + // url: "https://play.google.com/store/apps/details?id=com.ejada.hmg", + url: "https://play.google.com/store/apps/details?id=com.cloudsolutions.HMGPatientApp", ); }); } if (Platform.isIOS) { Utils.openWebView( - url: "https://itunes.apple.com/app/id733503978", + // url: "https://itunes.apple.com/app/id733503978", + url: "https://itunes.apple.com/app/id6758851027", ); } } diff --git a/lib/presentation/home/data/landing_page_data.dart b/lib/presentation/home/data/landing_page_data.dart index b74e57f3..4606c800 100644 --- a/lib/presentation/home/data/landing_page_data.dart +++ b/lib/presentation/home/data/landing_page_data.dart @@ -165,8 +165,8 @@ class LandingPageData { serviceName: "home_health_care", icon: AppAssets.homeBottom, title: LocaleKeys.homeHealthCare, - subtitle: LocaleKeys.liveCareServiceDesc, - largeCardIcon: AppAssets.homeHealthCareService, + subtitle: LocaleKeys.homeHealthCareText, + largeCardIcon: AppAssets.homeHealthCareService, backgroundColor: AppColors.primaryRedColor, iconColor: AppColors.whiteColor, isBold: false, @@ -175,8 +175,8 @@ class LandingPageData { serviceName: "pharmacy", icon: AppAssets.pharmacy_icon, //359846 title: LocaleKeys.hmgPharmacy, - subtitle: LocaleKeys.liveCareServiceDesc, - largeCardIcon: AppAssets.pharmacyService, + subtitle: LocaleKeys.hmgPharmacyText, + largeCardIcon: AppAssets.pharmacyService, backgroundColor: AppColors.pharmacyBGColor, iconColor: null, isBold: true, diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index a7ae78b9..14684c0c 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -25,6 +25,8 @@ import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_mode import 'package:hmg_patient_app_new/features/hospital/hospital_selection_view_model.dart'; import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; +import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; @@ -45,7 +47,10 @@ import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card. import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/widgets/insurance_update_details_card.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; +import 'package:hmg_patient_app_new/presentation/my_family/my_family.dart'; import 'package:hmg_patient_app_new/presentation/notifications/notifications_list_page.dart'; import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart'; import 'package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_doctor.dart'; @@ -53,6 +58,7 @@ import 'package:hmg_patient_app_new/presentation/todo_section/ancillary_procedur import 'package:hmg_patient_app_new/presentation/todo_section/widgets/ancillary_orders_list.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; +import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/zoom_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -62,6 +68,7 @@ import 'package:hmg_patient_app_new/widgets/countdown_timer.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/spring_page_route_builder.dart'; import 'package:provider/provider.dart'; +import 'package:smooth_corner/smooth_corner.dart'; import '../emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart'; @@ -122,6 +129,7 @@ class _LandingPageState extends State { emergencyServicesViewModel.checkPatientERAdvanceBalance(); // myAppointmentsViewModel.getPatientAppointmentQueueDetails(); notificationsViewModel.initNotificationsViewModel(); + insuranceViewModel.initInsuranceProvider(); // Commented as per new requirement to remove rating popup from the app @@ -160,29 +168,50 @@ class _LandingPageState extends State { canPop: false, child: Scaffold( backgroundColor: AppColors.bgScaffoldColor, - body: SingleChildScrollView( - padding: EdgeInsets.only(top: kToolbarHeight + 0.h, bottom: 24), - child: Column( - spacing: 16.h, + body: Consumer(builder: (context, insuranceVM, child) { + return Stack( children: [ - Row( - spacing: 8.h, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - appState.isAuthenticated - ? WelcomeWidget( - onTap: () { - Navigator.of(context).push(springPageRoute(ProfileSettings())); - }, - name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'), - imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, - ).expanded - : CustomButton( - text: LocaleKeys.loginOrRegister.tr(context: context), - onPressed: () async { - await authVM.onLoginPressed(); + SingleChildScrollView( + padding: EdgeInsets.only( + top: (!insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown) + ? (MediaQuery.paddingOf(context).top + 70.h) + : kToolbarHeight + 0.h, + bottom: 24), + child: Column( + spacing: 16.h, + children: [ + Row( + spacing: 8.h, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + appState.isAuthenticated + ? WelcomeWidget( + onTap: () { + // DialogService dialogService = getIt.get(); + // dialogService.showFamilyBottomSheetWithoutH( + // label: LocaleKeys.familyTitle.tr(context: context), + // message: "", + // isShowManageButton: true, + // onSwitchPress: (FamilyFileResponseModelLists profile) { + // getIt.get().switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); + // }, + // profiles: getIt.get().patientFamilyFiles); + + Navigator.of(context).push( + CustomPageRoute( + page: FamilyMedicalScreen(), + ), + ); + }, + name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'), + imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, + ).expanded + : CustomButton( + text: LocaleKeys.loginOrRegister.tr(context: context), + onPressed: () async { + await authVM.onLoginPressed(); - // Navigator.pushReplacementNamed( + // Navigator.pushReplacementNamed( // // context, // context, // AppRoutes.zoomCallPage, @@ -223,470 +252,542 @@ class _LandingPageState extends State { }), (appState.isAuthenticated && (int.parse(todoSectionVM.notificationsCount ?? "0") > 0)) ? Positioned( - right: 0, - top: 0, - child: Container( - width: 8.w, - height: 8.h, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: AppColors.primaryRedColor, - borderRadius: BorderRadius.circular(20.r), - ), - child: Text( - "", - style: TextStyle( - color: Colors.white, - fontSize: 8.f, - ), - textAlign: TextAlign.center, - ), - ), - ) - : SizedBox.shrink(), - ]), - Utils.buildSvgWithAssets(icon: AppAssets.indoor_nav_icon, height: 24.h, width: 24.w).onPress(() { - openIndoorNavigationBottomSheet(context); - }), - Utils.buildSvgWithAssets(icon: AppAssets.contact_icon, height: 24.h, width: 24.h).onPress(() { - showCommonBottomSheetWithoutHeight( - context, + right: 0, + top: 0, + child: Container( + width: 8.w, + height: 8.h, + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: AppColors.primaryRedColor, + borderRadius: BorderRadius.circular(20.r), + ), + child: Text( + "", + style: TextStyle( + color: Colors.white, + fontSize: 8.f, + ), + textAlign: TextAlign.center, + ), + ), + ) + : SizedBox.shrink(), + ]), + Utils.buildSvgWithAssets(icon: AppAssets.location, height: 24.h, width: 24.w).onPress(() { + // openIndoorNavigationBottomSheet(context); + showCommonBottomSheetWithoutHeight( + context, title: LocaleKeys.contactUs.tr(), child: ContactUs(), callBackFunc: () {}, isFullScreen: false, ); }), - !appState.isAuthenticated - ? Utils.buildSvgWithAssets(icon: AppAssets.changeLanguageHomePageIcon, height: 24.h, width: 24.h).onPress(() { - context.setLocale(appState.isArabic() ? Locale('en', 'US') : Locale('ar', 'SA')); - }) - : SizedBox.shrink() - ], + // Utils.buildSvgWithAssets(icon: AppAssets.contact_icon, height: 24.h, width: 24.h).onPress(() { + // showCommonBottomSheetWithoutHeight( + // context, + // title: LocaleKeys.contactUs.tr(), + // child: ContactUs(), + // callBackFunc: () {}, + // isFullScreen: false, + // ); + // }), + !appState.isAuthenticated + ? Utils.buildSvgWithAssets(icon: appState.isArabic() ? AppAssets.enLangIcon : AppAssets.arLangIcon, height: 24.h, width: 24.h).onPress(() { + context.setLocale(appState.isArabic() ? Locale('en', 'US') : Locale('ar', 'SA')); + }) + : SizedBox.shrink() + ], ); }), ], ).paddingSymmetrical(24.h, 0.h), !appState.isAuthenticated ? Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, - hasShadow: false, - ), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Row( - children: [ - Utils.buildSvgWithAssets( - width: 50.w, - height: 60.h, - icon: AppAssets.symptomCheckerIcon, - fit: BoxFit.contain, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: false, ), - SizedBox(width: 12.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.howAreYouFeelingToday.tr(context: context).toText14(weight: FontWeight.w600), - LocaleKeys.checkYourSymptomsWithScale.tr(context: context).toText12(fontWeight: FontWeight.w500), - SizedBox(height: 14.h), - CustomButton( - text: LocaleKeys.checkYourSymptoms.tr(context: context), - onPressed: () async { - context.navigateWithName(AppRoutes.userInfoSelection); - }, - padding: EdgeInsetsGeometry.zero, - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - textColor: Colors.white, - fontSize: 14.f, - fontWeight: FontWeight.w600, - borderRadius: 12.r, - height: 40.h, - ), - ], - ).expanded - ], - ), - ), - ).paddingSymmetrical(24.w, 0.h) - : SizedBox.shrink(), - appState.isAuthenticated - ? Column( - children: [ - SizedBox(height: 12.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.appointmentsAndVisits.tr(context: context).toText16(weight: FontWeight.w600), - Row( - children: [ - LocaleKeys.viewAll.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500), - SizedBox(width: 2.h), - Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), - ], + child: Padding( + padding: EdgeInsets.all(16.h), + child: Row( + children: [ + Utils.buildSvgWithAssets( + width: 50.w, + height: 60.h, + icon: AppAssets.symptomCheckerIcon, + fit: BoxFit.contain, + ), + SizedBox(width: 12.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.howAreYouFeelingToday.tr(context: context).toText14(weight: FontWeight.w600), + LocaleKeys.checkYourSymptomsWithScale.tr(context: context).toText12(fontWeight: FontWeight.w500), + SizedBox(height: 14.h), + CustomButton( + text: LocaleKeys.checkYourSymptoms.tr(context: context), + onPressed: () async { + context.navigateWithName(AppRoutes.userInfoSelection); + }, + padding: EdgeInsetsGeometry.zero, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: Colors.white, + fontSize: 14.f, + fontWeight: FontWeight.w600, + borderRadius: 12.r, + height: 40.h, + ), + ], + ).expanded + ], + ), ), - ], - ).paddingSymmetrical(24.h, 0.h).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: MyAppointmentsPage())); - }), - SizedBox(height: 16.h), - Consumer3( - builder: (context, myAppointmentsVM, immediateLiveCareVM, todoSectionVM, child) { - return myAppointmentsVM.isMyAppointmentsLoading - ? Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, - hasShadow: true, - ), - child: AppointmentCard( - patientAppointmentHistoryResponseModel: PatientAppointmentHistoryResponseModel(), - myAppointmentsViewModel: myAppointmentsViewModel, - bookAppointmentsViewModel: bookAppointmentsViewModel, - isLoading: true, - isFromHomePage: true, - ), - ).paddingSymmetrical(24.h, 0.h) - : myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty - ? myAppointmentsVM.patientAppointmentsHistoryList.length == 1 - ? Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.r, - hasShadow: true, - ), - child: AppointmentCard( - patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList.first, - myAppointmentsViewModel: myAppointmentsViewModel, - bookAppointmentsViewModel: bookAppointmentsViewModel, - isLoading: false, - isFromHomePage: true, - ), - ).paddingSymmetrical(24.h, 0.h) - : isTablet - ? SizedBox( - height: isFoldable ? 290.h : 255.h, - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: 3, - shrinkWrap: true, - padding: EdgeInsets.only(left: 16.h, right: 16.h), - itemBuilder: (context, index) { - return SizedBox( - height: 255.h, - width: 250.w, - child: getIndexSwiperCard(index), - ); - // return AnimationConfiguration.staggeredList( - // position: index, - // duration: const Duration(milliseconds: 1000), - // child: SlideAnimation( - // horizontalOffset: 100.0, - // child: FadeInAnimation( - // child: SizedBox( - // height: 255.h, - // width: 250.w, - // child: getIndexSwiperCard(index), - // ), - // ), - // ), - // ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox( - width: 10.w, + ).paddingSymmetrical(24.w, 0.h) + : SizedBox.shrink(), + appState.isAuthenticated + ? Column( + children: [ + SizedBox(height: 12.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.appointmentsAndVisits.tr(context: context).toText16(weight: FontWeight.w600), + Row( + children: [ + LocaleKeys.viewAll.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500), + SizedBox(width: 2.h), + Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), + ], + ), + ], + ).paddingSymmetrical(24.h, 0.h).onPress(() { + Navigator.of(context).push(CustomPageRoute(page: MyAppointmentsPage())); + }), + Consumer3( + builder: (context, myAppointmentsVM, immediateLiveCareVM, todoSectionVM, child) { + return myAppointmentsVM.isMyAppointmentsLoading + ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, + ), + child: AppointmentCard( + patientAppointmentHistoryResponseModel: PatientAppointmentHistoryResponseModel(), + myAppointmentsViewModel: myAppointmentsViewModel, + bookAppointmentsViewModel: bookAppointmentsViewModel, + isLoading: true, + isFromHomePage: true, + ), + ).paddingSymmetrical(24.h, 16.h) + : myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty + ? myAppointmentsVM.patientAppointmentsHistoryList.length == 1 + ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.r, + hasShadow: true, ), + child: AppointmentCard( + patientAppointmentHistoryResponseModel: myAppointmentsVM.patientAppointmentsHistoryList.first, + myAppointmentsViewModel: myAppointmentsViewModel, + bookAppointmentsViewModel: bookAppointmentsViewModel, + isLoading: false, + isFromHomePage: true, + ), + ).paddingSymmetrical(24.h, 0.h) + : isTablet + ? SizedBox( + height: isFoldable ? 290.h : 255.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: 3, + shrinkWrap: true, + padding: EdgeInsets.only(left: 16.h, right: 16.h), + itemBuilder: (context, index) { + return SizedBox( + height: 255.h, + width: 250.w, + child: getIndexSwiperCard(index), + ); + // return AnimationConfiguration.staggeredList( + // position: index, + // duration: const Duration(milliseconds: 1000), + // child: SlideAnimation( + // horizontalOffset: 100.0, + // child: FadeInAnimation( + // child: SizedBox( + // height: 255.h, + // width: 250.w, + // child: getIndexSwiperCard(index), + // ), + // ), + // ), + // ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox( + width: 10.w, + ), + ), + ) + : SizedBox( + height: 255.h + 20 + 30, // itemHeight + shadow padding (10 top + 10 bottom) + pagination dots space + child: Swiper( + itemCount: myAppointmentsVM.isMyAppointmentsLoading + ? 3 + : myAppointmentsVM.patientAppointmentsHistoryList.length < 3 + ? myAppointmentsVM.patientAppointmentsHistoryList.length + : 3, + layout: SwiperLayout.STACK, + loop: false, + itemWidth: MediaQuery.of(context).size.width - 48.h, + indicatorLayout: PageIndicatorLayout.COLOR, + axisDirection: getIt.get().isArabic() ? AxisDirection.left : AxisDirection.right, + controller: _controller, + itemHeight: 255.h + 20, + // extra space for shadow + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 220.h + 20 + 8 + 24), + builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + ), + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: getIndexSwiperCard(index), + ); + }, + ), + ) + : Container( + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), + SizedBox(height: 12.h), + LocaleKeys.noUpcomingAppointmentPleaseBook.tr(context: context).toText12(isCenter: true), + SizedBox(height: 12.h), + CustomButton( + text: LocaleKeys.bookAppo.tr(context: context), + onPressed: () { + getIt.get().onTabChanged(0); + Navigator.of(context).push(CustomPageRoute(page: BookAppointmentPage())); + }, + backgroundColor: Color(0xffFEE9EA), + borderColor: Color(0xffFEE9EA), + textColor: Color(0xffED1C2B), + fontSize: 14.f, + fontWeight: FontWeight.w500, + padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0), + icon: AppAssets.add_icon, + iconColor: AppColors.primaryRedColor, + height: 40.h, + ), + ], ), - ) - : Swiper( - itemCount: myAppointmentsVM.isMyAppointmentsLoading - ? 3 - : myAppointmentsVM.patientAppointmentsHistoryList.length < 3 - ? myAppointmentsVM.patientAppointmentsHistoryList.length - : 3, - layout: SwiperLayout.STACK, - loop: true, - itemWidth: MediaQuery.of(context).size.width - 48.h, - indicatorLayout: PageIndicatorLayout.COLOR, - axisDirection: AxisDirection.right, - controller: _controller, - itemHeight: 255.h, - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(top: 240.h + 8 + 24), - builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), - ), - itemBuilder: (BuildContext context, int index) { - return getIndexSwiperCard(index); - }, - ) - : Container( - width: double.infinity, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), - child: Padding( - padding: EdgeInsets.all(16.h), - child: Column( - children: [ - Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), - SizedBox(height: 12.h), - LocaleKeys.noUpcomingAppointmentPleaseBook.tr(context: context).toText12(isCenter: true), - SizedBox(height: 12.h), - CustomButton( - text: LocaleKeys.bookAppo.tr(context: context), - onPressed: () { - getIt.get().onTabChanged(0); - Navigator.of(context).push(CustomPageRoute(page: BookAppointmentPage())); - }, - backgroundColor: Color(0xffFEE9EA), - borderColor: Color(0xffFEE9EA), - textColor: Color(0xffED1C2B), - fontSize: 14.f, - fontWeight: FontWeight.w500, - padding: EdgeInsets.fromLTRB(10.h, 0, 10.h, 0), - icon: AppAssets.add_icon, - iconColor: AppColors.primaryRedColor, - height: 40.h, ), - ], - ), - ), - ).paddingSymmetrical(24.h, 0.h); - }, - ), + ).paddingSymmetrical(24.h, 16.h); + }, + ), - // Consumer for ER Online Check-In pending request - Consumer( - builder: (context, emergencyServicesVM, child) { - return emergencyServicesVM.patientHasAdvanceERBalance - ? Column( + // Consumer for ER Online Check-In pending request + Consumer( + builder: (context, emergencyServicesVM, child) { + return emergencyServicesVM.patientHasAdvanceERBalance + ? Column( + children: [ + SizedBox(height: 16.h), + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.r, + hasShadow: false, + side: BorderSide(color: AppColors.primaryRedColor, width: 3.h), + ), + width: double.infinity, + child: Padding( + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // AppCustomChipWidget( + // labelText: LocaleKeys.erOnlineCheckInRequest.tr(context: context), + // backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.10), + // textColor: AppColors.primaryRedColor, + // ), + // Utils.buildSvgWithAssets(icon: AppAssets.appointment_checkin_icon, width: 24.h, height: 24.h, iconColor: AppColors.primaryRedColor), + // ], + // ), + SizedBox(height: 8.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.r, - hasShadow: true, - side: BorderSide(color: AppColors.primaryRedColor, width: 3.h), - ), - width: double.infinity, - child: Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppCustomChipWidget( - labelText: LocaleKeys.erOnlineCheckInRequest.tr(context: context), - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.10), - textColor: AppColors.primaryRedColor, - ), - Utils.buildSvgWithAssets(icon: AppAssets.appointment_checkin_icon, width: 24.h, height: 24.h, iconColor: AppColors.primaryRedColor), - ], - ), - SizedBox(height: 8.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.youHaveEROnlineCheckInRequest.tr(context: context).toText12(isBold: true), - Transform.flip( - flipX: getIt.get().isArabic(), - child: Utils.buildSvgWithAssets( - icon: AppAssets.forward_arrow_icon_small, - iconColor: AppColors.blackColor, - width: 20.h, - height: 15.h, - fit: BoxFit.contain, - ), - ), - ], - ), - ], - ), + LocaleKeys.youHaveEROnlineCheckInRequest.tr(context: context).toText12(isBold: true), + Transform.flip( + flipX: getIt.get().isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.blackColor, + width: 20.h, + height: 15.h, + fit: BoxFit.contain, ), - ).paddingSymmetrical(24.h, 0.h).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: ErOnlineCheckinHome())); - // context.read().navigateToEROnlineCheckIn(); - }), - SizedBox(height: 12.h), + ), ], - ) - : SizedBox(height: 0.h); - }, + ), + ], + ), + ), + ).paddingSymmetrical(24.h, 0.h).onPress(() { + Navigator.of(context).push(CustomPageRoute(page: ErOnlineCheckinHome())); + // context.read().navigateToEROnlineCheckIn(); + }), + SizedBox(height: 12.h), + ], + ) + : SizedBox(height: 0.h); + }, + ), + SizedBox(height: 16.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.quickLinks.tr(context: context).toText16(weight: FontWeight.w600), + Row( + children: [ + LocaleKeys.viewMedicalFile.tr(context: context).toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + SizedBox(width: 2.h), + Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), + ], + ), + ], + ).paddingSymmetrical(24.h, 0.h).onPress(() { + Navigator.of(context).push(CustomPageRoute(page: MedicalFilePage())); + }), + SizedBox(height: 16.h), + Container( + // height: 121.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( + children: [ + SizedBox( + height: 92.h + 32.h - 4.h, + child: RawScrollbar( + controller: _horizontalScrollController, + thumbVisibility: true, + radius: Radius.circular(10.0), + thumbColor: AppColors.primaryRedColor, + trackVisibility: true, + trackColor: Color(0xffD9D9D9), + trackBorderColor: Colors.transparent, + trackRadius: Radius.circular(10.0), + padding: EdgeInsets.only(top: 92.h + 32.h, left: MediaQuery + .sizeOf(context) + .width / 2 - 35, right: MediaQuery + .sizeOf(context) + .width / 2 - 35), + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: LandingPageData.getLoggedInServiceCardsList.length, + shrinkWrap: true, + controller: _horizontalScrollController, + padding: EdgeInsets.only(left: 16.h, right: 16.h, top: 16.h, bottom: 12.h), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: SmallServiceCard( + icon: LandingPageData.getLoggedInServiceCardsList[index].icon, + title: LandingPageData.getLoggedInServiceCardsList[index].title, + subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle, + iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor!, + textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor, + backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor, + isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold, + serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName, + ), + ), + ), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => 10.width, + ), + ), ), SizedBox(height: 16.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.quickLinks.tr(context: context).toText16(weight: FontWeight.w600), - Row( + ], + ), + ).paddingSymmetrical(24.h, 0.h), + ], + ) + : Container( + // height: 141.h, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Column( children: [ - LocaleKeys.viewMedicalFile.tr(context: context).toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), - SizedBox(width: 2.h), - Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), - ], - ), - ], - ).paddingSymmetrical(24.h, 0.h).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: MedicalFilePage())); - }), - SizedBox(height: 16.h), - Container( - // height: 121.h, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), - child: Column( - children: [ - SizedBox( - height: 92.h + 32.h - 4.h, - child: RawScrollbar( - controller: _horizontalScrollController, - thumbVisibility: true, - radius: Radius.circular(10.0), - thumbColor: AppColors.primaryRedColor, - trackVisibility: true, - trackColor: Color(0xffD9D9D9), - trackBorderColor: Colors.transparent, - trackRadius: Radius.circular(10.0), - padding: EdgeInsets.only(top: 92.h + 32.h, left: MediaQuery.sizeOf(context).width / 2 - 35, right: MediaQuery.sizeOf(context).width / 2 - 35), - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: LandingPageData.getLoggedInServiceCardsList.length, - shrinkWrap: true, + SizedBox( + height: 92.h + 32.h - 4.h, + child: RawScrollbar( controller: _horizontalScrollController, - padding: EdgeInsets.only(left: 16.h, right: 16.h, top: 16.h, bottom: 12.h), - itemBuilder: (context, index) { - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - horizontalOffset: 100.0, - child: FadeInAnimation( - child: SmallServiceCard( - icon: LandingPageData.getLoggedInServiceCardsList[index].icon, - title: LandingPageData.getLoggedInServiceCardsList[index].title, - subtitle: LandingPageData.getLoggedInServiceCardsList[index].subtitle, - iconColor: LandingPageData.getLoggedInServiceCardsList[index].iconColor!, - textColor: LandingPageData.getLoggedInServiceCardsList[index].textColor, - backgroundColor: LandingPageData.getLoggedInServiceCardsList[index].backgroundColor, - isBold: LandingPageData.getLoggedInServiceCardsList[index].isBold, - serviceName: LandingPageData.getLoggedInServiceCardsList[index].serviceName, + thumbVisibility: true, + radius: Radius.circular(10.0), + thumbColor: AppColors.primaryRedColor, + trackVisibility: true, + trackColor: Color(0xffD9D9D9), + trackBorderColor: Colors.transparent, + trackRadius: Radius.circular(10.0), + padding: EdgeInsets.only(top: 92.h + 32.h, left: MediaQuery.sizeOf(context).width / 2 - 35, right: MediaQuery.sizeOf(context).width / 2 - 35), + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: LandingPageData.getNotLoggedInServiceCardsList.length, + shrinkWrap: true, + controller: _horizontalScrollController, + padding: EdgeInsets.only(left: 16.h, right: 16.h, top: 16.h, bottom: 12.h), + // padding: EdgeInsets.zero, + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: SmallServiceCard( + serviceName: LandingPageData.getNotLoggedInServiceCardsList[index].serviceName, + icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, + title: LandingPageData.getNotLoggedInServiceCardsList[index].title, + subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, + iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor!, + textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor, + backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor, + isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold, + ), ), ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => 10.width, + ); + }, + separatorBuilder: (BuildContext cxt, int index) => 0.width, + ), ), ), - ), - SizedBox(height: 16.h), - ], - ), - ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 16.h), + ], + ), + ).paddingSymmetrical(24.h, 0.h), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.services2.tr(context: context).toText18(weight: FontWeight.w600), + Row( + children: [ + LocaleKeys.viewAllServices.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500), + SizedBox(width: 2.h), + Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), + ], + ).onPress(() { + Navigator.of(context).push(CustomPageRoute(page: ServicesPage())); + }), ], - ) - : Container( - // height: 141.h, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), - child: Column( - children: [ - SizedBox( - height: 92.h + 32.h - 4.h, - child: RawScrollbar( - controller: _horizontalScrollController, - thumbVisibility: true, - radius: Radius.circular(10.0), - thumbColor: AppColors.primaryRedColor, - trackVisibility: true, - trackColor: Color(0xffD9D9D9), - trackBorderColor: Colors.transparent, - trackRadius: Radius.circular(10.0), - padding: EdgeInsets.only(top: 92.h + 32.h, left: MediaQuery.sizeOf(context).width / 2 - 35, right: MediaQuery.sizeOf(context).width / 2 - 35), - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: LandingPageData.getNotLoggedInServiceCardsList.length, - shrinkWrap: true, - controller: _horizontalScrollController, - padding: EdgeInsets.only(left: 16.h, right: 16.h, top: 16.h, bottom: 12.h), - // padding: EdgeInsets.zero, - itemBuilder: (context, index) { - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - horizontalOffset: 100.0, - child: FadeInAnimation( - child: SmallServiceCard( - serviceName: LandingPageData.getNotLoggedInServiceCardsList[index].serviceName, - icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, - title: LandingPageData.getNotLoggedInServiceCardsList[index].title, - subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, - iconColor: LandingPageData.getNotLoggedInServiceCardsList[index].iconColor!, - textColor: LandingPageData.getNotLoggedInServiceCardsList[index].textColor, - backgroundColor: LandingPageData.getNotLoggedInServiceCardsList[index].backgroundColor, - isBold: LandingPageData.getNotLoggedInServiceCardsList[index].isBold, - ), - ), - ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => 0.width, + ).paddingSymmetrical(24.w, 0.h), + SizedBox( + height: 431.h, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: LandingPageData.getServiceCardsList.length, + shrinkWrap: true, + padding: EdgeInsets.only(left: 24.w, right: 24.w), + itemBuilder: (context, index) { + return AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 1000), + child: SlideAnimation( + horizontalOffset: 100.0, + child: FadeInAnimation( + child: FadedLargeServiceCard( + serviceCardData: LandingPageData.getServiceCardsList[index], + image: LandingPageData.getServiceCardsList[index].icon, + title: LandingPageData.getServiceCardsList[index].title, + subtitle: LandingPageData.getServiceCardsList[index].subtitle, + icon: LandingPageData.getServiceCardsList[index].largeCardIcon, + ), ), ), - ), - SizedBox(height: 16.h), - ], - ), - ).paddingSymmetrical(24.h, 0.h), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - LocaleKeys.services2.tr(context: context).toText18(weight: FontWeight.w600), - Row( - children: [ - LocaleKeys.viewAllServices.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500), - SizedBox(width: 2.h), - Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 14.h), - ], - ).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: ServicesPage())); - }), - ], - ).paddingSymmetrical(24.w, 0.h), - SizedBox( - height: 431.h, - child: ListView.separated( - scrollDirection: Axis.horizontal, - itemCount: LandingPageData.getServiceCardsList.length, - shrinkWrap: true, - padding: EdgeInsets.only(left: 24.w, right: 24.w), - itemBuilder: (context, index) { - return AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 1000), - child: SlideAnimation( - horizontalOffset: 100.0, - child: FadeInAnimation( - child: FadedLargeServiceCard( - serviceCardData: LandingPageData.getServiceCardsList[index], - image: LandingPageData.getServiceCardsList[index].icon, - title: LandingPageData.getServiceCardsList[index].title, - subtitle: LandingPageData.getServiceCardsList[index].subtitle, - icon: LandingPageData.getServiceCardsList[index].largeCardIcon, - ), - ), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 16.w), ), - ); - }, - separatorBuilder: (BuildContext cxt, int index) => SizedBox(width: 16.w), + ), + appState.isAuthenticated ? HabibWalletCard() : SizedBox(), + ], ), ), - appState.isAuthenticated ? HabibWalletCard() : SizedBox(), + (!insuranceVM.isInsuranceLoading && insuranceVM.isInsuranceExpired && insuranceVM.isInsuranceExpiryBannerShown) + ? Container( + height: MediaQuery.paddingOf(context).top + 50.h, + decoration: ShapeDecoration( + color: AppColors.secondaryLightRedBorderColor, + shape: SmoothRectangleBorder( + side: BorderSide(width: 1, color: AppColors.primaryRedColor.withAlpha(20)), + // borderRadius: BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), + smoothness: 1, + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.insuranceExpiredOrInactive.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500).paddingSymmetrical(0.h, 0.h), + Row( + children: [ + CustomButton( + text: LocaleKeys.updateInsurance.tr(context: context), + onPressed: () { + insuranceVM.setIsInsuranceUpdateDetailsLoading(true); + insuranceVM.getPatientInsuranceDetailsForUpdate( + appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); + showCommonBottomSheetWithoutHeight(context, + child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.secondaryLightRedBorderColor, + textColor: Colors.white, + fontSize: 12.f, + fontWeight: FontWeight.bold, + borderRadius: 8.r, + padding: EdgeInsets.fromLTRB(15, 0, 15, 0), + height: 36.h, + ).paddingSymmetrical(12.h, 0.h), + Icon(Icons.close, color: AppColors.primaryRedColor).onPress(() { + insuranceVM.setIsInsuranceExpiryBannerShown(false); + }), + ], + ), + ], + ), + SizedBox( + height: 10.h, + ) + ], + ).paddingSymmetrical(24.h, 0.h), + ) + : SizedBox.shrink() ], - ), - ), + ); + }), ), ); } @@ -775,7 +876,7 @@ class _LandingPageState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 20.h, - hasShadow: false, + hasShadow: true, side: BorderSide( color: Utils.getCardBorderColor(currentStatus), width: 2.w, @@ -1006,6 +1107,7 @@ class _LandingPageState extends State { color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true, + hasDenseShadow: true ), child: AppointmentCard( patientAppointmentHistoryResponseModel: appointment, diff --git a/lib/presentation/home/widgets/large_service_card.dart b/lib/presentation/home/widgets/large_service_card.dart index 7c86dd09..b89e58c5 100644 --- a/lib/presentation/home/widgets/large_service_card.dart +++ b/lib/presentation/home/widgets/large_service_card.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -92,12 +93,12 @@ class LargeServiceCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ serviceCardData.title.tr(context: context).toText14(isBold: true, color: AppColors.textColor), - serviceCardData.subtitle.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + serviceCardData.subtitle.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight, maxLine: 2), ], ), ), ], - ).paddingSymmetrical(16.w, 0.h).expanded, + ).paddingSymmetrical(8.w, 0.h).expanded, CustomButton( text: serviceCardData.isBold ? LocaleKeys.visitPharmacyOnline.tr(context: context) : LocaleKeys.bookNow.tr(context: context), onPressed: () { @@ -177,7 +178,9 @@ class FadedLargeServiceCard extends StatelessWidget { children: [ ClipRRect( borderRadius: BorderRadius.circular(24.r), - child: Image.asset(serviceCardData.largeCardIcon, fit: BoxFit.cover, width: 520.w, height: 250.h), + child: Transform.flip( + flipX: getIt.get().isArabic(), + child: Image.asset(serviceCardData.largeCardIcon, fit: BoxFit.cover, width: 520.w, height: 250.h)), ), Positioned( top: 0, @@ -216,11 +219,14 @@ class FadedLargeServiceCard extends StatelessWidget { ), child: Padding( padding: EdgeInsets.all(8.h), - child: Utils.buildSvgWithAssets( - icon: serviceCardData.icon, - iconColor: serviceCardData.iconColor, - fit: BoxFit.contain, - applyThemeColor: false + child: Transform.flip( + flipX: getIt.get().isArabic(), + child: Utils.buildSvgWithAssets( + icon: serviceCardData.icon, + iconColor: serviceCardData.iconColor, + fit: BoxFit.contain, + applyThemeColor: false + ), ), ), ), @@ -229,10 +235,10 @@ class FadedLargeServiceCard extends StatelessWidget { ], ), SizedBox(height: 10.h), - serviceCardData.subtitle.tr(context: context).toText14(weight: FontWeight.w500, color: AppColors.blackBgColor, letterSpacing: 0), + serviceCardData.subtitle.tr(context: context).toText14(weight: FontWeight.w500, color: AppColors.blackBgColor, letterSpacing: 0, maxlines: 2), SizedBox(height: 12.h), CustomButton( - text: serviceCardData.isBold ? "Visit Pharmacy Online".needTranslation : LocaleKeys.bookNow.tr(context: context), + text: serviceCardData.isBold ? LocaleKeys.visitPharmacyOnline.tr(context: context) : LocaleKeys.bookNow.tr(context: context), onPressed: () { handleOnTap(); }, @@ -255,6 +261,7 @@ class FadedLargeServiceCard extends StatelessWidget { case "livecare": { getIt.get().onTabChanged(1); + getIt.get().setIsLiveCareSelectedFromHomePage(true); Navigator.of(getIt.get().navigatorKey.currentContext!).push( CustomPageRoute( page: BookAppointmentPage(), diff --git a/lib/presentation/home/widgets/welcome_widget.dart b/lib/presentation/home/widgets/welcome_widget.dart index 4ccc126a..9b613e64 100644 --- a/lib/presentation/home/widgets/welcome_widget.dart +++ b/lib/presentation/home/widgets/welcome_widget.dart @@ -1,10 +1,20 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; +import 'package:hmg_patient_app_new/presentation/profile_settings/profile_settings.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; +import 'package:hmg_patient_app_new/widgets/routes/spring_page_route_builder.dart'; +import 'package:smooth_corner/smooth_corner.dart'; class WelcomeWidget extends StatelessWidget { final String name; @@ -20,33 +30,41 @@ class WelcomeWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - borderRadius: BorderRadius.circular(30), - child: Row( - mainAxisSize: MainAxisSize.min, - spacing: 8.h, - children: [ - Image.asset(imageUrl, width: 40, height: 40), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - spacing: 4.h, + return Column( + children: [ + InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(30), + child: Row( mainAxisSize: MainAxisSize.min, + spacing: 8.h, children: [ - LocaleKeys.welcome.tr(context: context).toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500), - Row( + Icon(Icons.menu, color: AppColors.textColor).onPress(() { + Navigator.of(context).push(springPageRoute(ProfileSettings())); + }), + Image.asset(imageUrl, width: 40, height: 40), + Column( + crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, - crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - Flexible(child: name.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1, height: 1)), - Icon(Icons.keyboard_arrow_down, size: 20, color: AppColors.greyTextColor), + LocaleKeys.welcome.tr(context: context).toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500), + Row( + spacing: 4.h, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Flexible(child: name.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1, height: 1, isEnglishOnly: true)), + // Icon(Icons.keyboard_arrow_down, size: 20, color: AppColors.greyTextColor), + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, height: 22.h, width: 22.w) + ], + ), ], - ), + ).expanded, ], - ).expanded, - ], - ), + ), + ), + ], ); } } diff --git a/lib/presentation/home_health_care/hhc_procedures_page.dart b/lib/presentation/home_health_care/hhc_procedures_page.dart index c420742c..88766ea0 100644 --- a/lib/presentation/home_health_care/hhc_procedures_page.dart +++ b/lib/presentation/home_health_care/hhc_procedures_page.dart @@ -8,6 +8,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; @@ -33,11 +34,13 @@ class HhcProceduresPage extends StatefulWidget { } class _HhcProceduresPageState extends State { + + late AppState appState; + @override void initState() { super.initState(); final HmgServicesViewModel hmgServicesViewModel = context.read(); - final AppState appState = getIt.get(); scheduleMicrotask(() async { final user = appState.getAuthenticatedUser(); @@ -445,11 +448,12 @@ class _HhcProceduresPageState extends State { @override Widget build(BuildContext context) { + appState = getIt.get(); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( title: LocaleKeys.homeHealthCare.tr(context: context), - history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)), + history: () => appState.isAuthenticated ? Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)) : null, bottomChild: Consumer( builder: (BuildContext context, HmgServicesViewModel hmgServicesViewModel, Widget? child) { if (hmgServicesViewModel.isHhcOrdersLoading || hmgServicesViewModel.isHhcServicesLoading) { @@ -467,8 +471,14 @@ class _HhcProceduresPageState extends State { padding: EdgeInsets.all(24.w), child: CustomButton( borderWidth: 0, - text: LocaleKeys.createNewRequest.tr(context: context), - onPressed: () => _buildServicesListBottomsSheet(hmgServicesViewModel.hhcServicesList), + text: appState.isAuthenticated ? LocaleKeys.createNewRequest.tr(context: context) : LocaleKeys.loginToUseService.tr(context: context), + onPressed: () { + if(appState.isAuthenticated) { + _buildServicesListBottomsSheet(hmgServicesViewModel.hhcServicesList); + } else { + getIt().onLoginPressed(); + } + }, textColor: AppColors.whiteColor, borderRadius: 12.r, borderColor: Colors.transparent, @@ -492,12 +502,13 @@ class _HhcProceduresPageState extends State { } else { return Column( children: [ + appState.isAuthenticated ? Center( child: Utils.getNoDataWidget( context, noDataText: LocaleKeys.youHaveNoPendingRequests.tr(context: context), ), - ), + ) : LocaleKeys.homeHealthCareText.tr(context: context).toText18(weight: FontWeight.w500).paddingSymmetrical(24.h, 24.h), ], ); } diff --git a/lib/presentation/insurance/insurance_approval_details_page.dart b/lib/presentation/insurance/insurance_approval_details_page.dart index a074a8d8..7a69e088 100644 --- a/lib/presentation/insurance/insurance_approval_details_page.dart +++ b/lib/presentation/insurance/insurance_approval_details_page.dart @@ -63,8 +63,8 @@ class InsuranceApprovalDetailsPage extends StatelessWidget { ), AppCustomChipWidget( labelText: appState.isArabic() ? insuranceApprovalResponseModel.isInOutPatientDescriptionN! : insuranceApprovalResponseModel.isInOutPatientDescription!, - backgroundColor: AppColors.primaryRedColor.withOpacity(0.1), - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, ), ], ), diff --git a/lib/presentation/insurance/insurance_approvals_page.dart b/lib/presentation/insurance/insurance_approvals_page.dart index 52f8b1f6..feac2e3a 100644 --- a/lib/presentation/insurance/insurance_approvals_page.dart +++ b/lib/presentation/insurance/insurance_approvals_page.dart @@ -51,7 +51,7 @@ class _InsuranceApprovalsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ ListView.separated( - padding: EdgeInsets.only(top: 24.h), + padding: EdgeInsets.only(top: 12.h), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: insuranceVM.isInsuranceApprovalsLoading diff --git a/lib/presentation/insurance/insurance_home_page.dart b/lib/presentation/insurance/insurance_home_page.dart index 519d8306..35e3acb8 100644 --- a/lib/presentation/insurance/insurance_home_page.dart +++ b/lib/presentation/insurance/insurance_home_page.dart @@ -48,11 +48,11 @@ class _InsuranceHomePageState extends State { insuranceViewModel = Provider.of(context, listen: false); return CollapsingListView( title: "${LocaleKeys.insurance.tr(context: context)} ${LocaleKeys.updateInsurance.tr(context: context)}", - history: () { - insuranceViewModel.setIsInsuranceHistoryLoading(true); - insuranceViewModel.getPatientInsuranceCardHistory(); - showCommonBottomSheetWithoutHeight(context, child: InsuranceHistory(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); - }, + // history: () { + // // insuranceViewModel.setIsInsuranceHistoryLoading(true); + // // insuranceViewModel.getPatientInsuranceCardHistory(); + // showCommonBottomSheetWithoutHeight(context, child: InsuranceHistory(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + // }, child: SingleChildScrollView( child: Consumer(builder: (context, insuranceVM, child) { return Column( @@ -66,12 +66,23 @@ class _InsuranceHomePageState extends State { isLoading: true, ).paddingSymmetrical(24.h, 24.h) : insuranceVM.patientInsuranceList.isNotEmpty - ? Padding( - padding: EdgeInsets.only(top: 24.h), - child: PatientInsuranceCard( - insuranceCardDetailsModel: insuranceVM.patientInsuranceList.first, - isInsuranceExpired: DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo))) - .paddingSymmetrical(24.w, 0.h), + ? ListView.builder( + shrinkWrap: true, + padding: EdgeInsets.all(16.h), + physics: const BouncingScrollPhysics(), + itemBuilder: (context, index) { + return Column( + children: [ + PatientInsuranceCard( + insuranceCardDetailsModel: insuranceVM.patientInsuranceList[index], + isInsuranceExpired: DateTime.now().isAfter(DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo))), + SizedBox( + height: 12.h, + ) + ], + ); + }, + itemCount: insuranceVM.patientInsuranceList.length, ) : Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.12), diff --git a/lib/presentation/insurance/widgets/insurance_approval_card.dart b/lib/presentation/insurance/widgets/insurance_approval_card.dart index 588f9887..8f5f7cfb 100644 --- a/lib/presentation/insurance/widgets/insurance_approval_card.dart +++ b/lib/presentation/insurance/widgets/insurance_approval_card.dart @@ -9,8 +9,11 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_approval_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/insurance_approval_details_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; class InsuranceApprovalCard extends StatelessWidget { InsuranceApprovalCard({super.key, required this.insuranceApprovalResponseModel, required this.isLoading, required this.appState}); @@ -64,8 +67,8 @@ class InsuranceApprovalCard extends StatelessWidget { : appState.isArabic() ? insuranceApprovalResponseModel.isInOutPatientDescriptionN! : insuranceApprovalResponseModel.isInOutPatientDescription!, - backgroundColor: AppColors.primaryRedColor.withOpacity(0.1), - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, ).toShimmer2(isShow: isLoading), ], ).toShimmer2(isShow: isLoading), @@ -111,12 +114,30 @@ class InsuranceApprovalCard extends StatelessWidget { ), ], ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Transform.flip( - flipX: appState.isArabic(), child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon_small, width: 15.h, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)), - ], + SizedBox( + height: 12.h, + ), + CustomButton( + text: LocaleKeys.viewDetails.tr(context: context), + onPressed: () async { + Navigator.of(context).push( + CustomPageRoute( + page: InsuranceApprovalDetailsPage(insuranceApprovalResponseModel: insuranceApprovalResponseModel), + ), + ); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: (isFoldable || isTablet) ? 12.f : 14.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: isTablet || isFoldable ? 46.h : 40.h, + // height: 40.h, + // icon: AppAssets.insurance, + // iconColor: AppColors.primaryRedColor, + iconSize: 16.h, ).toShimmer2(isShow: isLoading), ], ), diff --git a/lib/presentation/insurance/widgets/insurance_update_details_card.dart b/lib/presentation/insurance/widgets/insurance_update_details_card.dart index 35be7f9e..770f4da2 100644 --- a/lib/presentation/insurance/widgets/insurance_update_details_card.dart +++ b/lib/presentation/insurance/widgets/insurance_update_details_card.dart @@ -3,11 +3,13 @@ import 'package:flutter/cupertino.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -75,21 +77,18 @@ class PatientInsuranceCardUpdateCard extends StatelessWidget { ], ), SizedBox(height: 8.h), - Row( + Wrap( + direction: Axis.horizontal, + spacing: 4.h, + runSpacing: 4.h, children: [ - Wrap( - direction: Axis.horizontal, - spacing: 4.h, - runSpacing: 4.h, - children: [ - AppCustomChipWidget( - icon: AppAssets.doctor_calendar_icon, - labelText: "${LocaleKeys.expiryOn.tr(context: context)} ${insuranceViewModel.patientInsuranceUpdateResponseModel!.effectiveTo}", - ), - AppCustomChipWidget( - labelText: "Member ID: ${insuranceViewModel.patientInsuranceUpdateResponseModel!.memberID!}", - ), - ], + AppCustomChipWidget( + icon: AppAssets.doctor_calendar_icon, + labelText: + "${LocaleKeys.expiryOn.tr(context: context)} ${DateUtil.formatDateToDate(DateTime.parse(insuranceViewModel.patientInsuranceUpdateResponseModel!.effectiveTo!), false)}", + ), + AppCustomChipWidget( + labelText: "Member ID: ${insuranceViewModel.patientInsuranceUpdateResponseModel!.memberID!}", ), ], ), @@ -106,39 +105,51 @@ class PatientInsuranceCardUpdateCard extends StatelessWidget { iconSize: 20.w, text: "${LocaleKeys.updateInsurance.tr(context: context)} ${LocaleKeys.updateInsuranceSubtitle.tr(context: context)}", onPressed: () { - LoaderBottomSheet.showLoader(); - insuranceViewModel.updatePatientInsuranceCard( - patientID: appState.getAuthenticatedUser()!.patientId!, - patientType: appState.getAuthenticatedUser()!.patientType!, - patientIdentificationID: appState.getAuthenticatedUser()!.patientIdentificationNo!, - mobileNo: appState.getAuthenticatedUser()!.mobileNumber!, - insuranceCardImage: "", - onSuccess: (val) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.success.tr(context: context), - context, - child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr(context: context)), - callBackFunc: () { - Navigator.pop(context); - }, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: context), - context, - child: Utils.getErrorWidget(loadingText: err.toString()), - callBackFunc: () { - Navigator.pop(context); + if (insuranceViewModel.patientInsuranceUpdateResponseModel != null) { + LoaderBottomSheet.showLoader(); + getIt().sendPatientUpdateRequest(onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + insuranceViewModel.setIsInsuranceDataToBeLoaded(true); + insuranceViewModel.initInsuranceProvider(); + Navigator.pop(context); + }, onError: (err) { + insuranceViewModel.updatePatientInsuranceCard( + patientID: appState.getAuthenticatedUser()!.patientId!, + patientType: appState.getAuthenticatedUser()!.patientType!, + patientIdentificationID: appState.getAuthenticatedUser()!.patientIdentificationNo!, + mobileNo: appState.getAuthenticatedUser()!.mobileNumber!, + insuranceCardImage: "", + onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.success.tr(context: context), + context, + child: Utils.getSuccessWidget(loadingText: LocaleKeys.insuranceRequestSubmittedSuccessfully.tr(context: context)), + callBackFunc: () { + Navigator.pop(context); + }, + isFullScreen: false, + isCloseButtonVisible: false, + ); + // Future.delayed(Duration(milliseconds: 2000)).then((value) async { + // Navigator.pop(context); + // }); }, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getErrorWidget(loadingText: err.toString()), + callBackFunc: () { + Navigator.pop(context); + }, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }); + } }, backgroundColor: insuranceViewModel.patientInsuranceUpdateResponseModel != null ? AppColors.successColor : AppColors.lightGrayBGColor, borderColor: AppColors.successColor.withOpacity(0.01), diff --git a/lib/presentation/insurance/widgets/patient_insurance_card.dart b/lib/presentation/insurance/widgets/patient_insurance_card.dart index 531341b5..1607a7c6 100644 --- a/lib/presentation/insurance/widgets/patient_insurance_card.dart +++ b/lib/presentation/insurance/widgets/patient_insurance_card.dart @@ -52,57 +52,69 @@ class PatientInsuranceCard extends StatelessWidget { children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.4, - child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true, textOverflow: TextOverflow.clip)), - LocaleKeys.policyNumber.tr(namedArgs: {'number': insuranceCardDetailsModel.insurancePolicyNo ?? ''}, context: context).toText12(isBold: true, color: AppColors.lightGrayColor), + child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true, textOverflow: TextOverflow.clip, isEnglishOnly: true)), + Row( + children: [ + "${LocaleKeys.policyNumber.tr(context: context)}${insuranceCardDetailsModel.insurancePolicyNo}".toText12(isBold: true, color: AppColors.lightGrayColor), + ], + ), ], ), AppCustomChipWidget( - icon: insuranceViewModel.isInsuranceExpired + icon: isCurrentPatientInsuranceExpired(insuranceCardDetailsModel.cardValidTo!) ? AppAssets.cancel_circle_icon : insuranceViewModel.isInsuranceActive ? AppAssets.insurance_active_icon : AppAssets.alertSquare, - labelText: insuranceViewModel.isInsuranceExpired + labelText: isCurrentPatientInsuranceExpired(insuranceCardDetailsModel.cardValidTo!) ? LocaleKeys.insuranceExpired.tr(context: context) : insuranceViewModel.isInsuranceActive ? LocaleKeys.insuranceActive.tr(context: context) : LocaleKeys.insuranceInActive.tr(context: context), - iconColor: insuranceViewModel.isInsuranceExpired + iconColor: isCurrentPatientInsuranceExpired(insuranceCardDetailsModel.cardValidTo!) ? AppColors.primaryRedColor : insuranceViewModel.isInsuranceActive ? AppColors.successColor : AppColors.warningColorYellow, - textColor: insuranceViewModel.isInsuranceExpired + textColor: isCurrentPatientInsuranceExpired(insuranceCardDetailsModel.cardValidTo!) ? AppColors.primaryRedColor : insuranceViewModel.isInsuranceActive ? AppColors.successColor : AppColors.warningColorYellow, iconSize: 12.w, deleteIcon: insuranceViewModel.isInsuranceActive ? null : AppAssets.forward_chevron_icon, - deleteIconColor: AppColors.warningColorYellow, + deleteIconColor: insuranceViewModel.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceViewModel.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, deleteIconHasColor: true, onChipTap: () { if (!insuranceViewModel.isInsuranceActive) { - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: context), - context, - child: Utils.getWarningWidget( - loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), - confirmText: LocaleKeys.contactUs.tr(context: context), - isShowActionButtons: true, - onCancelTap: () { - Navigator.pop(context); - }, - onConfirmTap: () async { - launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); - }), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); + insuranceViewModel.setIsInsuranceUpdateDetailsLoading(true); + insuranceViewModel.getPatientInsuranceDetailsForUpdate( + appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); + showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + // showCommonBottomSheetWithoutHeight( + // title: LocaleKeys.notice.tr(context: context), + // context, + // child: Utils.getWarningWidget( + // loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), + // confirmText: LocaleKeys.contactUs.tr(context: context), + // isShowActionButtons: true, + // onCancelTap: () { + // Navigator.pop(context); + // }, + // onConfirmTap: () async { + // launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); + // }), + // callBackFunc: () {}, + // isFullScreen: false, + // isCloseButtonVisible: true, + // ); } }, - backgroundColor: insuranceViewModel.isInsuranceExpired + backgroundColor: isCurrentPatientInsuranceExpired(insuranceCardDetailsModel.cardValidTo!) ? AppColors.primaryRedColor.withOpacity(0.1) : insuranceViewModel.isInsuranceActive ? AppColors.successColor.withOpacity(0.1) @@ -122,7 +134,23 @@ class PatientInsuranceCard extends StatelessWidget { ), SizedBox(height: 12.h), insuranceCardDetailsModel.groupName!.toText12(isBold: true), - insuranceCardDetailsModel.companyName!.toText12(isBold: true), + Row( + children: [ + insuranceCardDetailsModel.companyName!.toText12(isBold: true), + SizedBox( + width: 6.h, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 6.h, vertical: 4.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.infoColor, + borderRadius: 50.r, + ), + child: (insuranceCardDetailsModel.subCategoryDesc!.length > 5 ? insuranceCardDetailsModel.subCategoryDesc!.substring(0, 12) : insuranceCardDetailsModel.subCategoryDesc!) + .toText8(isBold: true, color: AppColors.whiteColor), + ), + ], + ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, @@ -142,9 +170,10 @@ class PatientInsuranceCard extends StatelessWidget { isInsuranceExpired ? CustomButton( icon: AppAssets.update_insurance_card_icon, - iconColor: AppColors.successColor, + iconColor: AppColors.warningColorYellow, iconSize: 15.h, - text: "${LocaleKeys.updateInsurance.tr(context: context)} ${LocaleKeys.updateInsuranceSubtitle.tr(context: context)}", + // text: "${LocaleKeys.updateInsurance.tr(context: context)} ${LocaleKeys.updateInsuranceSubtitle.tr(context: context)}", + text: LocaleKeys.verifyInsurance.tr(context: context), onPressed: () { insuranceViewModel.setIsInsuranceUpdateDetailsLoading(true); insuranceViewModel.getPatientInsuranceDetailsForUpdate( @@ -157,9 +186,9 @@ class PatientInsuranceCard extends StatelessWidget { isCloseButtonVisible: false, isFullScreen: false); }, - backgroundColor: AppColors.bgGreenColor.withOpacity(0.20), - borderColor: AppColors.bgGreenColor.withOpacity(0.0), - textColor: AppColors.bgGreenColor, + backgroundColor: AppColors.warningColorYellow.withOpacity(0.20), + borderColor: AppColors.warningColorYellow.withOpacity(0.0), + textColor: AppColors.warningColorYellow, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, @@ -172,4 +201,10 @@ class PatientInsuranceCard extends StatelessWidget { ), ).paddingSymmetrical(0.h, 0.h); } + + bool isCurrentPatientInsuranceExpired(String cardValidTo) { + return DateTime.now().isAfter( + DateUtil.convertStringToDate(cardValidTo), + ); + } } diff --git a/lib/presentation/lab/lab_order_by_test.dart b/lib/presentation/lab/lab_order_by_test.dart index 1b5db920..ac6f0f3b 100644 --- a/lib/presentation/lab/lab_order_by_test.dart +++ b/lib/presentation/lab/lab_order_by_test.dart @@ -59,7 +59,7 @@ class LabOrderByTest extends StatelessWidget { icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, - text: LocaleKeys.viewReport.tr(context: context), + text: LocaleKeys.viewResults.tr(context: context), onPressed: () { onTap(); }, diff --git a/lib/presentation/lab/lab_orders_page.dart b/lib/presentation/lab/lab_orders_page.dart index 15461659..900477e4 100644 --- a/lib/presentation/lab/lab_orders_page.dart +++ b/lib/presentation/lab/lab_orders_page.dart @@ -1 +1 @@ -import 'dart:async'; import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'alphabeticScroll.dart'; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return CollapsingListView( title: LocaleKeys.labResults.tr(context: context), search: () async { if (labProvider.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: labProvider.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; labProvider.filterLabReports(value); } } }, child: Consumer( builder: (context, labViewModel, child) { return SingleChildScrollView( physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.all(24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, LocaleKeys.byVisit.tr()), CustomTabBarModel(null, LocaleKeys.byTest.tr()), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), ), ], ), if (activeIndex == 0) Padding( padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( children: [ CustomButton( text: LocaleKeys.byClinic.tr(context: context), onPressed: () { labViewModel.setIsSortByClinic(true); }, backgroundColor: labViewModel.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, borderColor: labViewModel.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: labViewModel.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12.f, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), SizedBox(width: 8.h), CustomButton( text: LocaleKeys.byHospital.tr(context: context), onPressed: () { labViewModel.setIsSortByClinic(false); }, backgroundColor: labViewModel.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, borderColor: labViewModel.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, textColor: labViewModel.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ], ), ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? Column( children: [ AppCustomChipWidget( labelText: selectedFilterText!, backgroundColor: AppColors.alertColor, textColor: AppColors.whiteColor, deleteIcon: AppAssets.close_bottom_sheet_icon, deleteIconColor: AppColors.whiteColor, deleteIconHasColor: true, onDeleteTap: () { selectedFilterText = ""; labProvider.filterLabReports(""); }, ), SizedBox(height: 8.h), ], ) : SizedBox(), activeIndex == 0 ? // By Visit - show grouped view when available labViewModel.isLabOrdersLoading ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: 5, itemBuilder: (context, index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ), ) : (labViewModel.patientLabOrdersViewList.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: labViewModel.patientLabOrdersViewList.length, itemBuilder: (context, index) { final group = labViewModel.patientLabOrdersViewList[index]; final isExpanded = expandedIndex == index; return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), SizedBox(height: 8.h), Text( labViewModel.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'), style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis, ), ], ), ), AnimatedSwitcher( duration: Duration(milliseconds: 500), switchInCurve: Curves.easeIn, switchOutCurve: Curves.easeOut, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0.0, child: child, ), ); }, child: isExpanded ? Container( key: ValueKey(index), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), child: ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, itemBuilder: (cxt, index) { PatientLabOrdersResponseModel order = group[index]; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ Image.network( order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 24.w, height: 24.h, fit: BoxFit.cover, ).circle(100), SizedBox(width: 8.h), Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ AppCustomChipWidget( labelText: ("${LocaleKeys.orderNo.tr(context: context)}: ${order.orderNo!}"), ), AppCustomChipWidget( labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), ), AppCustomChipWidget( labelText: labViewModel.isSortByClinic ? (order.projectName ?? "") : (order.clinicDescription ?? ""), ), ], ), // Row( // children: [ // CustomButton( // text: ("Order No: ".needTranslation + order.orderNo!), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // SizedBox(width: 8.h), // CustomButton( // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), // SizedBox(height: 8.h), // Row( // children: [ // CustomButton( // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), SizedBox(height: 12.h), Row( children: [ Expanded(flex: 2, child: SizedBox()), // Expanded( // flex: 1, // child: Container( // height: 40.h, // width: 40.w, // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // color: AppColors.textColor, // borderRadius: 12, // ), // child: Padding( // padding: EdgeInsets.all(12.h), // child: Transform.flip( // flipX: _appState.isArabic(), // child: Utils.buildSvgWithAssets( // icon: AppAssets.forward_arrow_icon_small, // iconColor: AppColors.whiteColor, // fit: BoxFit.contain, // ), // ), // ), // ).onPress(() { // model.currentlySelectedPatientOrder = order; // labProvider.getPatientLabResultByHospital(order); // labProvider.getPatientSpecialResult(order); // Navigator.of(context).push( // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // ); // }), // ) Expanded( flex: 2, child: CustomButton( icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, text: LocaleKeys.viewResults.tr(context: context), onPressed: () { labViewModel.currentlySelectedPatientOrder = order; labProvider.getPatientLabResultByHospital(order); labProvider.getPatientSpecialResult(order); Navigator.of(context).push( CustomPageRoute(page: LabResultByClinic(labOrder: order)), ); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ) ], ), // SizedBox(height: 12.h), // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), // SizedBox(height: 12.h), ], ).paddingOnly(top: 16, bottom: 16); }, separatorBuilder: (cxt, index) => Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), itemCount: group.length)) : SizedBox.shrink(), ), ], ), ), ), ), )); }, ) : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noLabResults.tr(context: context))) : // By Test or other tabs keep existing behavior (labViewModel.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) : AlphabeticScroll( alpahbetsAvailable: labViewModel.indexedCharacterForUniqueTest, details: labViewModel.uniqueTestsList, labViewModel: labViewModel, rangeViewModel: rangeViewModel, appState: _appState, ) ], )); }, ), ); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file +import 'dart:async'; import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'alphabeticScroll.dart'; import 'dart:ui' as ui; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return CollapsingListView( title: LocaleKeys.labResults.tr(context: context), search: () async { if (labProvider.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: labProvider.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; labProvider.filterLabReports(value); } } }, child: Consumer( builder: (context, labViewModel, child) { return SingleChildScrollView( physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.all(24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, LocaleKeys.byVisit.tr()), CustomTabBarModel(null, LocaleKeys.byTest.tr()), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), ), ], ), if (activeIndex == 0) Padding( padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( children: [ // CustomButton( // text: LocaleKeys.byClinic.tr(context: context), // onPressed: () { // labViewModel.setIsSortByClinic(true); // }, // backgroundColor: labViewModel.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, // borderColor: labViewModel.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), // textColor: labViewModel.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, // fontSize: 12.f, // fontWeight: FontWeight.w500, // borderRadius: 10, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 40.h, // ), // SizedBox(width: 8.h), // CustomButton( // text: LocaleKeys.byHospital.tr(context: context), // onPressed: () { // labViewModel.setIsSortByClinic(false); // }, // backgroundColor: labViewModel.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, // borderColor: labViewModel.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, // textColor: labViewModel.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, // fontSize: 12, // fontWeight: FontWeight.w500, // borderRadius: 10, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 40.h, // ), ], ), ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? Column( children: [ AppCustomChipWidget( labelText: selectedFilterText!, backgroundColor: AppColors.alertColor, textColor: AppColors.whiteColor, deleteIcon: AppAssets.close_bottom_sheet_icon, deleteIconColor: AppColors.whiteColor, deleteIconHasColor: true, onDeleteTap: () { selectedFilterText = ""; labProvider.filterLabReports(""); }, ), SizedBox(height: 8.h), ], ) : SizedBox(), activeIndex == 0 ? // By Visit - show grouped view when available labViewModel.isLabOrdersLoading ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: 5, itemBuilder: (context, index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ), ) : (labViewModel.patientLabOrders.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: labViewModel.patientLabOrders.length, itemBuilder: (context, index) { final group = labViewModel.patientLabOrders[index]; final isExpanded = expandedIndex == index; return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ AppCustomChipWidget( labelText: "${group.testDetails!.length} ${LocaleKeys.tests.tr(context: context)}", backgroundColor: AppColors.successColor.withOpacity(0.1), textColor: AppColors.successColor, ), AppCustomChipWidget( labelText: "${_appState.isArabic() ? group.isInOutPatientDescriptionN : group.isInOutPatientDescription}", backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), textColor: AppColors.warningColorYellow, ) ], ), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), SizedBox(height: 8.h), Row( mainAxisSize: MainAxisSize.min, children: [ Image.network( group.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 24.w, height: 24.h, fit: BoxFit.cover, ).circle(100), SizedBox(width: 8.h), Expanded(child: (group.doctorName ?? group.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ Directionality( textDirection: ui.TextDirection.ltr, child: AppCustomChipWidget( labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(group.orderDate ?? ""), false), isEnglishOnly: true, )), AppCustomChipWidget( labelText: (group.projectName ?? ""), ), AppCustomChipWidget( labelText: (group.clinicDescription ?? ""), ), ], ), ], ), ), AnimatedSwitcher( duration: Duration(milliseconds: 500), switchInCurve: Curves.easeIn, switchOutCurve: Curves.easeOut, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0.0, child: child, ), ); }, child: isExpanded ? Container( key: ValueKey(index), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), child: Column( children: [ ListView.separated( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, itemBuilder: (cxt, index) { PatientLabOrdersResponseModel order = group; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ "• ${order.testDetails![index].description!}".toText14(weight: FontWeight.w500), SizedBox(height: 4.h), order.testDetails![index].testDescriptionEn!.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), // Row( // mainAxisSize: MainAxisSize.min, // children: [ // Image.network( // order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", // width: 24.w, // height: 24.h, // fit: BoxFit.cover, // ).circle(100), // SizedBox(width: 8.h), // Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), // ], // ), // SizedBox(height: 8.h), // Wrap( // direction: Axis.horizontal, // spacing: 4.h, // runSpacing: 4.h, // children: [ // AppCustomChipWidget( // labelText: ("${LocaleKeys.orderNo.tr(context: context)}: ${order.orderNo!}"), isEnglishOnly: true, // ), // Directionality( // textDirection: ui.TextDirection.ltr, // child: AppCustomChipWidget( // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // isEnglishOnly: true, // )), // AppCustomChipWidget( // labelText: labViewModel.isSortByClinic ? (order.projectName ?? "") : (order.clinicDescription ?? ""), // ), // ], // ), // // Row( // // children: [ // // CustomButton( // // text: ("Order No: ".needTranslation + order.orderNo!), // // onPressed: () {}, // // backgroundColor: AppColors.greyColor, // // borderColor: AppColors.greyColor, // // textColor: AppColors.blackColor, // // fontSize: 10, // // fontWeight: FontWeight.w500, // // borderRadius: 8, // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // // height: 24.h, // // ), // // SizedBox(width: 8.h), // // CustomButton( // // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // // onPressed: () {}, // // backgroundColor: AppColors.greyColor, // // borderColor: AppColors.greyColor, // // textColor: AppColors.blackColor, // // fontSize: 10, // // fontWeight: FontWeight.w500, // // borderRadius: 8, // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // // height: 24.h, // // ), // // ], // // ), // // SizedBox(height: 8.h), // // Row( // // children: [ // // CustomButton( // // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), // // onPressed: () {}, // // backgroundColor: AppColors.greyColor, // // borderColor: AppColors.greyColor, // // textColor: AppColors.blackColor, // // fontSize: 10, // // fontWeight: FontWeight.w500, // // borderRadius: 8, // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // // height: 24.h, // // ), // // ], // // ), // SizedBox(height: 12.h), // Row( // children: [ // Expanded(flex: 2, child: SizedBox()), // // Expanded( // // flex: 1, // // child: Container( // // height: 40.h, // // width: 40.w, // // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // // color: AppColors.textColor, // // borderRadius: 12, // // ), // // child: Padding( // // padding: EdgeInsets.all(12.h), // // child: Transform.flip( // // flipX: _appState.isArabic(), // // child: Utils.buildSvgWithAssets( // // icon: AppAssets.forward_arrow_icon_small, // // iconColor: AppColors.whiteColor, // // fit: BoxFit.contain, // // ), // // ), // // ), // // ).onPress(() { // // model.currentlySelectedPatientOrder = order; // // labProvider.getPatientLabResultByHospital(order); // // labProvider.getPatientSpecialResult(order); // // Navigator.of(context).push( // // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // // ); // // }), // // ) // // Expanded( // flex: 2, // child: CustomButton( // icon: AppAssets.view_report_icon, // iconColor: AppColors.primaryRedColor, // iconSize: 16.h, // text: LocaleKeys.viewResults.tr(context: context), // onPressed: () { // labViewModel.currentlySelectedPatientOrder = order; // labProvider.getPatientLabResultByHospital(order); // labProvider.getPatientSpecialResult(order); // Navigator.of(context).push( // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // ); // }, // backgroundColor: AppColors.secondaryLightRedColor, // borderColor: AppColors.secondaryLightRedColor, // textColor: AppColors.primaryRedColor, // fontSize: 14, // fontWeight: FontWeight.w500, // borderRadius: 12, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 40.h, // ), // ) // ], // ), // SizedBox(height: 12.h), // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), // SizedBox(height: 12.h), ], ).paddingOnly(top: 16, bottom: 16); }, separatorBuilder: (cxt, index) => Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), itemCount: group.testDetails!.length > 3 ? 3 : group.testDetails!.length), SizedBox(height: 16.h), CustomButton( text: "${LocaleKeys.viewResults.tr()} (${group.testDetails!.length})", onPressed: () { labProvider.currentlySelectedPatientOrder = group; labProvider.getPatientLabResultByHospital(group); labProvider.getPatientSpecialResult(group); Navigator.of(context).push( CustomPageRoute( page: LabResultByClinic(labOrder: group), ), ); }, backgroundColor: AppColors.infoColor.withAlpha(20), borderColor: AppColors.infoColor.withAlpha(0), textColor: AppColors.infoColor, fontSize: (isFoldable || isTablet) ? 12.f : 14.f, fontWeight: FontWeight.w500, borderRadius: 12.r, padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), height: 40.h, iconSize: 14.h, icon: AppAssets.view_report_icon, iconColor: AppColors.infoColor, ), SizedBox(height: 16.h), ], ), ) : SizedBox.shrink(), ), ], ), ), ), ), )); }, ) : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noLabResults.tr(context: context))) : // By Test or other tabs keep existing behavior (labViewModel.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) : AlphabeticScroll( alpahbetsAvailable: labViewModel.indexedCharacterForUniqueTest, details: labViewModel.uniqueTestsList, labViewModel: labViewModel, rangeViewModel: rangeViewModel, appState: _appState, ) ], )); }, ), ); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file diff --git a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart index af6c97f8..c883c863 100644 --- a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart +++ b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart @@ -164,7 +164,7 @@ class LabResultByClinic extends StatelessWidget { padding: EdgeInsets.only(right: 4.w, left: 4.w), child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white), ), - LocaleKeys.generateAiAnalysis.tr(context: context).toText16(isBold: true) + LocaleKeys.generateAiAnalysis.tr(context: context).toText16(isBold: true, color: Colors.white) ], ), ).paddingSymmetrical(24.h, 24.h).onPress(() async { diff --git a/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart b/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart index 7a477761..ebf802df 100644 --- a/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart +++ b/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart @@ -2,11 +2,14 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; class AiAnalysisWidget extends StatelessWidget { final LabOrderResponseByAi data; @@ -71,6 +74,16 @@ class AiAnalysisWidget extends StatelessWidget { ), ], ), + SizedBox(height: 16.h), + CustomButton( + height: 50.h, + text: LocaleKeys.close.tr(context: context), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + onPressed: () { + getIt.get().closeAILabResultAnalysis(); + }, + ), ], ), ), diff --git a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart index cf6ce97b..1a97d48d 100644 --- a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart +++ b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart @@ -114,15 +114,15 @@ class LabOrderResultItem extends StatelessWidget { ), CustomButton( icon: AppAssets.view_report_icon, - iconColor: AppColors.primaryRedColor, + iconColor: AppColors.infoColor, iconSize: 16.h, text: LocaleKeys.viewReport.tr(context: context), onPressed: () { onTap(); }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.infoColor.withAlpha(20), + borderColor: AppColors.infoColor.withAlpha(0), + textColor: AppColors.infoColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, diff --git a/lib/presentation/lab/lab_results/lab_result_details.dart b/lib/presentation/lab/lab_results/lab_result_details.dart index d2c1b524..ded1e693 100644 --- a/lib/presentation/lab/lab_results/lab_result_details.dart +++ b/lib/presentation/lab/lab_results/lab_result_details.dart @@ -35,97 +35,99 @@ class LabResultDetails extends StatelessWidget { LabViewModel labViewModel = Provider.of(context, listen: false); final appState = getIt.get(); return Scaffold( - body: Column( - children: [ - Expanded( - child: CollapsingListView( - title: LocaleKeys.labResultDetails.tr(context: context), - // aiOverview: () async { - // final _dialogService = getIt.get(); - // await _dialogService.showCommonBottomSheetWithoutH( - // message: LocaleKeys.aiDisclaimer.tr(), - // label: LocaleKeys.consent.tr(), - // okLabel: LocaleKeys.acceptLbl.tr(), - // cancelLabel: LocaleKeys.rejectView.tr(), - // onOkPressed: () { - // context.pop(); - // labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); - // }, - // onCancelPressed: () { - // context.pop(); - // }); - // }, - child: SingleChildScrollView( - child: Column( - spacing: 16.h, - children: [ - LabNameAndStatus(context), - getLabDescription(context), - LabGraph(context), - Selector( - selector: (_, model) => model.labOrderResponseByAi, - builder: (_, aiData, __) { - if (aiData != null) { - return AiAnalysisWidget(data: aiData).paddingOnly(bottom: 16.h); - } - return const SizedBox.shrink(); - }, - ), - ], - ).paddingAll(24.h), + body: Consumer(builder: (context, labVM, child) { + return Column( + children: [ + Expanded( + child: CollapsingListView( + title: LocaleKeys.labResultDetails.tr(context: context), + // aiOverview: () async { + // final _dialogService = getIt.get(); + // await _dialogService.showCommonBottomSheetWithoutH( + // message: LocaleKeys.aiDisclaimer.tr(), + // label: LocaleKeys.consent.tr(), + // okLabel: LocaleKeys.acceptLbl.tr(), + // cancelLabel: LocaleKeys.rejectView.tr(), + // onOkPressed: () { + // context.pop(); + // labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); + // }, + // onCancelPressed: () { + // context.pop(); + // }); + // }, + child: SingleChildScrollView( + child: Column( + spacing: 16.h, + children: [ + LabNameAndStatus(context), + getLabDescription(context), + LabGraph(context), + Selector( + selector: (_, model) => model.labOrderResponseByAi, + builder: (_, aiData, __) { + if (aiData != null) { + return AiAnalysisWidget(data: aiData).paddingOnly(bottom: 16.h); + } + return const SizedBox.shrink(); + }, + ), + ], + ).paddingAll(24.h), + ), ), ), - ), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 24.h, - hasShadow: true, - ), - child: Container( - height: 56.h, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.r), - gradient: LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - stops: [0.236, 1.0], // 53.6% and 100% - colors: [ - Color(0xFF8A38F5), // Transparent - Color(0xFFE20BBB), // Solid #F8F8F8 - ], - ), + labVM.labOrderResponseByAi == null ? Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.h, + hasShadow: true, ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(right: 4.w, left: 4.w), - child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white), + child: Container( + height: 56.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.r), + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + stops: [0.236, 1.0], // 53.6% and 100% + colors: [ + Color(0xFF8A38F5), // Transparent + Color(0xFFE20BBB), // Solid #F8F8F8 + ], ), - LocaleKeys.generateAiAnalysis.tr(context: context).toText16(isBold: true) - ], - ), - ).paddingSymmetrical(24.h, 24.h).onPress(() async { - final _dialogService = getIt.get(); - await _dialogService.showCommonBottomSheetWithoutH( - message: LocaleKeys.aiDisclaimer.tr(), - label: LocaleKeys.consent.tr(), - okLabel: LocaleKeys.acceptLbl.tr(), - cancelLabel: LocaleKeys.rejectView.tr(), - onOkPressed: () { - context.pop(); - labViewModel.getAiOverviewSingleLabResult( - langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); - }, - onCancelPressed: () { - context.pop(); - }); - }), - ), - ], - ), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(right: 4.w, left: 4.w), + child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white), + ), + LocaleKeys.generateAiAnalysisResult.tr(context: context).toText16(isBold: true, color: Colors.white) + ], + ), + ).paddingSymmetrical(24.h, 24.h).onPress(() async { + final _dialogService = getIt.get(); + await _dialogService.showCommonBottomSheetWithoutH( + message: LocaleKeys.aiDisclaimer.tr(), + label: LocaleKeys.consent.tr(), + okLabel: LocaleKeys.acceptLbl.tr(), + cancelLabel: LocaleKeys.rejectView.tr(), + onOkPressed: () { + context.pop(); + labViewModel.getAiOverviewSingleLabResult( + langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); + }, + onCancelPressed: () { + context.pop(); + }); + }), + ) : SizedBox.shrink(), + ], + ); + }), ); } @@ -326,20 +328,20 @@ class LabResultDetails extends StatelessWidget { }, leftLabelFormatter: (value) { value = double.parse(value.toStringAsFixed(1)); - // return leftLabels(value.toStringAsFixed(2)); - if (value == labmodel.highRefrenceValue) { - return leftLabels(LocaleKeys.high.tr()); - } - - if (value == labmodel.lowRefenceValue) { - return leftLabels(LocaleKeys.low.tr()); - } + return leftLabels(value.toStringAsFixed(2)); + // if (value == labmodel.highRefrenceValue) { + // return leftLabels(LocaleKeys.high.tr()); + // } + // + // if (value == labmodel.lowRefenceValue) { + // return leftLabels(LocaleKeys.low.tr()); + // } return SizedBox.shrink(); // } }, - graphColor: AppColors.blackColor, - graphShadowColor: Colors.transparent, + graphColor: AppColors.graphGridColor, + graphShadowColor: AppColors.graphGridColor.withOpacity(.5), graphGridColor: graphColor.withOpacity(.4), bottomLabelFormatter: (value, data) { if (data.isEmpty) return SizedBox.shrink(); @@ -371,7 +373,7 @@ class LabResultDetails extends StatelessWidget { ranges.add(HorizontalRangeAnnotation( y1: model.minY, y2: model.lowRefenceValue, - color: AppColors.highAndLow.withOpacity(0.05), + color: Colors.transparent, )); ranges.add(HorizontalRangeAnnotation( @@ -383,7 +385,7 @@ class LabResultDetails extends StatelessWidget { ranges.add(HorizontalRangeAnnotation( y1: model.highRefrenceValue, y2: model.maxY, - color: AppColors.criticalLowAndHigh.withOpacity(0.05), + color: Colors.transparent, )); return ranges; } @@ -412,15 +414,17 @@ class LabResultDetails extends StatelessWidget { } double? getInterval(LabViewModel labmodel) { - return .1; - // var maxX = labmodel.maxY; - // if(maxX<1) return .5; - // if(maxX >1 && maxX < 5) return 1; - // if(maxX >5 && maxX < 10) return 5; - // if(maxX >10 && maxX < 50) return 10; - // if(maxX >50 && maxX < 100) return 20; - // if(maxX >100 && maxX < 200) return 30; - // return 50; + // return .1; + var maxX = labmodel.maxY; + if(maxX<1) return .3; + if(maxX >1 && maxX <= 5) return .7; + if(maxX >5 && maxX <= 10) return 2.5; + if(maxX >10 && maxX <= 50) return 5; + if(maxX >50 && maxX <= 100) return 10; + if(maxX >100 && maxX <= 200) return 30; + if(maxX >200 && maxX <= 300) return 50; + if(maxX >300 && maxX <= 400) return 100; + return 200 ; } Widget getLabDescription(BuildContext context) { diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index f288af66..cddc4757 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -85,6 +85,8 @@ import '../../features/active_prescriptions/active_prescriptions_view_model.dart import '../prescriptions/prescription_detail_page.dart'; import 'widgets/medical_file_appointment_card.dart'; +import 'dart:ui' as ui; + class MedicalFilePage extends StatefulWidget { bool showBackIcon; @@ -197,18 +199,23 @@ class _MedicalFilePageState extends State { ], ), SizedBox(width: 4.h), - Utils.buildSvgWithAssets(icon: AppAssets.arrow_down, height: 22.h, width: 22.w) + Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, height: 22.h, width: 22.w) ], ).onPress(() { - DialogService dialogService = getIt.get(); - dialogService.showFamilyBottomSheetWithoutH( - label: LocaleKeys.familyTitle.tr(context: context), - message: "", - isShowManageButton: true, - onSwitchPress: (FamilyFileResponseModelLists profile) { - medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); - }, - profiles: medicalFileViewModel.patientFamilyFiles); + Navigator.of(context).push( + CustomPageRoute( + page: FamilyMedicalScreen(), + ), + ); + // DialogService dialogService = getIt.get(); + // dialogService.showFamilyBottomSheetWithoutH( + // label: LocaleKeys.familyTitle.tr(context: context), + // message: "", + // isShowManageButton: true, + // onSwitchPress: (FamilyFileResponseModelLists profile) { + // medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); + // }, + // profiles: medicalFileViewModel.patientFamilyFiles); }), isLeading: widget.showBackIcon, // leadingCallback: () { @@ -281,9 +288,9 @@ class _MedicalFilePageState extends State { ), AppCustomChipWidget( icon: AppAssets.blood_icon, - labelText: LocaleKeys.bloodGroup.tr(namedArgs: {'bloodType': appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup}, context: context), + labelText: appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup, iconColor: AppColors.primaryRedColor, - labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), padding: EdgeInsets.zero, ), Consumer(builder: (context, insuranceVM, child) { @@ -310,27 +317,35 @@ class _MedicalFilePageState extends State { : AppColors.warningColorYellow, iconSize: 12.w, deleteIcon: insuranceVM.isInsuranceActive ? null : AppAssets.forward_chevron_icon, - deleteIconColor: AppColors.warningColorYellow, + deleteIconColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceVM.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, deleteIconHasColor: true, onChipTap: () { if (!insuranceVM.isInsuranceActive) { - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), - navigationService.navigatorKey.currentContext!, - child: Utils.getWarningWidget( - loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), - confirmText: LocaleKeys.contactUs.tr(context: context), - isShowActionButtons: true, - onCancelTap: () { - navigationService.pop(); - }, - onConfirmTap: () async { - launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); - }), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); + insuranceVM.setIsInsuranceUpdateDetailsLoading(true); + insuranceVM.getPatientInsuranceDetailsForUpdate( + appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); + showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + // showCommonBottomSheetWithoutHeight( + // title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), + // navigationService.navigatorKey.currentContext!, + // child: Utils.getWarningWidget( + // loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), + // confirmText: LocaleKeys.contactUs.tr(context: context), + // isShowActionButtons: true, + // onCancelTap: () { + // navigationService.pop(); + // }, + // onConfirmTap: () async { + // launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); + // }), + // callBackFunc: () {}, + // isFullScreen: false, + // isCloseButtonVisible: true, + // ); } }, backgroundColor: insuranceVM.isInsuranceExpired @@ -507,7 +522,7 @@ class _MedicalFilePageState extends State { ], ), ExpandableListItem( - title: LocaleKeys.trackerAndOthers.tr(context: context).toText18(weight: FontWeight.w600), + title: LocaleKeys.healthTrackers.tr(context: context).toText18(weight: FontWeight.w600), expandedBackgroundColor: Colors.transparent, children: [ SizedBox(height: 10.h), @@ -739,7 +754,26 @@ class _MedicalFilePageState extends State { ], ).paddingSymmetrical(0.w, 0.h), SizedBox(height: 24.h), - LocaleKeys.activeMedicationsAndPrescriptions.tr(context: context).toText16(weight: FontWeight.w500, letterSpacing: -0.2), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.activeMedicationsAndPrescriptions.tr(context: context).toText16(weight: FontWeight.w500, letterSpacing: -0.2), + Row( + children: [ + LocaleKeys.viewAll.tr(context: context).toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + SizedBox(width: 2.w), + Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), + ], + ).onPress(() { + // myAppointmentsViewModel.getPatientMyDoctors(); + Navigator.of(context).push( + CustomPageRoute( + page: PrescriptionsListPage(), + ), + ); + }), + ], + ), SizedBox(height: 16.h), Consumer(builder: (context, prescriptionVM, child) { return prescriptionVM.isPrescriptionsOrdersLoading @@ -784,11 +818,15 @@ class _MedicalFilePageState extends State { runSpacing: 4.w, children: [ AppCustomChipWidget(labelText: prescriptionVM.patientPrescriptionOrders[index].clinicDescription!), - AppCustomChipWidget( - icon: AppAssets.doctor_calendar_icon, - labelText: DateUtil.formatDateToDate( - DateUtil.convertStringToDate(prescriptionVM.patientPrescriptionOrders[index].appointmentDate), - false, + Directionality( + textDirection: ui.TextDirection.ltr, + child: AppCustomChipWidget( + icon: AppAssets.doctor_calendar_icon, + labelText: DateUtil.formatDateToDate( + DateUtil.convertStringToDate(prescriptionVM.patientPrescriptionOrders[index].appointmentDate), + false, + ), + isEnglishOnly: true, ), ), ], @@ -816,55 +854,55 @@ class _MedicalFilePageState extends State { separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), SizedBox(height: 16.h), - Divider(color: AppColors.dividerColor), - SizedBox(height: 16.h), - Row( - children: [ - Expanded( - child: CustomButton( - text: LocaleKeys.allPrescriptions.tr(context: context), - onPressed: () { - Navigator.of(context).push( - CustomPageRoute( - page: PrescriptionsListPage(), - ), - ); - }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 12.f, - fontWeight: FontWeight.w500, - borderRadius: 12.r, - height: 40.h, - icon: AppAssets.requests, - iconColor: AppColors.primaryRedColor, - iconSize: 16.w, - ), - ), - SizedBox(width: 6.w), - Expanded( - child: CustomButton( - text: LocaleKeys.allMedications.tr(context: context), - onPressed: () { Navigator.of(context).push( - CustomPageRoute( - page: ActiveMedicationPage(), - ), - );}, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 12.f, - fontWeight: FontWeight.w500, - borderRadius: 12.h, - height: 40.h, - icon: AppAssets.all_medications_icon, - iconColor: AppColors.primaryRedColor, - iconSize: 16.h, - ), - ), - ], - ), + // Divider(color: AppColors.dividerColor), + // SizedBox(height: 16.h), + // Row( + // children: [ + // Expanded( + // child: CustomButton( + // text: LocaleKeys.allPrescriptions.tr(context: context), + // onPressed: () { + // Navigator.of(context).push( + // CustomPageRoute( + // page: PrescriptionsListPage(), + // ), + // ); + // }, + // backgroundColor: AppColors.secondaryLightRedColor, + // borderColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.primaryRedColor, + // fontSize: 12.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.r, + // height: 40.h, + // icon: AppAssets.requests, + // iconColor: AppColors.primaryRedColor, + // iconSize: 16.w, + // ), + // ), + // SizedBox(width: 6.w), + // Expanded( + // child: CustomButton( + // text: LocaleKeys.allMedications.tr(context: context), + // onPressed: () { Navigator.of(context).push( + // CustomPageRoute( + // page: ActiveMedicationPage(), + // ), + // );}, + // backgroundColor: AppColors.secondaryLightRedColor, + // borderColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.primaryRedColor, + // fontSize: 12.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.h, + // height: 40.h, + // icon: AppAssets.all_medications_icon, + // iconColor: AppColors.primaryRedColor, + // iconSize: 16.h, + // ), + // ), + // ], + // ), ], ), ), @@ -897,7 +935,7 @@ class _MedicalFilePageState extends State { Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), ], ).onPress(() { - myAppointmentsViewModel.getPatientMyDoctors(); + // myAppointmentsViewModel.getPatientMyDoctors(); Navigator.of(context).push( CustomPageRoute( page: MyDoctorsPage(), @@ -1196,6 +1234,26 @@ class _MedicalFilePageState extends State { // Requests Tab Data return Column( children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "${LocaleKeys.sick.tr(context: context)} ${LocaleKeys.sickSubtitle.tr(context: context)}".toText16(isBold: true), + Row( + children: [ + LocaleKeys.viewAll.tr(context: context).toText12(color: AppColors.primaryRedColor), + SizedBox(width: 2.h), + Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), + ], + ), + ], + ).onPress(() { + Navigator.of(context).push( + CustomPageRoute( + page: PatientSickleavesListPage(), + ), + ); + }), + SizedBox(height: 16.h), Consumer(builder: (context, medicalFileVM, child) { return medicalFileVM.isPatientSickLeaveListLoading ? PatientSickLeaveCard( @@ -1265,20 +1323,20 @@ class _MedicalFilePageState extends State { ), ); }), - MedicalFileCard( - label: LocaleKeys.sickLeaveReport.tr(context: context), - textColor: AppColors.blackColor, - backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.sick_leave_report_icon, - isLargeText: true, - iconSize: 36.h, - ).onPress(() { - Navigator.of(context).push( - CustomPageRoute( - page: PatientSickleavesListPage(), - ), - ); - }), + // MedicalFileCard( + // label: LocaleKeys.sickLeaveReport.tr(context: context), + // textColor: AppColors.blackColor, + // backgroundColor: AppColors.whiteColor, + // svgIcon: AppAssets.sick_leave_report_icon, + // isLargeText: true, + // iconSize: 36.h, + // ).onPress(() { + // Navigator.of(context).push( + // CustomPageRoute( + // page: PatientSickleavesListPage(), + // ), + // ); + // }), ], ).paddingSymmetrical(0.w, 0.0), SizedBox(height: 24.h), @@ -1289,12 +1347,12 @@ class _MedicalFilePageState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - LocaleKeys.healthTrackers.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.textColor), - ], - ), - SizedBox(height: 16.h), + // Row( + // children: [ + // LocaleKeys.healthTrackers.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.textColor), + // ], + // ), + // SizedBox(height: 16.h), GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, @@ -1333,11 +1391,11 @@ class _MedicalFilePageState extends State { ], ).paddingSymmetrical(0.w, 0.0), SizedBox(height: 16.h), - Row( - children: [ - LocaleKeys.others.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.textColor), - ], - ), + // Row( + // children: [ + // LocaleKeys.others.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.textColor), + // ], + // ), SizedBox(height: 16.h), GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -1350,21 +1408,22 @@ class _MedicalFilePageState extends State { padding: EdgeInsets.zero, shrinkWrap: true, children: [ - MedicalFileCard( - label: LocaleKeys.askYourDoctor.tr(context: context), - textColor: AppColors.blackColor, - backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.ask_doctor_medical_file_icon, - isLargeText: true, - iconSize: 36.w, - ).onPress(() { - getIt.get().initAskDoctorViewModel(); - Navigator.of(context).push( - CustomPageRoute( - page: AskDoctorPage(), - ), - ); - }), + // MedicalFileCard( + // label: LocaleKeys.askYourDoctor.tr(context: context), + // textColor: AppColors.blackColor, + // backgroundColor: AppColors.whiteColor, + // svgIcon: AppAssets.ask_doctor_medical_file_icon, + // isLargeText: true, + // iconSize: 36.w, + // ).onPress(() { + // getIt.get().initAskDoctorViewModel(); + // Navigator.of(context).push( + // CustomPageRoute( + // page: AskDoctorPage(), + // ), + // ); + // }), + // MedicalFileCard( // label: LocaleKeys.internetPairing.tr(context: context), // textColor: AppColors.blackColor, diff --git a/lib/presentation/medical_file/patient_sickleaves_list_page.dart b/lib/presentation/medical_file/patient_sickleaves_list_page.dart index 93cf17ff..4518eca5 100644 --- a/lib/presentation/medical_file/patient_sickleaves_list_page.dart +++ b/lib/presentation/medical_file/patient_sickleaves_list_page.dart @@ -57,48 +57,48 @@ class _PatientSickleavesListPageState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 16.h), + // SizedBox(height: 16.h), // Clinic & Hospital Sort - Row( - children: [ - CustomButton( - text: LocaleKeys.byClinic.tr(context: context), - onPressed: () { - model.setIsSickLeavesSortByClinic(true); - }, - backgroundColor: model.isSickLeavesSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), - textColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - SizedBox(width: 8.h), - CustomButton( - text: LocaleKeys.byHospital.tr(context: context), - onPressed: () { - model.setIsSickLeavesSortByClinic(false); - }, - backgroundColor: model.isSickLeavesSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, - borderColor: model.isSickLeavesSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, - textColor: model.isSickLeavesSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - ], - ).paddingSymmetrical(24.h, 0.h), - SizedBox(height: 20.h), + // Row( + // children: [ + // CustomButton( + // text: LocaleKeys.byClinic.tr(context: context), + // onPressed: () { + // model.setIsSickLeavesSortByClinic(true); + // }, + // backgroundColor: model.isSickLeavesSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + // borderColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + // textColor: model.isSickLeavesSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // SizedBox(width: 8.h), + // CustomButton( + // text: LocaleKeys.byHospital.tr(context: context), + // onPressed: () { + // model.setIsSickLeavesSortByClinic(false); + // }, + // backgroundColor: model.isSickLeavesSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + // borderColor: model.isSickLeavesSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + // textColor: model.isSickLeavesSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // ], + // ).paddingSymmetrical(24.h, 0.h), + // SizedBox(height: 20.h), // Expandable list ListView.builder( itemCount: model.isPatientSickLeaveListLoading ? 4 : model.patientSickLeaveList.isNotEmpty - ? model.patientSickLeavesViewList.length + ? model.patientSickLeaveList.length : 1, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, @@ -122,155 +122,322 @@ class _PatientSickleavesListPageState extends State { curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), - child: InkWell( - onTap: () { - setState(() { - expandedIndex = isExpanded ? null : index; - }); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppCustomChipWidget( + labelText: + "${getIt.get().isArabic() ? model.patientSickLeaveList[index].isInOutPatientDescriptionN : model.patientSickLeaveList[index].isInOutPatientDescription}", + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, + ), + SizedBox(height: 16.h), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + model.patientSickLeaveList[index].doctorImageURL!, + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: model.patientSickLeaveList[index].doctorName!.toText14(weight: FontWeight.w500)), + ], + ), + SizedBox(height: 8.h), + Wrap( + direction: Axis.horizontal, + spacing: 6.h, + runSpacing: 6.h, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CustomButton( - text: "${model.patientSickLeavesViewList[index].sickLeavesList!.length} ${LocaleKeys.sickSubtitle.tr(context: context)} Available", - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 8, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 30.h, - ), - Icon(isExpanded ? Icons.expand_less : Icons.expand_more), - ], + AppCustomChipWidget( + labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(model.patientSickLeaveList[index].appointmentDate), false), + ), + AppCustomChipWidget( + labelText: model.isSickLeavesSortByClinic ? model.patientSickLeaveList[index].projectName! : model.patientSickLeaveList[index].clinicName!, + ), + AppCustomChipWidget( + labelText: "${model.patientSickLeaveList[index].sickLeaveDays} Days", ), - SizedBox(height: 8.h), - model.patientSickLeavesViewList[index].filterName!.toText16(isBold: true) ], ), - ), - AnimatedSwitcher( - duration: Duration(milliseconds: 500), - switchInCurve: Curves.easeIn, - switchOutCurve: Curves.easeOut, - transitionBuilder: (Widget child, Animation animation) { - return FadeTransition( - opacity: animation, - child: SizeTransition( - sizeFactor: animation, - axisAlignment: 0.0, - child: child, + SizedBox(height: 12.h), + Row( + children: [ + Expanded( + flex: 6, + child: CustomButton( + text: LocaleKeys.downloadReport.tr(context: context), + onPressed: () async { + LoaderBottomSheet.showLoader(); + await medicalFileViewModel.getPatientSickLeavePDF(model.patientSickLeaveList[index], appState.getAuthenticatedUser()!).then((val) async { + LoaderBottomSheet.hideLoader(); + if (medicalFileViewModel.patientSickLeavePDFBase64.isNotEmpty) { + String path = await Utils.createFileFromString(medicalFileViewModel.patientSickLeavePDFBase64, "pdf"); + try { + OpenFilex.open(path); + } catch (ex) { + debugPrint("Error opening file: $ex"); + } + } + }); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 14, + fontWeight: FontWeight.w500, + borderRadius: 12, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + icon: AppAssets.download, + iconColor: AppColors.primaryRedColor, + iconSize: 14.h, + ), ), - ); - }, - child: isExpanded - ? Container( - key: ValueKey(index), - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...model.patientSickLeavesViewList[index].sickLeavesList!.map((sickLeave) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.network( - sickLeave.doctorImageURL!, - width: 24.h, - height: 24.h, - fit: BoxFit.fill, - ).circle(100), - SizedBox(width: 8.h), - Expanded(child: sickLeave.doctorName!.toText14(weight: FontWeight.w500)), - ], - ), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 6.h, - runSpacing: 6.h, - children: [ - AppCustomChipWidget( - labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(sickLeave.appointmentDate), false), - ), - AppCustomChipWidget( - labelText: model.isSickLeavesSortByClinic ? sickLeave.projectName! : sickLeave.clinicName!, - ), - AppCustomChipWidget( - labelText: "${sickLeave.sickLeaveDays} Days", - ), - ], - ), - SizedBox(height: 12.h), - Row( - children: [ - Expanded( - flex: 6, - child: CustomButton( - text: LocaleKeys.downloadReport.tr(context: context), - onPressed: () async { - LoaderBottomSheet.showLoader(); - await medicalFileViewModel.getPatientSickLeavePDF(sickLeave, appState.getAuthenticatedUser()!).then((val) async { - LoaderBottomSheet.hideLoader(); - if (medicalFileViewModel.patientSickLeavePDFBase64.isNotEmpty) { - String path = await Utils.createFileFromString(medicalFileViewModel.patientSickLeavePDFBase64, "pdf"); - try { - OpenFilex.open(path); - } catch (ex) { - debugPrint("Error opening file: $ex"); - } - } - }); - }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 14, - fontWeight: FontWeight.w500, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - icon: AppAssets.download, - iconColor: AppColors.primaryRedColor, - iconSize: 14.h, - ), - ), - ], - ), - SizedBox(height: 12.h), - Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), - SizedBox(height: 12.h), - ], - ); - }), - ], - ), - ) - : SizedBox.shrink(), - ), - ], + ], + ), + // SizedBox(height: 12.h), + // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // SizedBox(height: 12.h), + ], + ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // ...model.patientSickLeaveList[index].sickLeavesList!.map((sickLeave) { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Image.network( + // sickLeave.doctorImageURL!, + // width: 24.h, + // height: 24.h, + // fit: BoxFit.fill, + // ).circle(100), + // SizedBox(width: 8.h), + // Expanded(child: sickLeave.doctorName!.toText14(weight: FontWeight.w500)), + // ], + // ), + // SizedBox(height: 8.h), + // Wrap( + // direction: Axis.horizontal, + // spacing: 6.h, + // runSpacing: 6.h, + // children: [ + // AppCustomChipWidget( + // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(sickLeave.appointmentDate), false), + // ), + // AppCustomChipWidget( + // labelText: model.isSickLeavesSortByClinic ? sickLeave.projectName! : sickLeave.clinicName!, + // ), + // AppCustomChipWidget( + // labelText: "${sickLeave.sickLeaveDays} Days", + // ), + // ], + // ), + // SizedBox(height: 12.h), + // Row( + // children: [ + // Expanded( + // flex: 6, + // child: CustomButton( + // text: LocaleKeys.downloadReport.tr(context: context), + // onPressed: () async { + // LoaderBottomSheet.showLoader(); + // await medicalFileViewModel.getPatientSickLeavePDF(sickLeave, appState.getAuthenticatedUser()!).then((val) async { + // LoaderBottomSheet.hideLoader(); + // if (medicalFileViewModel.patientSickLeavePDFBase64.isNotEmpty) { + // String path = await Utils.createFileFromString(medicalFileViewModel.patientSickLeavePDFBase64, "pdf"); + // try { + // OpenFilex.open(path); + // } catch (ex) { + // debugPrint("Error opening file: $ex"); + // } + // } + // }); + // }, + // backgroundColor: AppColors.secondaryLightRedColor, + // borderColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.primaryRedColor, + // fontSize: 14, + // fontWeight: FontWeight.w500, + // borderRadius: 12, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // icon: AppAssets.download, + // iconColor: AppColors.primaryRedColor, + // iconSize: 14.h, + // ), + // ), + // ], + // ), + // SizedBox(height: 12.h), + // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // SizedBox(height: 12.h), + // ], + // ); + // }), + // ], + // ), + ) + // InkWell( + // onTap: () { + // setState(() { + // expandedIndex = isExpanded ? null : index; + // }); + // }, + // child: + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Padding( + // padding: EdgeInsets.all(16.h), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // CustomButton( + // text: "${model.patientSickLeavesViewList[index].sickLeavesList!.length} ${LocaleKeys.sickSubtitle.tr(context: context)} Available", + // onPressed: () {}, + // backgroundColor: AppColors.greyColor, + // borderColor: AppColors.greyColor, + // textColor: AppColors.blackColor, + // fontSize: 10, + // fontWeight: FontWeight.w500, + // borderRadius: 8, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 30.h, + // ), + // Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + // ], + // ), + // SizedBox(height: 8.h), + // model.patientSickLeavesViewList[index].filterName!.toText16(isBold: true) + // ], + // ), + // ), + // // AnimatedSwitcher( + // // duration: Duration(milliseconds: 500), + // // switchInCurve: Curves.easeIn, + // // switchOutCurve: Curves.easeOut, + // // transitionBuilder: (Widget child, Animation animation) { + // // return FadeTransition( + // // opacity: animation, + // // child: SizeTransition( + // // sizeFactor: animation, + // // axisAlignment: 0.0, + // // child: child, + // // ), + // // ); + // // }, + // // child: isExpanded + // // ? Container( + // // key: ValueKey(index), + // // padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + // // child: Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // ...model.patientSickLeavesViewList[index].sickLeavesList!.map((sickLeave) { + // // return Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // Row( + // // mainAxisSize: MainAxisSize.min, + // // children: [ + // // Image.network( + // // sickLeave.doctorImageURL!, + // // width: 24.h, + // // height: 24.h, + // // fit: BoxFit.fill, + // // ).circle(100), + // // SizedBox(width: 8.h), + // // Expanded(child: sickLeave.doctorName!.toText14(weight: FontWeight.w500)), + // // ], + // // ), + // // SizedBox(height: 8.h), + // // Wrap( + // // direction: Axis.horizontal, + // // spacing: 6.h, + // // runSpacing: 6.h, + // // children: [ + // // AppCustomChipWidget( + // // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(sickLeave.appointmentDate), false), + // // ), + // // AppCustomChipWidget( + // // labelText: model.isSickLeavesSortByClinic ? sickLeave.projectName! : sickLeave.clinicName!, + // // ), + // // AppCustomChipWidget( + // // labelText: "${sickLeave.sickLeaveDays} Days", + // // ), + // // ], + // // ), + // // SizedBox(height: 12.h), + // // Row( + // // children: [ + // // Expanded( + // // flex: 6, + // // child: CustomButton( + // // text: LocaleKeys.downloadReport.tr(context: context), + // // onPressed: () async { + // // LoaderBottomSheet.showLoader(); + // // await medicalFileViewModel.getPatientSickLeavePDF(sickLeave, appState.getAuthenticatedUser()!).then((val) async { + // // LoaderBottomSheet.hideLoader(); + // // if (medicalFileViewModel.patientSickLeavePDFBase64.isNotEmpty) { + // // String path = await Utils.createFileFromString(medicalFileViewModel.patientSickLeavePDFBase64, "pdf"); + // // try { + // // OpenFilex.open(path); + // // } catch (ex) { + // // debugPrint("Error opening file: $ex"); + // // } + // // } + // // }); + // // }, + // // backgroundColor: AppColors.secondaryLightRedColor, + // // borderColor: AppColors.secondaryLightRedColor, + // // textColor: AppColors.primaryRedColor, + // // fontSize: 14, + // // fontWeight: FontWeight.w500, + // // borderRadius: 12, + // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // height: 40.h, + // // icon: AppAssets.download, + // // iconColor: AppColors.primaryRedColor, + // // iconSize: 14.h, + // // ), + // // ), + // // ], + // // ), + // // SizedBox(height: 12.h), + // // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // // SizedBox(height: 12.h), + // // ], + // // ); + // // }), + // // ], + // // ), + // // ) + // // : SizedBox.shrink(), + // // ), + // ], + // ), + // ), ), - ), - ), ), ), ) : Utils.getNoDataWidget(context, noDataText: LocaleKeys.youDontHaveAnySickLeavesYet.tr(context: context)); }, ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 24.h), ], ); }), diff --git a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart index 73dd1652..4c1a72b7 100644 --- a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart @@ -74,7 +74,7 @@ class MedicalFileAppointmentCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (patientAppointmentHistoryResponseModel.doctorNameObj ?? "").toText14(isBold: true, maxlines: 1).toShimmer2(isShow: myAppointmentsViewModel.isMyAppointmentsLoading), + (patientAppointmentHistoryResponseModel.doctorNameObj ?? "").toText14(isBold: true, maxlines: 1, isEnglishOnly: !Utils.isArabicText(patientAppointmentHistoryResponseModel.doctorNameObj ?? "")).toShimmer2(isShow: myAppointmentsViewModel.isMyAppointmentsLoading), (patientAppointmentHistoryResponseModel.clinicName ?? "") .toText12(maxLine: 1, fontWeight: FontWeight.w500, color: AppColors.greyTextColor) .toShimmer2(isShow: myAppointmentsViewModel.isMyAppointmentsLoading), diff --git a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart index a0c54e68..18bd2e69 100644 --- a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart +++ b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart @@ -40,18 +40,17 @@ class PatientSickLeaveCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - "${LocaleKeys.sick.tr(context: context)} ${LocaleKeys.sickSubtitle.tr(context: context)}".toText16(isBold: true).toShimmer2(isShow: isLoading), - AppCustomChipWidget( - labelText: isLoading ? "" : getStatusText(context), - backgroundColor: getStatusColor().withOpacity(0.15), - textColor: getStatusColor(), - ).toShimmer2(isShow: isLoading, width: 100.h), - ], - ), - SizedBox(height: 16.h), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // AppCustomChipWidget( + // labelText: isLoading ? "" : getStatusText(context), + // backgroundColor: getStatusColor().withOpacity(0.15), + // textColor: getStatusColor(), + // ).toShimmer2(isShow: isLoading, width: 100.h), + // ], + // ), + // SizedBox(height: 16.h), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 826b1741..a621168f 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,16 +11,22 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; +import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/widgets/insurance_update_details_card.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:provider/provider.dart'; class FamilyCards extends StatefulWidget { final List profiles; + late List? profileViewList; final Function(FamilyFileResponseModelLists) onSelect; final Function(FamilyFileResponseModelLists) onRemove; final bool isShowDetails; @@ -28,11 +36,12 @@ class FamilyCards extends StatefulWidget { final bool isShowRemoveButton; final bool isForWalletRecharge; - const FamilyCards( + FamilyCards( {super.key, required this.profiles, required this.onSelect, required this.onRemove, + this.profileViewList, this.isShowDetails = false, this.isBottomSheet = false, this.isRequestDesign = false, @@ -46,9 +55,22 @@ class FamilyCards extends StatefulWidget { class _FamilyCardsState extends State { AppState appState = getIt(); + late InsuranceViewModel insuranceViewModel; + + @override + void initState() { + scheduleMicrotask(() { + insuranceViewModel.initInsuranceProvider(); + }); + super.initState(); + } @override Widget build(BuildContext context) { + widget.profileViewList = []; + widget.profileViewList!.addAll(widget.profiles); + widget.profileViewList!.removeWhere((element) => element.responseId == appState.getAuthenticatedUser()?.patientId); + insuranceViewModel = Provider.of(context, listen: false); DialogService dialogService = getIt.get(); if (widget.isRequestDesign) { return Column( @@ -71,15 +93,15 @@ class _FamilyCardsState extends State { ], ), SizedBox(height: 24.h), - widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).isEmpty + widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).isEmpty ? Utils.getNoDataWidget(context) : ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.zero, - itemCount: widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).length, + itemCount: widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).length, itemBuilder: (context, index) { - final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList(); + final mySideProfiles = widget.profileViewList!.where((profile) => profile.isRequestFromMySide ?? false).toList(); FamilyFileResponseModelLists profile = mySideProfiles[index]; return Container( margin: EdgeInsets.only(bottom: 12.h), @@ -102,7 +124,7 @@ class _FamilyCardsState extends State { : profile.status == FamilyFileEnum.active.toInt ? AppColors.lightGreenColor : AppColors.lightGrayBGColor, - chipText: profile.statusDescription ?? "N/A", + chipText: profile.statusDescription ?? " N/A", iconAsset: null, isShowBorder: false, borderRadius: 8.h, @@ -146,113 +168,252 @@ class _FamilyCardsState extends State { ], ); } else { - return GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: widget.profiles.length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 10.w, - mainAxisSpacing: 10.h, - childAspectRatio: widget.isShowDetails ? 0.56.h : 0.64.h, - ), - padding: EdgeInsets.only(bottom: 20.h), - itemBuilder: (context, index) { - final profile = widget.profiles[index]; - final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); - final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; - final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); - return Container( - padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), - child: Opacity( - opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active - child: Stack( + return Column( + children: [ + Container( + width: double.infinity, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r), + child: Padding( + padding: EdgeInsets.all(16.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( - mainAxisSize: MainAxisSize.min, + Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Utils.buildImgWithAssets( - icon: profile.gender == null - ? AppAssets.dummyUser - : profile.gender == 1 - ? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.maleImg) - : (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg), - width: 72.h, - height: 70.h, + Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.maleImg : AppAssets.femaleImg, width: 56.w, height: 56.h), + SizedBox(width: 8.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width * 0.6, + child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}" + .toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 2), + ), + SizedBox(height: 4.h), + Wrap( + direction: Axis.horizontal, + spacing: 4.w, + runSpacing: 6.w, + children: [ + AppCustomChipWidget( + icon: AppAssets.file_icon, + richText: "${LocaleKeys.fileno.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}".toText10(isEnglishOnly: true), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), + ), + AppCustomChipWidget( + icon: AppAssets.checkmark_icon, + labelText: LocaleKeys.verified.tr(context: context), + iconColor: AppColors.successColor, + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: 6.w), + ), + ], + ), + ], + ) + ], + ), + SizedBox(height: 16.h), + Divider(color: AppColors.dividerColor, height: 1.h), + SizedBox(height: 16.h), + Wrap( + direction: Axis.horizontal, + spacing: 4.h, + runSpacing: 4.h, + children: [ + AppCustomChipWidget( + labelText: LocaleKeys.ageYearsOld.tr(namedArgs: {'age': '${appState.getAuthenticatedUser()!.age}', 'yearsOld': LocaleKeys.yearsOld.tr(context: context)}, context: context), + labelPadding: EdgeInsetsDirectional.only(start: 8.w, end: 8.w), ), - SizedBox(height: 8.h), - (profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), - SizedBox(height: 8.h), - CustomChipWidget( - chipType: ChipTypeEnum.alert, - backgroundColor: AppColors.lightGrayBGColor, - chipText: "Relation:${profile.relationship ?? " N/A"}", - iconAsset: AppAssets.heart, - isShowBorder: false, - borderRadius: 8.h, - textColor: AppColors.textColor), - widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(), - widget.isShowDetails - ? CustomChipWidget( + AppCustomChipWidget( + icon: AppAssets.blood_icon, + labelText: appState.getUserBloodGroup.isEmpty ? "N/A" : appState.getUserBloodGroup, + iconColor: AppColors.primaryRedColor, + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), + padding: EdgeInsets.zero, + ), + Consumer(builder: (context, insuranceVM, child) { + return AppCustomChipWidget( + icon: insuranceVM.isInsuranceExpired + ? AppAssets.cancel_circle_icon + : insuranceVM.isInsuranceActive + ? AppAssets.insurance_active_icon + : AppAssets.alertSquare, + labelText: insuranceVM.isInsuranceExpired + ? LocaleKeys.insuranceExpired.tr(context: context) + : insuranceVM.isInsuranceActive + ? LocaleKeys.insuranceActive.tr(context: context) + : LocaleKeys.insuranceInActive.tr(context: context), + iconColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceVM.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, + textColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceVM.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, + iconSize: 12.w, + deleteIcon: insuranceVM.isInsuranceActive ? null : AppAssets.forward_chevron_icon, + deleteIconColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceVM.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, + deleteIconHasColor: true, + onChipTap: () { + if (!insuranceVM.isInsuranceActive) { + insuranceVM.setIsInsuranceUpdateDetailsLoading(true); + insuranceVM.getPatientInsuranceDetailsForUpdate( + appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); + showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + // showCommonBottomSheetWithoutHeight( + // title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), + // navigationService.navigatorKey.currentContext!, + // child: Utils.getWarningWidget( + // loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), + // confirmText: LocaleKeys.contactUs.tr(context: context), + // isShowActionButtons: true, + // onCancelTap: () { + // navigationService.pop(); + // }, + // onConfirmTap: () async { + // launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); + // }), + // callBackFunc: () {}, + // isFullScreen: false, + // isCloseButtonVisible: true, + // ); + } + }, + backgroundColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor.withOpacity(0.1) + : insuranceVM.isInsuranceActive + ? AppColors.successColor.withOpacity(0.1) + : AppColors.warningColorYellow.withOpacity(0.1), + labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: insuranceVM.isInsuranceActive ? 6.w : 0.w), + ).toShimmer2(isShow: insuranceVM.isInsuranceLoading); + }), + ], + ), + ], + ), + ), + ).paddingSymmetrical(0.w, 0.0), + SizedBox(height: 16.h), + GridView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: widget.profileViewList!.length, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 10.w, + mainAxisSpacing: 10.h, + childAspectRatio: widget.isShowDetails ? 0.56.h : 0.74.h, + ), + padding: EdgeInsets.only(bottom: 20.h), + itemBuilder: (context, index) { + final profile = widget.profileViewList![index]; + final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); + final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; + final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); + return Container( + padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r), + child: Opacity( + opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active + child: Stack( + children: [ + Column( + mainAxisSize: MainAxisSize.min, + children: [ + Utils.buildImgWithAssets( + icon: profile.gender == null + ? AppAssets.dummyUser + : profile.gender == 1 + ? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.maleImg) + : (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg), + width: 72.h, + height: 70.h, + ), + SizedBox(height: 8.h), + (profile.patientName ?? "Unknown").toText14(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), + SizedBox(height: 8.h), + CustomChipWidget( chipType: ChipTypeEnum.alert, backgroundColor: AppColors.lightGrayBGColor, - chipText: "Age:${profile.age ?? "N/A"} Years", + chipText: "Relation: ${profile.relationship ?? " N/A"}", + iconAsset: AppAssets.heart, isShowBorder: false, borderRadius: 8.h, - textColor: AppColors.textColor, - ) - : SizedBox(), - widget.isShowDetails - ? SizedBox(height: 8.h) - : SizedBox( - height: 4.h, - ), - Spacer(), - widget.isForWalletRecharge ? CustomButton( - height: 40.h, - onPressed: () { - widget.onSelect(profile); - // if (canSwitch) widget.onSelect(profile); - }, - text: LocaleKeys.select.tr(context: context), - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 13.h, - icon: AppAssets.activeCheck, - iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor, - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0), - ).paddingOnly(top: 0, bottom: 0) : CustomButton( - height: 40.h, - onPressed: () { - if (canSwitch) widget.onSelect(profile); - }, - text: isActive ? LocaleKeys.active.tr(context: context) : LocaleKeys.switchLogin.tr(context: context), - backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, - borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, - textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor, - fontSize: 13.h, - icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user, - iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor, - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0), - ).paddingOnly(top: 0, bottom: 0), + textColor: AppColors.textColor), + widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(), + widget.isShowDetails + ? CustomChipWidget( + chipType: ChipTypeEnum.alert, + backgroundColor: AppColors.lightGrayBGColor, + chipText: "Age: ${profile.age ?? "N/A"} Years", + isShowBorder: false, + borderRadius: 8.h, + textColor: AppColors.textColor, + ) + : SizedBox(), + widget.isShowDetails + ? SizedBox(height: 8.h) + : SizedBox( + height: 4.h, + ), + Spacer(), + widget.isForWalletRecharge + ? CustomButton( + height: 40.h, + onPressed: () { + widget.onSelect(profile); + // if (canSwitch) widget.onSelect(profile); + }, + text: LocaleKeys.select.tr(context: context), + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 13.h, + icon: AppAssets.activeCheck, + iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor, + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0), + ).paddingOnly(top: 0, bottom: 0) + : CustomButton( + height: 40.h, + onPressed: () { + if (canSwitch) widget.onSelect(profile); + }, + text: isActive ? LocaleKeys.active.tr(context: context) : LocaleKeys.switchLogin.tr(context: context), + backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, + borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, + textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor, + fontSize: 13.h, + icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user, + iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor, + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0), + ).paddingOnly(top: 0, bottom: 0), + ], + ), + if (widget.isShowRemoveButton) ...[ + Positioned( + top: 0, + right: 0, + child: Utils.buildSvgWithAssets(icon: AppAssets.deleteIcon).onPress(() { + if (!isActive) widget.onRemove(profile); + }), + ), + ], ], ), - if (widget.isShowRemoveButton) ...[ - Positioned( - top: 0, - right: 0, - child: Utils.buildSvgWithAssets(icon: AppAssets.deleteIcon).onPress(() { - if (!isActive) widget.onRemove(profile); - }), - ), - ], - ], - ), - ), - ); - }, + ), + ); + }, + ), + ], ); } } @@ -260,15 +421,15 @@ class _FamilyCardsState extends State { Widget manageFamily() { NavigationService navigationService = getIt(); - return widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).isEmpty + return widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).isEmpty ? Utils.getNoDataWidget(context) : ListView.builder( shrinkWrap: true, physics: NeverScrollableScrollPhysics(), padding: EdgeInsetsGeometry.zero, - itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length, + itemCount: widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).length, itemBuilder: (context, index) { - final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList(); + final otherProfiles = widget.profileViewList!.where((profile) => !(profile.isRequestFromMySide ?? false)).toList(); FamilyFileResponseModelLists profile = otherProfiles[index]; return Container( margin: EdgeInsets.only(bottom: 12.h), diff --git a/lib/presentation/my_invoices/my_invoices_details_page.dart b/lib/presentation/my_invoices/my_invoices_details_page.dart index a38194fe..79e1adc3 100644 --- a/lib/presentation/my_invoices/my_invoices_details_page.dart +++ b/lib/presentation/my_invoices/my_invoices_details_page.dart @@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/my_invoices/models/get_invoice_details_response_model.dart'; +import 'package:hmg_patient_app_new/features/my_invoices/models/get_invoices_list_response_model.dart'; import 'package:hmg_patient_app_new/features/my_invoices/my_invoices_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -20,8 +21,9 @@ import 'package:provider/provider.dart'; class MyInvoicesDetailsPage extends StatefulWidget { GetInvoiceDetailsResponseModel getInvoiceDetailsResponseModel; + GetInvoicesListResponseModel getInvoicesListResponseModel; - MyInvoicesDetailsPage({super.key, required this.getInvoiceDetailsResponseModel}); + MyInvoicesDetailsPage({super.key, required this.getInvoiceDetailsResponseModel, required this.getInvoicesListResponseModel}); @override State createState() => _MyInvoicesDetailsPageState(); @@ -82,6 +84,26 @@ class _MyInvoicesDetailsPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + Wrap( + alignment: WrapAlignment.start, + direction: Axis.horizontal, + spacing: 6.w, + runSpacing: 6.h, + children: [ + AppCustomChipWidget( + icon: AppAssets.walkin_appointment_icon, + iconColor: AppColors.textColor, + labelText: LocaleKeys.walkin.tr(context: context), + textColor: AppColors.textColor, + ), + AppCustomChipWidget( + labelText: LocaleKeys.outPatient.tr(context: context), + backgroundColor: AppColors.warningColorYellow.withValues(alpha: 0.1), + textColor: AppColors.warningColorYellow, + ), + ], + ), + SizedBox(height: 16.h), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -93,6 +115,29 @@ class _MyInvoicesDetailsPageState extends State { height: 63.h, fit: BoxFit.cover, ).circle(100.r), + Transform.translate( + offset: Offset(0.0, -20.h), + child: Container( + width: 40.w, + height: 40.h, + decoration: BoxDecoration( + color: AppColors.whiteColor, + shape: BoxShape.circle, // Makes the container circular + border: Border.all( + color: AppColors.scaffoldBgColor, // Color of the border + width: 1.5.w, // Width of the border + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.rating_icon, width: 15.w, height: 15.h, applyThemeColor: false), + SizedBox(height: 2.h), + "${widget.getInvoicesListResponseModel.decimalDoctorRate}".toText11(isBold: true, color: AppColors.textColor), + ], + ), + ).circle(100), + ), ], ), SizedBox(width: 16.w), @@ -138,41 +183,46 @@ class _MyInvoicesDetailsPageState extends State { ), ), SizedBox(height: 16.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: true, - ), - child: Padding( - padding: EdgeInsets.all(14.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - widget.getInvoiceDetailsResponseModel.listConsultation!.first.procedureName!.toText16(isBold: true), - SizedBox(height: 16.h), - Wrap( - direction: Axis.horizontal, - spacing: 6.w, - runSpacing: 6.h, + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + ), + child: Padding( + padding: EdgeInsets.all(14.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppCustomChipWidget( - labelText: "${LocaleKeys.quantity.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.quantity!}", - labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), - ), - AppCustomChipWidget( - labelText: "${LocaleKeys.price.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.price!} ${LocaleKeys.sar.tr()}", - labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), - ), - AppCustomChipWidget( - labelText: "${LocaleKeys.total.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.total!} ${LocaleKeys.sar.tr()}", - labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), + widget.getInvoiceDetailsResponseModel.listConsultation!.first.procedureName!.toText16(isBold: true), + SizedBox(height: 16.h), + Wrap( + direction: Axis.horizontal, + spacing: 6.w, + runSpacing: 6.h, + children: [ + AppCustomChipWidget( + labelText: "${LocaleKeys.quantity.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.quantity!}", + labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), + ), + AppCustomChipWidget( + labelText: "${LocaleKeys.price.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.price!} ${LocaleKeys.sar.tr()}", + labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), + ), + AppCustomChipWidget( + labelText: "${LocaleKeys.total.tr()}: ${widget.getInvoiceDetailsResponseModel.listConsultation!.first.total!} ${LocaleKeys.sar.tr()}", + labelPadding: EdgeInsetsDirectional.only(start: 6.w, end: 6.w), + ), + ], ), ], ), - ], + ), ), - ), + ], ), SizedBox(height: 16.h), Container( diff --git a/lib/presentation/my_invoices/my_invoices_list.dart b/lib/presentation/my_invoices/my_invoices_list.dart index 177dde84..054d2fce 100644 --- a/lib/presentation/my_invoices/my_invoices_list.dart +++ b/lib/presentation/my_invoices/my_invoices_list.dart @@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/my_invoices/my_invoices_details_page.dart'; +import 'package:hmg_patient_app_new/presentation/my_invoices/widgets/invoice_filter_bottom_sheet.dart'; import 'package:hmg_patient_app_new/presentation/my_invoices/widgets/invoice_list_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -21,6 +22,8 @@ import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; +import '../../widgets/buttons/custom_button.dart'; + class MyInvoicesList extends StatefulWidget { const MyInvoicesList({super.key}); @@ -40,6 +43,75 @@ class _MyInvoicesListState extends State { super.initState(); } + void _showHospitalFilterBottomSheet(BuildContext context) { + myInvoicesViewModel.prepareFilterList(InvoiceFilterType.hospital); + + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.selectHospital.tr(context: context), + context, + child: InvoiceFilterBottomSheet( + title: LocaleKeys.hospital.tr(context: context), + onItemSelected: (selectedHospital) { + Navigator.pop(context); + myInvoicesViewModel.filterInvoicesByHospital(selectedHospital); + }, + ), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + myInvoicesViewModel.clearFilterSearch(); + }, + ); + } + + void _showClinicFilterBottomSheet(BuildContext context) { + myInvoicesViewModel.prepareFilterList(InvoiceFilterType.clinic); + + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.selectClinic.tr(context: context), + context, + child: InvoiceFilterBottomSheet( + title: LocaleKeys.clinic.tr(context: context), + onItemSelected: (selectedClinic) { + Navigator.pop(context); + myInvoicesViewModel.filterInvoicesByClinic(selectedClinic); + }, + ), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + myInvoicesViewModel.clearFilterSearch(); + }, + ); + } + + void _showDoctorFilterBottomSheet(BuildContext context) { + myInvoicesViewModel.prepareFilterList(InvoiceFilterType.doctor); + + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.selectDoctor.tr(context: context), + context, + child: InvoiceFilterBottomSheet( + title: LocaleKeys.doctor.tr(context: context), + onItemSelected: (selectedDoctor) { + Navigator.pop(context); + myInvoicesViewModel.filterInvoicesByDoctor(selectedDoctor); + }, + ), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + myInvoicesViewModel.clearFilterSearch(); + }, + ); + } + @override Widget build(BuildContext context) { myInvoicesViewModel = Provider.of(context, listen: false); @@ -50,62 +122,133 @@ class _MyInvoicesListState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 24.h), + SizedBox(height: 16.h), + Row( + children: [ + CustomButton( + text: LocaleKeys.allInvoices.tr(context: context), + onPressed: () { + myInvoicesViewModel.filterInvoices(InvoiceFilterType.all); + }, + backgroundColor: myInvoicesVM.currentFilter == InvoiceFilterType.all ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: myInvoicesVM.currentFilter == InvoiceFilterType.all ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + textColor: myInvoicesVM.currentFilter == InvoiceFilterType.all ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.hospitals.tr(context: context), + onPressed: () { + if (myInvoicesVM.allInvoicesList.isEmpty) return; + _showHospitalFilterBottomSheet(context); + }, + backgroundColor: myInvoicesVM.currentFilter == InvoiceFilterType.hospital ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: myInvoicesVM.currentFilter == InvoiceFilterType.hospital ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + textColor: myInvoicesVM.currentFilter == InvoiceFilterType.hospital ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.clinics.tr(context: context), + onPressed: () { + if (myInvoicesVM.allInvoicesList.isEmpty) return; + _showClinicFilterBottomSheet(context); + }, + backgroundColor: myInvoicesVM.currentFilter == InvoiceFilterType.clinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: myInvoicesVM.currentFilter == InvoiceFilterType.clinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + textColor: myInvoicesVM.currentFilter == InvoiceFilterType.clinic ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + SizedBox(width: 8.h), + CustomButton( + text: LocaleKeys.doctors.tr(context: context), + onPressed: () { + if (myInvoicesVM.allInvoicesList.isEmpty) return; + _showDoctorFilterBottomSheet(context); + }, + backgroundColor: myInvoicesVM.currentFilter == InvoiceFilterType.doctor ? AppColors.bgRedLightColor : AppColors.whiteColor, + borderColor: myInvoicesVM.currentFilter == InvoiceFilterType.doctor ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + textColor: myInvoicesVM.currentFilter == InvoiceFilterType.doctor ? AppColors.primaryRedColor : AppColors.blackColor, + fontSize: 12, + fontWeight: FontWeight.w500, + borderRadius: 10, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + ), + ], + ).paddingSymmetrical(24.h, 0.h), + SizedBox(height: 16.h), ListView.builder( - itemCount: myInvoicesVM.isInvoicesListLoading ? 4 : myInvoicesVM.allInvoicesList.isEmpty ? 1 : myInvoicesVM.allInvoicesList.length, + itemCount: myInvoicesVM.isInvoicesListLoading + ? 4 + : myInvoicesVM.allInvoicesList.isEmpty + ? 1 + : myInvoicesVM.allInvoicesList.length, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, padding: EdgeInsetsGeometry.zero, itemBuilder: (context, index) { return myInvoicesVM.isInvoicesListLoading - ? LabResultItemView( - onTap: () {}, - labOrder: null, - index: index, - isLoading: true, - ) - : myInvoicesVM.allInvoicesList.isNotEmpty ? AnimationConfiguration.staggeredList( - position: index, - duration: const Duration(milliseconds: 500), - child: SlideAnimation( - verticalOffset: 100.0, - child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - child: InvoiceListCard( - getInvoicesListResponseModel: myInvoicesVM.allInvoicesList[index], - onTap: () async { - myInvoicesVM.setInvoiceDetailLoading(); - LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingInvoiceDetails.tr(context: context)); - await myInvoicesVM.getInvoiceDetails( - appointmentNo: myInvoicesVM.allInvoicesList[index].appointmentNo!, - invoiceNo: myInvoicesVM.allInvoicesList[index].invoiceNo!, - projectID: myInvoicesVM.allInvoicesList[index].projectID!, - onSuccess: (val) { - LoaderBottomSheet.hideLoader(); - Navigator.of(context).push( - CustomPageRoute( - page: MyInvoicesDetailsPage(getInvoiceDetailsResponseModel: myInvoicesVM.invoiceDetailsResponseModel), - ), - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); - }, + ? LabResultItemView(onTap: () {}, labOrder: null, index: index, isLoading: true) + : myInvoicesVM.allInvoicesList.isNotEmpty + ? AnimationConfiguration.staggeredList( + position: index, + duration: const Duration(milliseconds: 500), + child: SlideAnimation( + verticalOffset: 100.0, + child: FadeInAnimation( + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + child: InvoiceListCard( + getInvoicesListResponseModel: myInvoicesVM.allInvoicesList[index], + onTap: () async { + myInvoicesVM.setInvoiceDetailLoading(); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingInvoiceDetails.tr(context: context)); + await myInvoicesVM.getInvoiceDetails( + appointmentNo: myInvoicesVM.allInvoicesList[index].appointmentNo!, + invoiceNo: myInvoicesVM.allInvoicesList[index].invoiceNo!, + projectID: myInvoicesVM.allInvoicesList[index].projectID!, + onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + Navigator.of(context).push( + CustomPageRoute( + page: MyInvoicesDetailsPage( + getInvoiceDetailsResponseModel: myInvoicesVM.invoiceDetailsResponseModel, + getInvoicesListResponseModel: myInvoicesVM.allInvoicesList[index], + ), + ), + ); + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }, + ), + ), ), ), - ), - ), - ) : Utils.getNoDataWidget(context); + ) + : Utils.getNoDataWidget(context); }).paddingSymmetrical(24.w, 0.h), ], ); diff --git a/lib/presentation/my_invoices/widgets/invoice_filter_bottom_sheet.dart b/lib/presentation/my_invoices/widgets/invoice_filter_bottom_sheet.dart new file mode 100644 index 00000000..340f1020 --- /dev/null +++ b/lib/presentation/my_invoices/widgets/invoice_filter_bottom_sheet.dart @@ -0,0 +1,133 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/enums.dart'; +import 'package:hmg_patient_app_new/core/utils/debouncer.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/my_invoices/my_invoices_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +import 'package:provider/provider.dart'; + +class InvoiceFilterBottomSheet extends StatelessWidget { + final Function(String) onItemSelected; + final String title; + + const InvoiceFilterBottomSheet({ + super.key, + required this.onItemSelected, + required this.title, + }); + + @override + Widget build(BuildContext context) { + final debouncer = Debouncer(milliseconds: 500); + + return Consumer( + builder: (context, vm, child) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextInputWidget( + labelText: LocaleKeys.search.tr(context: context), + hintText: "Search $title", + controller: vm.filterSearchController, + onChange: (value) { + debouncer.run(() { + vm.searchFilterItems(value ?? ""); + }); + }, + isEnable: true, + prefix: null, + autoFocus: false, + isBorderAllowed: false, + keyboardType: TextInputType.text, + isAllowLeadingIcon: true, + selectionType: SelectionTypeEnum.search, + padding: EdgeInsets.symmetric( + vertical: ResponsiveExtension(10).h, + horizontal: ResponsiveExtension(15).h, + ), + ), + SizedBox(height: 24.h), + SizedBox( + height: MediaQuery.sizeOf(context).height * 0.4, + child: vm.filterDisplayList.isEmpty + ? Center( + child: Text( + "No $title found", + style: TextStyle( + fontSize: 16, + color: AppColors.greyTextColor, + ), + ), + ) + : ListView.separated( + itemBuilder: (_, index) { + final item = vm.filterDisplayList[index]; + return FilterListItem( + itemName: item, + ).onPress(() { + vm.selectFilterItem(item); + onItemSelected(item); + }); + }, + separatorBuilder: (_, __) => SizedBox(height: 16.h), + itemCount: vm.filterDisplayList.length, + ), + ), + ], + ); + }, + ); + } +} + +class FilterListItem extends StatelessWidget { + final String itemName; + + const FilterListItem({super.key, required this.itemName}); + + AppState get appState => getIt.get(); + + @override + Widget build(BuildContext context) { + return DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: false, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + itemName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + color: AppColors.blackColor, + ), + ), + ), + Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.blackColor, + width: 18.h, + height: 13.h, + fit: BoxFit.contain, + ), + ), + ], + ).paddingSymmetrical(16.h, 16.h), + ); + } +} diff --git a/lib/presentation/my_invoices/widgets/invoice_list_card.dart b/lib/presentation/my_invoices/widgets/invoice_list_card.dart index 6e0fa0e4..e5ae7de8 100644 --- a/lib/presentation/my_invoices/widgets/invoice_list_card.dart +++ b/lib/presentation/my_invoices/widgets/invoice_list_card.dart @@ -47,8 +47,8 @@ class InvoiceListCard extends StatelessWidget { ), AppCustomChipWidget( labelText: LocaleKeys.outPatient.tr(context: context), - backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1), - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.warningColorYellow.withValues(alpha: 0.1), + textColor: AppColors.warningColorYellow, ), ], ), diff --git a/lib/presentation/prescriptions/prescription_detail_page.dart b/lib/presentation/prescriptions/prescription_detail_page.dart index b9b5b789..0ac9ce40 100644 --- a/lib/presentation/prescriptions/prescription_detail_page.dart +++ b/lib/presentation/prescriptions/prescription_detail_page.dart @@ -4,6 +4,8 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; @@ -23,6 +25,8 @@ import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'dart:ui' as ui; + class PrescriptionDetailPage extends StatefulWidget { PrescriptionDetailPage({super.key, required this.prescriptionsResponseModel, required this.isFromAppointments}); @@ -61,8 +65,9 @@ class _PrescriptionDetailPageState extends State { Expanded( child: CollapsingListView( title: LocaleKeys.prescriptions.tr(context: context), - instructions: () async { - LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context)); + instructions: widget.prescriptionsResponseModel.isInOutPatient! + ? () async { + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context)); await prescriptionsViewModel.getPrescriptionInstructionsPDF(widget.prescriptionsResponseModel, onSuccess: (val) { LoaderBottomSheet.hideLoader(); if (prescriptionsViewModel.prescriptionInstructionsPDFLink.isNotEmpty) { @@ -87,7 +92,8 @@ class _PrescriptionDetailPageState extends State { isCloseButtonVisible: true, ); }); - }, + } + : null, child: SingleChildScrollView( child: Consumer(builder: (context, prescriptionVM, child) { return Column( @@ -105,6 +111,13 @@ class _PrescriptionDetailPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppCustomChipWidget( + labelText: + "${getIt.get().isArabic() ? widget.prescriptionsResponseModel.isInOutPatientDescriptionN : widget.prescriptionsResponseModel.isInOutPatientDescription}", + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, + ), + SizedBox(height: 16.h), Row( mainAxisSize: MainAxisSize.min, children: [ @@ -124,11 +137,15 @@ class _PrescriptionDetailPageState extends State { spacing: 4.h, runSpacing: 4.h, children: [ - AppCustomChipWidget( - icon: AppAssets.doctor_calendar_icon, - labelText: DateUtil.formatDateToDate( - DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false), - labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h), + Directionality( + textDirection: ui.TextDirection.ltr, + child: AppCustomChipWidget( + icon: AppAssets.doctor_calendar_icon, + labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.prescriptionsResponseModel.appointmentDate), false), + isEnglishOnly: true + , + labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h), + ), ), AppCustomChipWidget( labelText: widget.prescriptionsResponseModel.clinicDescription!, @@ -225,9 +242,7 @@ class _PrescriptionDetailPageState extends State { hasShadow: true, ), child: CustomButton( - text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! - ? LocaleKeys.resendOrder.tr(context: context) - : LocaleKeys.prescriptionDeliveryError.tr(context: context), + text: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? LocaleKeys.resendOrder.tr(context: context) : LocaleKeys.prescriptionDeliveryError.tr(context: context), onPressed: () async { if (widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported!) { LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); @@ -237,18 +252,16 @@ class _PrescriptionDetailPageState extends State { }); } }, - backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color, + backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.15), borderColor: AppColors.successColor.withOpacity(0.01), - textColor: - widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35), + textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35), fontSize: 16, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 50.h, icon: AppAssets.prescription_refill_icon, - iconColor: - widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35), + iconColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35), iconSize: 20.h, ).paddingSymmetrical(24.h, 24.h), ), diff --git a/lib/presentation/prescriptions/prescription_item_view.dart b/lib/presentation/prescriptions/prescription_item_view.dart index 38b96d37..1c145115 100644 --- a/lib/presentation/prescriptions/prescription_item_view.dart +++ b/lib/presentation/prescriptions/prescription_item_view.dart @@ -13,6 +13,7 @@ import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/scroll_wheel_time_picker.dart'; class PrescriptionItemView extends StatelessWidget { int index; @@ -47,7 +48,7 @@ class PrescriptionItemView extends StatelessWidget { fit: BoxFit.fill, ).toShimmer2(isShow: isLoading).circle(100), Expanded( - child: (isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].itemDescription!).toText16(isBold: true, maxlines: 2).toShimmer2(isShow: isLoading), + child: (isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].itemDescription!).toText16(isBold: true, maxlines: 2, isEnglishOnly: true).toShimmer2(isShow: isLoading), ), ], ).paddingSymmetrical(16.h, 0.h), @@ -78,7 +79,9 @@ class PrescriptionItemView extends StatelessWidget { children: [ Utils.buildSvgWithAssets(icon: AppAssets.prescription_remarks_icon, width: 18.h, height: 18.h), SizedBox(width: 9.h), - Expanded(child: "${LocaleKeys.remarks.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].remarks!}".toText10(isBold: true)), + Expanded( + child: "${LocaleKeys.remarks.tr(context: context)} ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].remarks!}".toText10(isBold: true, isEnglishOnly: true), + ), ], ).paddingSymmetrical(16.h, 0.h), SizedBox(height: 14.h), @@ -95,61 +98,74 @@ class PrescriptionItemView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.setReminder.tr(context: context).toText13(isBold: true), - "Notify me before the consumption time".toText10(color: AppColors.textColorLight), + "Notify me before the consumption time".toText10(color: AppColors.textColorLight, isEnglishOnly: true), ], ).toShimmer2(isShow: isLoading).expanded, Switch( activeColor: AppColors.successColor, activeTrackColor: AppColors.successColor.withValues(alpha: .15), value: isLoading ? false : prescriptionVM.prescriptionDetailsList[index].hasReminder!, + // value: prescriptionVM.prescriptionDetailsList[index].hasReminder ?? false, onChanged: (newValue) async { CalenderUtilsNew calender = CalenderUtilsNew.instance; - if (prescriptionVM.prescriptionDetailsList[index].hasReminder ?? false) { - LoaderBottomSheet.showLoader(loadingText: "Removing Reminders"); - bool resultValue = await calender.checkAndRemoveMultipleItems(id: prescriptionVM.prescriptionDetailsList[index].itemID.toString()); + if (await prescriptionVM.checkIfReminderExistForPrescription(index)) { + prescriptionVM.prescriptionDetailsList[index].hasReminder = true; - prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]); - LoaderBottomSheet.hideLoader(); - return; - } + LoaderBottomSheet.showLoader(loadingText: "Removing Reminders"); + bool resultValue = await calender.checkAndRemoveMultipleItems(id: prescriptionVM.prescriptionDetailsList[index].itemID.toString()); + + prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]); + LoaderBottomSheet.hideLoader(); + return; + + } else { + DateTime startDate = DateTime.now(); + prescriptionVM.serSelectedTime(startDate); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionVM.prescriptionDetailsList[index].days!.toInt()); + showCommonBottomSheetWithoutHeight( + context, + child: bottomSheetContent(context), + title: LocaleKeys.timeForFirstReminder.tr(), - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionVM.prescriptionDetailsList[index].days!.toInt()); - BottomSheetUtils().showReminderBottomSheet( - context, - endDate, - "", - prescriptionVM.prescriptionDetailsList[index].itemID.toString(), - "", - "", - title: "${prescriptionVM.prescriptionDetailsList[index].itemDescription} Prescription Reminder", - description: - "${prescriptionVM.prescriptionDetailsList[index].itemDescription} ${prescriptionVM.prescriptionDetailsList[index].frequency} ${prescriptionVM.prescriptionDetailsList[index].route} ", - onSuccess: () {}, - isMultiAllowed: true, - onMultiDateSuccess: (int selectedIndex) async { - bool isEventAdded = await calender.createMultipleEvents( - reminderMinutes: selectedIndex, - frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(), - days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(), - orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!, - itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!, - route: prescriptionVM.prescriptionDetailsList[index].route!, - onFailure: (errorMessage) => prescriptionVM.showError(errorMessage), - prescriptionNumber: prescriptionVM.prescriptionDetailsList[index].itemID.toString(), - ); - prescriptionVM.setPrescriptionItemReminder(isEventAdded, prescriptionVM.prescriptionDetailsList[index]); - // setCalender(context, - // eventId: prescriptionVM.prescriptionDetailsList[index].itemID.toString(), - // selectedMinutes: selectedIndex, - // frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(), - // days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(), - // orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!, - // itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!, - // route: prescriptionVM.prescriptionDetailsList[index].route!); - }, - ); + isCloseButtonVisible: true + ); + + // BottomSheetUtils().showReminderBottomSheet( + // context, + // endDate, + // "", + // prescriptionVM.prescriptionDetailsList[index].itemID.toString(), + // "", + // "", + // title: "${prescriptionVM.prescriptionDetailsList[index].itemDescription} Prescription Reminder", + // description: + // "${prescriptionVM.prescriptionDetailsList[index].itemDescription} ${prescriptionVM.prescriptionDetailsList[index].frequency} ${prescriptionVM.prescriptionDetailsList[index].route} ", + // onSuccess: () {}, + // isMultiAllowed: true, + // onMultiDateSuccess: (int selectedIndex) async { + // bool isEventAdded = await calender.createMultipleEvents( + // reminderMinutes: selectedIndex, + // frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(), + // days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(), + // orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!, + // itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!, + // route: prescriptionVM.prescriptionDetailsList[index].route!, + // onFailure: (errorMessage) => prescriptionVM.showError(errorMessage), + // prescriptionNumber: prescriptionVM.prescriptionDetailsList[index].itemID.toString(), + // ); + // prescriptionVM.setPrescriptionItemReminder(isEventAdded, prescriptionVM.prescriptionDetailsList[index]); + // // setCalender(context, + // // eventId: prescriptionVM.prescriptionDetailsList[index].itemID.toString(), + // // selectedMinutes: selectedIndex, + // // frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(), + // // days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(), + // // orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!, + // // itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!, + // // route: prescriptionVM.prescriptionDetailsList[index].route!); + // }, + // ); + } }, ).toShimmer2(isShow: isLoading), ], @@ -180,4 +196,47 @@ class PrescriptionItemView extends StatelessWidget { ), ); } + + Widget bottomSheetContent(BuildContext context) { + return Column( + children: [ + SizedBox(height: 4.h), + LocaleKeys.reminderRemovalNote.tr().toText14(isBold: true, color: AppColors.warningColorYellow), + SizedBox(height: 8.h), + ScrollWheelTimePicker( + initialHour: DateTime.now().hour, + initialMinute: DateTime.now().minute, + use24HourFormat: true, + pickerHeight: 120.h, + itemExtent: 100.h, + onTimeChanged: (time) { + // Handle selected time + debugPrint('Selected time: ${time.hour}:${time.minute}'); + prescriptionVM.serSelectedTime(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, time.hour, time.minute)); + }, + ), + SizedBox(height: 8.h), + CustomButton( + backgroundColor: AppColors.successColor, + borderColor: AppColors.successColor, + text: LocaleKeys.confirm.tr(), onPressed: () async { + CalenderUtilsNew calender = CalenderUtilsNew.instance; + bool isEventAdded = await calender.createMultipleEvents( + reminderMinutes: 10, + frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(), + days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(), + orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!, + itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!, + route: prescriptionVM.prescriptionDetailsList[index].route!, + onFailure: (errorMessage) => prescriptionVM.showError(errorMessage), + prescriptionNumber: prescriptionVM.prescriptionDetailsList[index].itemID.toString(), + scheduleDateTime: prescriptionVM.selectedReminderTime, + ); + prescriptionVM.setPrescriptionItemReminder(isEventAdded, prescriptionVM.prescriptionDetailsList[index]); + Navigator.of(context).pop(); + }) + + ], + ); + } } diff --git a/lib/presentation/prescriptions/prescriptions_list_page.dart b/lib/presentation/prescriptions/prescriptions_list_page.dart index cd507d41..3a54926f 100644 --- a/lib/presentation/prescriptions/prescriptions_list_page.dart +++ b/lib/presentation/prescriptions/prescriptions_list_page.dart @@ -24,6 +24,8 @@ import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; +import 'dart:ui' as ui; + class PrescriptionsListPage extends StatefulWidget { const PrescriptionsListPage({super.key}); @@ -67,52 +69,52 @@ class _PrescriptionsListPageState extends State { children: [ SizedBox(height: 16.h), // Clinic & Hospital Sort - Row( - children: [ - CustomButton( - text: LocaleKeys.byClinic.tr(context: context), - onPressed: () { - model.setIsSortByClinic(true); - }, - backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), - textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - SizedBox(width: 8.h), - CustomButton( - text: LocaleKeys.byHospital.tr(context: context), - onPressed: () { - model.setIsSortByClinic(false); - }, - backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, - borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor, - textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - ], - ).paddingSymmetrical(24.h, 0.h), - SizedBox(height: 20.h), + // Row( + // children: [ + // CustomButton( + // text: LocaleKeys.byClinic.tr(context: context), + // onPressed: () { + // model.setIsSortByClinic(true); + // }, + // backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + // borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), + // textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // SizedBox(width: 8.h), + // CustomButton( + // text: LocaleKeys.byHospital.tr(context: context), + // onPressed: () { + // model.setIsSortByClinic(false); + // }, + // backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + // borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor, + // textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // ], + // ).paddingSymmetrical(24.h, 0.h), + // SizedBox(height: 20.h), // Expandable list ListView.builder( itemCount: model.isPrescriptionsOrdersLoading ? 4 : model.patientPrescriptionOrders.isNotEmpty - ? model.patientPrescriptionOrdersViewList.length + ? model.patientPrescriptionOrders.length : 1, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, padding: const EdgeInsets.only(left: 0, right: 8), itemBuilder: (context, index) { - final isExpanded = expandedIndex == index; + // final isExpanded = expandedIndex == index; return model.isPrescriptionsOrdersLoading ? LabResultItemView( onTap: () {}, @@ -132,177 +134,415 @@ class _PrescriptionsListPageState extends State { curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), - child: InkWell( - onTap: () { - setState(() { - expandedIndex = isExpanded ? null : index; - }); - }, + child: Container( + key: ValueKey(index), + padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.all(16.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CustomButton( - text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available", - onPressed: () {}, - backgroundColor: AppColors.greyColor, - borderColor: AppColors.greyColor, - textColor: AppColors.blackColor, - fontSize: 10, - fontWeight: FontWeight.w500, - borderRadius: 8, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 30.h, - ), - Icon(isExpanded ? Icons.expand_less : Icons.expand_more), - ], + AppCustomChipWidget( + labelText: + "${getIt.get().isArabic() ? model.patientPrescriptionOrders[index].isInOutPatientDescriptionN : model.patientPrescriptionOrders[index].isInOutPatientDescription}", + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, + ), + SizedBox(height: 16.h), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.network( + model.patientPrescriptionOrders[index].doctorImageURL!, + width: 24.h, + height: 24.h, + fit: BoxFit.fill, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: model.patientPrescriptionOrders[index].doctorName!.toText14(weight: FontWeight.w500)), + ], + ), + SizedBox(height: 8.h), + Wrap( + direction: Axis.horizontal, + spacing: 6.h, + runSpacing: 6.h, + children: [ + Directionality( + textDirection: ui.TextDirection.ltr, + child: AppCustomChipWidget( + labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(model.patientPrescriptionOrders[index].appointmentDate), false), + isEnglishOnly: true, ), - SizedBox(height: 8.h), - (model.patientPrescriptionOrdersViewList[index].filterName ?? "").toText16(isBold: true) - ], - ), + ), + AppCustomChipWidget( + labelText: model.patientPrescriptionOrders[index].name, + ), + AppCustomChipWidget( + labelText: model.patientPrescriptionOrders[index].clinicDescription!, + ), + ], ), - AnimatedSwitcher( - duration: Duration(milliseconds: 500), - switchInCurve: Curves.easeIn, - switchOutCurve: Curves.easeOut, - transitionBuilder: (Widget child, Animation animation) { - return FadeTransition( - opacity: animation, - child: SizeTransition( - sizeFactor: animation, - axisAlignment: 0.0, - child: child, + SizedBox(height: 8.h), + Row( + children: [ + Expanded( + flex: 6, + child: CustomButton( + text: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! + ? LocaleKeys.resendOrder.tr(context: context) + : LocaleKeys.prescriptionDeliveryError.tr(context: context), + onPressed: () async { + if (model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported!) { + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); + await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + prescriptionsViewModel.initiatePrescriptionDelivery(); + }); + } + }, + backgroundColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! + ? AppColors.successColor.withOpacity(0.15) + : AppColors.textColor.withOpacity(0.15), + borderColor: AppColors.successColor.withOpacity(0.01), + textColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + fontSize: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? 14.f : 12.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 40.h, + icon: AppAssets.prescription_refill_icon, + iconColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + iconSize: 16.h, ), - ); - }, - child: isExpanded - ? Container( - key: ValueKey(index), - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.network( - prescription.doctorImageURL!, - width: 24.h, - height: 24.h, - fit: BoxFit.fill, - ).circle(100), - SizedBox(width: 8.h), - Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), - ], - ), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 6.h, - runSpacing: 6.h, - children: [ - AppCustomChipWidget( - labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), - ), - AppCustomChipWidget( - labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!, - ), - ], - ), - SizedBox(height: 8.h), - Row( - children: [ - Expanded( - flex: 6, - child: CustomButton( - text: prescription.isHomeMedicineDeliverySupported! - ? LocaleKeys.resendOrder.tr(context: context) - : LocaleKeys.prescriptionDeliveryError.tr(context: context), - onPressed: () async { - if (prescription.isHomeMedicineDeliverySupported!) { - LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); - await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], - onSuccess: (val) { - LoaderBottomSheet.hideLoader(); - prescriptionsViewModel.initiatePrescriptionDelivery(); - }); - } - }, - backgroundColor: - prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color, - borderColor: AppColors.successColor.withOpacity(0.01), - textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), - fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f, - fontWeight: FontWeight.w500, - borderRadius: 12.r, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - icon: AppAssets.prescription_refill_icon, - iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), - iconSize: 16.h, - ), - ), - SizedBox(width: 8.h), - Expanded( - flex: 1, - child: Container( - height: 40.h, - width: 40.w, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.textColor, - borderRadius: 12, - ), - child: Padding( - padding: EdgeInsets.all(12.h), - child: Transform.flip( - flipX: appState.isArabic(), - child: Utils.buildSvgWithAssets( - icon: AppAssets.forward_arrow_icon_small, - iconColor: AppColors.whiteColor, - fit: BoxFit.contain, - ), - ), - ), - ).onPress(() { - model.setPrescriptionsDetailsLoading(); - Navigator.of(context).push( - CustomPageRoute( - page: PrescriptionDetailPage( - prescriptionsResponseModel: prescription, - isFromAppointments: false, - ), - ), - ); - }), - ), - ], - ), - SizedBox(height: 12.h), - Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), - SizedBox(height: 12.h), - ], - ); - }).toList(), - ], + ), + SizedBox(width: 8.h), + Expanded( + flex: 1, + child: Container( + height: 40.h, + width: 40.w, + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.textColor, + borderRadius: 12, + ), + child: Padding( + padding: EdgeInsets.all(12.h), + child: Transform.flip( + flipX: appState.isArabic(), + child: Utils.buildSvgWithAssets( + icon: AppAssets.forward_arrow_icon_small, + iconColor: AppColors.whiteColor, + fit: BoxFit.contain, + ), + ), + ), + ).onPress(() { + model.setPrescriptionsDetailsLoading(); + Navigator.of(context).push( + CustomPageRoute( + page: PrescriptionDetailPage( + prescriptionsResponseModel: model.patientPrescriptionOrders[index], + isFromAppointments: false, + ), ), - ) - : SizedBox.shrink(), + ); + }), + ), + ], ), + // SizedBox(height: 12.h), + // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // SizedBox(height: 12.h), ], ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // ...model.patientPrescriptionOrders.map((prescription) { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Image.network( + // prescription.doctorImageURL!, + // width: 24.h, + // height: 24.h, + // fit: BoxFit.fill, + // ).circle(100), + // SizedBox(width: 8.h), + // Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), + // ], + // ), + // SizedBox(height: 8.h), + // Wrap( + // direction: Axis.horizontal, + // spacing: 6.h, + // runSpacing: 6.h, + // children: [ + // Directionality( + // textDirection: ui.TextDirection.ltr, + // child: AppCustomChipWidget( + // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), isEnglishOnly: true, + // ), + // ), + // AppCustomChipWidget( + // labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!, + // ), + // ], + // ), + // SizedBox(height: 8.h), + // Row( + // children: [ + // Expanded( + // flex: 6, + // child: CustomButton( + // text: prescription.isHomeMedicineDeliverySupported! + // ? LocaleKeys.resendOrder.tr(context: context) + // : LocaleKeys.prescriptionDeliveryError.tr(context: context), + // onPressed: () async { + // if (prescription.isHomeMedicineDeliverySupported!) { + // LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); + // await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], + // onSuccess: (val) { + // LoaderBottomSheet.hideLoader(); + // prescriptionsViewModel.initiatePrescriptionDelivery(); + // }); + // } + // }, + // backgroundColor: + // prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color, + // borderColor: AppColors.successColor.withOpacity(0.01), + // textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + // fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.r, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // icon: AppAssets.prescription_refill_icon, + // iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + // iconSize: 16.h, + // ), + // ), + // SizedBox(width: 8.h), + // Expanded( + // flex: 1, + // child: Container( + // height: 40.h, + // width: 40.w, + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // color: AppColors.textColor, + // borderRadius: 12, + // ), + // child: Padding( + // padding: EdgeInsets.all(12.h), + // child: Transform.flip( + // flipX: appState.isArabic(), + // child: Utils.buildSvgWithAssets( + // icon: AppAssets.forward_arrow_icon_small, + // iconColor: AppColors.whiteColor, + // fit: BoxFit.contain, + // ), + // ), + // ), + // ).onPress(() { + // model.setPrescriptionsDetailsLoading(); + // Navigator.of(context).push( + // CustomPageRoute( + // page: PrescriptionDetailPage( + // prescriptionsResponseModel: prescription, + // isFromAppointments: false, + // ), + // ), + // ); + // }), + // ), + // ], + // ), + // SizedBox(height: 12.h), + // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // SizedBox(height: 12.h), + // ], + // ); + // }).toList(), + // ], + // ), ), + + // InkWell( + // onTap: () { + // setState(() { + // expandedIndex = isExpanded ? null : index; + // }); + // }, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Padding( + // padding: EdgeInsets.all(16.h), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // CustomButton( + // text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available", + // onPressed: () {}, + // backgroundColor: AppColors.greyColor, + // borderColor: AppColors.greyColor, + // textColor: AppColors.blackColor, + // fontSize: 10, + // fontWeight: FontWeight.w500, + // borderRadius: 8, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 30.h, + // ), + // Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + // ], + // ), + // SizedBox(height: 8.h), + // (model.patientPrescriptionOrdersViewList[index].filterName ?? "").toText16(isBold: true) + // ], + // ), + // ), + // AnimatedSwitcher( + // duration: Duration(milliseconds: 500), + // switchInCurve: Curves.easeIn, + // switchOutCurve: Curves.easeOut, + // transitionBuilder: (Widget child, Animation animation) { + // return FadeTransition( + // opacity: animation, + // child: SizeTransition( + // sizeFactor: animation, + // axisAlignment: 0.0, + // child: child, + // ), + // ); + // }, + // // child: isExpanded + // // ? Container( + // // key: ValueKey(index), + // // padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), + // // child: Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) { + // // return Column( + // // crossAxisAlignment: CrossAxisAlignment.start, + // // children: [ + // // Row( + // // mainAxisSize: MainAxisSize.min, + // // children: [ + // // Image.network( + // // prescription.doctorImageURL!, + // // width: 24.h, + // // height: 24.h, + // // fit: BoxFit.fill, + // // ).circle(100), + // // SizedBox(width: 8.h), + // // Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), + // // ], + // // ), + // // SizedBox(height: 8.h), + // // Wrap( + // // direction: Axis.horizontal, + // // spacing: 6.h, + // // runSpacing: 6.h, + // // children: [ + // // Directionality( + // // textDirection: ui.TextDirection.ltr, + // // child: AppCustomChipWidget( + // // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), isEnglishOnly: true, + // // ), + // // ), + // // AppCustomChipWidget( + // // labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!, + // // ), + // // ], + // // ), + // // SizedBox(height: 8.h), + // // Row( + // // children: [ + // // Expanded( + // // flex: 6, + // // child: CustomButton( + // // text: prescription.isHomeMedicineDeliverySupported! + // // ? LocaleKeys.resendOrder.tr(context: context) + // // : LocaleKeys.prescriptionDeliveryError.tr(context: context), + // // onPressed: () async { + // // if (prescription.isHomeMedicineDeliverySupported!) { + // // LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); + // // await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], + // // onSuccess: (val) { + // // LoaderBottomSheet.hideLoader(); + // // prescriptionsViewModel.initiatePrescriptionDelivery(); + // // }); + // // } + // // }, + // // backgroundColor: + // // prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color, + // // borderColor: AppColors.successColor.withOpacity(0.01), + // // textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + // // fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f, + // // fontWeight: FontWeight.w500, + // // borderRadius: 12.r, + // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // height: 40.h, + // // icon: AppAssets.prescription_refill_icon, + // // iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35), + // // iconSize: 16.h, + // // ), + // // ), + // // SizedBox(width: 8.h), + // // Expanded( + // // flex: 1, + // // child: Container( + // // height: 40.h, + // // width: 40.w, + // // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // // color: AppColors.textColor, + // // borderRadius: 12, + // // ), + // // child: Padding( + // // padding: EdgeInsets.all(12.h), + // // child: Transform.flip( + // // flipX: appState.isArabic(), + // // child: Utils.buildSvgWithAssets( + // // icon: AppAssets.forward_arrow_icon_small, + // // iconColor: AppColors.whiteColor, + // // fit: BoxFit.contain, + // // ), + // // ), + // // ), + // // ).onPress(() { + // // model.setPrescriptionsDetailsLoading(); + // // Navigator.of(context).push( + // // CustomPageRoute( + // // page: PrescriptionDetailPage( + // // prescriptionsResponseModel: prescription, + // // isFromAppointments: false, + // // ), + // // ), + // // ); + // // }), + // // ), + // // ], + // // ), + // // SizedBox(height: 12.h), + // // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // // SizedBox(height: 12.h), + // // ], + // // ); + // // }).toList(), + // // ], + // // ), + // // ) + // // : SizedBox.shrink(), + // ), + // ], + // ), + // ), ), ), ), diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index 2bd41f06..1a10e0de 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -15,14 +15,19 @@ import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; +import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; +import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart'; +import 'package:hmg_patient_app_new/presentation/insurance/widgets/insurance_update_details_card.dart'; +import 'package:hmg_patient_app_new/presentation/profile_settings/widgets/update_email_widget.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/app_language_change.dart'; @@ -48,6 +53,7 @@ class ProfileSettingsState extends State { scheduleMicrotask(() { insuranceViewModel.initInsuranceProvider(); }); + _loadPermissions(); super.initState(); } @@ -86,10 +92,13 @@ class ProfileSettingsState extends State { int length = 3; final SwiperController _controller = SwiperController(); late InsuranceViewModel insuranceViewModel; + late ContactUsViewModel contactUsViewModel; + String _permissionsLabel = ""; @override Widget build(BuildContext context) { insuranceViewModel = Provider.of(context, listen: false); + contactUsViewModel = Provider.of(context, listen: false); return CollapsingListView( title: LocaleKeys.profileAndSettings.tr(context: context), logout: () { @@ -97,102 +106,109 @@ class ProfileSettingsState extends State { }, isClose: true, child: SingleChildScrollView( - padding: EdgeInsets.only(top: 24.h, bottom: 24.h), + padding: EdgeInsets.only(top: 0.h, bottom: 24.h), physics: NeverScrollableScrollPhysics(), child: Consumer2( builder: (context, profileVm, medicalVm, child) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Swiper( - itemCount: medicalVm.patientFamilyFiles.length, - layout: SwiperLayout.STACK, - loop: true, - itemHeight: dynamicItemHeight(context), - itemWidth: SizeUtils.width - 30.w, - indicatorLayout: PageIndicatorLayout.COLOR, - axisDirection: AxisDirection.right, - controller: _controller, - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(top: (210.h + 8.h + 24.h)), - builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), - ), - itemBuilder: (BuildContext context, int index) { - return FamilyCardWidget( - profile: medicalVm.patientFamilyFiles[index], - onAddFamilyMemberPress: () { - DialogService dialogService = getIt.get(); - dialogService.showAddFamilyFileSheet( - label: LocaleKeys.addFamilyMember.tr(context: context), - message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context), - onVerificationPress: () { - medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); - }); - }, - onFamilySwitchPress: (FamilyFileResponseModelLists profile) { - medicalVm.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); - }, - ).paddingOnly(right: 16.w, left: 8.w); - }, - ), - SizedBox(height: 5.h), - GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: isTablet ? 3 : 2), - physics: const NeverScrollableScrollPhysics(), - padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 24.h), - shrinkWrap: true, - children: [ - Container( - padding: EdgeInsets.all(16.w), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.r, - hasShadow: true, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // spacing: 4.h, - children: [ - Row( - spacing: 8.w, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 40.w, height: 40.h, applyThemeColor: false), - LocaleKeys.habibWallet.tr(context: context).toText16(weight: FontWeight.w600, maxlines: 2).expanded, - Utils.buildSvgWithAssets(icon: getIt.get().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward), - ], - ), - Spacer(), - Consumer(builder: (context, habibWalletVM, child) { - return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) - .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); - }), - Spacer(), - CustomButton( - height: 40.h, - icon: AppAssets.recharge_icon, - iconSize: 22.w, - iconColor: AppColors.infoColor, - textColor: AppColors.infoColor, - text: LocaleKeys.recharge.tr(context: context), - borderWidth: 0.w, - fontWeight: FontWeight.w500, - borderColor: Colors.transparent, - backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08), - padding: EdgeInsets.all(8.w), - fontSize: 14.f, - onPressed: () { - Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage())); - }, - ), - ], - ).onPress(() { - Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage())); - }), - ), - ], - ), + // SizedBox( + // height: dynamicItemHeight(context) + 20 + 30, // itemHeight + shadow padding (10 top + 10 bottom) + pagination dots space + // child: Swiper( + // itemCount: medicalVm.patientFamilyFiles.length, + // layout: SwiperLayout.STACK, + // loop: true, + // itemHeight: dynamicItemHeight(context) + 20, + // // extra space for shadow + // itemWidth: SizeUtils.width - 30.w, + // indicatorLayout: PageIndicatorLayout.COLOR, + // axisDirection: getIt.get().isArabic() ? AxisDirection.left : AxisDirection.right, + // controller: _controller, + // pagination: SwiperPagination( + // alignment: Alignment.bottomCenter, + // margin: EdgeInsets.only(top: (180.h + 20 + 8.h + 24.h)), + // builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + // ), + // itemBuilder: (BuildContext context, int index) { + // return Padding( + // padding: const EdgeInsets.symmetric(vertical: 10), + // child: FamilyCardWidget( + // profile: medicalVm.patientFamilyFiles[index], + // onAddFamilyMemberPress: () { + // DialogService dialogService = getIt.get(); + // dialogService.showAddFamilyFileSheet( + // label: LocaleKeys.addFamilyMember.tr(context: context), + // message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context), + // onVerificationPress: () { + // medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); + // }); + // }, + // onFamilySwitchPress: (FamilyFileResponseModelLists profile) { + // medicalVm.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); + // }, + // ).paddingOnly(right: 16.w, left: 8.w), + // ); + // }, + // ), + // ), + // SizedBox(height: 16.h), + // GridView( + // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: isTablet ? 3 : 2), + // physics: const NeverScrollableScrollPhysics(), + // padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 24.h), + // shrinkWrap: true, + // children: [ + // Container( + // padding: EdgeInsets.all(16.w), + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // color: AppColors.whiteColor, + // borderRadius: 20.r, + // hasShadow: true, + // ), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // // spacing: 4.h, + // children: [ + // Row( + // spacing: 8.w, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 40.w, height: 40.h, applyThemeColor: false), + // LocaleKeys.habibWallet.tr(context: context).toText16(weight: FontWeight.w600, maxlines: 2).expanded, + // Utils.buildSvgWithAssets(icon: getIt.get().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward), + // ], + // ), + // Spacer(), + // Consumer(builder: (context, habibWalletVM, child) { + // return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) + // .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); + // }), + // Spacer(), + // CustomButton( + // height: 40.h, + // icon: AppAssets.recharge_icon, + // iconSize: 22.w, + // iconColor: AppColors.infoColor, + // textColor: AppColors.infoColor, + // text: LocaleKeys.recharge.tr(context: context), + // borderWidth: 0.w, + // fontWeight: FontWeight.w500, + // borderColor: Colors.transparent, + // backgroundColor: Color(0xff45A2F8).withValues(alpha: 0.08), + // padding: EdgeInsets.all(8.w), + // fontSize: 14.f, + // onPressed: () { + // Navigator.of(context).push(CustomPageRoute(page: RechargeWalletPage())); + // }, + // ), + // ], + // ).onPress(() { + // Navigator.of(context).push(CustomPageRoute(page: HabibWalletPage())); + // }), + // ), + // ], + // ), LocaleKeys.quickActions.tr(context: context).toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), @@ -226,41 +242,49 @@ class ProfileSettingsState extends State { ], ), ), - Container( - margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), - padding: EdgeInsets.only(top: 4.h, bottom: 4.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), - child: Column( - children: [ - actionItem(AppAssets.language_change, LocaleKeys.language.tr(context: context), () { - showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.language.tr(context: context), child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); - }, trailingLabel: Utils.appState.isArabic() ? "العربية" : "English"), - 1.divider, - actionItem(AppAssets.bell, LocaleKeys.notificationsSettings.tr(context: context), () { - openAppSettings(); - }), - // 1.divider, - // actionItem(AppAssets.touch_face_id, LocaleKeys.touchIDFaceIDServices.tr(context: context), () {}, switchValue: true), - ], - ), - ), - LocaleKeys.personalInformation.tr(context: context).toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), - Container( - margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), - padding: EdgeInsets.only(top: 4.h, bottom: 4.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), - child: Column( - children: [ - actionItem(AppAssets.email_transparent, LocaleKeys.updateEmailAddress.tr(context: context), () {}), - // 1.divider, - // actionItem(AppAssets.smart_phone_fill, "Phone Number".needTranslation, () {}), - // 1.divider, - // actionItem(AppAssets.my_address, "My Addresses".needTranslation, () {}), - // 1.divider, - // actionItem(AppAssets.emergency, "Emergency Contact".needTranslation, () {}), - ], - ), - ), + // Container( + // margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), + // padding: EdgeInsets.only(top: 4.h, bottom: 4.h), + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + // child: Column( + // children: [ + // actionItem(AppAssets.language_change, LocaleKeys.language.tr(context: context), () { + // showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.language.tr(context: context), child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); + // }, trailingLabel: Utils.appState.isArabic() ? "العربية" : "English"), + // 1.divider, + // actionItem(AppAssets.bell, LocaleKeys.notificationsSettings.tr(context: context), () { + // openAppSettings(); + // }), + // // 1.divider, + // // actionItem(AppAssets.touch_face_id, LocaleKeys.touchIDFaceIDServices.tr(context: context), () {}, switchValue: true), + // ], + // ), + // ), + // LocaleKeys.personalInformation.tr(context: context).toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), + // Container( + // margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), + // padding: EdgeInsets.only(top: 4.h, bottom: 4.h), + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), + // child: Column( + // children: [ + // actionItem(AppAssets.email_transparent, LocaleKeys.updateEmailAddress.tr(context: context), () { + // showCommonBottomSheetWithoutHeight( + // context, + // title: LocaleKeys.updateEmailAddress.tr(context: context), + // child: UpdateEmailDialog(), + // callBackFunc: () {}, + // isFullScreen: false, + // ); + // }), + // // 1.divider, + // // actionItem(AppAssets.smart_phone_fill, "Phone Number".needTranslation, () {}), + // // 1.divider, + // // actionItem(AppAssets.my_address, "My Addresses".needTranslation, () {}), + // // 1.divider, + // // actionItem(AppAssets.emergency, "Emergency Contact".needTranslation, () {}), + // ], + // ), + // ), LocaleKeys.helpAndSupport.tr(context: context).toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1).paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h), @@ -272,6 +296,22 @@ class ProfileSettingsState extends State { launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); }, trailingLabel: "92 006 6666"), 1.divider, + actionItem(AppAssets.permission, LocaleKeys.permissionsProfile.tr(context: context), () { + openAppSettings(); + }, trailingLabel: getCurrentPermissions()), + actionItem(AppAssets.feedbackFill, LocaleKeys.feedback.tr(context: context), () { + contactUsViewModel.setSelectedFeedbackType( + FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'), + ); + contactUsViewModel.setIsSendFeedbackTabSelected(true); + Navigator.pop(context); + Navigator.of(context).push( + CustomPageRoute( + page: FeedbackPage(), + ), + ); + }, trailingLabel: ""), + 1.divider, // actionItem(AppAssets.permission, LocaleKeys.permissions.tr(context: context), () {}, trailingLabel: "Location, Camera"), // 1.divider, actionItem(AppAssets.rate, LocaleKeys.rateApp.tr(context: context), () { @@ -314,6 +354,34 @@ class ProfileSettingsState extends State { ); } + Future _loadPermissions() async { + final Map permissionMap = { + 'Camera': Permission.camera, + 'Microphone': Permission.microphone, + 'Location': Permission.location, + 'Notifications': Permission.notification, + 'Calendar': Permission.calendarFullAccess, + }; + + final List granted = []; + + for (final entry in permissionMap.entries) { + if (await entry.value.isGranted) { + granted.add(entry.key); + } + } + + if (mounted) { + setState(() { + _permissionsLabel = granted.isEmpty ? 'No permissions granted' : granted.join(', '); + }); + } + } + + String getCurrentPermissions() { + return _permissionsLabel; + } + Widget actionItem(String icon, String label, VoidCallback onPress, {String trailingLabel = "", bool? switchValue, ValueChanged? onSwitchChanged, bool isExternalLink = false}) { return SizedBox( height: 56.h, @@ -361,9 +429,7 @@ class FamilyCardWidget extends StatelessWidget { return Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, - borderRadius: 24.r, - hasShadow: true, - ), + borderRadius: 24.r, hasShadow: true, hasDenseShadow: true), child: Column( children: [ Column( @@ -378,11 +444,25 @@ class FamilyCardWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - "${profile.patientName}".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), - AppCustomChipWidget( - icon: AppAssets.file_icon, - labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${profile.responseId}", - iconSize: 12.w, + "${profile.patientName}".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1, isEnglishOnly: true), + Wrap( + direction: Axis.horizontal, + spacing: 4.w, + runSpacing: 6.w, + children: [ + AppCustomChipWidget( + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), + icon: AppAssets.file_icon, + labelText: "${LocaleKeys.fileno.tr(context: context)}: ${profile.responseId}", + iconSize: 12.w, + ), + isActive ? AppCustomChipWidget( + icon: AppAssets.checkmark_icon, + labelText: LocaleKeys.verified.tr(context: context), + iconColor: AppColors.successColor, + labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w), + ) : SizedBox.shrink(), + ], ), ], ).expanded, @@ -400,18 +480,20 @@ class FamilyCardWidget extends StatelessWidget { AppCustomChipWidget( labelText: LocaleKeys.ageYearsOld.tr(namedArgs: {'age': profile.age.toString(), 'yearsOld': LocaleKeys.yearsOld.tr(context: context)}), ), - isActive && appState.getAuthenticatedUser()!.bloodGroup != null - ? AppCustomChipWidget( - icon: AppAssets.blood_icon, + // isActive && appState.getAuthenticatedUser()!.bloodGroup != null + // ? + isActive ? AppCustomChipWidget( + icon: AppAssets.blood_icon, labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 8.w), - labelText: "Blood: ${appState.getAuthenticatedUser()!.bloodGroup ?? ""}", - iconColor: AppColors.primaryRedColor) - : SizedBox(), + labelText: appState.getAuthenticatedUser()!.bloodGroup ?? "N/A", + iconColor: AppColors.primaryRedColor) + : SizedBox(), Consumer(builder: (context, insuranceVM, child) { - return AppCustomChipWidget( - icon: insuranceVM.isInsuranceExpired - ? AppAssets.cancel_circle_icon - : insuranceVM.isInsuranceActive + return isActive + ? AppCustomChipWidget( + icon: insuranceVM.isInsuranceExpired + ? AppAssets.cancel_circle_icon + : insuranceVM.isInsuranceActive ? AppAssets.insurance_active_icon : AppAssets.alertSquare, labelText: insuranceVM.isInsuranceExpired @@ -431,27 +513,34 @@ class FamilyCardWidget extends StatelessWidget { : AppColors.warningColorYellow, iconSize: 12.w, deleteIcon: insuranceVM.isInsuranceActive ? null : AppAssets.forward_chevron_icon, - deleteIconColor: AppColors.warningColorYellow, + deleteIconColor: insuranceVM.isInsuranceExpired + ? AppColors.primaryRedColor + : insuranceVM.isInsuranceActive + ? AppColors.successColor + : AppColors.warningColorYellow, deleteIconHasColor: true, onChipTap: () { if (!insuranceVM.isInsuranceActive) { - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: context), - context, - child: Utils.getWarningWidget( - loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), - confirmText: LocaleKeys.contactUs.tr(context: context), - isShowActionButtons: true, - onCancelTap: () { - Navigator.pop(context); - }, - onConfirmTap: () async { - launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); - }), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); + insuranceVM.setIsInsuranceUpdateDetailsLoading(true); + insuranceVM.getPatientInsuranceDetailsForUpdate(appState.getAuthenticatedUser()!.patientId.toString(), appState.getAuthenticatedUser()!.patientIdentificationNo.toString()); + showCommonBottomSheetWithoutHeight(context, child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", isCloseButtonVisible: false, isFullScreen: false); + // showCommonBottomSheetWithoutHeight( + // title: LocaleKeys.notice.tr(context: context), + // context, + // child: Utils.getWarningWidget( + // loadingText: LocaleKeys.insuranceInActiveContactSupport.tr(context: context), + // confirmText: LocaleKeys.contactUs.tr(context: context), + // isShowActionButtons: true, + // onCancelTap: () { + // Navigator.pop(context); + // }, + // onConfirmTap: () async { + // launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); + // }), + // callBackFunc: () {}, + // isFullScreen: false, + // isCloseButtonVisible: true, + // ); } }, backgroundColor: insuranceVM.isInsuranceExpired @@ -460,7 +549,8 @@ class FamilyCardWidget extends StatelessWidget { ? AppColors.successColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1), labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: insuranceVM.isInsuranceActive ? 6.w : 0.w), - ).toShimmer2(isShow: insuranceVM.isInsuranceLoading); + ).toShimmer2(isShow: insuranceVM.isInsuranceLoading) + : SizedBox.shrink(); }), ], ), diff --git a/lib/presentation/profile_settings/widgets/update_email_widget.dart b/lib/presentation/profile_settings/widgets/update_email_widget.dart new file mode 100644 index 00000000..ad9b9d5a --- /dev/null +++ b/lib/presentation/profile_settings/widgets/update_email_widget.dart @@ -0,0 +1,106 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; +import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:provider/provider.dart'; + +class UpdateEmailDialog extends StatefulWidget { + UpdateEmailDialog({super.key}); + + @override + State createState() => _UpdateEmailDialogState(); +} + +class _UpdateEmailDialogState extends State { + late FocusNode _textFieldFocusNode; + late TextEditingController? textController; + ProfileSettingsViewModel? profileSettingsViewModel; + + @override + void initState() { + _textFieldFocusNode = FocusNode(); + textController = TextEditingController(); + textController!.text = getIt.get().getAuthenticatedUser()!.emailAddress ?? ""; + super.initState(); + } + + @override + void dispose() { + _textFieldFocusNode.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + profileSettingsViewModel = Provider.of(context); + return GestureDetector( + onTap: () { + _textFieldFocusNode.unfocus(); + FocusScope.of(context).unfocus(); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Enter the new email address to be updated in your HMG File: ".toText16(textAlign: TextAlign.start, weight: FontWeight.w500), + SizedBox(height: 12.h), + TextInputWidget( + labelText: LocaleKeys.email.tr(), + hintText: "demo@gmail.com", + controller: textController, + focusNode: _textFieldFocusNode, + autoFocus: true, + padding: EdgeInsets.all(8.h), + keyboardType: TextInputType.emailAddress, + isEnable: true, + isReadOnly: false, + prefix: null, + isBorderAllowed: false, + isAllowLeadingIcon: true, + fontSize: 14.f, + isCountryDropDown: false, + leadingIcon: AppAssets.email, + fontFamily: "Poppins", + ), + SizedBox(height: 12.h), + CustomButton( + text: LocaleKeys.submit.tr(context: context), + onPressed: () { + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.updatingEmailAddress.tr(context: context)); + profileSettingsViewModel!.updatePatientInfo( + patientInfo: {"EmailAddress": textController!.text}, + onSuccess: (response) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.success.tr(context: context), child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), + callBackFunc: () async { + Navigator.of(context).pop(); + }, isFullScreen: false); + }, + onError: (error) { + LoaderBottomSheet.hideLoader(); + // Show error message + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(error)), + ); + }, + ); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: const Color(0xFFffffff), + ), + ], + ), + ); + } +} diff --git a/lib/presentation/radiology/radiology_orders_page.dart b/lib/presentation/radiology/radiology_orders_page.dart index a07face1..1a3ab448 100644 --- a/lib/presentation/radiology/radiology_orders_page.dart +++ b/lib/presentation/radiology/radiology_orders_page.dart @@ -3,6 +3,8 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; @@ -24,6 +26,8 @@ import 'package:provider/provider.dart'; import '../../features/radiology/radiology_view_model.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'dart:ui' as ui; + class RadiologyOrdersPage extends StatefulWidget { const RadiologyOrdersPage({super.key}); @@ -94,40 +98,40 @@ class _RadiologyOrdersPageState extends State { children: [ // Clinic / Hospital toggle SizedBox(height: 16.h), - Row( - children: [ - CustomButton( - text: LocaleKeys.byClinic.tr(context: context), - onPressed: () { - model.setIsSortByClinic(true); - }, - backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, - borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), - textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - SizedBox(width: 8.h), - CustomButton( - text: LocaleKeys.byHospital.tr(context: context), - onPressed: () { - model.setIsSortByClinic(false); - }, - backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, - borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, - textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, - fontSize: 12, - fontWeight: FontWeight.w500, - borderRadius: 10, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - ], - ), - SizedBox(height: 8.h), + // Row( + // children: [ + // CustomButton( + // text: LocaleKeys.byClinic.tr(context: context), + // onPressed: () { + // model.setIsSortByClinic(true); + // }, + // backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, + // borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), + // textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // SizedBox(width: 8.h), + // CustomButton( + // text: LocaleKeys.byHospital.tr(context: context), + // onPressed: () { + // model.setIsSortByClinic(false); + // }, + // backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, + // borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, + // textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, + // fontSize: 12, + // fontWeight: FontWeight.w500, + // borderRadius: 10, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // ], + // ), + // SizedBox(height: 8.h), selectedFilterText.isNotEmpty ? AppCustomChipWidget( padding: EdgeInsets.symmetric(horizontal: 5.h), @@ -165,199 +169,525 @@ class _RadiologyOrdersPageState extends State { ); } - if (model.patientRadiologyOrdersViewList.isEmpty) { + if (model.patientRadiologyOrders.isEmpty) { return Utils.getNoDataWidget(ctx, noDataText: LocaleKeys.youDontHaveRadiologyOrders.tr(context: context)); } - return ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - itemCount: model.patientRadiologyOrdersViewList.length, - itemBuilder: (context, index) { - final group = model.patientRadiologyOrdersViewList[index]; - final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'); - final isExpanded = expandedIndex == index; - return AnimationConfiguration.staggeredList( + // return ListView.builder( + // shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + // padding: EdgeInsets.zero, + // itemCount: model.patientRadiologyOrdersViewList.length, + // itemBuilder: (context, index) { + // final group = model.patientRadiologyOrdersViewList[index]; + // final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'); + // final isExpanded = expandedIndex == index; + // return AnimationConfiguration.staggeredList( + // position: index, + // duration: const Duration(milliseconds: 400), + // child: SlideAnimation( + // verticalOffset: 50.0, + // child: FadeInAnimation( + // child: AnimatedContainer( + // duration: const Duration(milliseconds: 300), + // curve: Curves.easeInOut, + // margin: EdgeInsets.symmetric(vertical: 8.h), + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // color: AppColors.whiteColor, + // borderRadius: 20.h, + // hasShadow: true, + // ), + // child: InkWell( + // onTap: () { + // setState(() { + // expandedIndex = isExpanded ? null : index; + // }); + // WidgetsBinding.instance.addPostFrameCallback((_) { + // final key = _groupKeys.putIfAbsent(index, () => GlobalKey()); + // if (key.currentContext != null && expandedIndex == index) { + // Future.delayed(const Duration(milliseconds: 450), () { + // if (key.currentContext != null) { + // Scrollable.ensureVisible( + // key.currentContext!, + // duration: const Duration(milliseconds: 350), + // curve: Curves.easeInOut, + // alignment: 0.0, + // ); + // } + // }); + // } + // }); + // }, + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Padding( + // key: _groupKeys.putIfAbsent(index, () => GlobalKey()), + // padding: EdgeInsets.all(16.h), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), + // Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + // ], + // ), + // SizedBox(height: 8.h), + // Text( + // displayName, + // style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), + // overflow: TextOverflow.ellipsis, + // ), + // ], + // ), + // ), + // AnimatedSwitcher( + // duration: const Duration(milliseconds: 500), + // switchInCurve: Curves.easeIn, + // switchOutCurve: Curves.easeOut, + // transitionBuilder: (Widget child, Animation animation) { + // return FadeTransition( + // opacity: animation, + // child: SizeTransition( + // sizeFactor: animation, + // axisAlignment: 0.0, + // child: child, + // ), + // ); + // }, + // child: isExpanded + // ? Container( + // key: ValueKey(index), + // padding: EdgeInsets.symmetric(horizontal: 16.w), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // ...group.map((order) { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Image.network( + // order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + // width: 24.w, + // height: 24.h, + // fit: BoxFit.cover, + // ).circle(100), + // SizedBox(width: 8.h), + // Expanded( + // child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500), + // ), + // ], + // ), + // SizedBox(height: 8.h), + // Wrap( + // direction: Axis.horizontal, + // spacing: 4.h, + // runSpacing: 4.h, + // children: [ + // if ((order.description ?? '').isNotEmpty) + // AppCustomChipWidget( + // labelText: (order.description ?? '').toString(), + // ), + // Directionality( + // textDirection: ui.TextDirection.ltr, + // child: AppCustomChipWidget( + // labelText: DateUtil.formatDateToDate( + // (order.orderDate ?? order.appointmentDate), + // false, + // ), isEnglishOnly: true, + // ), + // ), + // AppCustomChipWidget( + // labelText: model.isSortByClinic ? (order.projectName ?? '') : (order.clinicDescription ?? ''), + // ), + // ], + // ), + // SizedBox(height: 12.h), + // Row( + // children: [ + // Expanded(flex: 2, child: const SizedBox()), + // Expanded( + // flex: 2, + // child: CustomButton( + // icon: AppAssets.view_report_icon, + // iconColor: AppColors.primaryRedColor, + // iconSize: 16.h, + // text: LocaleKeys.viewResults.tr(context: context), + // onPressed: () { + // model.navigationService.push( + // CustomPageRoute( + // page: RadiologyResultPage(patientRadiologyResponseModel: order), + // ), + // ); + // }, + // backgroundColor: AppColors.secondaryLightRedColor, + // borderColor: AppColors.secondaryLightRedColor, + // textColor: AppColors.primaryRedColor, + // fontSize: 14, + // fontWeight: FontWeight.w500, + // borderRadius: 12, + // padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // ), + // ), + // ], + // ), + // SizedBox(height: 12.h), + // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // SizedBox(height: 12.h), + // ], + // ); + // }).toList(), + // ], + // ), + // ) + // : const SizedBox.shrink(), + // ), + // ], + // ), + // ), + // ), + // ), + // ), + // ); + // }, + // ); + + return ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: model.patientRadiologyOrders.length, + itemBuilder: (context, index) { + final group = model.patientRadiologyOrders[index]; + final isExpanded = expandedIndex == index; + return AnimationConfiguration.staggeredList( position: index, - duration: const Duration(milliseconds: 400), + duration: const Duration(milliseconds: 500), child: SlideAnimation( - verticalOffset: 50.0, + verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( - duration: const Duration(milliseconds: 300), + duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: 20.h, - hasShadow: true, - ), + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); - WidgetsBinding.instance.addPostFrameCallback((_) { - final key = _groupKeys.putIfAbsent(index, () => GlobalKey()); - if (key.currentContext != null && expandedIndex == index) { - Future.delayed(const Duration(milliseconds: 450), () { - if (key.currentContext != null) { - Scrollable.ensureVisible( - key.currentContext!, - duration: const Duration(milliseconds: 350), - curve: Curves.easeInOut, - alignment: 0.0, - ); - } - }); - } - }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - key: _groupKeys.putIfAbsent(index, () => GlobalKey()), padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppCustomChipWidget( + labelText: "${getIt.get().isArabic() ? group.isInOutPatientDescriptionN : group.isInOutPatientDescription}", + backgroundColor: AppColors.warningColorYellow.withOpacity(0.1), + textColor: AppColors.warningColorYellow, + ), + SizedBox(height: 16.h), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.min, children: [ - AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), - Icon(isExpanded ? Icons.expand_less : Icons.expand_more), + Image.network( + group.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + width: 24.w, + height: 24.h, + fit: BoxFit.cover, + ).circle(100), + SizedBox(width: 8.h), + Expanded(child: (group.doctorName ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), - Text( - displayName, - style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), - overflow: TextOverflow.ellipsis, + Wrap( + direction: Axis.horizontal, + spacing: 4.h, + runSpacing: 4.h, + children: [ + Directionality( + textDirection: ui.TextDirection.ltr, + child: AppCustomChipWidget( + labelText: DateUtil.formatDateToDate(group.orderDate!, false), + isEnglishOnly: true, + )), + AppCustomChipWidget( + labelText: (group.projectName ?? ""), + ), + AppCustomChipWidget( + labelText: (group.clinicDescription ?? ""), + ), + ], ), + SizedBox(height: 16.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "• ${group.procedureName.toString().trim() ?? ""}".toText14(weight: FontWeight.w500), + // "Lorem ipsum text".toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + SizedBox(height: 16.h), + CustomButton( + text: LocaleKeys.viewReport.tr(), + onPressed: () { + model.navigationService.push( + CustomPageRoute( + page: RadiologyResultPage(patientRadiologyResponseModel: group), + ), + ); + }, + backgroundColor: AppColors.infoColor.withAlpha(20), + borderColor: AppColors.infoColor.withAlpha(0), + textColor: AppColors.infoColor, + fontSize: (isFoldable || isTablet) ? 12.f : 14.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), + height: 40.h, + iconSize: 14.h, + icon: AppAssets.view_report_icon, + iconColor: AppColors.infoColor, + ), + ], + ) ], ), ), - AnimatedSwitcher( - duration: const Duration(milliseconds: 500), - switchInCurve: Curves.easeIn, - switchOutCurve: Curves.easeOut, - transitionBuilder: (Widget child, Animation animation) { - return FadeTransition( - opacity: animation, - child: SizeTransition( - sizeFactor: animation, - axisAlignment: 0.0, - child: child, - ), - ); - }, - child: isExpanded - ? Container( - key: ValueKey(index), - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...group.map((order) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.network( - order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", - width: 24.w, - height: 24.h, - fit: BoxFit.cover, - ).circle(100), - SizedBox(width: 8.h), - Expanded( - child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500), - ), - ], - ), - SizedBox(height: 8.h), - Wrap( - direction: Axis.horizontal, - spacing: 4.h, - runSpacing: 4.h, - children: [ - if ((order.description ?? '').isNotEmpty) - AppCustomChipWidget( - labelText: (order.description ?? '').toString(), - ), - AppCustomChipWidget( - labelText: DateUtil.formatDateToDate( - (order.orderDate ?? order.appointmentDate), - false, - ), - ), - AppCustomChipWidget( - labelText: model.isSortByClinic ? (order.projectName ?? '') : (order.clinicDescription ?? ''), - ), - ], - ), - SizedBox(height: 12.h), - Row( - children: [ - Expanded(flex: 2, child: const SizedBox()), - Expanded( - flex: 2, - child: CustomButton( - icon: AppAssets.view_report_icon, - iconColor: AppColors.primaryRedColor, - iconSize: 16.h, - text: LocaleKeys.viewResults.tr(context: context), - onPressed: () { - model.navigationService.push( - CustomPageRoute( - page: RadiologyResultPage(patientRadiologyResponseModel: order), - ), - ); - }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - fontSize: 14, - fontWeight: FontWeight.w500, - borderRadius: 12, - padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - ), - ), - ], - ), - SizedBox(height: 12.h), - Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), - SizedBox(height: 12.h), - ], - ); - }).toList(), - ], - ), - ) - : const SizedBox.shrink(), - ), + // AnimatedSwitcher( + // duration: Duration(milliseconds: 500), + // switchInCurve: Curves.easeIn, + // switchOutCurve: Curves.easeOut, + // transitionBuilder: (Widget child, Animation animation) { + // return FadeTransition( + // opacity: animation, + // child: SizeTransition( + // sizeFactor: animation, + // axisAlignment: 0.0, + // child: child, + // ), + // ); + // }, + // child: isExpanded + // ? Container( + // key: ValueKey(index), + // padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), + // child: Column( + // children: [ + // ListView.separated( + // shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + // padding: EdgeInsets.zero, + // itemBuilder: (cxt, index) { + // PatientRadiologyResponseModel order = group; + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // "• ${order.procedureName ?? ""}".toText14(weight: FontWeight.w500), + // "Lorem ipsum text".toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + // // SizedBox(height: 4.h), + // // order.testDetails![index].testDescriptionEn!.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + // // Row( + // // mainAxisSize: MainAxisSize.min, + // // children: [ + // // Image.network( + // // order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", + // // width: 24.w, + // // height: 24.h, + // // fit: BoxFit.cover, + // // ).circle(100), + // // SizedBox(width: 8.h), + // // Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), + // // ], + // // ), + // // SizedBox(height: 8.h), + // // Wrap( + // // direction: Axis.horizontal, + // // spacing: 4.h, + // // runSpacing: 4.h, + // // children: [ + // // AppCustomChipWidget( + // // labelText: ("${LocaleKeys.orderNo.tr(context: context)}: ${order.orderNo!}"), isEnglishOnly: true, + // // ), + // // Directionality( + // // textDirection: ui.TextDirection.ltr, + // // child: AppCustomChipWidget( + // // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), + // // isEnglishOnly: true, + // // )), + // // AppCustomChipWidget( + // // labelText: labViewModel.isSortByClinic ? (order.projectName ?? "") : (order.clinicDescription ?? ""), + // // ), + // // ], + // // ), + // // // Row( + // // // children: [ + // // // CustomButton( + // // // text: ("Order No: ".needTranslation + order.orderNo!), + // // // onPressed: () {}, + // // // backgroundColor: AppColors.greyColor, + // // // borderColor: AppColors.greyColor, + // // // textColor: AppColors.blackColor, + // // // fontSize: 10, + // // // fontWeight: FontWeight.w500, + // // // borderRadius: 8, + // // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // // height: 24.h, + // // // ), + // // // SizedBox(width: 8.h), + // // // CustomButton( + // // // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), + // // // onPressed: () {}, + // // // backgroundColor: AppColors.greyColor, + // // // borderColor: AppColors.greyColor, + // // // textColor: AppColors.blackColor, + // // // fontSize: 10, + // // // fontWeight: FontWeight.w500, + // // // borderRadius: 8, + // // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // // height: 24.h, + // // // ), + // // // ], + // // // ), + // // // SizedBox(height: 8.h), + // // // Row( + // // // children: [ + // // // CustomButton( + // // // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), + // // // onPressed: () {}, + // // // backgroundColor: AppColors.greyColor, + // // // borderColor: AppColors.greyColor, + // // // textColor: AppColors.blackColor, + // // // fontSize: 10, + // // // fontWeight: FontWeight.w500, + // // // borderRadius: 8, + // // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // // height: 24.h, + // // // ), + // // // ], + // // // ), + // // SizedBox(height: 12.h), + // // Row( + // // children: [ + // // Expanded(flex: 2, child: SizedBox()), + // // // Expanded( + // // // flex: 1, + // // // child: Container( + // // // height: 40.h, + // // // width: 40.w, + // // // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // // // color: AppColors.textColor, + // // // borderRadius: 12, + // // // ), + // // // child: Padding( + // // // padding: EdgeInsets.all(12.h), + // // // child: Transform.flip( + // // // flipX: _appState.isArabic(), + // // // child: Utils.buildSvgWithAssets( + // // // icon: AppAssets.forward_arrow_icon_small, + // // // iconColor: AppColors.whiteColor, + // // // fit: BoxFit.contain, + // // // ), + // // // ), + // // // ), + // // // ).onPress(() { + // // // model.currentlySelectedPatientOrder = order; + // // // labProvider.getPatientLabResultByHospital(order); + // // // labProvider.getPatientSpecialResult(order); + // // // Navigator.of(context).push( + // // // CustomPageRoute(page: LabResultByClinic(labOrder: order)), + // // // ); + // // // }), + // // // ) + // // + // // Expanded( + // // flex: 2, + // // child: CustomButton( + // // icon: AppAssets.view_report_icon, + // // iconColor: AppColors.primaryRedColor, + // // iconSize: 16.h, + // // text: LocaleKeys.viewResults.tr(context: context), + // // onPressed: () { + // // labViewModel.currentlySelectedPatientOrder = order; + // // labProvider.getPatientLabResultByHospital(order); + // // labProvider.getPatientSpecialResult(order); + // // Navigator.of(context).push( + // // CustomPageRoute(page: LabResultByClinic(labOrder: order)), + // // ); + // // }, + // // backgroundColor: AppColors.secondaryLightRedColor, + // // borderColor: AppColors.secondaryLightRedColor, + // // textColor: AppColors.primaryRedColor, + // // fontSize: 14, + // // fontWeight: FontWeight.w500, + // // borderRadius: 12, + // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // // height: 40.h, + // // ), + // // ) + // // ], + // // ), + // // SizedBox(height: 12.h), + // // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // // SizedBox(height: 12.h), + // ], + // ).paddingOnly(top: 16, bottom: 16); + // }, + // separatorBuilder: (cxt, index) => Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), + // itemCount: 1), + // SizedBox(height: 16.h), + // CustomButton( + // text: LocaleKeys.viewReport.tr(), + // onPressed: () { + // model.navigationService.push( + // CustomPageRoute( + // page: RadiologyResultPage(patientRadiologyResponseModel: group), + // ), + // ); + // }, + // backgroundColor: AppColors.infoColor.withAlpha(20), + // borderColor: AppColors.infoColor.withAlpha(0), + // textColor: AppColors.infoColor, + // fontSize: (isFoldable || isTablet) ? 12.f : 14.f, + // fontWeight: FontWeight.w500, + // borderRadius: 12.r, + // padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0), + // height: 40.h, + // iconSize: 14.h, + // icon: AppAssets.view_report_icon, + // iconColor: AppColors.infoColor, + // ), + // SizedBox(height: 16.h), + // ], + // ), + // ) + // : SizedBox.shrink(), + // ), ], ), ), ), ), - ), - ); - }, - ); - }), - ], - ), - ); - }, - ), + )); + }, + ); + }), + ], + ), + ); + }, ), ), + ), ); } diff --git a/lib/presentation/radiology/radiology_result_page.dart b/lib/presentation/radiology/radiology_result_page.dart index 7b3f11d4..05f23530 100644 --- a/lib/presentation/radiology/radiology_result_page.dart +++ b/lib/presentation/radiology/radiology_result_page.dart @@ -20,6 +20,7 @@ import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:open_filex/open_filex.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'dart:ui' as ui; class RadiologyResultPage extends StatefulWidget { RadiologyResultPage({super.key, required this.patientRadiologyResponseModel}); @@ -52,6 +53,48 @@ class _RadiologyResultPageState extends State { Expanded( child: CollapsingListView( title: LocaleKeys.radiologyResult.tr(context: context), + downloadReport: () async { + LoaderBottomSheet.showLoader(); + await radiologyViewModel + .getRadiologyPDF( + patientRadiologyResponseModel: widget.patientRadiologyResponseModel, + authenticatedUser: _appState.getAuthenticatedUser()!, + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }) + .then((val) async { + LoaderBottomSheet.hideLoader(); + if (radiologyViewModel.patientRadiologyReportPDFBase64.isNotEmpty) { + String path = await Utils.createFileFromString(radiologyViewModel.patientRadiologyReportPDFBase64, "pdf"); + try { + OpenFilex.open(path); + } catch (ex) { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: "Cannot open file"), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + } + }); + }, + // viewImage: () { + // if (radiologyViewModel.radiologyImageURL.isNotEmpty) { + // Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); + // launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); + // } else { + // Utils.showToast("Radiology image not available"); + // } + // }, child: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), @@ -71,31 +114,34 @@ class _RadiologyResultPageState extends State { SizedBox(height: 16.h), // widget.patientRadiologyResponseModel.description!.toText16(isBold: true), SizedBox(height: 8.h), - widget.patientRadiologyResponseModel.reportData!.trim().toText12(isBold: true, color: AppColors.textColorLight), - SizedBox(height: 16.h), - CustomButton( - text: LocaleKeys.viewRadiologyImage.tr(context: context), - onPressed: () async { - if (radiologyViewModel.radiologyImageURL.isNotEmpty) { - Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); - launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); - } else { - Utils.showToast("Radiology image not available"); - } - }, - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - textColor: Colors.white, - fontSize: 14, - fontWeight: FontWeight.w500, - borderRadius: 12, - padding: EdgeInsets.fromLTRB(10, 0, 10, 0), - height: 40.h, - icon: AppAssets.download, - iconColor: Colors.white, - iconSize: 20.h, + Directionality( + textDirection: ui.TextDirection.ltr, + child: widget.patientRadiologyResponseModel.reportData!.trim().toText12(isBold: true, color: AppColors.textColorLight, isEnglishOnly: true), ), SizedBox(height: 16.h), + // CustomButton( + // text: LocaleKeys.viewRadiologyImage.tr(context: context), + // onPressed: () async { + // if (radiologyViewModel.radiologyImageURL.isNotEmpty) { + // Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); + // launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); + // } else { + // Utils.showToast("Radiology image not available"); + // } + // }, + // backgroundColor: AppColors.primaryRedColor, + // borderColor: AppColors.primaryRedColor, + // textColor: Colors.white, + // fontSize: 14, + // fontWeight: FontWeight.w500, + // borderRadius: 12, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + // height: 40.h, + // icon: AppAssets.download, + // iconColor: Colors.white, + // iconSize: 20.h, + // ), + // SizedBox(height: 16.h), ], ).paddingSymmetrical(16.h, 0.h), ), @@ -112,49 +158,28 @@ class _RadiologyResultPageState extends State { borderRadius: 24.h, hasShadow: true, ), - child: CustomButton( - text: LocaleKeys.downloadReport.tr(context: context), + child: widget.patientRadiologyResponseModel.dIAPACSURL != "" ? CustomButton( + text: LocaleKeys.openRad.tr(context: context), onPressed: () async { - LoaderBottomSheet.showLoader(); - await radiologyViewModel.getRadiologyPDF(patientRadiologyResponseModel: widget.patientRadiologyResponseModel, authenticatedUser: _appState.getAuthenticatedUser()!, onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }).then((val) async { - LoaderBottomSheet.hideLoader(); - if (radiologyViewModel.patientRadiologyReportPDFBase64.isNotEmpty) { - String path = await Utils.createFileFromString(radiologyViewModel.patientRadiologyReportPDFBase64, "pdf"); - try { - OpenFilex.open(path); - } catch (ex) { - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: "Cannot open file"), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - } - } - }); + if (radiologyViewModel.radiologyImageURL.isNotEmpty) { + Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); + launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); + } else { + Utils.showToast("Radiology image not available"); + } }, - backgroundColor: AppColors.successColor, - borderColor: AppColors.successColor, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, textColor: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 45.h, - icon: AppAssets.download, + icon: AppAssets.imageIcon, iconColor: Colors.white, iconSize: 20.h, - ).paddingSymmetrical(24.h, 24.h), + ).paddingSymmetrical(24.h, 24.h) : SizedBox.shrink(), ), ], ), diff --git a/lib/presentation/smartwatches/activity_detail.dart b/lib/presentation/smartwatches/activity_detail.dart new file mode 100644 index 00000000..78527140 --- /dev/null +++ b/lib/presentation/smartwatches/activity_detail.dart @@ -0,0 +1,359 @@ +import 'dart:math'; + +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/common_models/data_points.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; +import 'package:hmg_patient_app_new/widgets/graph/CustomBarGraph.dart'; +import 'package:intl/intl.dart' show DateFormat; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/HealthDataTransformation.dart' as durations; +import 'package:dartz/dartz.dart' show Tuple2; + +import '../../core/utils/date_util.dart'; + +class ActivityDetails extends StatefulWidget { + final String selectedActivity; + final String sectionName; + final String uom; + + const ActivityDetails({super.key, required this.selectedActivity, required this.sectionName, required this.uom}); + + @override + State createState() => _ActivityDetailsState(); +} + +class _ActivityDetailsState extends State { + int index = 0; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "All Health Data".needTranslation, + child: Column( + spacing: 16.h, + children: [ + periodSelectorView((index) {}), + activityDetails(), + DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: + activityGraph().paddingOnly(left: 16.w, right: 16.w, top: 32.h, bottom: 16.h),) + ], + ).paddingSymmetrical(24.w, 24.h), + ), + ); + } + + Widget periodSelectorView(Function(int) onItemSelected) { + return DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Row( + children: [ + Expanded( + child: CustomTabBar( + activeTextColor: Color(0xffED1C2B), + activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), + tabs: [ + CustomTabBarModel(null, "D"), + CustomTabBarModel(null, "W"), + CustomTabBarModel(null, "M"), + CustomTabBarModel(null, "6M"), + CustomTabBarModel(null, "Y"), + // CustomTabBarModel(null, "Completed".needTranslation), + ], + shouldTabExpanded: true, + onTabChange: (index) { + switch (index) { + case 0: + context.read().setDurations(durations.Durations.daily); + break; + case 1: + context.read().setDurations(durations.Durations.weekly); + break; + case 2: + context.read().setDurations(durations.Durations.monthly); + break; + case 3: + context.read().setDurations(durations.Durations.halfYearly); + break; + case 4: + context.read().setDurations(durations.Durations.yearly); + break; + } + context.read().fetchData(); + }, + ), + ), + ], + ).paddingSymmetrical(4.w, 4.h)); + } + + Widget activityDetails() { + return DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h, hasShadow: true), + child: Column( + spacing: 8.h, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + widget.sectionName.capitalizeFirstofEach.toText32(weight: FontWeight.w600, color: AppColors.textColor), + "Average".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor) + ], + ), + Selector>( + selector: (_, model) => Tuple2(model.averageValue, model.averageValueString), + builder: (_, data, __) { + var averageAsDouble = data.value1; + var averageAsString = data.value2; + return Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + spacing: 4.w, + children: [ + (averageAsDouble?.toStringAsFixed(2) ?? averageAsString ?? "N/A").toText24(color: AppColors.textGreenColor, fontWeight: FontWeight.w600), + Visibility( + visible: averageAsDouble != null || averageAsString != null, + child: widget.uom.toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500) + ) + ], + ); + }) + ], + ).paddingSymmetrical(16.w, 16.h)); + } + + + Widget activityGraph() { + // final _random = Random(); + // + // int randomBP() => 100 + _random.nextInt(51); // 100–150 + // final List data6Months = List.generate(6, (index) { + // final date = DateTime.now().subtract(Duration(days: 30 * (5 - index))); + // + // final value = randomBP(); + // + // return DataPoint( + // value: value.toDouble(), + // label: value.toString(), + // actualValue: value.toString(), + // displayTime: DateFormat('MMM').format(date), + // unitOfMeasurement: 'mmHg', + // time: date, + // ); + // }); + // final List data12Months = List.generate(12, (index) { + // final date = DateTime.now().subtract(Duration(days: 30 * (11 - index))); + // + // final value = randomBP(); + // + // return DataPoint( + // value: value.toDouble(), + // label: value.toString(), + // actualValue: value.toString(), + // displayTime: DateFormat('MMM').format(date), + // unitOfMeasurement: 'mmHg', + // time: date, + // ); + // }); + // + // List data =[]; + // if(index == 0){ + // data = data6Months; + // } else if(index == 1){ + // data = data12Months; + // } else + // data = [ + // DataPoint( + // value: 128, + // label: "128", + // actualValue: '128', + // displayTime: 'Sun', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 6)), + // ), + // DataPoint( + // value: 135, + // label: "135", + // actualValue: '135', + // displayTime: 'Mon', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 5)), + // ), + // DataPoint( + // value: 122, + // label: "122", + // actualValue: '122', + // displayTime: 'Tue', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 4)), + // ), + // DataPoint( + // value: 140, + // label: "140", + // actualValue: '140', + // displayTime: 'Wed', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 3)), + // ), + // DataPoint( + // value: 118, + // label: "118", + // actualValue: '118', + // displayTime: 'Thu', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 2)), + // ), + // DataPoint( + // value: 125, + // label: "125", + // actualValue: '125', + // displayTime: 'Fri', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now().subtract(const Duration(days: 1)), + // ), + // DataPoint( + // value: 130, + // label: "130", + // actualValue: '130', + // displayTime: 'Sat', + // unitOfMeasurement: 'mmHg', + // time: DateTime.now(), + // ),23 + // ]; + return Selector>?>( + selector: (_, model) => model.selectedData, + builder: (_, data, __) { + if (context.read().selectedData.values.toList().first?.isEmpty == true) return SizedBox(); + + return CustomBarChart( + dataPoints: context.read().selectedData.values.toList().first, + height: 300.h, + maxY: 150, + barColor: AppColors.bgGreenColor, + barWidth: getBarWidth(), + barRadius: BorderRadius.circular(8), + bottomLabelColor: Colors.black, + bottomLabelSize: 12, + leftLabelInterval: .1, + leftLabelReservedSize: 20, + // Left axis label formatter (Y-axis) + leftLabelFormatter: (value) { + var labelValue = double.tryParse(value.toStringAsFixed(0)); + + if (labelValue == null) return SizedBox.shrink(); + // if (labelValue == 0 || labelValue == 150 / 2 || labelValue == 150) { + // return Text( + // labelValue.toStringAsFixed(0), + // style: const TextStyle( + // color: Colors.black26, + // fontSize: 11, + // ), + // ); + // } + + return SizedBox.shrink(); + }, + + /// for the handling of the sleep time + getTooltipItem: (widget.selectedActivity == "sleep") + ? (data) { + return BarTooltipItem( + '${DateUtil. millisToHourMin(num.parse(data.actualValue).toInt())}\n${DateFormat('dd MMM, yyyy').format(data.time)}', + TextStyle( + color: Colors.black, + fontSize: 12.f, + fontWeight: FontWeight.w500, + ), + ); + } + : null, + + // Bottom axis label formatter (X-axis - Days) + bottomLabelFormatter: (value, dataPoints) { + final index = value.toInt(); + print("value is $value"); + print("the index is $index"); + print("the dataPoints.length is ${dataPoints.length}"); + + var bottomText = ""; + var date = dataPoints[index].time; + print("the time is ${date}"); + switch (context.read().selectedDuration) { + case durations.Durations.daily: + bottomText = getHour(date).toString(); + break; + case durations.Durations.weekly: + bottomText = getDayName(date)[0]; + break; + case durations.Durations.monthly: + case durations.Durations.halfYearly: + case durations.Durations.yearly: + bottomText = getMonthName(date)[0]; + } + + return Text( + bottomText, + style: const TextStyle( + color: Colors.grey, + fontSize: 11, + ), + ); + return const Text(''); + }, + verticalInterval: 1 / context.read().selectedData.values.toList().first.length, + getDrawingVerticalLine: (value) { + return FlLine( + color: AppColors.greyColor, + strokeWidth: 1, + ); + }, + showGridLines: true); + }); + } + + //todo remove these from here + String getDayName(DateTime date) { + return DateUtil.getWeekDayAsOfLang(date.weekday); + } + + String getHour(DateTime date) { + return date.hour.toString().padLeft(2, '0').toString(); + } + + static String getMonthName(DateTime date) { + return DateUtil.getMonthDayAsOfLang(date.month); + } + + double getBarWidth() { + var duration = context.read().selectedDuration; + switch(duration){ + case durations.Durations.daily: + return 26.w; + case durations.Durations.weekly: + return 26.w; + case durations.Durations.monthly: + return 6.w; + case durations.Durations.halfYearly: + return 26.w; + case durations.Durations.yearly: + return 18.w; + } + } +} diff --git a/lib/presentation/smartwatches/smart_watch_activity.dart b/lib/presentation/smartwatches/smart_watch_activity.dart new file mode 100644 index 00000000..678fd715 --- /dev/null +++ b/lib/presentation/smartwatches/smart_watch_activity.dart @@ -0,0 +1,252 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/activity_detail.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:provider/provider.dart'; +import 'package:hmg_patient_app_new/features/smartwatch_health_data/HealthDataTransformation.dart' as durations; + +import '../../core/utils/date_util.dart' show DateUtil; + +class SmartWatchActivity extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: AppColors.bgScaffoldColor, + body: CollapsingListView( + title: "All Health Data".needTranslation, + child: Column( + spacing: 16.h, + children: [ + resultItem( + leadingIcon: AppAssets.watchActivity, + title: "Activity Calories".needTranslation, + description: "Activity rings give you a quick visual reference of how active you are each day. ".needTranslation, + trailingIcon: AppAssets.watchActivityTrailing, + result: context.read().sumOfNonEmptyData(context.read().vitals?.activity??[]), + unitsOfMeasure: "Kcal" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("activity"); + context.read().saveSelectedSection("activity"); + context.read().fetchData(); + context.read().navigateToDetails("activity", sectionName:"Activity Calories", uom: "Kcal"); + + }), + resultItem( + leadingIcon: AppAssets.watchSteps, + title: "Steps".needTranslation, + description: "Step count is the number of steps you take throughout the day.".needTranslation, + trailingIcon: AppAssets.watchStepsTrailing, + result: context.read().sumOfNonEmptyData(context.read().vitals?.step??[]), + unitsOfMeasure: "Steps" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("steps"); + context.read().saveSelectedSection("steps"); + context.read().fetchData(); + context.read().navigateToDetails("steps", sectionName: "Steps", uom: "Steps"); + + }), + resultItem( + leadingIcon: AppAssets.watchSteps, + title: "Distance Covered".needTranslation, + description: "Step count is the distance you take throughout the day.".needTranslation, + trailingIcon: AppAssets.watchStepsTrailing, + result: context.read().sumOfNonEmptyData(context.read().vitals?.distance??[]), + unitsOfMeasure: "Km" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("distance"); + context.read().saveSelectedSection("distance"); + context.read().fetchData(); + context.read().navigateToDetails("distance", sectionName: "Distance Covered", uom: "km"); + + }), + + resultItem( + leadingIcon: AppAssets.watchSleep, + title: "Sleep Score".needTranslation, + description: "This will keep track of how much hours you sleep in a day".needTranslation, + trailingIcon: AppAssets.watchSleepTrailing, + result: DateUtil.millisToHourMin(int.parse(context.read().firstNonEmptyValue(context.read().vitals?.sleep??[]))).split(" ")[0], + unitsOfMeasure: "hr", + resultSecondValue: DateUtil.millisToHourMin(int.parse(context.read().firstNonEmptyValue(context.read().vitals?.sleep??[]))).split(" ")[2], + unitOfSecondMeasure: "min" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("sleep"); + context.read().saveSelectedSection("sleep"); + context.read().fetchData(); + context.read().navigateToDetails("sleep", sectionName:"Sleep Score",uom:""); + + }), + + resultItem( + leadingIcon: AppAssets.watchWeight, + title: "Blood Oxygen".needTranslation, + description: "This will calculate your Blood Oxygen to keep track and update history".needTranslation, + trailingIcon: AppAssets.watchWeightTrailing, + result: context.read().firstNonEmptyValue(context.read().vitals?.bodyOxygen??[], ), + unitsOfMeasure: "%" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("bodyOxygen"); + context.read().saveSelectedSection("bodyOxygen"); + context.read().fetchData(); + context.read().navigateToDetails("bodyOxygen", uom: "%", sectionName:"Blood Oxygen" ); + + }), + resultItem( + leadingIcon: AppAssets.watchWeight, + title: "Body temperature".needTranslation, + description: "This will calculate your Body temprerature to keep track and update history".needTranslation, + trailingIcon: AppAssets.watchWeightTrailing, + result: context.read().firstNonEmptyValue(context.read().vitals?.bodyTemperature??[]), + unitsOfMeasure: "C" + ).onPress((){ + // Map> getVitals() { + // return { + // "heartRate": heartRate , + // "sleep": sleep, + // "steps": step, + // "activity": activity, + // "bodyOxygen": bodyOxygen, + // "bodyTemperature": bodyTemperature, + // }; + // } + context.read().setDurations(durations.Durations.daily); + + context.read().deleteDataIfSectionIsDifferent("bodyTemperature"); + context.read().saveSelectedSection("bodyTemperature"); + context.read().fetchData(); + context.read().navigateToDetails("bodyTemperature" , sectionName: "Body temperature".capitalizeFirstofEach, uom: "C"); + + }), + ], + ).paddingSymmetrical(24.w, 24.h), + )); + } + + Widget resultItem({ + required String leadingIcon, + required String title, + required String description, + required String trailingIcon, + required String result, + required String unitsOfMeasure, + String? resultSecondValue, + String? unitOfSecondMeasure + }) { + return DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Row( + spacing: 16.w, + children: [ + Expanded( + child:Column( + spacing: 8.h, + children: [ + Row( + spacing: 8.w, + children: [ + Utils.buildSvgWithAssets(icon: leadingIcon, height: 16.h, width: 14.w), + title.toText16( weight: FontWeight.w600, color: AppColors.textColor), + ], + ), + description.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + spacing: 2.h, + children: [ + result.toText21(weight: FontWeight.w600, color: AppColors.textColor), + unitsOfMeasure.toText10(weight: FontWeight.w500, color:AppColors.greyTextColor ), + if(resultSecondValue != null) + Visibility( + visible: resultSecondValue != null , + child: Row( + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, + spacing: 2.h, + children: [ + SizedBox(width: 2.w,), + resultSecondValue.toText21(weight: FontWeight.w600, color: AppColors.textColor), + unitOfSecondMeasure!.toText10(weight: FontWeight.w500, color:AppColors.greyTextColor ) + ], + ), + ) + ], + ), + + ], + ) , + ), + Utils.buildSvgWithAssets(icon: trailingIcon, width: 72.w, height: 72.h), + ], + ).paddingSymmetrical(16.w, 16.h) + ); + } +} diff --git a/lib/presentation/smartwatches/smartwatch_home_page.dart b/lib/presentation/smartwatches/smartwatch_home_page.dart index 8fd79098..800ff030 100644 --- a/lib/presentation/smartwatches/smartwatch_home_page.dart +++ b/lib/presentation/smartwatches/smartwatch_home_page.dart @@ -3,18 +3,25 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/common_models/smart_watch.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/smartwatch_instructions_page.dart'; import 'package:hmg_patient_app_new/presentation/smartwatches/widgets/supported_watches_list.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:provider/provider.dart'; +import '../../core/utils/utils.dart'; + class SmartwatchHomePage extends StatelessWidget { const SmartwatchHomePage({super.key}); @@ -80,7 +87,15 @@ class SmartwatchHomePage extends StatelessWidget { CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { - context.read().setSelectedWatchType("apple", "assets/images/png/smartwatches/apple-watch-5.jpg"); + context.read().setSelectedWatchType(SmartWatchTypes.apple, "assets/images/png/smartwatches/apple-watch-5.jpg"); + getIt.get().pushPage(page: SmartwatchInstructionsPage( + smartwatchDetails: SmartwatchDetails(SmartWatchTypes.apple, + "assets/images/png/smartwatches/apple-watch-5.jpg", + AppAssets.bluetooth, + LocaleKeys.applehealthapplicationshouldbeinstalledinyourphone.tr(context: context), + LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + LocaleKeys.applewatchshouldbeconnected.tr(context: context)), + )); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), @@ -105,8 +120,15 @@ class SmartwatchHomePage extends StatelessWidget { CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { - context.read().setSelectedWatchType("samsung", "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); - }, + context.read().setSelectedWatchType(SmartWatchTypes.samsung, "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); + getIt.get().pushPage(page: SmartwatchInstructionsPage( + smartwatchDetails: SmartwatchDetails(SmartWatchTypes.samsung, + "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", + AppAssets.bluetooth, + LocaleKeys.samsunghealthapplicationshouldbeinstalledinyourphone.tr(context: context), + LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + LocaleKeys.samsungwatchshouldbeconnected.tr(context: context)), + )); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), textColor: AppColors.primaryRedColor, @@ -130,7 +152,16 @@ class SmartwatchHomePage extends StatelessWidget { CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { - context.read().setSelectedWatchType("huawei", "assets/images/png/smartwatches/Huawei_Watch.png"); + // context.read().setSelectedWatchType(SmartWatchTypes.huawei, "assets/images/png/smartwatches/Huawei_Watch.png"); + // getIt.get().pushPage(page: SmartwatchInstructionsPage( + // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.huawei, + // "assets/images/png/smartwatches/Huawei_Watch.png", + // AppAssets.bluetooth, + // LocaleKeys.huaweihealthapplicationshouldbeinstalledinyourphone.tr(context: context), + // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + // LocaleKeys.huaweiwatchshouldbeconnected.tr(context: context)), + // )); + showUnavailableDialog(context); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), @@ -155,7 +186,17 @@ class SmartwatchHomePage extends StatelessWidget { CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { - context.read().setSelectedWatchType("whoop", "assets/images/png/smartwatches/Whoop_Watch.png"); + + showUnavailableDialog(context); + // context.read().setSelectedWatchType(SmartWatchTypes.whoop, "assets/images/png/smartwatches/Whoop_Watch.png"); + // getIt.get().pushPage(page: SmartwatchInstructionsPage( + // smartwatchDetails: SmartwatchDetails(SmartWatchTypes.whoop, + // "assets/images/png/smartwatches/Whoop_Watch.png", + // AppAssets.bluetooth, + // LocaleKeys.whoophealthapplicationshouldbeinstalledinyourphone.tr(context: context), + // LocaleKeys.unabletodetectapplicationinstalledpleasecomebackonceinstalled.tr(context: context), + // LocaleKeys.whoopwatchshouldbeconnected.tr(context: context)), + // )); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), @@ -177,4 +218,23 @@ class SmartwatchHomePage extends StatelessWidget { ), ); } + + void showUnavailableDialog(BuildContext context) { + + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getWarningWidget( + loadingText: LocaleKeys.featureComingSoonDescription.tr(context: context), + isShowActionButtons: false, + showOkButton: true, + onConfirmTap: () async { + context.pop(); + } + ), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } } diff --git a/lib/presentation/smartwatches/smartwatch_instructions_page.dart b/lib/presentation/smartwatches/smartwatch_instructions_page.dart index 48683d50..fa5f3135 100644 --- a/lib/presentation/smartwatches/smartwatch_instructions_page.dart +++ b/lib/presentation/smartwatches/smartwatch_instructions_page.dart @@ -1,15 +1,26 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; +import 'package:hmg_patient_app_new/core/common_models/smart_watch.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/smartwatches/smart_watch_activity.dart' show SmartWatchActivity; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:provider/provider.dart'; + +import '../../core/utils/utils.dart'; +import '../../features/smartwatch_health_data/health_provider.dart' show HealthProvider; class SmartwatchInstructionsPage extends StatelessWidget { - const SmartwatchInstructionsPage({super.key}); + final SmartwatchDetails smartwatchDetails; + + const SmartwatchInstructionsPage({super.key, required this.smartwatchDetails}); @override Widget build(BuildContext context) { @@ -25,6 +36,7 @@ class SmartwatchInstructionsPage extends StatelessWidget { child: CustomButton( text: LocaleKeys.getStarted.tr(context: context), onPressed: () { + context.read().initDevice(); }, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -35,8 +47,55 @@ class SmartwatchInstructionsPage extends StatelessWidget { height: 50.h, ).paddingSymmetrical(24.w, 30.h), ), - child: SingleChildScrollView(), + child: Column( + mainAxisSize: MainAxisSize.max, + spacing: 18.h, + children: [ + Image.asset(smartwatchDetails.watchIcon, fit: BoxFit.contain, height: 280.h,width: 280.w,), + DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Column( + children: [ + watchContentDetails( + title: smartwatchDetails.detailsTitle, + description: smartwatchDetails.details, + icon: smartwatchDetails.smallIcon, + descriptionTextColor: AppColors.primaryRedColor + ), + Divider( + color: AppColors.dividerColor, + thickness: 1.h, + ).paddingOnly(top: 16.h, bottom: 16.h), + watchContentDetails( + title: smartwatchDetails.secondTitle, + description: LocaleKeys.updatetheinformation.tr(), + icon: AppAssets.bluetooth, + descriptionTextColor: AppColors.greyTextColor + ), + ], + ).paddingSymmetrical(16.w, 16.h), + ) + ], + ).paddingSymmetrical(24.w, 16.h), ), ); } + + + Widget watchContentDetails({required String title, required String description, required String icon, required Color descriptionTextColor}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.h, + children: [ + DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.h), + child: Utils.buildSvgWithAssets(icon: icon, width: 40.w, height: 40.h), + + ), + + title.toText16(weight: FontWeight.w600, color: AppColors.textColor), + description.toText12(fontWeight: FontWeight.w500, color: descriptionTextColor) + ], + ); + } } diff --git a/lib/presentation/symptoms_checker/user_info_selection.dart b/lib/presentation/symptoms_checker/user_info_selection.dart index f1e8413d..b245c014 100644 --- a/lib/presentation/symptoms_checker/user_info_selection.dart +++ b/lib/presentation/symptoms_checker/user_info_selection.dart @@ -100,7 +100,7 @@ class _UserInfoSelectionPageState extends State { children: [ title.toText14(weight: FontWeight.w500), subTitle - .toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) + .toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500, isEnglishOnly: true) .toShimmer2(isShow: (leadingIcon == AppAssets.rulerIcon || leadingIcon == AppAssets.weightScale) && hmgServicesVM.isVitalSignLoading), ], ), diff --git a/lib/presentation/symptoms_checker/widgets/condition_card.dart b/lib/presentation/symptoms_checker/widgets/condition_card.dart index e48f41ea..d753b780 100644 --- a/lib/presentation/symptoms_checker/widgets/condition_card.dart +++ b/lib/presentation/symptoms_checker/widgets/condition_card.dart @@ -168,7 +168,7 @@ class ConditionCard extends StatelessWidget { crossAxisAlignment: WrapCrossAlignment.center, children: [ for (int i = 0; i < symptoms.length; i++) ...[ - "● ${symptoms[i]}".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), + "● ${symptoms[i]}".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor, isEnglishOnly: true), if (i != symptoms.length - 1) Padding( padding: EdgeInsets.symmetric(horizontal: 2.w), @@ -228,7 +228,7 @@ class ConditionCard extends StatelessWidget { backgroundColor: AppColors.scaffoldBgColor, titleWidget: Row( children: [ - "$percentage%".toText12(fontWeight: FontWeight.bold, color: getChipColorBySeverityEnum(severityEnum)), + "$percentage%".toText12(fontWeight: FontWeight.bold, color: getChipColorBySeverityEnum(severityEnum), isEnglishOnly: true), ], ).paddingSymmetrical(0, 4.h), ), diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 01cc50b7..f22c6805 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -41,6 +41,7 @@ import '../features/monthly_reports/monthly_reports_repo.dart'; import '../features/monthly_reports/monthly_reports_view_model.dart'; import '../features/qr_parking/qr_parking_view_model.dart'; import '../presentation/parking/paking_page.dart'; +import '../presentation/smartwatches/smartwatch_instructions_page.dart'; import '../services/error_handler_service.dart'; class AppRoutes { diff --git a/lib/services/dialog_service.dart b/lib/services/dialog_service.dart index c4dfb7c4..d2ba2723 100644 --- a/lib/services/dialog_service.dart +++ b/lib/services/dialog_service.dart @@ -166,7 +166,7 @@ class DialogServiceImp implements DialogService { mainAxisAlignment: MainAxisAlignment.start, children: [ if (message != null) (message).toText16(isBold: false, color: AppColors.textColor), - SizedBox(height: 24.h), + // SizedBox(height: 24.h), FamilyCards( profiles: profiles, onSelect: (FamilyFileResponseModelLists profile) { @@ -190,6 +190,7 @@ class DialogServiceImp implements DialogService { }) ], ), + useSafeArea: true, callBackFunc: () {}); } diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 8f1ff4a6..64518f30 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -57,7 +57,7 @@ class _SplashScreenState extends State { await notificationService.initialize(onNotificationClick: (payload) { // Handle notification click here }); - //ZoomService().initializeZoomSDK(); + ZoomService().initializeZoomSDK(); if (isAppOpenedFromCall) { navigateToTeleConsult(); } else { diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 514acfb4..c8cbf308 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -8,7 +8,7 @@ class AppColors { static const transparent = Colors.transparent; // ── Scaffold / Background ───────────────────────────────────────────────── - static Color get scaffoldBgColor => isDarkMode ? dark.scaffoldBgColor : const Color(0xFFF8F8F8); + static Color get scaffoldBgColor => isDarkMode ? dark.scaffoldBgColor : const Color(0xFFF0F0F0); static Color get bottomSheetBgColor => isDarkMode ? dark.bottomSheetBgColor : const Color(0xFFF8F8FA); static Color get lightGreyEFColor => isDarkMode ? dark.lightGreyEFColor : const Color(0xffeaeaff); static Color get greyF7Color => isDarkMode ? dark.greyF7Color : const Color(0xffF7F7F7); @@ -300,6 +300,7 @@ extension AppColorsContext on BuildContext { // Shimmer Color get shimmerBaseColor => _isDark ? AppColors.dark.shimmerBaseColor : const Color(0xFFE0E0E0); Color get shimmerHighlightColor => _isDark ? AppColors.dark.shimmerHighlightColor : const Color(0xFFF5F5F5); + static const Color tooltipColor = Color(0xFF1AACACAC); // Aliases Color get bgScaffoldColor => scaffoldBgColor; diff --git a/lib/widgets/appbar/collapsing_list_view.dart b/lib/widgets/appbar/collapsing_list_view.dart index 0c32d87d..4c754b65 100644 --- a/lib/widgets/appbar/collapsing_list_view.dart +++ b/lib/widgets/appbar/collapsing_list_view.dart @@ -26,6 +26,8 @@ class CollapsingListView extends StatelessWidget { VoidCallback? sendEmail; VoidCallback? doctorResponse; VoidCallback? downloadReport; + VoidCallback? viewImage; + VoidCallback? location; Widget? bottomChild; Widget? trailing; bool isClose; @@ -49,6 +51,8 @@ class CollapsingListView extends StatelessWidget { this.sendEmail, this.doctorResponse, this.downloadReport, + this.viewImage, + this.location, this.isLeading = true, this.trailing, this.leadingCallback, @@ -92,6 +96,8 @@ class CollapsingListView extends StatelessWidget { sendEmail: sendEmail, doctorResponse: doctorResponse, downloadReport: downloadReport, + viewImage: viewImage, + location: location, bottomChild: bottomChild, trailing: trailing, aiOverview: aiOverview, @@ -204,6 +210,8 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget VoidCallback? sendEmail; VoidCallback? doctorResponse; VoidCallback? downloadReport; + VoidCallback? viewImage; + VoidCallback? location; Widget? bottomChild; Widget? trailing; @@ -222,6 +230,8 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget this.sendEmail, this.doctorResponse, this.downloadReport, + this.viewImage, + this.location, this.bottomChild, this.trailing, }); @@ -254,7 +264,7 @@ class _ScrollAnimatedTitleState extends State { super.dispose(); } - double t = 0; + double t = 1.0; void _onScroll() { final double offset = widget.controller.offset; @@ -301,6 +311,8 @@ class _ScrollAnimatedTitleState extends State { if (widget.search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(widget.search!), if (widget.aiOverview != null) actionButton(context, t, title: LocaleKeys.aiOverView.tr(context: context), icon: AppAssets.aiOverView, isAiButton: true).onPress(widget.aiOverview!), if (widget.downloadReport != null) actionButton(context, t, title: LocaleKeys.downloadReport.tr(context: context), icon: AppAssets.download).onPress(widget.downloadReport!), + if (widget.viewImage != null) actionButton(context, t, title: LocaleKeys.viewRadiologyImage.tr(context: context), icon: AppAssets.download).onPress(widget.viewImage!), + if (widget.location != null) actionButton(context, t, title: LocaleKeys.sortByLocation.tr(context: context), icon: AppAssets.location).onPress(widget.location!), if (widget.trailing != null) widget.trailing!, ] ], diff --git a/lib/widgets/chip/app_custom_chip_widget.dart b/lib/widgets/chip/app_custom_chip_widget.dart index 77345933..b2ae4288 100644 --- a/lib/widgets/chip/app_custom_chip_widget.dart +++ b/lib/widgets/chip/app_custom_chip_widget.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -27,6 +29,7 @@ class AppCustomChipWidget extends StatelessWidget { this.labelPadding, this.onDeleteTap, this.applyThemeColor = true, + this.isEnglishOnly = false }); final String? labelText; @@ -48,6 +51,7 @@ class AppCustomChipWidget extends StatelessWidget { final void Function()? onChipTap; final void Function()? onDeleteTap; final bool applyThemeColor; + final bool isEnglishOnly; @override Widget build(BuildContext context) { @@ -85,7 +89,7 @@ class AppCustomChipWidget extends StatelessWidget { applyThemeColor: applyThemeColor, ) : SizedBox.shrink(), - label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: resolvedTextColor), + label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: resolvedTextColor, isEnglishOnly: isEnglishOnly), padding: padding, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, labelPadding: labelPadding ?? EdgeInsetsDirectional.only(end: deleteIcon?.isNotEmpty == true ? 2.w : 8.w), @@ -99,12 +103,15 @@ class AppCustomChipWidget extends StatelessWidget { deleteIcon: deleteIcon?.isNotEmpty == true ? InkWell( onTap: onDeleteTap, - child: Utils.buildSvgWithAssets( - icon: deleteIcon!, - width: iconS, - height: iconS, - iconColor: deleteIconHasColor ? resolvedDeleteIconColor : null, - applyThemeColor: applyThemeColor, + child: Transform.flip( + flipX: getIt.get().isArabic(), + child: Utils.buildSvgWithAssets( + icon: deleteIcon!, + width: iconS, + height: iconS, + iconColor: deleteIconHasColor ? resolvedDeleteIconColor : null, + applyThemeColor: applyThemeColor, + ), ), ) : null, @@ -112,7 +119,7 @@ class AppCustomChipWidget extends StatelessWidget { ) : Chip( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: resolvedTextColor, isCenter: true), + label: richText ?? (labelText?? "").toText10(weight: FontWeight.w500, letterSpacing: 0, color: resolvedTextColor, isCenter: true, isEnglishOnly: isEnglishOnly), padding: EdgeInsets.zero, backgroundColor: resolvedBackgroundColor, shape: shape ?? diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 5269a8dc..bc52c0cc 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -2,6 +2,7 @@ import 'dart:io' show Platform; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; @@ -10,6 +11,7 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_reminder_view.dart'; +import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/permission_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -22,19 +24,66 @@ class BottomSheetUtils { _showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); } else { - // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async { - // if (await Permission.calendarFullAccess.request().isGranted) { - // _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - // onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); - // } - // }); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: GetIt.instance().navigatorKey.currentContext!), + GetIt.instance().navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: LocaleKeys.calendarPermissionAlert.tr(), + isShowActionButtons: true, + onCancelTap: () { + GetIt.instance().pop(); + }, + onConfirmTap: () async { + GetIt.instance().pop(); + openAppSettings(); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); } } else { if (await Permission.calendarWriteOnly.request().isGranted) { if (await Permission.calendarFullAccess.request().isGranted) { _showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); + } else { + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: GetIt.instance().navigatorKey.currentContext!), + GetIt.instance().navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: LocaleKeys.calendarPermissionAlert.tr(), + isShowActionButtons: true, + onCancelTap: () { + GetIt.instance().pop(); + }, + onConfirmTap: () async { + GetIt.instance().pop(); + openAppSettings(); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); } + } else { + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: GetIt.instance().navigatorKey.currentContext!), + GetIt.instance().navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: LocaleKeys.calendarPermissionAlert.tr(), + isShowActionButtons: true, + onCancelTap: () { + GetIt.instance().pop(); + }, + onConfirmTap: () async { + GetIt.instance().pop(); + openAppSettings(); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); } } } diff --git a/lib/widgets/custom_tab_bar.dart b/lib/widgets/custom_tab_bar.dart index 0fd354e0..b93519ca 100644 --- a/lib/widgets/custom_tab_bar.dart +++ b/lib/widgets/custom_tab_bar.dart @@ -21,6 +21,7 @@ class CustomTabBar extends StatefulWidget { final Color? inActiveTextColor; final Color? inActiveBackgroundColor; final Function(int)? onTabChange; + final bool shouldTabExpanded; const CustomTabBar({ super.key, @@ -31,6 +32,7 @@ class CustomTabBar extends StatefulWidget { this.activeBackgroundColor, this.inActiveBackgroundColor, this.onTabChange, + this.shouldTabExpanded = false }); @override @@ -62,6 +64,11 @@ class CustomTabBarState extends State { final resolvedActiveBgColor = widget.activeBackgroundColor ?? AppColors.lightGrayBGColor; final resolvedInActiveBgColor = widget.inActiveBackgroundColor ?? AppColors.whiteColor; late Widget parentWidget; + if(widget.shouldTabExpanded){ + return Row( + children:List.generate(widget.tabs.length, (index)=>myTab(widget.tabs[index], index, resolvedActiveTextColor, resolvedInActiveTextColor, resolvedActiveBgColor, resolvedInActiveBgColor).expanded), + ); + } if (widget.tabs.length > 3) { parentWidget = ListView.separated( diff --git a/lib/widgets/graph/CustomBarGraph.dart b/lib/widgets/graph/CustomBarGraph.dart new file mode 100644 index 00000000..2f50f20d --- /dev/null +++ b/lib/widgets/graph/CustomBarGraph.dart @@ -0,0 +1,250 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/common_models/data_points.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +/// A customizable bar chart widget using `fl_chart`. +/// +/// Displays a bar chart with configurable axis labels, colors, and data points. +/// Useful for visualizing comparative data, categories, or grouped values. +/// +/// **Parameters:** +/// - [dataPoints]: List of `DataPoint` objects to plot. +/// - [secondaryDataPoints]: Optional list for grouped bars (e.g., comparison data). +/// - [leftLabelFormatter]: Function to build left axis labels. +/// - [bottomLabelFormatter]: Function to build bottom axis labels. +/// - [width]: Optional width of the chart. +/// - [height]: Required height of the chart. +/// - [maxY], [maxX], [minX]: Axis bounds. +/// - [barColor]: Color of the bars. +/// - [secondaryBarColor]: Color of the secondary bars. +/// - [barRadius]: Border radius for bar corners. +/// - [barWidth]: Width of each bar. +/// - [bottomLabelColor]: Color of bottom axis labels. +/// - [bottomLabelSize]: Font size for bottom axis labels. +/// - [bottomLabelFontWeight]: Font weight for bottom axis labels. +/// - [leftLabelInterval]: Interval between left axis labels. +/// - [leftLabelReservedSize]: Reserved space for left axis labels. +/// - [showBottomTitleDates]: Whether to show bottom axis labels. +/// - [isFullScreeGraph]: Whether the graph is fullscreen. +/// - [makeGraphBasedOnActualValue]: Use `actualValue` for plotting. +/// +/// Example usage: +/// ```dart +/// CustomBarChart( +/// dataPoints: sampleData, +/// leftLabelFormatter: (value) => ..., +/// bottomLabelFormatter: (value, dataPoints) => ..., +/// height: 300, +/// maxY: 100, +/// ) +class CustomBarChart extends StatelessWidget { + final List dataPoints; + final List? secondaryDataPoints; // For grouped bar charts + final double? width; + final double height; + final double? maxY; + final double? maxX; + final double? minX; + Color? barColor; + final Color? secondaryBarColor; + Color? barGridColor; + Color? bottomLabelColor; + final double? bottomLabelSize; + final FontWeight? bottomLabelFontWeight; + final double? leftLabelInterval; + final double? leftLabelReservedSize; + final double? bottomLabelReservedSize; + final bool? showGridLines; + final GetDrawingGridLine? getDrawingVerticalLine; + final double? verticalInterval; + final double? minY; + final BorderRadius? barRadius; + final double barWidth; + final BarTooltipItem Function(DataPoint)? getTooltipItem; + + /// Creates the left label and provides it to the chart + final Widget Function(double) leftLabelFormatter; + final Widget Function(double, List) bottomLabelFormatter; + + final bool showBottomTitleDates; + final bool isFullScreeGraph; + final bool makeGraphBasedOnActualValue; + + CustomBarChart( + {super.key, + required this.dataPoints, + this.secondaryDataPoints, + required this.leftLabelFormatter, + this.width, + required this.height, + this.maxY, + this.maxX, + this.showBottomTitleDates = true, + this.isFullScreeGraph = false, + this.secondaryBarColor, + this.bottomLabelFontWeight = FontWeight.w500, + this.bottomLabelSize, + this.leftLabelInterval, + this.leftLabelReservedSize, + this.bottomLabelReservedSize, + this.makeGraphBasedOnActualValue = false, + required this.bottomLabelFormatter, + this.minX, + this.showGridLines = false, + this.getDrawingVerticalLine, + this.verticalInterval, + this.minY, + this.barRadius, + this.barWidth = 16, + this.getTooltipItem, + this.barColor , + this.barGridColor , + this.bottomLabelColor, + }); + + @override + Widget build(BuildContext context) { + barColor ??= AppColors.bgGreenColor; + barGridColor ??= AppColors.graphGridColor; + bottomLabelColor ??= AppColors.textColor; + return Material( + color: Colors.white, + child: SizedBox( + width: width, + height: height, + child: BarChart( + BarChartData( + minY: minY ?? 0, + maxY: maxY, + + barTouchData: BarTouchData( + handleBuiltInTouches: true, + touchCallback: (FlTouchEvent event, BarTouchResponse? touchResponse) { + // Let fl_chart handle the touch + }, + + touchTooltipData: BarTouchTooltipData( + getTooltipColor: (_)=>AppColorsContext.tooltipColor, + getTooltipItem: (group, groupIndex, rod, rodIndex) { + final dataPoint = dataPoints[groupIndex]; + if(getTooltipItem != null) { + return getTooltipItem!(dataPoint); + } + + return BarTooltipItem( + '${dataPoint.actualValue} ${dataPoint.unitOfMeasurement ?? ""}\n${DateFormat('dd MMM, yyyy').format(dataPoint.time)}', + TextStyle( + color: Colors.black, + fontSize: 12.f, + fontWeight: FontWeight.w500, + ), + ); + }, + ), + enabled: true, + ), + titlesData: FlTitlesData( + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: leftLabelReservedSize ?? 80, + interval: leftLabelInterval ?? .1, + getTitlesWidget: (value, _) { + return leftLabelFormatter(value); + }, + ), + ), + bottomTitles: AxisTitles( + axisNameSize: 20, + sideTitles: SideTitles( + showTitles: showBottomTitleDates, + reservedSize: bottomLabelReservedSize ?? 30, + getTitlesWidget: (value, _) { + return bottomLabelFormatter(value, dataPoints); + }, + interval: 1, + ), + ), + topTitles: AxisTitles(), + rightTitles: AxisTitles(), + ), + borderData: FlBorderData( + show: true, + border: const Border( + bottom: BorderSide.none, + left: BorderSide(color: Colors.grey, width: .5), + right: BorderSide.none, + top: BorderSide.none, + ), + ), + barGroups: _buildBarGroups(dataPoints), + + gridData: FlGridData( + show: showGridLines ?? true, + drawHorizontalLine: false, + verticalInterval: verticalInterval, + getDrawingVerticalLine: getDrawingVerticalLine ?? + (value) { + return FlLine( + color: barGridColor, + strokeWidth: 1, + dashArray: [5, 5], + ); + }, + )), + ), + ), + ); + } + + /// Builds bar chart groups from data points + List _buildBarGroups(List dataPoints) { + return dataPoints.asMap().entries.map((entry) { + final index = entry.key; + final dataPoint = entry.value; + double value = (makeGraphBasedOnActualValue) + ? double.tryParse(dataPoint.actualValue) ?? 0.0 + : dataPoint.value; + + final barRods = [ + BarChartRodData( + toY: value, + color: barColor, + width: barWidth, + borderRadius: barRadius ?? BorderRadius.circular(6), + // backDrawRodData: BackgroundBarChartRodData( + // show: true, + // toY: maxY, + // color: Colors.grey[100], + // ), + ), + ]; + + // Add secondary bar if provided (for grouped bar charts) + if (secondaryDataPoints != null && index < secondaryDataPoints!.length) { + final secondaryDataPoint = secondaryDataPoints![index]; + double secondaryValue = (makeGraphBasedOnActualValue) + ? double.tryParse(secondaryDataPoint.actualValue) ?? 0.0 + : secondaryDataPoint.value; + + barRods.add( + BarChartRodData( + toY: secondaryValue, + color: secondaryBarColor ?? AppColors.blueColor, + width: barWidth, + borderRadius: barRadius ?? BorderRadius.circular(6), + ), + ); + } + + return BarChartGroupData( + x: index, + barRods: barRods, + barsSpace: 8.w + ); + }).toList(); + } +} \ No newline at end of file diff --git a/lib/widgets/graph/custom_graph.dart b/lib/widgets/graph/custom_graph.dart index d9a69a99..3b0629f0 100644 --- a/lib/widgets/graph/custom_graph.dart +++ b/lib/widgets/graph/custom_graph.dart @@ -257,7 +257,7 @@ class CustomGraph extends StatelessWidget { isCurved: true, isStrokeCapRound: true, isStrokeJoinRound: true, - barWidth: 2, + barWidth: 3, gradient: LinearGradient( colors: [resolvedGraphColor, resolvedGraphColor], begin: Alignment.centerLeft, diff --git a/lib/widgets/scroll_wheel_time_picker.dart b/lib/widgets/scroll_wheel_time_picker.dart new file mode 100644 index 00000000..a6e155bb --- /dev/null +++ b/lib/widgets/scroll_wheel_time_picker.dart @@ -0,0 +1,181 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + + +class ScrollWheelTimePicker extends StatefulWidget { + final int initialHour; + + final int initialMinute; + + final bool use24HourFormat; + + final ValueChanged? onTimeChanged; + + final double itemExtent; + + final double pickerHeight; + + final TextStyle? digitTextStyle; + + final TextStyle? separatorTextStyle; + + const ScrollWheelTimePicker({ + super.key, + this.initialHour = 8, + this.initialMinute = 15, + this.use24HourFormat = true, + this.onTimeChanged, + this.itemExtent = 60, + this.pickerHeight = 180, + this.digitTextStyle, + this.separatorTextStyle, + }); + + @override + State createState() => _ScrollWheelTimePickerState(); +} + +class _ScrollWheelTimePickerState extends State { + late FixedExtentScrollController _hourController; + late FixedExtentScrollController _minuteController; + late int _selectedHour; + late int _selectedMinute; + + int get _maxHour => widget.use24HourFormat ? 24 : 12; + + @override + void initState() { + super.initState(); + _selectedHour = widget.initialHour; + _selectedMinute = widget.initialMinute; + + final hourIndex = + widget.use24HourFormat ? _selectedHour : (_selectedHour == 0 ? 11 : _selectedHour - 1); + + _hourController = FixedExtentScrollController(initialItem: hourIndex); + _minuteController = FixedExtentScrollController(initialItem: _selectedMinute); + } + + @override + void dispose() { + _hourController.dispose(); + _minuteController.dispose(); + super.dispose(); + } + + void _notifyChange() { + widget.onTimeChanged?.call(TimeOfDay(hour: _selectedHour, minute: _selectedMinute)); + } + + TextStyle get _defaultDigitStyle => TextStyle( + fontSize: 72.f, + fontWeight: FontWeight.w800, + color: AppColors.textColor, + letterSpacing: 0, + ); + + TextStyle get _defaultSeparatorStyle => TextStyle( + fontSize: 40.f, + fontWeight: FontWeight.w800, + color: AppColors.textColor, + letterSpacing: 0, + ); + + @override + Widget build(BuildContext context) { + final digitStyle = widget.digitTextStyle ?? _defaultDigitStyle; + final separatorStyle = widget.separatorTextStyle ?? _defaultSeparatorStyle; + + return SizedBox( + height: widget.pickerHeight, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 150.w, + child: ListWheelScrollView.useDelegate( + controller: _hourController, + itemExtent: widget.itemExtent, + physics: const FixedExtentScrollPhysics(), + perspective: 0.005, + diameterRatio: 1.2, + onSelectedItemChanged: (index) { + setState(() { + _selectedHour = + widget.use24HourFormat ? index : index + 1; + }); + _notifyChange(); + }, + childDelegate: ListWheelChildBuilderDelegate( + childCount: _maxHour, + builder: (context, index) { + final hour = + widget.use24HourFormat ? index : index + 1; + final isSelected = hour == _selectedHour; + return Visibility( + visible: isSelected, + child: Center( + child: AnimatedDefaultTextStyle( + duration: const Duration(milliseconds: 200), + style: digitStyle.copyWith( + color: isSelected + ? AppColors.textColor + : AppColors.textColor.withValues(alpha: 0.3), + ), + child: Text(hour.toString().padLeft(2, '0')), + ), + )); + }, + ), + ), + ), + + Padding( + padding: EdgeInsets.symmetric(horizontal: 2.w), + child: Text(':', style: separatorStyle), + ), + + SizedBox( + width: 150.w, + child: ListWheelScrollView.useDelegate( + controller: _minuteController, + itemExtent: widget.itemExtent, + physics: const FixedExtentScrollPhysics(), + perspective: 0.005, + diameterRatio: 1.2, + onSelectedItemChanged: (index) { + setState(() { + _selectedMinute = index; + }); + _notifyChange(); + }, + childDelegate: ListWheelChildBuilderDelegate( + childCount: 60, + + builder: (context, index) { + final isSelected = index == _selectedMinute; + return Visibility( + visible: isSelected, + child: + Center( + child: AnimatedDefaultTextStyle( + duration: const Duration(milliseconds: 200), + style: digitStyle.copyWith( + color: isSelected + ? AppColors.textColor + : AppColors.transparent.withValues(alpha: 0.3), + ), + child: Text(index.toString().padLeft(2, '0')), + ), + )); + }, + ), + ), + ), + ], + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 00000000..8395a120 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,2097 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: ff0a84a2734d9e1089f8aedd5c0af0061b82fb94e95260d943404e0ef2134b11 + url: "https://pub.dev" + source: hosted + version: "1.3.59" + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + amazon_payfort: + dependency: "direct main" + description: + name: amazon_payfort + sha256: "7732df0764aecbb814f910db36d0dca2f696e7e5ea380b49aa3ec62965768b33" + url: "https://pub.dev" + source: hosted + version: "1.1.4" + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + audio_session: + dependency: transitive + description: + name: audio_session + sha256: "8f96a7fecbb718cb093070f868b4cdcb8a9b1053dce342ff8ab2fde10eb9afb7" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + barcode_scan2: + dependency: "direct main" + description: + name: barcode_scan2 + sha256: "9b539b0ce419005c451de66374c79f39801986f1fd7a213e63d948f21487cd69" + url: "https://pub.dev" + source: hosted + version: "4.7.2" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + carp_serializable: + dependency: transitive + description: + name: carp_serializable + sha256: f039f8ea22e9437aef13fe7e9743c3761c76d401288dcb702eadd273c3e4dcef + url: "https://pub.dev" + source: hosted + version: "2.0.1" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + chewie: + dependency: transitive + description: + name: chewie + sha256: "44bcfc5f0dfd1de290c87c9d86a61308b3282a70b63435d5557cfd60f54a69ca" + url: "https://pub.dev" + source: hosted + version: "1.13.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + connectivity_plus: + dependency: "direct main" + description: + name: connectivity_plus + sha256: b5e72753cf63becce2c61fd04dfe0f1c430cc5278b53a1342dc5ad839eab29ec + url: "https://pub.dev" + source: hosted + version: "6.1.5" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "701dcfc06da0882883a2657c445103380e53e647060ad8d9dfb710c100996608" + url: "https://pub.dev" + source: hosted + version: "0.3.5+1" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dart_jsonwebtoken: + dependency: "direct main" + description: + name: dart_jsonwebtoken + sha256: "0de65691c1d736e9459f22f654ddd6fd8368a271d4e41aa07e53e6301eff5075" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + dartz: + dependency: "direct main" + description: + name: dartz + sha256: e6acf34ad2e31b1eb00948692468c30ab48ac8250e0f0df661e29f12dd252168 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + dbus: + dependency: transitive + description: + name: dbus + sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + device_calendar: + dependency: "direct main" + description: + path: "." + ref: HEAD + resolved-ref: "5ea5ed9e2bb499c0633383b53103f2920b634755" + url: "https://github.com/bardram/device_calendar" + source: git + version: "4.3.1" + device_calendar_plus: + dependency: "direct main" + description: + name: device_calendar_plus + sha256: d11a70d98eb123e8eb09fdcfaf220ca4f1aa65a1512e12092f176f4b54983507 + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_android: + dependency: transitive + description: + name: device_calendar_plus_android + sha256: a341ef29fa0251251287d63c1d009dfd35c1459dc6a129fd5e03f5ac92d8d7ff + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_ios: + dependency: transitive + description: + name: device_calendar_plus_ios + sha256: "3b2f84ce1ed002be8460e214a3229e66748bbaad4077603f2c734d67c42033ff" + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_platform_interface: + dependency: transitive + description: + name: device_calendar_plus_platform_interface + sha256: "0ce7511c094ca256831a48e16efe8f1e97e7bd00a5ff3936296ffd650a1d76b5" + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: "98f28b42168cc509abc92f88518882fd58061ea372d7999aecc424345c7bff6a" + url: "https://pub.dev" + source: hosted + version: "11.5.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: e1ea89119e34903dca74b883d0dd78eb762814f97fb6c76f35e9ff74d261a18f + url: "https://pub.dev" + source: hosted + version: "7.0.3" + dropdown_search: + dependency: "direct main" + description: + name: dropdown_search + sha256: c29b3e5147a82a06a4a08b3b574c51cb48cc17ad89893d53ee72a6f86643622e + url: "https://pub.dev" + source: hosted + version: "6.0.2" + easy_localization: + dependency: "direct main" + description: + name: easy_localization + sha256: "2ccdf9db8fe4d9c5a75c122e6275674508fd0f0d49c827354967b8afcc56bbed" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + easy_logger: + dependency: transitive + description: + name: easy_logger + sha256: c764a6e024846f33405a2342caf91c62e357c24b02c04dbc712ef232bf30ffb7 + url: "https://pub.dev" + source: hosted + version: "0.0.2" + ed25519_edwards: + dependency: transitive + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" + url: "https://pub.dev" + source: hosted + version: "2.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: d07d37192dbf97461359c1518788f203b0c9102cfd2c35a716b823741219542c + url: "https://pub.dev" + source: hosted + version: "2.1.5" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + file_picker: + dependency: "direct main" + description: + name: file_picker + sha256: d974b6ba2606371ac71dd94254beefb6fa81185bde0b59bdc1df09885da85fde + url: "https://pub.dev" + source: hosted + version: "10.3.8" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0" + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a" + url: "https://pub.dev" + source: hosted + version: "0.9.5" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd" + url: "https://pub.dev" + source: hosted + version: "0.9.3+5" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + sha256: "4f85b161772e1d54a66893ef131c0a44bd9e552efa78b33d5f4f60d2caa5c8a3" + url: "https://pub.dev" + source: hosted + version: "11.6.0" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + sha256: a44b6d1155ed5cae7641e3de7163111cfd9f6f6c954ca916dc6a3bdfa86bf845 + url: "https://pub.dev" + source: hosted + version: "4.4.3" + firebase_analytics_web: + dependency: transitive + description: + name: firebase_analytics_web + sha256: c7d1ed1f86ae64215757518af5576ff88341c8ce5741988c05cc3b2e07b0b273 + url: "https://pub.dev" + source: hosted + version: "0.5.10+16" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "7be63a3f841fc9663342f7f3a011a42aef6a61066943c90b1c434d79d5c995c5" + url: "https://pub.dev" + source: hosted + version: "3.15.2" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: cccb4f572325dc14904c02fcc7db6323ad62ba02536833dddb5c02cac7341c64 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "0ed0dc292e8f9ac50992e2394e9d336a0275b6ae400d64163fdf0a8a8b556c37" + url: "https://pub.dev" + source: hosted + version: "2.24.1" + firebase_crashlytics: + dependency: "direct main" + description: + name: firebase_crashlytics + sha256: "662ae6443da91bca1fb0be8aeeac026fa2975e8b7ddfca36e4d90ebafa35dde1" + url: "https://pub.dev" + source: hosted + version: "4.3.10" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + sha256: "7222a8a40077c79f6b8b3f3439241c9f2b34e9ddfde8381ffc512f7b2e61f7eb" + url: "https://pub.dev" + source: hosted + version: "3.8.10" + firebase_messaging: + dependency: "direct main" + description: + name: firebase_messaging + sha256: "60be38574f8b5658e2f22b7e311ff2064bea835c248424a383783464e8e02fcc" + url: "https://pub.dev" + source: hosted + version: "15.2.10" + firebase_messaging_platform_interface: + dependency: transitive + description: + name: firebase_messaging_platform_interface + sha256: "685e1771b3d1f9c8502771ccc9f91485b376ffe16d553533f335b9183ea99754" + url: "https://pub.dev" + source: hosted + version: "4.6.10" + firebase_messaging_web: + dependency: transitive + description: + name: firebase_messaging_web + sha256: "0d1be17bc89ed3ff5001789c92df678b2e963a51b6fa2bdb467532cc9dbed390" + url: "https://pub.dev" + source: hosted + version: "3.10.10" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + fl_chart: + dependency: "direct main" + description: + name: fl_chart + sha256: "577aeac8ca414c25333334d7c4bb246775234c0e44b38b10a82b559dd4d764e7" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_callkit_incoming: + dependency: "direct main" + description: + name: flutter_callkit_incoming + sha256: "3589deb8b71e43f2d520a9c8a5240243f611062a8b246cdca4b1fda01fbbf9b8" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + flutter_hooks: + dependency: transitive + description: + name: flutter_hooks + sha256: cde36b12f7188c85286fba9b38cc5a902e7279f36dd676967106c041dc9dde70 + url: "https://pub.dev" + source: hosted + version: "0.20.5" + flutter_inappwebview: + dependency: "direct main" + description: + name: flutter_inappwebview + sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5" + url: "https://pub.dev" + source: hosted + version: "6.1.5" + flutter_inappwebview_android: + dependency: transitive + description: + name: flutter_inappwebview_android + sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + flutter_inappwebview_internal_annotations: + dependency: transitive + description: + name: flutter_inappwebview_internal_annotations + sha256: "787171d43f8af67864740b6f04166c13190aa74a1468a1f1f1e9ee5b90c359cd" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + flutter_inappwebview_ios: + dependency: transitive + description: + name: flutter_inappwebview_ios + sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_inappwebview_macos: + dependency: transitive + description: + name: flutter_inappwebview_macos + sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_inappwebview_platform_interface: + dependency: transitive + description: + name: flutter_inappwebview_platform_interface + sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500 + url: "https://pub.dev" + source: hosted + version: "1.3.0+1" + flutter_inappwebview_web: + dependency: transitive + description: + name: flutter_inappwebview_web + sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_inappwebview_windows: + dependency: transitive + description: + name: flutter_inappwebview_windows + sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + flutter_ios_voip_kit_karmm: + dependency: "direct main" + description: + name: flutter_ios_voip_kit_karmm + sha256: "31a445d78aacacdf128a0354efb9f4e424285dfe4c0af3ea872e64f03e6f6bfc" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_local_notifications: + dependency: "direct main" + description: + name: flutter_local_notifications + sha256: "19ffb0a8bb7407875555e5e98d7343a633bb73707bae6c6a5f37c90014077875" + url: "https://pub.dev" + source: hosted + version: "19.5.0" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: e3c277b2daab8e36ac5a6820536668d07e83851aeeb79c446e525a70710770a5 + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "277d25d960c15674ce78ca97f57d0bae2ee401c844b6ac80fcd972a9c99d09fe" + url: "https://pub.dev" + source: hosted + version: "9.1.0" + flutter_local_notifications_windows: + dependency: transitive + description: + name: flutter_local_notifications_windows + sha256: "8d658f0d367c48bd420e7cf2d26655e2d1130147bca1eea917e576ca76668aaf" + url: "https://pub.dev" + source: hosted + version: "1.0.3" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_nfc_kit: + dependency: "direct main" + description: + name: flutter_nfc_kit + sha256: "3cf589592373f1d0b0bd9583532368bb85e7cd76ae014a2b67a5ab2d68ae9450" + url: "https://pub.dev" + source: hosted + version: "3.6.1" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1 + url: "https://pub.dev" + source: hosted + version: "2.0.33" + flutter_rating_bar: + dependency: "direct main" + description: + name: flutter_rating_bar + sha256: d2af03469eac832c591a1eba47c91ecc871fe5708e69967073c043b2d775ed93 + url: "https://pub.dev" + source: hosted + version: "4.0.1" + flutter_staggered_animations: + dependency: "direct main" + description: + name: flutter_staggered_animations + sha256: "81d3c816c9bb0dca9e8a5d5454610e21ffb068aedb2bde49d2f8d04f75538351" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + flutter_swiper_view: + dependency: "direct main" + description: + name: flutter_swiper_view + sha256: "2a165b259e8a4c49d4da5626b967ed42a73dac2d075bd9e266ad8d23b9f01879" + url: "https://pub.dev" + source: hosted + version: "1.1.8" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_widget_from_html: + dependency: "direct main" + description: + name: flutter_widget_from_html + sha256: "7f1daefcd3009c43c7e7fb37501e6bb752d79aa7bfad0085fb0444da14e89bd0" + url: "https://pub.dev" + source: hosted + version: "0.17.1" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: "1120ee6ed3509ceff2d55aa6c6cbc7b6b1291434422de2411b5a59364dd6ff03" + url: "https://pub.dev" + source: hosted + version: "0.17.0" + flutter_zoom_videosdk: + dependency: "direct main" + description: + name: flutter_zoom_videosdk + sha256: "46a4dea664b1c969099328a499c198a1755adf9ac333dea28bea5187910b3bf9" + url: "https://pub.dev" + source: hosted + version: "2.1.10" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: "90778fe0497fe3a09166e8cf2e0867310ff434b794526589e77ec03cf08ba8e8" + url: "https://pub.dev" + source: hosted + version: "8.2.14" + fwfh_cached_network_image: + dependency: transitive + description: + name: fwfh_cached_network_image + sha256: "484cb5f8047f02cfac0654fca5832bfa91bb715fd7fc651c04eb7454187c4af8" + url: "https://pub.dev" + source: hosted + version: "0.16.1" + fwfh_chewie: + dependency: transitive + description: + name: fwfh_chewie + sha256: ae74fc26798b0e74f3983f7b851e74c63b9eeb2d3015ecd4b829096b2c3f8818 + url: "https://pub.dev" + source: hosted + version: "0.16.1" + fwfh_just_audio: + dependency: transitive + description: + name: fwfh_just_audio + sha256: dfd622a0dfe049ac647423a2a8afa7f057d9b2b93d92710b624e3d370b1ac69a + url: "https://pub.dev" + source: hosted + version: "0.17.0" + fwfh_svg: + dependency: transitive + description: + name: fwfh_svg + sha256: "2e6bb241179eeeb1a7941e05c8c923b05d332d36a9085233e7bf110ea7deb915" + url: "https://pub.dev" + source: hosted + version: "0.16.1" + fwfh_url_launcher: + dependency: transitive + description: + name: fwfh_url_launcher + sha256: c38aa8fb373fda3a89b951fa260b539f623f6edb45eee7874cb8b492471af881 + url: "https://pub.dev" + source: hosted + version: "0.16.1" + fwfh_webview: + dependency: transitive + description: + name: fwfh_webview + sha256: f71b0aa16e15d82f3c017f33560201ff5ae04e91e970cab5d12d3bcf970b870c + url: "https://pub.dev" + source: hosted + version: "0.15.6" + geoclue: + dependency: transitive + description: + name: geoclue + sha256: c2a998c77474fc57aa00c6baa2928e58f4b267649057a1c76738656e9dbd2a7f + url: "https://pub.dev" + source: hosted + version: "0.1.1" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: "79939537046c9025be47ec645f35c8090ecadb6fe98eba146a0d25e8c1357516" + url: "https://pub.dev" + source: hosted + version: "14.0.2" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "179c3cb66dfa674fc9ccbf2be872a02658724d1c067634e2c427cf6df7df901a" + url: "https://pub.dev" + source: hosted + version: "5.0.2" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.dev" + source: hosted + version: "2.3.13" + geolocator_linux: + dependency: transitive + description: + name: geolocator_linux + sha256: d64112a205931926f4363bb6bd48f14cb38e7326833041d170615586cd143797 + url: "https://pub.dev" + source: hosted + version: "0.2.4" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.dev" + source: hosted + version: "4.2.6" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: b1ae9bdfd90f861fde8fd4f209c37b953d65e92823cb73c7dee1fa021b06f172 + url: "https://pub.dev" + source: hosted + version: "4.1.3" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "175435404d20278ffd220de83c2ca293b73db95eafbdc8131fe8609be1421eb6" + url: "https://pub.dev" + source: hosted + version: "0.2.5" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: ae78de7c3f2304b8d81f2bb6e320833e5e81de942188542328f074978cc0efa9 + url: "https://pub.dev" + source: hosted + version: "8.3.0" + gms_check: + dependency: "direct main" + description: + name: gms_check + sha256: b3fc08fd41da233f9761f9981303346aa9778b4802e90ce9bd8122674fcca6f0 + url: "https://pub.dev" + source: hosted + version: "1.0.4" + google_api_availability: + dependency: "direct main" + description: + name: google_api_availability + sha256: "2ffdc91e1e0cf4e7974fef6c2988a24cefa81f03526ff04b694df6dc0fcbca03" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + google_api_availability_android: + dependency: transitive + description: + name: google_api_availability_android + sha256: "4794147f43a8f3eee6b514d3ae30dbe6f7b9048cae8cd2a74cb4055cd28d74a8" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + google_api_availability_platform_interface: + dependency: transitive + description: + name: google_api_availability_platform_interface + sha256: "65b7da62fe5b582bb3d508628ad827d36d890710ea274766a992a56fa5420da6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "5d410c32112d7c6eb7858d359275b2aa04778eed3e36c745aeae905fb2fa6468" + url: "https://pub.dev" + source: hosted + version: "8.2.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + sha256: "819985697596a42e1054b5feb2f407ba1ac92262e02844a40168e742b9f36dca" + url: "https://pub.dev" + source: hosted + version: "2.14.0" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: "6dbbfc697eedd29c3634affb2d6b3e5ecfc4e6e50c8345f4b975cc969c74b582" + url: "https://pub.dev" + source: hosted + version: "2.18.9" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: b3f9aa62f65f7f266651e156a910ce88b8158de6546c6b145c9ba8080eb861b3 + url: "https://pub.dev" + source: hosted + version: "2.16.1" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: e8b1232419fcdd35c1fdafff96843f5a40238480365599d8ca661dde96d283dd + url: "https://pub.dev" + source: hosted + version: "2.14.1" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: d416602944e1859f3cbbaa53e34785c223fa0a11eddb34a913c964c5cbb5d8cf + url: "https://pub.dev" + source: hosted + version: "0.5.14+3" + gsettings: + dependency: transitive + description: + name: gsettings + sha256: "1b0ce661f5436d2db1e51f3c4295a49849f03d304003a7ba177d01e3a858249c" + url: "https://pub.dev" + source: hosted + version: "0.2.8" + health: + dependency: "direct main" + description: + name: health + sha256: "320633022fb2423178baa66508001c4ca5aee5806ffa2c913e66488081e9fd47" + url: "https://pub.dev" + source: hosted + version: "13.1.4" + hijri_gregorian_calendar: + dependency: "direct main" + description: + name: hijri_gregorian_calendar + sha256: aecdbe3c9365fac55f17b5e1f24086a81999b1e5c9372cb08888bfbe61e07fa1 + url: "https://pub.dev" + source: hosted + version: "0.1.1" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + huawei_health: + dependency: "direct main" + description: + name: huawei_health + sha256: "52fb9990e1fc857e2fa1b1251dde63b2146086a13b2d9c50bdfc3c4f715c8a12" + url: "https://pub.dev" + source: hosted + version: "6.16.0+300" + huawei_location: + dependency: "direct main" + description: + name: huawei_location + sha256: dd939b0add3e228865cb7da230d7723551e55677d7d59de7dbfd466229847b9f + url: "https://pub.dev" + source: hosted + version: "6.16.0+300" + huawei_map: + dependency: "direct main" + description: + path: flutter-hms-map + ref: HEAD + resolved-ref: "9a16541e4016e3bf58a2571e6aa658a4751af399" + url: "https://github.com/fleoparra/hms-flutter-plugin.git" + source: git + version: "6.11.2+303" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "784210112be18ea55f69d7076e2c656a4e24949fa9e76429fe53af0c0f4fa320" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "5e9bf126c37c117cf8094215373c6d561117a3cfb50ebc5add1a61dc6e224677" + url: "https://pub.dev" + source: hosted + version: "0.8.13+10" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "66257a3191ab360d23a55c8241c91a6e329d31e94efa7be9cf7a212e65850214" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: "956c16a42c0c708f914021666ffcd8265dde36e673c9fa68c81f7d085d9774ad" + url: "https://pub.dev" + source: hosted + version: "0.8.13+3" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "86f0f15a309de7e1a552c12df9ce5b59fe927e71385329355aec4776c6a8ec91" + url: "https://pub.dev" + source: hosted + version: "0.2.2+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c" + url: "https://pub.dev" + source: hosted + version: "2.11.1" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae + url: "https://pub.dev" + source: hosted + version: "0.2.2" + in_app_update: + dependency: "direct main" + description: + name: in_app_update + sha256: "9924a3efe592e1c0ec89dda3683b3cfec3d4cd02d908e6de00c24b759038ddb1" + url: "https://pub.dev" + source: hosted + version: "4.2.5" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + jiffy: + dependency: "direct main" + description: + name: jiffy + sha256: e6f3b2aaec032f95ae917268edcbf007a5b834b57a602d39eb0ab17995a9c64a + url: "https://pub.dev" + source: hosted + version: "6.4.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + just_audio: + dependency: "direct main" + description: + name: just_audio + sha256: "9694e4734f515f2a052493d1d7e0d6de219ee0427c7c29492e246ff32a219908" + url: "https://pub.dev" + source: hosted + version: "0.10.5" + just_audio_platform_interface: + dependency: transitive + description: + name: just_audio_platform_interface + sha256: "2532c8d6702528824445921c5ff10548b518b13f808c2e34c2fd54793b999a6a" + url: "https://pub.dev" + source: hosted + version: "4.6.0" + just_audio_web: + dependency: transitive + description: + name: just_audio_web + sha256: "6ba8a2a7e87d57d32f0f7b42856ade3d6a9fbe0f1a11fabae0a4f00bb73f0663" + url: "https://pub.dev" + source: hosted + version: "0.4.16" + keyboard_actions: + dependency: "direct main" + description: + name: keyboard_actions + sha256: "5155a158c0d22c3a2f4a2192040445fe84977620cf0eeb29f6148a1dcb5835fa" + url: "https://pub.dev" + source: hosted + version: "4.2.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + local_auth: + dependency: "direct main" + description: + name: local_auth + sha256: "434d854cf478f17f12ab29a76a02b3067f86a63a6d6c4eb8fbfdcfe4879c1b7b" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + local_auth_android: + dependency: transitive + description: + name: local_auth_android + sha256: a0bdfcc0607050a26ef5b31d6b4b254581c3d3ce3c1816ab4d4f4a9173e84467 + url: "https://pub.dev" + source: hosted + version: "1.0.56" + local_auth_darwin: + dependency: transitive + description: + name: local_auth_darwin + sha256: "699873970067a40ef2f2c09b4c72eb1cfef64224ef041b3df9fdc5c4c1f91f49" + url: "https://pub.dev" + source: hosted + version: "1.6.1" + local_auth_platform_interface: + dependency: transitive + description: + name: local_auth_platform_interface + sha256: f98b8e388588583d3f781f6806e4f4c9f9e189d898d27f0c249b93a1973dd122 + url: "https://pub.dev" + source: hosted + version: "1.1.0" + local_auth_windows: + dependency: transitive + description: + name: local_auth_windows + sha256: bc4e66a29b0fdf751aafbec923b5bed7ad6ed3614875d8151afe2578520b2ab5 + url: "https://pub.dev" + source: hosted + version: "1.0.11" + location: + dependency: "direct main" + description: + name: location + sha256: b080053c181c7d152c43dd576eec6436c40e25f326933051c330da563ddd5333 + url: "https://pub.dev" + source: hosted + version: "8.0.1" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: ca8700bb3f6b1e8b2afbd86bd78b2280d116c613ca7bfa1d4d7b64eba357d749 + url: "https://pub.dev" + source: hosted + version: "6.0.1" + location_web: + dependency: transitive + description: + name: location_web + sha256: b8e3add5efe0d65c5e692b7a135d80a4015c580d3ea646fa71973e97668dd868 + url: "https://pub.dev" + source: hosted + version: "6.0.1" + logger: + dependency: "direct main" + description: + name: logger + sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3 + url: "https://pub.dev" + source: hosted + version: "2.6.2" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + lottie: + dependency: "direct main" + description: + name: lottie + sha256: "8ae0be46dbd9e19641791dc12ee480d34e1fd3f84c749adc05f3ad9342b71b95" + url: "https://pub.dev" + source: hosted + version: "3.3.2" + manage_calendar_events: + dependency: "direct main" + description: + name: manage_calendar_events + sha256: f17600fcb7dc7047120c185993045e493d686930237b4e3c2689c26a64513d66 + url: "https://pub.dev" + source: hosted + version: "2.0.3" + map_launcher: + dependency: "direct main" + description: + name: map_launcher + sha256: "85ae218777b79c830477ed59d97f5ee9d6025b00c47b05d0b901f4dd7d2297cc" + url: "https://pub.dev" + source: hosted + version: "4.4.3" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + ndef: + dependency: transitive + description: + name: ndef + sha256: "198ba3798e80cea381648569d84059dbba64cd140079fb7b0d9c3f1e0f5973f3" + url: "https://pub.dev" + source: hosted + version: "0.4.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + network_info_plus: + dependency: "direct main" + description: + name: network_info_plus + sha256: f926b2ba86aa0086a0dfbb9e5072089bc213d854135c1712f1d29fc89ba3c877 + url: "https://pub.dev" + source: hosted + version: "6.1.4" + network_info_plus_platform_interface: + dependency: transitive + description: + name: network_info_plus_platform_interface + sha256: "7e7496a8a9d8136859b8881affc613c4a21304afeb6c324bcefc4bd0aff6b94b" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + open_filex: + dependency: "direct main" + description: + name: open_filex + sha256: "9976da61b6a72302cf3b1efbce259200cd40232643a467aac7370addf94d6900" + url: "https://pub.dev" + source: hosted + version: "4.7.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + url: "https://pub.dev" + source: hosted + version: "9.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: f2c65e21139ce2c3dad46922be8272bb5963516045659e71bb16e151c93b580e + url: "https://pub.dev" + source: hosted + version: "2.2.22" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "6d13aece7b3f5c5a9731eaf553ff9dcbc2eff41087fd2df587fd0fed9a3eb0c4" + url: "https://pub.dev" + source: hosted + version: "2.5.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1 + url: "https://pub.dev" + source: hosted + version: "12.0.1" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6" + url: "https://pub.dev" + source: hosted + version: "13.0.1" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023 + url: "https://pub.dev" + source: hosted + version: "9.4.7" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24" + url: "https://pub.dev" + source: hosted + version: "0.1.3+5" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878 + url: "https://pub.dev" + source: hosted + version: "4.3.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.dev" + source: hosted + version: "6.0.3" + protobuf: + dependency: transitive + description: + name: protobuf + sha256: "75ec242d22e950bdcc79ee38dd520ce4ee0bc491d7fadc4ea47694604d22bf06" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + quiver: + dependency: transitive + description: + name: quiver + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + rrule: + dependency: transitive + description: + name: rrule + sha256: f6f6ad5bf7b19d218d4c985d6055d3c9717f1d6efd5d1c0127b1146f1eb3640c + url: "https://pub.dev" + source: hosted + version: "0.2.18" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + scrollable_positioned_list: + dependency: "direct main" + description: + name: scrollable_positioned_list + sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287" + url: "https://pub.dev" + source: hosted + version: "0.3.8" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: d7dc0630a923883c6328ca31b89aa682bacbf2f8304162d29f7c6aaff03a27a1 + url: "https://pub.dev" + source: hosted + version: "11.1.0" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: "88023e53a13429bd65d8e85e11a9b484f49d4c190abbd96c7932b74d6927cc9a" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc" + url: "https://pub.dev" + source: hosted + version: "2.4.18" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sizer: + dependency: "direct main" + description: + name: sizer + sha256: "9963c89e4d30d7c2108de3eafc0a7e6a4a8009799376ea6be5ef0a9ad87cfbad" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + smooth_corner: + dependency: "direct main" + description: + name: smooth_corner + sha256: "112d7331f82ead81ec870c5d1eb0624f2e7e367eccd166c2fffe4c11d4f87c4f" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + sms_otp_auto_verify: + dependency: "direct main" + description: + name: sms_otp_auto_verify + sha256: ee02af0d6b81d386ef70d7d0317a1929bc0b4a3a30a451284450bbcf6901ba1a + url: "https://pub.dev" + source: hosted + version: "2.2.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + url: "https://pub.dev" + source: hosted + version: "2.4.2+2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + syncfusion_flutter_calendar: + dependency: "direct main" + description: + name: syncfusion_flutter_calendar + sha256: "8e8a4eef01d6a82ae2c17e76d497ff289ded274de014c9f471ffabc12d1e2e71" + url: "https://pub.dev" + source: hosted + version: "30.2.7" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + sha256: bfd026c0f9822b49ff26fed11cd3334519acb6a6ad4b0c81d9cd18df6af1c4c0 + url: "https://pub.dev" + source: hosted + version: "30.2.7" + syncfusion_flutter_datepicker: + dependency: transitive + description: + name: syncfusion_flutter_datepicker + sha256: b5f35cc808e91b229d41613efe71dadab1549a35bfd493f922fc06ccc2fe908c + url: "https://pub.dev" + source: hosted + version: "30.2.7" + syncfusion_localizations: + dependency: transitive + description: + name: syncfusion_localizations + sha256: bb32b07879b4c1dee5d4c8ad1c57343a4fdae55d65a87f492727c11b68f23164 + url: "https://pub.dev" + source: hosted + version: "30.2.7" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 + url: "https://pub.dev" + source: hosted + version: "3.4.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + url: "https://pub.dev" + source: hosted + version: "0.7.6" + time: + dependency: transitive + description: + name: time + sha256: "46187cf30bffdab28c56be9a63861b36e4ab7347bf403297595d6a97e10c789f" + url: "https://pub.dev" + source: hosted + version: "2.1.6" + timezone: + dependency: "direct main" + description: + name: timezone + sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + universal_platform: + dependency: transitive + description: + name: universal_platform + sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "767344bf3063897b5cf0db830e94f904528e6dd50a6dfaf839f0abf509009611" + url: "https://pub.dev" + source: hosted + version: "6.3.28" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad + url: "https://pub.dev" + source: hosted + version: "6.3.6" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a + url: "https://pub.dev" + source: hosted + version: "3.2.2" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18" + url: "https://pub.dev" + source: hosted + version: "3.2.5" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 + url: "https://pub.dev" + source: hosted + version: "4.5.2" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6 + url: "https://pub.dev" + source: hosted + version: "1.1.19" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + url: "https://pub.dev" + source: hosted + version: "1.1.13" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc + url: "https://pub.dev" + source: hosted + version: "1.1.19" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + video_player: + dependency: transitive + description: + name: video_player + sha256: "096bc28ce10d131be80dfb00c223024eb0fba301315a406728ab43dd99c45bdf" + url: "https://pub.dev" + source: hosted + version: "2.10.1" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: ee4fd520b0cafa02e4a867a0f882092e727cdaa1a2d24762171e787f8a502b0a + url: "https://pub.dev" + source: hosted + version: "2.9.1" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: d1eb970495a76abb35e5fa93ee3c58bd76fb6839e2ddf2fbb636674f2b971dd4 + url: "https://pub.dev" + source: hosted + version: "2.8.9" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: "57c5d73173f76d801129d0531c2774052c5a7c11ccb962f1830630decd9f24ec" + url: "https://pub.dev" + source: hosted + version: "6.6.0" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "9f3c00be2ef9b76a95d94ac5119fb843dca6f2c69e6c9968f6f2b6c9e7afbdeb" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + wakelock_plus: + dependency: transitive + description: + name: wakelock_plus + sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + web: + dependency: "direct main" + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + webview_flutter: + dependency: transitive + description: + name: webview_flutter + sha256: a3da219916aba44947d3a5478b1927876a09781174b5a2b67fa5be0555154bf9 + url: "https://pub.dev" + source: hosted + version: "4.13.1" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: eeeb3fcd5f0ff9f8446c9f4bbc18a99b809e40297528a3395597d03aafb9f510 + url: "https://pub.dev" + source: hosted + version: "4.10.11" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: "63d26ee3aca7256a83ccb576a50272edd7cfc80573a4305caa98985feb493ee0" + url: "https://pub.dev" + source: hosted + version: "2.14.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: e49f378ed066efb13fc36186bbe0bd2425630d4ea0dbc71a18fdd0e4d8ed8ebc + url: "https://pub.dev" + source: hosted + version: "3.23.5" + win32: + dependency: transitive + description: + name: win32 + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" + source: hosted + version: "5.15.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "6f1b564492d0147b330dd794fee8f512cec4977957f310f9951b5f9d83618dae" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" +sdks: + dart: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml index 43969000..b476f050 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,8 @@ name: hmg_patient_app_new description: "New HMG Patient App" publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.11+8 +version: 0.0.15+12 +#version: 0.0.1+14 environment: sdk: ">=3.6.0 <4.0.0" @@ -91,7 +92,7 @@ dependencies: location: ^8.0.1 gms_check: ^1.0.4 huawei_location: ^6.14.2+301 -# huawei_health: ^6.16.0+300 + huawei_health: ^6.15.0+300 intl: ^0.20.2 flutter_widget_from_html: ^0.17.1 huawei_map: ^6.12.0+301