From b6766654e0545dba231bf5d93f38e4446e9a73d5 Mon Sep 17 00:00:00 2001 From: Haroon Amjad <> Date: Fri, 29 Aug 2025 19:13:14 +0300 Subject: [PATCH] initial commit --- .gitignore | 45 + .metadata | 33 + README.md | 16 + analysis_options.yaml | 28 + assets/langs/ar-SA.json | 9 + assets/langs/en-US.json | 9 + key | Bin 0 -> 2051 bytes key.properties | 4 + lib/core/app_export.dart | 2 + lib/core/app_state.dart | 38 + lib/core/consts.dart | 163 ++ lib/core/dependencies.dart | 9 + lib/core/enums.dart | 29 + lib/core/location_util.dart | 174 ++ lib/core/utils/CalendarUtils.dart | 178 ++ lib/core/utils/LocalNotification.dart | 191 ++ lib/core/utils/push-notification-handler.dart | 383 ++++ lib/core/utils/size_config.dart | 103 ++ lib/core/utils/size_utils.dart | 93 + lib/core/utils/utils.dart | 341 ++++ lib/extensions/context_extensions.dart | 16 + lib/extensions/int_extensions.dart | 14 + lib/extensions/string_extensions.dart | 311 ++++ lib/extensions/util_extensions.dart | 33 + lib/extensions/widget_extensions.dart | 151 ++ lib/firebase_options.dart | 65 + lib/generated/locale_keys.g.dart | 14 + lib/main.dart | 79 + lib/presentation/home/landing_page.dart | 15 + lib/routes/app_routes.dart | 8 + lib/services/api_client.dart | 300 ++++ lib/services/api_exception.dart | 29 + lib/splashPage.dart | 117 ++ lib/theme/app_theme.dart | 58 + lib/theme/colors.dart | 18 + lib/widgets/app_bar_widget.dart | 32 + lib/widgets/arrow_back.dart | 24 + lib/widgets/attachment_options.dart | 58 + lib/widgets/bottom_sheet.dart | 89 + lib/widgets/category_buttons.dart | 34 + lib/widgets/custom_dropdown.dart | 73 + lib/widgets/default_button.dart | 133 ++ lib/widgets/dialogs/confirm_dialog.dart | 65 + lib/widgets/image_picker.dart | 214 +++ lib/widgets/input_widget.dart | 164 ++ lib/widgets/loading_dialog.dart | 66 + lib/widgets/otp_widget.dart | 377 ++++ lib/widgets/phone_number_input.dart | 115 ++ .../shimmer/dashboard_shimmer_widget.dart | 256 +++ .../shimmer/movies_shimmer_widget.dart | 43 + lib/widgets/transitions/fade_page.dart | 30 + lib/widgets/vital_sing_chart_and_detials.dart | 146 ++ .../vital_sing_chart_blood_pressure.dart | 149 ++ pubspec.lock | 1577 +++++++++++++++++ pubspec.yaml | 76 + test/widget_test.dart | 30 + 56 files changed, 6827 insertions(+) create mode 100644 .gitignore create mode 100644 .metadata create mode 100644 README.md create mode 100644 analysis_options.yaml create mode 100644 assets/langs/ar-SA.json create mode 100644 assets/langs/en-US.json create mode 100644 key create mode 100644 key.properties create mode 100644 lib/core/app_export.dart create mode 100644 lib/core/app_state.dart create mode 100644 lib/core/consts.dart create mode 100644 lib/core/dependencies.dart create mode 100644 lib/core/enums.dart create mode 100644 lib/core/location_util.dart create mode 100644 lib/core/utils/CalendarUtils.dart create mode 100644 lib/core/utils/LocalNotification.dart create mode 100644 lib/core/utils/push-notification-handler.dart create mode 100644 lib/core/utils/size_config.dart create mode 100644 lib/core/utils/size_utils.dart create mode 100644 lib/core/utils/utils.dart create mode 100644 lib/extensions/context_extensions.dart create mode 100644 lib/extensions/int_extensions.dart create mode 100644 lib/extensions/string_extensions.dart create mode 100644 lib/extensions/util_extensions.dart create mode 100644 lib/extensions/widget_extensions.dart create mode 100644 lib/firebase_options.dart create mode 100644 lib/generated/locale_keys.g.dart create mode 100644 lib/main.dart create mode 100644 lib/presentation/home/landing_page.dart create mode 100644 lib/routes/app_routes.dart create mode 100644 lib/services/api_client.dart create mode 100644 lib/services/api_exception.dart create mode 100644 lib/splashPage.dart create mode 100644 lib/theme/app_theme.dart create mode 100644 lib/theme/colors.dart create mode 100644 lib/widgets/app_bar_widget.dart create mode 100644 lib/widgets/arrow_back.dart create mode 100644 lib/widgets/attachment_options.dart create mode 100644 lib/widgets/bottom_sheet.dart create mode 100644 lib/widgets/category_buttons.dart create mode 100644 lib/widgets/custom_dropdown.dart create mode 100644 lib/widgets/default_button.dart create mode 100644 lib/widgets/dialogs/confirm_dialog.dart create mode 100644 lib/widgets/image_picker.dart create mode 100644 lib/widgets/input_widget.dart create mode 100644 lib/widgets/loading_dialog.dart create mode 100644 lib/widgets/otp_widget.dart create mode 100644 lib/widgets/phone_number_input.dart create mode 100644 lib/widgets/shimmer/dashboard_shimmer_widget.dart create mode 100644 lib/widgets/shimmer/movies_shimmer_widget.dart create mode 100644 lib/widgets/transitions/fade_page.dart create mode 100644 lib/widgets/vital_sing_chart_and_detials.dart create mode 100644 lib/widgets/vital_sing_chart_blood_pressure.dart create mode 100644 pubspec.lock create mode 100644 pubspec.yaml create mode 100644 test/widget_test.dart diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..da04d09 --- /dev/null +++ b/.metadata @@ -0,0 +1,33 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "d7b523b356d15fb81e7d340bbe52b47f93937323" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + base_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + - platform: android + create_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + base_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + - platform: ios + create_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + base_revision: d7b523b356d15fb81e7d340bbe52b47f93937323 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..08ae79f --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# hmg_patient_app_new + +New HMG Patient App + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json new file mode 100644 index 0000000..d3236ae --- /dev/null +++ b/assets/langs/ar-SA.json @@ -0,0 +1,9 @@ +{ + "english": "English", + "arabic": "عربي", + "login": "تسجيل الدخول", + "noDataAvailable": "لا تتوافر بيانات", + "ok": "موافق", + "confirm": "تأكيد", + "loadingText": "جاري التحميل، الرجاء الانتظار..." +} \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json new file mode 100644 index 0000000..4df77b3 --- /dev/null +++ b/assets/langs/en-US.json @@ -0,0 +1,9 @@ +{ + "english": "English", + "arabic": "عربي", + "login": "Login", + "noDataAvailable": "No Data Available", + "confirm": "Confirm", + "ok": "OK", + "loadingText": "Loading, please wait..." +} \ No newline at end of file diff --git a/key b/key new file mode 100644 index 0000000000000000000000000000000000000000..15b9f5d1307057e4b8e4bcd4381b23424811dac6 GIT binary patch literal 2051 zcmV+e2>kc{?f&fm000620003100031188k$0003(nN@t?000F5FoFd9Fb)O^D+U1s z0V)C!0RaU71cC(UgT>MCv(e@oDfNKKat;@%p4`DkvJuL`PH*E2{RRXpj8X+Vz6u)a zevfZjqLBl;cIY2&J>kVSmOnh85TlNca*tXy=ZzdqZ*Vi#m^yl{Ll6A;Sd={hT?IVR-vm zsFm$Js?Q^dp9o!qSRcSdC^2E_AlP7`-vDF*M#8~os|f9W9B0|TdDv}@ySNta&9Yrn ztMWQJdtXeJsd1 zKq<_)z$Ik+N!g%?b$VpY+coA!nEY&wh_Ohc8}1-jTREU#|5OvLK{({;mDBQeMpig# zTehwn0;k~~hLqrb;vtW@Me}!^uWZOw$iVnMV3srhjO=L)oJUX!(qD1ses|u&Nwioz zj+o`f9ed0UZJG6Ab~*}zEV>~R%-bZlckN2=)AHQqfI9a2&r!4j#F|-{Hey;yL;eas z!}{x-W9p?rgJgllLS=%ZZCI}uwYVNVts-(A;Vri?b2$bR<6+^mo?6~bi<6gK;zdIQ!icx8FBm&qi8FROwQbzQ zw|)D%S6A->!Z!SufL%t0YI;<{3u6GuZg&{;MqWRJ+`evF^h>P(WH3BA23c)%y!|yRfZ5fr(kpW{ zCf1T3e59lbZ_(19wN;BVSk`6GK}L~z=&IqjxqpUB(3%~!t38n%yAnb^KvwxHS|)Z` zmzS*45qo}8{IjS=Wr@;;HP#Ci%UCc)>vb>CL8+e9s1xSeeKD*@>}^Cl1P4wz#3Tn} z|45J2ehH;v4w5vX*?7lVO+z8V0000100mesH842<00O@-f&#lRf&rtT0|Eg80t5r% zH@Pqk1_>&LNQUzjQ&MLzN8IfTy_}v&8I@pw%wKNScy*LA3rc7KjA4 zWfC{O=iO5mqz#*(q&OyMdnNv6mZ@&>3L=UiQdm+;^2KQfDfoF=Djh9`E|#|nE*@Xh z(G2O~7*w_rC*WzLtCZ_O*hL%9*LNl!ullZ1L4!w0-YQ_Zb?SEbCN_?}r-r_nag8Ej zPm?AO0!sn|0RRD`Aut~>9R>qc9S#H*1Qd_SMR1N)p%d$|2yTd-kw{+84ni;u1_>&L zNQU-FMCu!XEeENt zbZYF>l?W5mT{|+Z_k)_(okzb+Ou{tP5Eh&Yha7vf3Zj*o9Y2*$m~-ET@4PCHJr+g= zI;*a_R6jK`yvN45zw?CC)lzz8uUW_?;Xz5T+b8EF9*97}49<0J|DmrGoq;v=4Vw=b zO*`9K?i9?i)Dsf$QBJ(@l{NnX&kh4pp^|M%ab0gp&nG4+V65?Tip%_;*SP45Fj)Xr hRD#uFfsONE{KL;10I7=mQW|g4`W}C56fpelh$yQ4rvv~1 literal 0 HcmV?d00001 diff --git a/key.properties b/key.properties new file mode 100644 index 0000000..5f99fd6 --- /dev/null +++ b/key.properties @@ -0,0 +1,4 @@ +storePassword=HmGsa123 +keyPassword=HmGsa123 +keyAlias=hmg +storeFile=key \ No newline at end of file diff --git a/lib/core/app_export.dart b/lib/core/app_export.dart new file mode 100644 index 0000000..0009b3a --- /dev/null +++ b/lib/core/app_export.dart @@ -0,0 +1,2 @@ +export '../routes/app_routes.dart'; +export 'utils/size_utils.dart'; diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart new file mode 100644 index 0000000..604e985 --- /dev/null +++ b/lib/core/app_state.dart @@ -0,0 +1,38 @@ +import 'dart:io'; + +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:hmg_patient_app_new/main.dart'; + +import 'consts.dart'; + +class AppState { + static final AppState _instance = AppState._internal(); + + AppState._internal(); + + factory AppState() => _instance; + + //Tokens + + bool isAuthenticated = false; + + set setIsAuthenticated(v) => isAuthenticated = v; + + set setAppAuthToken(v) => appAuthToken = v; + + String appAuthToken = ""; + + set setUserLat(v) => userLat = v; + + set setUserLong(v) => userLong = v; + + double userLat = 0.0; + double userLong = 0.0; + + bool isArabic() => EasyLocalization.of(navigatorKey.currentContext!)?.locale.languageCode == "ar"; + + int getLanguageID(context) => EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; + +// bool isUserLoggedIn() => +} diff --git a/lib/core/consts.dart b/lib/core/consts.dart new file mode 100644 index 0000000..a018eac --- /dev/null +++ b/lib/core/consts.dart @@ -0,0 +1,163 @@ +class ApiConsts { + static const maxSmallScreen = 660; + + static bool isDevelopment = true; + + // static String baseUrlBackend = 'http://ec2-13-51-36-142.eu-north-1.compute.amazonaws.com:8082/api/'; // Backend API URL UAT + // static String baseUrlBackend = 'http://207.127.99.20:82/api/'; // Backend API URL PROD + static String baseUrlBackend = 'https://api-mob.meena-health.com/api/'; // Backend API URL PROD + + static String checkIfUserExists = 'UserRegistrationHIS/phone'; + static String checkIfUserExistsMultiple = 'UserRegistrationHIS/phone/multiple'; + static String checkIfUserExistsByMRN = 'UserRegistrationHIS/mrn/phone'; + static String checkIfUserLastLoggedIn = 'UserRegistrationHIS/device-token'; + static String updateUserLastLogIn = 'UserRegistrationHIS/save-device-token'; + static String getStories = 'Stories'; + static String saveAppointmentDetailsInBackend = 'UserAppointment'; + static String getPatientAppointmentHistory = 'UserAppointment/my-appointments'; + static String updateAppointmentDetailsInBackend = 'UserAppointment/update/'; + static String submitDoctorReview = 'DoctorReview/submit-review'; + static String getUserDataFromYakeenByIqama = 'Yakeen/by-iqama'; + static String getUserDataFromYakeenByNin = 'Yakeen/by-nin'; + static String sendVerificationCode = 'UserLogin/otp-request'; + static String checkVerificationCode = 'UserLogin/otp-verify'; + static String registerNewPatient = 'UserRegistrationHIS/save/patient'; + static String getPatientVitalSignsHistory = 'Vitals/my-vitals'; + static String getPatientLabReports = 'LabsOrder/my-orders'; + static String getPatientRadReports = 'RadiologyOrder/my-orders'; + static String getPatientPrescriptionsReports = 'Prescription/my-prescriptions'; + static String updatePatientStoryViewedAPI = 'Stories/view'; + static String getClinicsList = 'Clinics'; + static String getDoctorsList = 'Doctors'; + static String checkAppVersion = 'AppVersion/check-version'; + static String getPatientLabOrdersAndResults = 'LabsOrder/my-order-result'; + static String updatePatientProfile = 'Users/profile-update'; + static String getPatientVitalSignsFromHIS = 'getpatientvital'; + static String getDoctorReviewsByDoctorID = 'DoctorReview/'; + + // static String baseUrl = 'http://158.101.230.106:5016/phi/'; // HIS API URL UAT + static String baseUrl = 'http://158.101.232.32:5016/phi/'; // HIS API URL PROD + + //Doctor Search + static String doctorSearch = 'doctor/search'; + + //Get Patient Data + static String getPatientData = 'patientdata/getpatientsdata'; + + //Get Free Slots + static String getFreeSlots = 'doctor/timeslot'; + + //Create Appointment + static String createAppointment = 'patient/appointment/create'; + + //Cancel Appointment + static String cancelAppointment = 'patient/appointment/create'; + + //Create Deposit + static String createDeposit = 'patient/PatientDeposits'; + + //Update Patient Photo + static String updatePatientPhoto = 'patientphoto'; + + // get Patient Insurance Details + static String getPatientInsuranceDetails = "http://158.101.232.32:5021/getpolicydetails"; + + // get Patient Insurance Details + static String getDoctorSessionsByAppointments = "http://158.101.232.32:5016/phi/doctor/getdoctorsessionbyappointment"; // Prod + + // static String getDoctorSessionsByAppointments = "http://158.101.230.106:5016/phi/doctor/getdoctorsessionbyappointment"; // UAT + + //get Organization List + static String getOrganizationsList = 'organisationsearch'; + + //get Departments List + static String getDepartmentsList = 'getdepartmentsearch'; + + static String VERSION_ID = "1.6"; + + // Nabed APIs + static String nabedBaseUrl = "https://portal.nabed.net/api/"; // Live + static String nabedAuthenticationURL = "auth/jwt-token"; + static String nabedGetPatientData = "educate/external/content/icd?page="; + + // SANED URLs + static String sanedLoginPassword = "Aa123456@"; + static String sanedSource = "Meena Mobile App"; + + static String baseUrlSaned = 'https://staging.sanedhealth.com/'; // SANED API URL STAGING + // static String baseUrlSaned = 'https://hc.sanedhealth.com/'; // SANED API URL PRODUCTION + static String sanedAPIVersion = 'mn_hc/'; + + // static String sanedWebSocketURL = 'wss://locationapi.sanedhealth.com/ws?apikey=st_zuhDm9xSyI'; // UAT SANED WEBSOCKET URL + static String sanedWebSocketURL = 'wss://locationapiprod.sanedhealth.com/ws?apikey=st_A1xVs5qA7z'; // PRODUCTION WEBSOCKET URL + + static String getSanedAuthToken = 'api/external/login'; + static String getSanedProductCategories = 'get_product_categories'; + static String getProductPackages = 'get/product/packages'; + static String getPackageDetails = 'get/package/details'; + static String checkPatientByNationalitySaned = 'check_patient_by_nationality'; + static String signupPatient = 'api/signup'; + static String getPatientCartDetails = 'shop/cart'; + static String addPackageToCart = 'shop/cart/update'; + static String updateCartItems = 'shop/cart/update_json'; + static String getPatientLocationList = 'get_patient_location_list'; + static String updatePatientLocationList = 'update_patient_location'; + static String getAvailableSlots = 'get/category/slot'; + static String createHHCAppointment = 'api/create/appointment'; + static String cancelHHCAppointment = 'cancel_appointment'; + static String getBlackOutDates = 'get/blackout/dates'; + + // static String createConfirmHHCAppointment = 'api/create/appointment'; + static String getPatientHHCAppointmentHistory = 'get_patient_medical_history/appointment'; + + static setBackendURLs() { + if (isDevelopment) { + baseUrlSaned = 'https://staging.sanedhealth.com/'; + sanedWebSocketURL = "wss://locationapi.sanedhealth.com/ws?apikey=st_zuhDm9xSyI"; + baseUrlBackend = "http://ec2-13-51-36-142.eu-north-1.compute.amazonaws.com:8082/api/"; + baseUrl = "http://158.101.230.106:5016/phi/"; + getDoctorSessionsByAppointments = "http://158.101.230.106:5016/phi/doctor/getdoctorsessionbyappointment"; + } else { + baseUrlSaned = 'https://hc.sanedhealth.com/'; + sanedWebSocketURL = "wss://locationapiprod.sanedhealth.com/ws?apikey=st_A1xVs5qA7z"; + baseUrlBackend = "https://api-mob.meena-health.com/api/"; + baseUrl = "http://158.101.232.32:5016/phi/"; + getDoctorSessionsByAppointments = "http://158.101.232.32:5016/phi/doctor/getdoctorsessionbyappointment"; + } + } + +// Login +// static String baseUrlLogin = 'https://keycloak.dev.evxtest.monster/realms/'; +// static String getLoginToken = 'my_city_uat/protocol/openid-connect/token'; +} + +class SharedPrefsConsts { + static String isRememberMe = "remember_me"; + static String username = "doctorId"; + static String password = "password"; + static String logInTokenID = "logInTokenID"; + static String vidaAuthTokenID = "vidaAuthTokenID"; + static String vidaRefreshTokenID = "vidaRefreshTokenID"; + static String authenticationTokenID = "authenticationTokenID"; + static String projectID = "projectID"; + static String clinicId = "clinicId"; + static String lastLoginDate = "lastLoginDate"; + static String lastLoginTime = "lastLoginTime"; + static String memberModel = "memberModel"; + + static String isShowOnboarding = "is_show_onboarding"; + static String appAuthToken = "app_auth_token"; + static String appUserID = "app_user_id"; + static String loggedInUserObj = "logged_in_user_obj"; + + static String PUSH_TOKEN = "push_token"; + static String APNS_TOKEN = "apns_token"; + static String VOIP_TOKEN = "voip_token"; + static String PATIENT_MRN = "patient_mrn"; + + static String loggedInUserID = "logged_in_user_id"; + static String loggedInUserPassword = "logged_in_user_password"; + + static String user_lat = 'user-lat'; + static String user_long = 'user-long'; +} diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart new file mode 100644 index 0000000..4b3b0d6 --- /dev/null +++ b/lib/core/dependencies.dart @@ -0,0 +1,9 @@ +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:injector/injector.dart'; + +class AppDependencies { + static void addDependencies() { + Injector injector = Injector.appInstance; + injector.registerSingleton(() => AppState()); + } +} diff --git a/lib/core/enums.dart b/lib/core/enums.dart new file mode 100644 index 0000000..cf27602 --- /dev/null +++ b/lib/core/enums.dart @@ -0,0 +1,29 @@ +// enum APPSTATUS { +// loading, +// unAuthenticated, +// authenticated, +// unverified, +// } + +enum AuthMethodTypes { + sms, + whatsApp, + fingerPrint, + faceID, + moreOptions, +} + +enum ViewState { + hide, + idle, + busy, + error, + busyLocal, + errorLocal, +} + +enum LoginType { + FROM_LOGIN, + SILENT_LOGIN, + SILENT_WITH_OTP, +} diff --git a/lib/core/location_util.dart b/lib/core/location_util.dart new file mode 100644 index 0000000..d9716a9 --- /dev/null +++ b/lib/core/location_util.dart @@ -0,0 +1,174 @@ +import 'dart:io'; + +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/core/consts.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +// import 'package:huawei_location/huawei_location.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; + +class LocationUtils { + bool isShowConfirmDialog; + bool isShowLocationTimeoutDialog; + BuildContext context; + bool isHuawei; + final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance; + + LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false, this.isShowLocationTimeoutDialog = true}); + + void getCurrentLocation({Function(LatLng)? callBack}) async { + Geolocator.isLocationServiceEnabled().then((value) async { + if (value) { + await Geolocator.checkPermission().then((permission) async { + if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { + // Geolocator.getCurrentPosition(locationSettings: LocationSettings(accuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 5))).then((value) { + Geolocator.getLastKnownPosition().then((value) { + setLocation(value); + if (callBack != null) callBack(LatLng(value?.latitude ?? 24.7101433, value?.longitude ?? 46.6757709)); + }).catchError((err) { + print(err); + if (isShowConfirmDialog && isShowLocationTimeoutDialog) { + // showLocationTimeOutDialog(failureCallBack: () { + // Geolocator.openAppSettings(); + // }); + } + }); + } + + if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { + if (Platform.isAndroid) { + // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () async { + final hasPermission = await _handlePermission(); + if (hasPermission) { + // Geolocator.getCurrentPosition(locationSettings: LocationSettings(accuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 5))).then((value) { + Geolocator.getLastKnownPosition().then((value) { + setLocation(value); + if (callBack != null) callBack(LatLng(value?.latitude ?? 24.7101433, value?.longitude ?? 46.6757709)); + }); + } else { + // if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + } + // }); + } else { + if (await Permission.location.request().isGranted) { + getCurrentLocation(callBack: callBack); + } else { + setZeroLocation(); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + } + } + } + }).catchError((err) { + print(err); + }); + } else { + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + } + }).catchError((err) { + print(err); + }); + } + + Future checkIfGPSIsEnabled() async { + return await Geolocator.isLocationServiceEnabled(); + } + + Future _handlePermission() async { + bool serviceEnabled; + LocationPermission permission; + + serviceEnabled = await _geolocatorPlatform.isLocationServiceEnabled(); + if (!serviceEnabled) { + return false; + } + + permission = await _geolocatorPlatform.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await _geolocatorPlatform.requestPermission(); + if (permission == LocationPermission.denied) { + return false; + } + } + + if (permission == LocationPermission.deniedForever) { + return false; + } + return true; + } + + // showLocationTimeOutDialog({Function()? failureCallBack}) { + // ConfirmDialog dialog = new ConfirmDialog( + // context: context, + // confirmMessage: TranslationBase.of(context).locationTimeoutError, + // okText: TranslationBase.of(context).ok, + // cancelText: TranslationBase.of(context).cancel_nocaps, + // okFunction: () { + // ConfirmDialog.closeAlertDialog(context); + // Navigator.of(context).canPop(); + // if (failureCallBack != null) { + // failureCallBack(); + // } + // }, + // cancelFunction: () { + // if (failureCallBack != null) { + // failureCallBack(); + // } + // }); + // return dialog.showAlertDialog(context); + // } + + showErrorLocationDialog(bool isPermissionError, {Function()? failureCallBack}) { + setLocation(null); + // ConfirmDialog dialog = new ConfirmDialog( + // context: context, + // confirmMessage: TranslationBase.of(context).locationDialogMessage, + // okText: TranslationBase.of(context).confirm, + // cancelText: TranslationBase.of(context).cancel_nocaps, + // okFunction: () { + // ConfirmDialog.closeAlertDialog(context); + // if (isPermissionError) + // Geolocator.openAppSettings(); + // else + // Geolocator.openLocationSettings(); + // Navigator.of(context).canPop(); + // if (failureCallBack != null) { + // failureCallBack(); + // } + // }, + // cancelFunction: () { + // if (failureCallBack != null) { + // failureCallBack(); + // } + // }); + // return dialog.showAlertDialog(context); + } + + void setLocation(Position? position) { + Utils.saveNumFromPrefs(SharedPrefsConsts.user_lat, position?.latitude ?? 0.0); + Utils.saveNumFromPrefs(SharedPrefsConsts.user_lat, position?.longitude ?? 0.0); + + AppState().setUserLat = position?.latitude ?? 0.0; + AppState().setUserLong = position?.longitude ?? 0.0; + + // projectViewModel.setLatitudeLongitude(position?.latitude ?? 0.0, position?.longitude ?? 0.0); + } + + void setZeroLocation() { + Utils.saveNumFromPrefs(SharedPrefsConsts.user_lat, 0.0); + Utils.saveNumFromPrefs(SharedPrefsConsts.user_lat, 0.0); + + AppState().setUserLat = 0.0; + AppState().setUserLong = 0.0; + } + + Future requestPermissions() async { + var result = await [ + Permission.location, + ].request(); + return (result[Permission.location]!.isGranted || result[Permission.locationAlways]!.isGranted); + } +} diff --git a/lib/core/utils/CalendarUtils.dart b/lib/core/utils/CalendarUtils.dart new file mode 100644 index 0000000..39c7a14 --- /dev/null +++ b/lib/core/utils/CalendarUtils.dart @@ -0,0 +1,178 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; +import 'dart:ui'; + +import 'package:device_calendar/device_calendar.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:manage_calendar_events/manage_calendar_events.dart' as ios; +import 'package:timezone/data/latest.dart' as tzl; + +final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin(); +final ios.CalendarPlugin _myPlugin = ios.CalendarPlugin(); + +class CalendarUtils { + static Completer? _completer; + + dynamic get writableCalendars => calendars.firstWhere((c) => !c.isReadOnly!); + dynamic calendars; + + CalendarUtils._(this.calendars); + + // static Future getInstance() async { + // if (_completer == null) { + // _completer = Completer(); + // print(_completer!.isCompleted); + // try { + // final dynamic calendarsResult; + // if (Platform.isIOS) { + // calendarsResult = await _myPlugin.getCalendars(); + // if (!_completer!.isCompleted) { + // _completer?.complete(CalendarUtils._(await calendarsResult!)); + // } + // } else { + // calendarsResult = await deviceCalendarPlugin.retrieveCalendars(); + // if (!_completer!.isCompleted) { + // _completer?.complete(CalendarUtils._(await calendarsResult.data!)); + // } + // } + // } on Exception catch (e) { + // if (!_completer!.isCompleted) { + // _completer!.completeError(e); + // } + // } + // } + // return _completer!.future; + // } + + static Future getInstance() async { + tzl.initializeTimeZones(); + if (_completer != null) { + return _completer!.future; + } + _completer = Completer(); + try { + final dynamic calendarsResult; + if (Platform.isIOS) { + calendarsResult = await _myPlugin.getCalendars(); + _completer!.complete(CalendarUtils._(calendarsResult)); + } else { + calendarsResult = await deviceCalendarPlugin.retrieveCalendars(); + _completer!.complete(CalendarUtils._(calendarsResult.data)); + } + } catch (e) { + _completer!.completeError(e); + } + + return _completer!.future; + } + + Future createOrUpdateEvents({List? scheduleList, String? title, String? description, List? scheduleDateTime, List? daysOfWeek}) async { + tzl.initializeTimeZones(); + List events = []; + Location _currentLocation; + if (DateTime.now().timeZoneName == "+04") + _currentLocation = getLocation('Asia/Dubai'); + else + _currentLocation = getLocation('Asia/Riyadh'); + + scheduleDateTime!.forEach((element) { + RecurrenceRule recurrenceRule = RecurrenceRule( + // RecurrenceFrequency.Daily, + // daysOfWeek: daysOfWeek, + // endDate: element, + until: element, frequency: Frequency.daily, + ); + //added byAamir Tz Time + Event event = Event(writableCalendars!.id, + recurrenceRule: recurrenceRule, + start: TZDateTime.from(element, _currentLocation), + end: TZDateTime.from(element.add(Duration(minutes: 30)), _currentLocation), + title: title, + description: description); + events.add(event); + }); + + events.forEach((element) { + deviceCalendarPlugin.createOrUpdateEvent(element); + }); + } + + Future createOrUpdateEvent({required String title, required String description, required String location, DateTime? scheduleDateTime, String? eventId}) async { + RecurrenceRule recurrenceRule = RecurrenceRule( + // RecurrenceFrequency.Daily, + // daysOfWeek: daysOfWeek, + // endDate: scheduleDateTime, + until: scheduleDateTime, frequency: Frequency.daily, + ); + + Location _currentLocation; + // if (DateTime.now().timeZoneName == "+04") + // _currentLocation = getLocation('Asia/Dubai'); + // else + _currentLocation = getLocation('Asia/Riyadh'); + + TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime!, _currentLocation); + + print("writableCalendars-name: " + writableCalendars.name); + print("writableCalendars-Id: " + writableCalendars.id); + print("writableCalendarsToString: " + writableCalendars.toString()); + print("writableCalendarsToString: " + writableCalendars!.id!); + Event event = Event( + writableCalendars!.id, + start: scheduleDateTimeUTZ, + end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), + title: title, + description: description, + ); + + ios.CalendarEvent iosCalEvent = + ios.CalendarEvent(location: location, startDate: scheduleDateTimeUTZ, endDate: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description, isAllDay: false); + + if (Platform.isAndroid) { + Result result = await deviceCalendarPlugin.hasPermissions(); + print(result); + await deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { + print("catchError " + e.toString()); + }).whenComplete(() { + print("whenComplete Calender ID " + eventId!); + // Utils.showToast(LocaleKeys.appoReminderSuccess.tr()); + }); + } else { + await _myPlugin.createEvent(calendarId: writableCalendars.id!, event: iosCalEvent).catchError((e) { + print("catchError " + e.toString()); + }).whenComplete(() { + print("whenComplete Calender ID iOS " + eventId!); + // Utils.showToast(LocaleKeys.appoReminderSuccess.tr()); + }); + } + } + + deleteEvent(String _calendarId, String _eventId) async { + if (Platform.isIOS) { + await _myPlugin.deleteEvent(calendarId: _calendarId, eventId: _eventId); + } else { + await deviceCalendarPlugin.deleteEvent(_calendarId, _eventId); + } + } + + Future retrieveEvents( + String calendarId, + RetrieveEventsParams retrieveEventsParams, + ) async { + if (Platform.isIOS) { + return await _myPlugin.getEvents(calendarId: calendarId); + } else { + return await deviceCalendarPlugin.retrieveEvents(calendarId, retrieveEventsParams); + } + } + + Future createCalendar( + String calendarName, { + Color? calendarColor, + String? localAccountName, + }) async { + return await deviceCalendarPlugin.createCalendar(calendarName, calendarColor: calendarColor, localAccountName: localAccountName); + } +} diff --git a/lib/core/utils/LocalNotification.dart b/lib/core/utils/LocalNotification.dart new file mode 100644 index 0000000..aba01f8 --- /dev/null +++ b/lib/core/utils/LocalNotification.dart @@ -0,0 +1,191 @@ +import 'dart:math'; +import 'dart:typed_data'; + +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; + +final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); + +class LocalNotification { + Function(String payload)? _onNotificationClick; + static LocalNotification? _instance; + + static LocalNotification? getInstance() { + return _instance; + } + + static init({required Function(String payload) onNotificationClick}) { + if (_instance == null) { + _instance = LocalNotification(); + _instance?._onNotificationClick = onNotificationClick; + _instance?._initialize(); + } else { + // assert(false,(){ + // //TODO fix it + // "LocalNotification Already Initialized"; + // }); + } + } + + _initialize() async { + try { + var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); + var initializationSettingsIOS = DarwinInitializationSettings(); + var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { + switch (notificationResponse.notificationResponseType) { + case NotificationResponseType.selectedNotification: + // selectNotificationStream.add(notificationResponse.payload); + break; + case NotificationResponseType.selectedNotificationAction: + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } + break; + } + }, + // onDidReceiveBackgroundNotificationResponse: notificationTapBackground, + ); + } catch (ex) { + print(ex.toString()); + } + // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) + // { + // switch (notificationResponse.notificationResponseType) { + // case NotificationResponseType.selectedNotification: + // // selectNotificationStream.add(notificationResponse.payload); + // break; + // case NotificationResponseType.selectedNotificationAction: + // // if (notificationResponse.actionId == navigationActionId) { + // // selectNotificationStream.add(notificationResponse.payload); + // } + // // break; + // },} + // + // , + // + // ); + } + + // void notificationTapBackground(NotificationResponse notificationResponse) { + // // ignore: avoid_print + // print('notification(${notificationResponse.id}) action tapped: ' + // '${notificationResponse.actionId} with' + // ' payload: ${notificationResponse.payload}'); + // if (notificationResponse.input?.isNotEmpty ?? false) { + // // ignore: avoid_print + // print('notification action tapped with input: ${notificationResponse.input}'); + // } + // } + + var _random = new Random(); + + _randomNumber({int from = 100000}) { + return _random.nextInt(from); + } + + _vibrationPattern() { + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + return vibrationPattern; + } + + Future? showNow({required String title, required String subtitle, required String payload}) { + Future.delayed(Duration(seconds: 1)).then((result) async { + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'com.hmg.local_notification', + 'HMG', + channelDescription: 'HMG', + importance: Importance.max, + priority: Priority.high, + ticker: 'ticker', + vibrationPattern: _vibrationPattern(), + ongoing: true, + autoCancel: false, + usesChronometer: true, + when: DateTime.now().millisecondsSinceEpoch - 120 * 1000, + ); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(25613, title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); + }); + } + + Future scheduleNotification({required DateTime scheduledNotificationDateTime, required String title, required String description}) async { + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + // channelDescription: 'ActivePrescriptionsDescription', + // // icon: 'secondary_icon', + // sound: RawResourceAndroidNotificationSound('slow_spring_board'), + // + // ///change it to be as ionic + // // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + // vibrationPattern: vibrationPattern, + // enableLights: true, + // color: const Color.fromARGB(255, 255, 0, 0), + // ledColor: const Color.fromARGB(255, 255, 0, 0), + // ledOnMs: 1000, + // ledOffMs: 500); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); + + // /change it to be as ionic + // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); + } + + ///Repeat notification every day at approximately 10:00:00 am + Future showDailyAtTime() async { + // var time = Time(10, 0, 0); + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); + } + + ///Repeat notification weekly on Monday at approximately 10:00:00 am + Future showWeeklyAtDayAndTime() async { + // var time = Time(10, 0, 0); + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); + // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); + } + + String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); + } + + Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); + } + + Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); + } +} diff --git a/lib/core/utils/push-notification-handler.dart b/lib/core/utils/push-notification-handler.dart new file mode 100644 index 0000000..4b7c424 --- /dev/null +++ b/lib/core/utils/push-notification-handler.dart @@ -0,0 +1,383 @@ +import 'dart:async'; +import 'dart:developer'; +import 'dart:io'; + +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:firebase_messaging/firebase_messaging.dart' as fir; +import 'package:firebase_core/firebase_core.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart'; + +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:hmg_patient_app_new/core/utils/LocalNotification.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:uuid/uuid.dart'; + +import '../consts.dart'; + +// |--> Push Notification Background +@pragma('vm:entry-point') +Future backgroundMessageHandler(dynamic message) async { + print("Firebase backgroundMessageHandler!!!"); + await Firebase.initializeApp(); + fir.RemoteMessage message_; + + if (message.data != null && (message.data['is_call'] == 'true' || message.data['is_call'] == true)) { + // showCallkitIncoming(message); + _incomingCall(message.data); + return; + } else {} +} + +callPage(String sessionID, String token) async {} + +_incomingCall(Map data) async { + // LandingPage.incomingCallData = IncomingCallData.fromJson(data); + // var dataItem = await AppSharedPreferences().getObject('call_data'); + // if(dataItem != null ) return; // to stop repeated attempt to invoke the call + // if (LandingPage.isOpenCallPage == false) { + // LandingPage.isOpenCallPage = true; + WidgetsFlutterBinding.ensureInitialized(); + // var _currentUuid = Uuid().v4(); + // await FlutterCallkitIncoming.showCallkitIncoming(callKitParams); + // } + // LandingPage.isOpenCallPage = false; + await Future.delayed(Duration(milliseconds: 500)); +} + +Future openCallPage(BuildContext context) async { + try { + // if (incomingCallData!.background == "0") { + // Zoom Call Page + // Navigator.of(context).pop(); + Navigator.pushReplacementNamed( + context, + "zoom_call_page", + // arguments: CallArguments(incomingCallData!.sessionId!, "123", "Patient", "40", "0", false, int.parse(incomingCallData!.appointmentNo!)), + ); + // } else { + // // OpenTok Call Page + // await Navigator.of(context).pushReplacement( + // MaterialPageRoute( + // // fullscreenDialog: true, + // builder: (BuildContext context) { + // // final caller = widget.incomingCallData.callerID; + // // final receiver = widget.incomingCallData.receiverID; + // // final host = widget.incomingCallData.server; + // // if(widget.incomingCallData.isWebRTC == "true"){ + // // return StartVideoCall(caller: caller, receiver: receiver, iAmCaller: false, host: host); + // // }else{ + // return OpenTokConnectCallPage(apiKey: OPENTOK_API_KEY, sessionId: incomingCallData!.sessionId!, token: incomingCallData!.token!); + // }, + // ), + // ); + // } + } catch (err) { + print(err); + // await PlatformExceptionAlertDialog( + // exception: Exception(err), + // ).show(context); + } +} + +// Future showCallkitIncoming(Map message) async { +// // if (message['type'] == 'ReservationCallStart') { +// var params = CallKitParams( +// id: DateTime.now().millisecondsSinceEpoch.toString(), +// nameCaller: 'Dr Sulaiman Al Habib', +// appName: 'Dr Sulaiman Al Habib', +// avatar: 'https://play-lh.googleusercontent.com/FBNNpxb7m6eM6wtW7MV1Ffp6OXOGLI38q47zcvP29OCYA1yhYH5mZzl5itZi0TgOyZpG', +// handle: 'LiveCare Call', +// type: 1, +// duration: 60000, +// textAccept: 'Accept', +// textDecline: 'Decline', +// textMissedCall: 'Missed call', +// textCallback: 'Call back', +// extra: { +// // 'reservationID': message['id'], +// 'userId': '1a2b3c4d' +// }, +// headers: {'apiKey': 'Abc@123!', 'platform': 'flutter'}, +// android: AndroidParams( +// isCustomNotification: true, +// isShowLogo: false, +// isShowCallback: false, +// ringtonePath: 'system_ringtone_default', +// backgroundColor: '#424242FF', +// // 'backgroundUrl': 'https://i.pravatar.cc/500', +// actionColor: '#4CAF50', +// incomingCallNotificationChannelName: "Incoming Call", +// missedCallNotificationChannelName: "Missed Call", +// ), +// ios: IOSParams( +// iconName: 'CallKitLogo', +// handleType: '', +// supportsVideo: true, +// maximumCallGroups: 2, +// maximumCallsPerCallGroup: 1, +// audioSessionMode: 'default', +// audioSessionActive: true, +// audioSessionPreferredSampleRate: 44100.0, +// audioSessionPreferredIOBufferDuration: 0.005, +// supportsDTMF: true, +// supportsHolding: true, +// supportsGrouping: false, +// supportsUngrouping: false, +// ringtonePath: 'system_ringtone_default')); +// await FlutterCallkitIncoming.showCallkitIncoming(params); +// // } else if (message['type'] == 'ReservationCallFinished') { +// // await FlutterCallkitIncoming.endAllCalls(); +// // } +// } + +class PushNotificationHandler { + late BuildContext context; + static final PushNotificationHandler _instance = PushNotificationHandler._internal(); + + // late HmsApiAvailability hmsApiAvailability; + + // final voIPKit = FlutterIOSVoIPKit.instance; + + late Timer timeOutTimer; + bool isTalking = false; + + var data = { + "AppointmentNo": "2016059247", + "ProjectID": "15", + "NotificationType": "10", + "background": "0", + "doctorname": "Call from postman", + "clinicname": "LIVECARE FAMILY MEDICINE AND GP", + "speciality": "General Practioner", + "appointmentdate": "2022-01-19", + "appointmenttime": "12:10", + "PatientName": "Testing", + "session_id": "1_MX40NjIwOTk2Mn5-MTY1NDE2NDQxMjc2Mn5xc3NCZkNIejJOdzgzTkg2TmlXblhQdnl-fg", + "token": + "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9MTliNTA3NDAxYmU0MjI5OGY5NTcxZTdhNzQyMTcyZjRjMjBhNjljZTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTFOREUyTkRReE1qYzJNbjV4YzNOQ1prTkllakpPZHpnelRrZzJUbWxYYmxoUWRubC1mZyZjcmVhdGVfdGltZT0xNjU0MTY0NDEzJm5vbmNlPTAuNjM3ODkzNDk4NDQ2NTIxOSZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjU0MjUwODEzJmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9", + "DoctorImageURL": "https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg", + "callerID": "9920", + "PatientID": "1231755", + "is_call": "true" + }; + + PushNotificationHandler._internal(); + + factory PushNotificationHandler() => _instance; + + static PushNotificationHandler getInstance() => _instance; + + // void _timeOut({ + // int seconds = 30, + // }) async { + // timeOutTimer = Timer(Duration(seconds: seconds), () async { + // print('🎈 example: timeOut'); + // final incomingCallerName = await voIPKit.getIncomingCallerName(); + // voIPKit.unansweredIncomingCall( + // skipLocalNotification: false, + // missedCallTitle: '📞 Missed call', + // missedCallBody: 'There was a call from $incomingCallerName', + // ); + // }); + // } + + init(BuildContext context) async { + this.context = context; + + if (Platform.isIOS) { + // voIPKit.getVoIPToken().then((value) { + // print("APNS VOIP KIT TOKEN: $value"); + // AppSharedPreferences().setString(APNS_TOKEN, value!); + // }); + // + // voIPKit.onDidUpdatePushToken = (String token) { + // print('🎈 example: onDidUpdatePushToken: $token'); + // }; + // + // voIPKit.onDidReceiveIncomingPush = ( + // Map payload, + // ) async { + // print('🎈 example: onDidReceiveIncomingPush $payload'); + // _timeOut(); + // }; + // + // voIPKit.onDidRejectIncomingCall = ( + // String uuid, + // String callerId, + // ) async { + // try { + // print('🎈 example: onDidRejectIncomingCall $uuid - $callerId'); + // timeOutTimer.cancel(); + // } catch (err) {} + // }; + // + // voIPKit.onDidAcceptIncomingCall = ( + // String uuid, + // String callerId, + // ) async { + // print('🎈 example: onDidAcceptIncomingCall $uuid - $callerId'); + // await voIPKit.acceptIncomingCall(callerState: CallStateType.calling); + // await voIPKit.callConnected(); + // await Future.delayed(Duration(seconds: 1)); + // + // Navigator.pushNamed( + // locator().navigatorKey.currentContext!, + // "zoom_call_page", + // arguments: CallArguments("hoover-dam", "123", "Patient", "40", "1", false), + // ); + // + // await voIPKit.endCall(); + // + // // Navigator.pushNamed(navigatorKey.currentContext!, VIDEO_CALL_SCREEN, + // // arguments: VideoArgus( + // // reservationId: int.parse(callerId), token: null, isVideo: true)); + // + // timeOutTimer.cancel(); + // }; + } + + if (Platform.isAndroid) { + try { + final fcmToken = await FirebaseMessaging.instance.getToken().catchError((err) { + print(err); + }); + if (fcmToken != null) onToken(fcmToken); + // } + } catch (ex) { + print("Notification Exception: " + ex.toString()); + } + FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); + } + + if (Platform.isIOS) { + await FirebaseMessaging.instance.getAPNSToken().then((value) async { + log("APNS token: " + value.toString()); + await Utils.saveStringFromPrefs(SharedPrefsConsts.APNS_TOKEN, value.toString()); + }); + await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions( + alert: true, // Required to display a heads up notification + badge: true, + sound: true, + ); + final permission = await FirebaseMessaging.instance.requestPermission(); + if (permission.authorizationStatus == AuthorizationStatus.denied) return; + } else {} + + try { + FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) async { + if (message != null) { + if (Platform.isIOS) + await Future.delayed(Duration(milliseconds: 3000)).then((value) { + if (message != null) newMessage(message); + }); + else if (message != null) newMessage(message); + } + }); + } catch (ex) {} + + FirebaseMessaging.onMessage.listen((RemoteMessage message) async { + print("Firebase onMessage!!!"); + // showCallkitIncoming(); + if (Platform.isIOS) + await Future.delayed(Duration(milliseconds: 3000)).then((value) { + newMessage(message); + }); + else + newMessage(message); + }); + + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async { + print("Firebase onMessageOpenedApp!!!"); + if (Platform.isIOS) + await Future.delayed(Duration(milliseconds: 3000)).then((value) { + newMessage(message); + }); + else + newMessage(message); + }); + + FirebaseMessaging.instance.getToken().then((String? token) { + print("Push Notification getToken: " + token!); + onToken(token!); + }).catchError((err) { + print(err); + }); + + FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { + print("Push Notification onTokenRefresh: " + fcm_token); + onToken(fcm_token); + }); + + if (Platform.isAndroid) { + final deviceInfo = DeviceInfoPlugin(); + final androidInfo = await deviceInfo.androidInfo; + + int sdkInt = androidInfo.version.sdkInt ?? 0; + if (sdkInt >= 33) { + await FlutterCallkitIncoming.requestFullIntentPermission(); + } + } + } + + newMessage(RemoteMessage remoteMessage) async { + print("Remote Message: " + remoteMessage.data.toString()); + if (remoteMessage.data.isEmpty) { + return; + } + debugPrint('the value of the remote message is ${remoteMessage.data}'); + if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) { + _incomingCall(remoteMessage.data); + // showCallkitIncoming(); + } else { + // GetNotificationsResponseModel notification = new GetNotificationsResponseModel(); + // + // notification.createdOn = DateUtil.convertDateToString(DateTime.now()); + // notification.messageTypeData = remoteMessage.data['picture']; + // notification.message = remoteMessage.data['message']; + // notification.notificationType = remoteMessage.data["NotificationType"].toString(); + // if (remoteMessage.data["NotificationType"] == "2") { + // notification.videoURL = remoteMessage.data["VideoUrl"]; + // } + // + // await NavigationService.navigateToPage(NotificationsDetailsPage( + // notification: notification, + // )); + } + } + + onToken(String token) async { + print("Push Notification Token: " + token); + await Utils.saveStringFromPrefs(SharedPrefsConsts.PUSH_TOKEN, token); + } + + onResume() async { + // var call_data = await AppSharedPreferences().getObject('call_data'); + // if (call_data != null) { + // _incomingCall(call_data); + // } + } + + Future requestPermissions() async { + try { + if (Platform.isIOS) { + await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation()?.requestPermissions(alert: true, badge: true, sound: true); + } else if (Platform.isAndroid) { + Map statuses = await [ + Permission.notification, + // Permission.camera, + // Permission.audio, + // Permission.microphone, + ].request(); + print("=-=-=-=-=-=-=-=-=-=-"); + print(statuses[Permission.notification]); + } + } catch (_) { + debugPrint(_.toString()); + } + } +} diff --git a/lib/core/utils/size_config.dart b/lib/core/utils/size_config.dart new file mode 100644 index 0000000..65ff374 --- /dev/null +++ b/lib/core/utils/size_config.dart @@ -0,0 +1,103 @@ +import 'package:flutter/cupertino.dart'; +import 'package:hmg_patient_app_new/core/consts.dart'; + +class SizeConfig { + static double _blockWidth = 0; + static double _blockHeight = 0; + + static double? realScreenWidth; + static double? realScreenHeight; + static double? screenWidth; + static double? screenHeight; + static double? textMultiplier; + static double? imageSizeMultiplier; + static double? heightMultiplier; + static bool isPortrait = true; + static double? widthMultiplier; + static bool isMobilePortrait = false; + static bool isMobile = false; + static bool isHeightShort = false; + static bool isHeightVeryShort = false; + static bool isHeightMiddle = false; + static bool isHeightLarge = false; + static bool isWidthLarge = false; + + void init(BoxConstraints constraints, Orientation orientation) { + realScreenHeight = constraints.maxHeight; + realScreenWidth = constraints.maxWidth; + if (constraints.maxWidth <= ApiConsts.maxSmallScreen) { + isMobile = true; + } + if (constraints.maxHeight < 600) { + isHeightVeryShort = true; + } else if (constraints.maxHeight < 800) { + isHeightShort = true; + } else if (constraints.maxHeight < 1000) { + isHeightMiddle = true; + } else { + isHeightLarge = true; + } + + if (constraints.maxWidth > 600) { + isWidthLarge = true; + } + + if (orientation == Orientation.portrait) { + isPortrait = true; + if (realScreenWidth! < 450) { + isMobilePortrait = true; + } + // textMultiplier = _blockHeight; + // imageSizeMultiplier = _blockWidth; + screenHeight = realScreenHeight; + screenWidth = realScreenWidth; + } else { + isPortrait = false; + isMobilePortrait = false; + // textMultiplier = _blockWidth; + // imageSizeMultiplier = _blockHeight; + screenHeight = realScreenWidth; + screenWidth = realScreenHeight; + } + _blockWidth = screenWidth! / 100; + _blockHeight = screenHeight! / 100; + + textMultiplier = _blockHeight; + imageSizeMultiplier = _blockWidth; + heightMultiplier = _blockHeight; + widthMultiplier = _blockWidth; + + print('realScreenWidth $realScreenWidth'); + print('realScreenHeight $realScreenHeight'); + print('textMultiplier $textMultiplier'); + print('imageSizeMultiplier $imageSizeMultiplier'); + print('heightMultiplier$heightMultiplier'); + print('widthMultiplier $widthMultiplier'); + print('isPortrait $isPortrait'); + print('isMobilePortrait $isMobilePortrait'); + } + + static getTextMultiplierBasedOnWidth({double? width}) { + // TODO handel LandScape case + if (width != null) { + return width / 100; + } + return widthMultiplier; + } + + static getWidthMultiplier({double? width}) { + // TODO handel LandScape case + if (width != null) { + return width / 100; + } + return widthMultiplier; + } + + static getHeightMultiplier({double? height}) { + // TODO handel LandScape case + if (height != null) { + return height / 100; + } + return heightMultiplier; + } +} diff --git a/lib/core/utils/size_utils.dart b/lib/core/utils/size_utils.dart new file mode 100644 index 0000000..0b37082 --- /dev/null +++ b/lib/core/utils/size_utils.dart @@ -0,0 +1,93 @@ +import 'package:flutter/material.dart'; // These are the Viewport values of your Figma Design. + +// These are used in the code as a reference to create your UI Responsively. +const num FIGMA_DESIGN_WIDTH = 375; +const num FIGMA_DESIGN_HEIGHT = 667; +const num FIGMA_DESIGN_STATUS_BAR = 0; + +extension ResponsiveExtension on num { + double get _width => SizeUtils.width; + + double get h => ((this * _width) / FIGMA_DESIGN_WIDTH); + + double get fSize => ((this * _width) / FIGMA_DESIGN_WIDTH); +} + +extension FormatExtension on double { + double toDoubleValue({int fractionDigits = 2}) { + return double.parse(this.toStringAsFixed(fractionDigits)); + } + + double isNonZero({num defaultValue = 0.0}) { + return this > 0 ? this : defaultValue.toDouble(); + } +} + +enum DeviceType { mobile, tablet, desktop } + +typedef ResponsiveBuild = Widget Function( + BuildContext context, + Orientation orientation, + DeviceType deviceType, +); + +class Sizer extends StatelessWidget { + const Sizer({Key? key, required this.builder}) : super(key: key); + + /// Builds the widget whenever the orientation changes. + final ResponsiveBuild builder; + + @override + Widget build(BuildContext context) { + return LayoutBuilder( + builder: (context, constraints) { + return OrientationBuilder( + builder: (context, orientation) { + SizeUtils.setScreenSize(constraints, orientation); + return builder(context, orientation, SizeUtils.deviceType); + }, + ); + }, + ); + } +} + +// ignore_for_file: must_be_immutable +class SizeUtils { + /// Device's BoxConstraints + static late BoxConstraints boxConstraints; + + /// Device's Orientation + static late Orientation orientation; + + /// Type of Device + /// + /// This can either be mobile or tablet + static late DeviceType deviceType; + + /// Device's Height + static late double height; + + /// Device's Width + static late double width; + + static void setScreenSize( + BoxConstraints constraints, + Orientation currentOrientation, + ) { + boxConstraints = constraints; + orientation = currentOrientation; + if (orientation == Orientation.portrait) { + width = boxConstraints.maxWidth.isNonZero( + defaultValue: FIGMA_DESIGN_WIDTH, + ); + height = boxConstraints.maxHeight.isNonZero(); + } else { + width = boxConstraints.maxHeight.isNonZero( + defaultValue: FIGMA_DESIGN_WIDTH, + ); + height = boxConstraints.maxWidth.isNonZero(); + } + deviceType = DeviceType.mobile; + } +} diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart new file mode 100644 index 0000000..003bc1c --- /dev/null +++ b/lib/core/utils/utils.dart @@ -0,0 +1,341 @@ +import 'package:hmg_patient_app_new/core/app_state.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/main.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/dialogs/confirm_dialog.dart'; +import 'package:hmg_patient_app_new/widgets/loading_dialog.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class Utils { + static bool _isLoadingVisible = false; + + static bool get isLoading => _isLoadingVisible; + + static void showToast(String message, {bool longDuration = true}) { + Fluttertoast.showToast( + msg: message, + toastLength: longDuration ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + timeInSecForIosWeb: 1, + backgroundColor: blackColor, + textColor: whiteColor, + fontSize: 16.0); + } + + static bool isArabicText(String inputText) { + bool isArabicText = false; + final arabic = RegExp(r'^[\u0621-\u064A]+'); + if (arabic.hasMatch(inputText)) { + isArabicText = true; + } else { + isArabicText = false; + } + + return isArabicText; + } + + static String getFreeSlotsTimeText(String startTime, {bool isAddHours = false}) { + // return DateFormat('hh:mm a', AppState().isArabic() ? "ar_SA" : "en_US").format(DateTime.tryParse(startTime)!.add( + // Duration( + // hours: isAddHours ? 3 : 0, + // ), + // )); + return !isAddHours + ? DateFormat('hh:mm a', AppState().isArabic() ? "ar_SA" : "en_US").format(DateTime.tryParse(startTime.contains("T") ? startTime : convertStringToDateTime(startTime))!.toLocal()) + : DateFormat('hh:mm a', AppState().isArabic() ? "ar_SA" : "en_US").format(DateTime.tryParse(startTime.contains("T") ? startTime : convertStringToDateTime(startTime))!.add( + Duration( + hours: isAddHours ? 3 : 0, + ), + )); + ; + } + + static String convertStringToDateTime(String dateTimeString) { + String timeString = dateTimeString; + // Parse the time string using DateFormat + DateFormat format = DateFormat.Hms(); // 'Hms' = 'HH:mm:ss' + DateTime time = format.parse(timeString); + + DateTime now = DateTime.now(); + DateTime dateTimeWithToday = DateTime( + now.year, + now.month, + now.day, + time.hour, + time.minute, + time.second, + ); + + return dateTimeWithToday.toIso8601String(); + } + + static String getMonthDayYearDateFormatted(DateTime dateTime) { + if (dateTime != null) + return AppState().isArabic() + ? getMonthArabic(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString() + : getMonth(dateTime.month) + " " + dateTime.day.toString() + ", " + dateTime.year.toString(); + else + return ""; + } + + /// get month by + /// [month] convert month number in to month name + static getMonth(int month) { + switch (month) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + } + } + + /// get month by + /// [month] convert month number in to month name in Arabic + static getMonthArabic(int month) { + switch (month) { + case 1: + return "يناير"; + case 2: + return " فبراير"; + case 3: + return "مارس"; + case 4: + return "أبريل"; + case 5: + return "مايو"; + case 6: + return "يونيو"; + case 7: + return "يوليو"; + case 8: + return "أغسطس"; + case 9: + return "سبتمبر"; + case 10: + return " اكتوبر"; + case 11: + return " نوفمبر"; + case 12: + return "ديسمبر"; + } + } + + static Future getStringFromPrefs(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getString(key) ?? ""; + } + + static Future saveStringFromPrefs(String key, String value) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return await prefs.setString(key, value); + } + + static Future getIntFromPrefs(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return prefs.getInt(key) ?? 0; + } + + static Future saveIntFromPrefs(String key, int value) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return await prefs.setInt(key, value); + } + + static Future getNumFromPrefs(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return num.parse(prefs.getString(key) ?? "0"); + } + + static Future saveNumFromPrefs(String key, num value) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return await prefs.setString(key, value.toString()); + } + + static Future removeFromPrefs(String key) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + return await prefs.remove(key); + } + + static void showLoading({bool isNeedBinding = true}) { + if (isNeedBinding) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showLoadingDialog(); + }); + } else { + showLoadingDialog(); + } + } + + static void showLoadingDialog() { + _isLoadingVisible = true; + showDialog( + context: navigatorKey.currentContext!, + barrierColor: Colors.black.withOpacity(0.5), + builder: (BuildContext context) => LoadingDialog(), + ) + .then((value) { + _isLoadingVisible = false; + }) + .catchError((e) {}) + .onError( + (error, stackTrace) {}, + ); + } + + static void hideLoading() { + try { + if (_isLoadingVisible) { + _isLoadingVisible = false; + Navigator.of(navigatorKey.currentContext!).pop(); + } + _isLoadingVisible = false; + } catch (e) {} + } + + static List uniqueBy(List list, K Function(T) keySelector) { + final seenKeys = {}; + return list.where((item) => seenKeys.add(keySelector(item))).toList(); + } + + static void showAppDialog(BuildContext context, String? title, String? message, VoidCallback? onTap) { + showDialog( + barrierDismissible: false, + context: context, + builder: (cxt) => ConfirmDialog( + title: title!, + message: message!, + onTap: onTap, + ), + ); + } + + static bool isSAUDIIDValid(String id, type) { + if (type == 1) { + if (id == null) { + return false; + } + try { + id = id.toString(); + id = id.trim(); + var returnValue = int.parse(id); + var sum = 0; + if (returnValue > 0) { + var type = int.parse(id[0]); + + if (id.length != 10) { + return false; + } + if (type != 2 && type != 1) { + return false; + } + + for (var i = 0; i < 10; i++) { + if (i % 2 == 0) { + var a = id[i]; + var x = int.parse(a) * 2; + var b = x.toString(); + if (b.length == 1) { + b = "0" + b; + } + sum += int.parse(b[0]) + int.parse(b[1]); + } else { + sum += int.parse(id[i]); + } + } + return sum % 10 == 0; + } + } catch (err) {} + return false; + } else { + return true; + } + } + + static Widget getNoDataWidget(BuildContext context, {String? errorText}) { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset('assets/images/NoDataAvailableIcon.svg', width: 150.0, height: 150.0), + (errorText ?? LocaleKeys.noDataAvailable.tr()).toText16(isCenter: true).paddingOnly(top: 15), + ], + ).center; + } + + static getPhoneNumberWithoutZero(String number) { + String newNumber = ""; + if (number.startsWith('0')) { + newNumber = number.substring(1); + } else { + newNumber = number; + } + return newNumber; + } + + static String removeHtmlTags(String htmlString) { + if (htmlString == null || htmlString.isEmpty) { + return ''; + } + + // Replace HTML line breaks with newlines + var withLineBreaks = + htmlString.replaceAll(RegExp(r'', multiLine: true), '\n').replaceAll(RegExp(r'<\/p>', multiLine: true), '\n').replaceAll(RegExp(r'', multiLine: true), '\n'); + + // Remove all other HTML tags + var withoutTags = withLineBreaks.replaceAll(RegExp(r'<[^>]*>'), ''); + + // Decode HTML entities + var decodedString = withoutTags + .replaceAll(' ', ' ') + .replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll(''', "'") + .replaceAll('’', "'") + .replaceAll('‘', "'") + .replaceAll('”', '"') + .replaceAll('“', '"'); + + // Remove extra whitespace and normalize line breaks + var normalizedString = decodedString + .replaceAll(RegExp(r'\n\s*\n'), '\n\n') // Replace multiple blank lines with double line break + .replaceAll(RegExp(r' +'), ' ') // Replace multiple spaces with single space + .trim(); // Remove leading/trailing whitespace + + return normalizedString; + } + + Widget mDivider(Color color) { + return Divider( + // width: double.infinity, + height: 1, + color: color, + ); + } +} diff --git a/lib/extensions/context_extensions.dart b/lib/extensions/context_extensions.dart new file mode 100644 index 0000000..5783ce3 --- /dev/null +++ b/lib/extensions/context_extensions.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +extension ContextUtils on BuildContext { + double get screenHeight => MediaQuery.of(this).size.height; + double get screenWidth => MediaQuery.of(this).size.width; + ThemeData get theme => Theme.of(this); + TextTheme get textTheme => theme.textTheme; + // TextStyle get headline1 => textTheme.headline1!; + // TextStyle get headline2 => textTheme.headline2!; + // TextStyle get headline3 => textTheme.headline3!; + // TextStyle get headline4 => textTheme.headline4!; + // TextStyle get headline5 => textTheme.headline5!; + // TextStyle get headline6 => textTheme.headline6!; + // TextStyle get bodyText1 => textTheme.bodyText1!; + // TextStyle get bodyText2 => textTheme.bodyText2!; +} diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart new file mode 100644 index 0000000..1cd461a --- /dev/null +++ b/lib/extensions/int_extensions.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +extension IntExtensions on int { + Widget get height => SizedBox(height: toDouble()); + + Widget get width => SizedBox(width: toDouble()); + + Widget get divider => Divider(height: toDouble(), thickness: toDouble(), color: buttonColor); + + Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble()); + + +} diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart new file mode 100644 index 0000000..43594c6 --- /dev/null +++ b/lib/extensions/string_extensions.dart @@ -0,0 +1,311 @@ +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:intl/intl.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:sizer/sizer.dart'; + +extension CapExtension on String { + String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + + String get allInCaps => this.toUpperCase(); + + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; +} + +extension EmailValidator on String { + Widget get toWidget => Text(this); + + Widget toText8({Color? color, bool isBold = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow}) => Text( + this, + maxLines: maxlines, + overflow: textOverflow, + style: TextStyle( + fontSize: 8.fSize, + fontStyle: fontStyle ?? FontStyle.normal, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + color: color ?? blackColor, + letterSpacing: 0.64, + ), + ); + + Widget toText10({Color? color, bool isBold = false, bool isUnderLine = false, int? maxlines, FontStyle? fontStyle, TextOverflow? textOverflow}) => Text( + this, + maxLines: maxlines, + overflow: textOverflow, + style: TextStyle( + fontSize: 10.fSize, + fontStyle: fontStyle ?? FontStyle.normal, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + color: color ?? blackColor, + letterSpacing: 0.64, + decoration: isUnderLine ? TextDecoration.underline : null, + decorationColor: color ?? blackColor), + ); + + Widget toText11({Color? color, FontWeight? weight, bool isUnderLine = false, bool isCenter = false, bool isBold = false, int maxLine = 0, double letterSpacing = 0.64}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + softWrap: true, + style: TextStyle( + fontSize: 11.fSize, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + color: color ?? blackColor, + letterSpacing: letterSpacing, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + style: TextStyle( + fontSize: 12.fSize, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + color: color ?? blackColor, + letterSpacing: 0.64, + decorationColor: isUnderLine ? blackColor : null, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + minFontSize: 8, + style: TextStyle( + fontSize: 12.fSize, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + color: color ?? blackColor, + letterSpacing: 0.64, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toTextAuto({ + Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int maxLine = 0, + double fontSize = 12, + double letterSpacing = 0.64, + double height = 1, + TextOverflow? textOverflow, + FontWeight? fontWeight, + }) => + AutoSizeText( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + minFontSize: 5, + overflow: textOverflow, + softWrap: true, + style: TextStyle( + fontSize: fontSize, + fontWeight: fontWeight ?? (isBold ? FontWeight.bold : FontWeight.normal), + color: color ?? blackColor, + letterSpacing: letterSpacing, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toText13({ + Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int maxLine = 0, + }) => + Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: (maxLine > 0) ? maxLine : null, + style: TextStyle( + fontSize: 13.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? blackColor, letterSpacing: 0.64, decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: maxlines, + style: TextStyle( + color: color ?? blackColor, + fontSize: 14.fSize, + letterSpacing: 0.64, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText15({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + maxLines: maxlines, + style: TextStyle( + color: color ?? blackColor, + fontSize: 15.fSize, + letterSpacing: 0.64, + fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), + decoration: isUnderLine ? TextDecoration.underline : null), + ); + + Widget toText16({ + Color? color, + bool isUnderLine = false, + bool isBold = false, + bool isCenter = false, + int? maxlines, + TextAlign? textAlign, + }) => + Text( + this, + maxLines: maxlines, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle( + color: color ?? blackColor, + fontSize: 16.fSize, + letterSpacing: 0.64, + fontWeight: isBold ? FontWeight.bold : FontWeight.normal, + decoration: isUnderLine ? TextDecoration.underline : null, + ), + ); + + Widget toText17({Color? color, bool isBold = false, bool isCenter = false}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(color: color ?? blackColor, fontSize: 17.fSize, letterSpacing: 0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + ); + + Widget toText18({Color? color, bool isBold = false, bool isCenter = false, int? maxlines}) => Text( + maxLines: maxlines, + textAlign: isCenter ? TextAlign.center : null, + this, + style: TextStyle(fontSize: 18.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? blackColor, letterSpacing: 0.64), + ); + + Widget toText19({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(fontSize: 19.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? blackColor, letterSpacing: 0.64), + ); + + Widget toText20({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(fontSize: 20.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? blackColor, letterSpacing: 0.64), + ); + + Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( + this, + maxLines: maxlines, + style: TextStyle(color: color ?? blackColor, fontSize: 21.fSize, letterSpacing: 0.64, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)), + ); + + Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(height: 1, color: color ?? blackColor, fontSize: 22.fSize, letterSpacing: 0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + ); + + Widget toText24({Color? color, bool isBold = false, bool isCenter = false}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(height: 23 / 24, color: color ?? blackColor, fontSize: 24.fSize, letterSpacing: 0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + ); + + Widget toText32({Color? color, bool isBold = false, bool isCenter = false}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + style: TextStyle(height: 32 / 32, color: color ?? blackColor, fontSize: 32.fSize, letterSpacing: 0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + ); + + Widget toText44({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(height: 32 / 32, color: color ?? blackColor, fontSize: 44.fSize, letterSpacing: 0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), + ); + + Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { + String upper = ""; + String lower = ""; + String heading = this; + if (heading.isNotEmpty) { + List data = heading.split(" "); + + if (data.length > 1) { + upper = data[0]; + data.removeAt(0); + lower = data.join(" "); + } else { + lower = data[0]; + } + } + if (upperHeading.isNotEmpty) { + upper = upperHeading; + } + if (lowerHeading.isNotEmpty) { + lower = lowerHeading; + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (upper.isNotEmpty) upper.toText12(), + lower.toText24(isBold: true), + ], + ); + } + + bool isValidEmail() { + return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this); + } + + String toFormattedDate() { + String date = this.split("T")[0]; + String time = this.split("T")[1]; + var dates = date.split("-"); + return "${dates[2]} ${getMonth(int.parse(dates[1]))} ${dates[0]} ${DateFormat('hh:mm a').format(DateFormat('hh:mm:ss').parse(time))}"; + } + + String getMonth(int month) { + switch (month) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + default: + return ""; + } + } + + String truncate(int max, {String suffix = ''}) { + try { + return length <= max ? this : '${substring(0, max - suffix.length)}$suffix'; + } catch (e) { + return this; + } + } +} diff --git a/lib/extensions/util_extensions.dart b/lib/extensions/util_extensions.dart new file mode 100644 index 0000000..49efca5 --- /dev/null +++ b/lib/extensions/util_extensions.dart @@ -0,0 +1,33 @@ +// import 'package:Dleelna/classes/enums.dart'; +// +// extension SelectedAuthMethodTypesService on AuthMethodTypes { +// int getTypeIdService() { +// switch (this) { +// case AuthMethodTypes.sms: +// return 1; +// case AuthMethodTypes.whatsApp: +// return 2; +// case AuthMethodTypes.fingerPrint: +// return 3; +// case AuthMethodTypes.faceID: +// return 4; +// case AuthMethodTypes.moreOptions: +// return 5; +// } +// } +// +// static getMethodsTypeService(int typeId) { +// switch (typeId) { +// case 1: +// return AuthMethodTypes.sms; +// case 2: +// return AuthMethodTypes.whatsApp; +// case 3: +// return AuthMethodTypes.fingerPrint; +// case 4: +// return AuthMethodTypes.faceID; +// case 5: +// return AuthMethodTypes.moreOptions; +// } +// } +// } diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart new file mode 100644 index 0000000..3899671 --- /dev/null +++ b/lib/extensions/widget_extensions.dart @@ -0,0 +1,151 @@ +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:shimmer/shimmer.dart'; +import 'package:sizer/sizer.dart'; + +extension WidgetExtensions on Widget { + Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this); + + Widget get expanded => Expanded(child: this); + + Widget get center => Center(child: this); + + Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this); + + Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this); + + Widget paddingSymmetrical(double horizontal, double vertical) => Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this); + + Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => + Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this); + + Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this); + + Widget toShimmer({bool isShow = true, bool isTransparent = false}) => isShow + ? Shimmer.fromColors( + baseColor: Color(0xffb9bebe), + highlightColor: Colors.white, + child: Container( + color: isTransparent ? Colors.transparent : Colors.white.withOpacity(0.3), + child: this, + ), + ) + : Container( + child: this, + ); + + Widget animatedSwither() => AnimatedSwitcher( + duration: const Duration(milliseconds: 500), + // transitionBuilder: (Widget child, Animation animation) { + // return ScaleTransition(scale: animation, child: child); + // }, + switchInCurve: Curves.linearToEaseOut, + switchOutCurve: Curves.linearToEaseOut, + child: this, + ); + + Widget objectContainerView({String title = "", String note = "", bool disablePadding = false, double radius = 15}) { + return Container( + padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(radius), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.15), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + alignment: Alignment.center, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (title.isNotEmpty) title.toText16(), + if (title.isNotEmpty) 12.height, + this, + if (note.isNotEmpty) note.toText11(), + ], + ), + ); + } + + Widget objectContainerBorderView( + {String title = "", String note = "", bool disablePadding = false, double radius = 20, Color? color, Color borderColor = buttonColor, bool disableWidth = false, bool isAlignment = false}) { + return Container( + padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(radius), + ), + color: color, + border: Border.all( + color: borderColor, + width: disableWidth ? 2 : 1, + ), + ), + alignment: isAlignment ? Alignment.center : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (title.isNotEmpty) title.toText16(), + if (title.isNotEmpty) 12.height, + this, + if (note.isNotEmpty) note.toText11(), + ], + ), + ); + } +} + +//Height Spacers in percentages +Widget heightSpacer02per() => SizedBox(height: 0.2.h); + +Widget heightSpacer04per() => SizedBox(height: 0.4.h); + +Widget heightSpacer06per() => SizedBox(height: 0.6.h); + +Widget heightSpacer08per() => SizedBox(height: 0.8.h); + +Widget heightSpacer1per() => SizedBox(height: 1.h); + +Widget heightSpacer2per() => SizedBox(height: 2.h); + +Widget heightSpacer3per() => SizedBox(height: 3.h); + +Widget heightSpacer4per() => SizedBox(height: 4.h); + +Widget heightSpacer5per() => SizedBox(height: 5.h); + +Widget heightSpacer8per() => SizedBox(height: 8.h); + +Widget heightSpacer10per() => SizedBox(height: 10.h); + +Widget heightSpacer15per() => SizedBox(height: 15.h); + +Widget heightSpacer20per() => SizedBox(height: 20.h); + +//Width Spacers in percentages +Widget widthSpacer02perc() => SizedBox(height: 0.2.w); + +Widget widthSpacer04perc() => SizedBox(height: 0.4.w); + +Widget widthSpacer06perc() => SizedBox(height: 0.6.w); + +Widget widthSpacer08per() => SizedBox(height: 0.8.w); + +Widget widthSpacer1per() => SizedBox(height: 1.w); + +Widget widthSpacer2per() => SizedBox(height: 2.w); + +Widget widthSpacer3per() => SizedBox(height: 3.w); + +Widget widthSpacer4per() => SizedBox(height: 4.w); + +Widget widthSpacer5per() => SizedBox(height: 5.w); diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..d1c53a0 --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,65 @@ +// Copyright 2022, the Chromium project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + // if (kIsWeb) { + // return web; + // } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + // case TargetPlatform.macOS: + // return macos; + // TODO(Lyokone): Remove when FlutterFire CLI updated + case TargetPlatform.windows: + return android; + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyDZDeWcBlRE3YfJWYt_DCiToVnANfaj8qg', + appId: '1:815750722565:android:62281cd3e5df4063', + messagingSenderId: '815750722565', + projectId: 'api-project-815750722565', + // databaseURL: + // 'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app', + storageBucket: 'api-project-815750722565.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyDiXnCO00li4V7Ioa2YZ_M4ECxRsu_P9tA', + appId: '1:815750722565:ios:328ec247a81a2ca23c186c', + messagingSenderId: '815750722565', + projectId: 'api-project-815750722565', + storageBucket: 'api-project-815750722565.appspot.com', + androidClientId: + '815750722565-m14h8mkosm7cnq6uh6rhqr54dn02d705.apps.googleusercontent.com', + iosClientId: + '815750722565-da8p56le8bd6apsbm9eft0jjl1rtpgkt.apps.googleusercontent.com', + iosBundleId: 'com.HMG.HMG-Smartphone', + ); +} diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart new file mode 100644 index 0000000..a5fd007 --- /dev/null +++ b/lib/generated/locale_keys.g.dart @@ -0,0 +1,14 @@ +// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart + +// ignore_for_file: constant_identifier_names + +abstract class LocaleKeys { + static const english = 'english'; + static const arabic = 'arabic'; + static const login = 'login'; + static const noDataAvailable = 'noDataAvailable'; + static const ok = 'ok'; + static const confirm = 'confirm'; + static const loadingText = 'loadingText'; + +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..b4ba1aa --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,79 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/routes/app_routes.dart'; +import 'package:hmg_patient_app_new/theme/app_theme.dart'; +import 'package:logger/logger.dart'; + +import 'firebase_options.dart'; + +var globalMessengerKey = GlobalKey(); +final navigatorKey = GlobalKey(); + +Logger logger = Logger( + printer: PrettyPrinter( + lineLength: 0, + ), +); + +late AppState appState; + +@pragma('vm:entry-point') +Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + print("Firebase backgroundMessageHandler Main!!!"); + // debugPrint('backgroundMessage: message => ${message.notification!.title.toString()}'); + // messagesOpended = message.notification!.title.toString(); + var payload = message.data; + // showCallkitIncoming(payload); + // await backgroundCallHandler(payload); +} + +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true; + } +} + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return SafeArea( + top: false, // Set to true if you want to avoid the notch area as well + bottom: Platform.isIOS ? false : true, + child: MaterialApp( + title: 'Dr. AlHabib', + builder: (context, mchild) { + return MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaler: TextScaler.linear(1.0), + ), //set desired text scale factor here + child: mchild!); + }, + showSemanticsDebugger: false, + debugShowCheckedModeBanner: false, + localizationsDelegates: context.localizationDelegates, + supportedLocales: context.supportedLocales, + locale: context.locale, + initialRoute: AppRoutes.initialRoute, + routes: AppRoutes.routes, + theme: AppTheme.getTheme( + EasyLocalization.of(context)?.locale.languageCode == "ar", + ), + navigatorKey: navigatorKey, + ), + ); + } +} diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart new file mode 100644 index 0000000..e5a934f --- /dev/null +++ b/lib/presentation/home/landing_page.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class LandingPage extends StatefulWidget { + const LandingPage({super.key}); + + @override + State createState() => _LandingPageState(); +} + +class _LandingPageState extends State { + @override + Widget build(BuildContext context) { + return const Placeholder(); + } +} diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart new file mode 100644 index 0000000..ce31fb7 --- /dev/null +++ b/lib/routes/app_routes.dart @@ -0,0 +1,8 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/splashPage.dart'; + +class AppRoutes { + static const String initialRoute = '/initialRoute'; + + static Map get routes => {initialRoute: (context) => SplashPage()}; +} diff --git a/lib/services/api_client.dart b/lib/services/api_client.dart new file mode 100644 index 0000000..4cab84d --- /dev/null +++ b/lib/services/api_client.dart @@ -0,0 +1,300 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:hmg_patient_app_new/services/api_exception.dart'; +import 'package:http/http.dart'; +import 'package:http/io_client.dart'; + +import '../core/app_state.dart'; +import '../core/consts.dart'; +import '../core/utils/utils.dart'; +import '../main.dart'; + +// ignore_for_file: avoid_annotating_with_dynamic + +typedef FactoryConstructor = U Function(dynamic); + +class APIError { + int? errorCode; + String? errorMessage; + + APIError(this.errorCode, this.errorMessage); + + Map toJson() => {'errorCode': errorCode, 'errorMessage': errorMessage}; + + @override + String toString() { + return jsonEncode(this); + } +} + +APIException _throwAPIException(Response response, Function retryCallBack) { + switch (response.statusCode) { + case 200: + APIError? apiError; + if (response.body != null && response.body.isNotEmpty) { + var jsonError = jsonDecode(response.body); + print(jsonError); + apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']); + } + return APIException(APIException.BAD_REQUEST, error: apiError); + case 400: + APIError? apiError; + if (response.body != null && response.body.isNotEmpty) { + var jsonError = jsonDecode(response.body); + apiError = APIError(jsonError['ErrorCode'], jsonError['ErrorMessage']); + } + return APIException(APIException.BAD_REQUEST, error: apiError); + case 401: + return APIException(APIException.UNAUTHORIZED); + case 403: + return APIException(APIException.FORBIDDEN); + case 404: + return APIException(APIException.NOT_FOUND); + case 500: + return APIException(APIException.INTERNAL_SERVER_ERROR); + case 444: + var downloadUrl = response.headers["location"]; + return APIException(APIException.UPGRADE_REQUIRED, arguments: downloadUrl); + default: + return APIException(APIException.OTHER); + } +} + +abstract class IApiClient { + Future postJsonForObject(FactoryConstructor factoryConstructor, String url, T jsonObject, + {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isFormData = false}); + + Future postJsonForResponse(String url, T jsonObject, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isFormData = false}); + + Future getJsonForResponse(String url, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0}); + + void setHomeUrl(String url); +} + +class ApiClient implements IApiClient { + // static final ApiClient _instance = ApiClient._internal(); + + // ApiClient._internal(); + + // factory ApiClient() => _instance; + + @override + Future postJsonForObject(FactoryConstructor factoryConstructor, String url, T jsonObject, + {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isFormData = false}) async { + var _headers = {'Accept': 'application/json'}; + if (headers != null && headers.isNotEmpty) { + _headers.addAll(headers); + } + if (!kReleaseMode) { + print("Url:$url"); + var bodyJson = json.encode(jsonObject); + print("body:$bodyJson"); + } + var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isFormData: isFormData); + // try { + if (!kReleaseMode) { + logger.i("res: " + response.body); + } + var jsonData = jsonDecode(response.body); + if (jsonData["IsAuthenticated"] != null) { + AppState().setIsAuthenticated = jsonData["IsAuthenticated"]; + } + if (jsonData["ErrorMessage"] == null) { + return factoryConstructor(jsonData); + } else { + APIError? apiError; + apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']); + throw APIException(APIException.BAD_REQUEST, error: apiError); + } + // } catch (ex) { + // if (ex is APIException) { + // rethrow; + // } else { + // throw APIException(APIException.BAD_RESPONSE_FORMAT, arguments: ex); + // } + // } + } + + @override + Future postJsonForResponse(String url, T jsonObject, + {String? token, + Map? queryParameters, + Map? headers, + int retryTimes = 0, + bool isFormData = false, + bool isAuthAPI = false, + bool isHISAPI = false, + bool isSanedAPI = false, + bool isPutRequest = false}) async { + String? requestBody; + late Map stringObj; + if (jsonObject != null) { + requestBody = jsonEncode(jsonObject); + if (headers == null) { + headers = {'Content-Type': 'application/json'}; + } else { + headers['Content-Type'] = 'application/json'; + } + } + + return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes); + } + + Future _postForResponse(String url, requestBody, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0}) async { + try { + var _headers = {}; + // if (token != null) { + // _headers['Authorization'] = 'Bearer $token'; + // } + + if (headers != null && headers.isNotEmpty) { + _headers.addAll(headers); + } + if (queryParameters != null) { + // var queryString = new Uri(queryParameters: queryParameters).query; + var queryString = Uri(queryParameters: queryParameters.map((key, value) => MapEntry(key, value == null ? null : value.toString()))).query; + url = url + '?' + queryString; + } + + // if (!kReleaseMode && url.contains("saned")) { + if (!kReleaseMode) { + print("Url: $url"); + print("Headers: $_headers"); + // var bodyJson = json.encode(requestBody); + print("body: $requestBody"); + } + + var response = await _post(Uri.parse(url), body: requestBody, headers: _headers).timeout(Duration(seconds: 120)); + + if (response.statusCode >= 200 && response.statusCode < 300) { + return response; + } else { + throw _throwAPIException(response, () { + // _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI); + postJsonForResponse(url, requestBody); + }); + } + } on SocketException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } on HttpException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } on TimeoutException catch (e) { + throw APIException(APIException.TIMEOUT, arguments: e); + } on ClientException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _postForResponse(url, requestBody, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } + } + + @override + Future getJsonForResponse(String url, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isAuthAPI = false}) async { + logger.i("Url:$url"); + if (headers == null) { + headers = {'Content-Type': 'application/json'}; + } else { + headers['Content-Type'] = 'application/json'; + } + return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes, isAuthAPI: isAuthAPI); + } + + Future _getForResponse(String url, {String? token, Map? queryParameters, Map? headers, int retryTimes = 0, bool isAuthAPI = false}) async { + try { + var _headers = {}; + if (token != null) { + _headers['Authorization'] = 'Bearer $token'; + } + + if (headers != null && headers.isNotEmpty) { + _headers.addAll(headers); + } + + if (isAuthAPI) { + String token = await Utils.getStringFromPrefs(SharedPrefsConsts.appAuthToken); + _headers['Authorization'] = "Bearer $token"; + } + + if (queryParameters != null) { + var queryString = new Uri(queryParameters: queryParameters).query; + url = url + '?' + queryString; + } + var response = await _get(Uri.parse(url), headers: _headers).timeout(Duration(seconds: 60)); + + if (response.statusCode >= 200 && response.statusCode < 300) { + return response; + } else { + throw _throwAPIException(response, () { + _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes); + }); + } + } on SocketException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } on HttpException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } on TimeoutException catch (e) { + throw APIException(APIException.TIMEOUT, arguments: e); + } on ClientException catch (e) { + if (retryTimes > 0) { + print('will retry after 3 seconds...'); + await Future.delayed(Duration(seconds: 3)); + return await _getForResponse(url, token: token, queryParameters: queryParameters, headers: headers, retryTimes: retryTimes - 1); + } else { + throw APIException(APIException.OTHER, arguments: e); + } + } + } + + Future _get(url, {Map? headers}) => _withClient((client) => client.get(url, headers: headers)); + + bool _certificateCheck(X509Certificate cert, String host, int port) => true; + + Future _withClient(Future Function(Client) fn) async { + var httpClient = HttpClient()..badCertificateCallback = _certificateCheck; + var client = IOClient(httpClient); + try { + return await fn(client); + } finally { + client.close(); + } + } + + Future _post(url, {Map? headers, body, Encoding? encoding}) => _withClient((client) => client.post(url, headers: headers, body: body, encoding: encoding)); + + Future _put(url, {Map? headers, body, Encoding? encoding}) => _withClient((client) => client.put(url, headers: headers, body: body, encoding: encoding)); + + @override + void setHomeUrl(String url) { + // TODO: implement setHomeUrl + } +} diff --git a/lib/services/api_exception.dart b/lib/services/api_exception.dart new file mode 100644 index 0000000..f0f1ff9 --- /dev/null +++ b/lib/services/api_exception.dart @@ -0,0 +1,29 @@ +import 'dart:convert'; + +import 'package:hmg_patient_app_new/services/api_client.dart'; + +class APIException implements Exception { + static const String BAD_REQUEST = 'api_common_bad_request'; + static const String UNAUTHORIZED = 'api_common_unauthorized'; + static const String FORBIDDEN = 'api_common_forbidden'; + static const String NOT_FOUND = 'api_common_not_found'; + static const String INTERNAL_SERVER_ERROR = 'api_common_internal_server_error'; + static const String UPGRADE_REQUIRED = 'api_common_upgrade_required'; + static const String BAD_RESPONSE_FORMAT = 'api_common_bad_response_format'; + static const String OTHER = 'api_common_http_error'; + static const String TIMEOUT = 'api_common_http_timeout'; + static const String UNKNOWN = 'unexpected_error'; + + final String message; + final APIError? error; + final arguments; + + const APIException(this.message, {this.arguments, this.error}); + + Map toJson() => {'message': message, 'error': error, 'arguments': '$arguments'}; + + @override + String toString() { + return jsonEncode(this); + } +} diff --git a/lib/splashPage.dart b/lib/splashPage.dart new file mode 100644 index 0000000..a90b3d7 --- /dev/null +++ b/lib/splashPage.dart @@ -0,0 +1,117 @@ +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart'; +import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; +import 'package:provider/provider.dart'; + +import 'core/utils/LocalNotification.dart'; +import 'core/utils/push-notification-handler.dart'; + +class SplashPage extends StatefulWidget { + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + @override + void initState() { + super.initState(); + print("Splash init called............."); + Timer(Duration(seconds: 1, milliseconds: 500), () async { + LocalNotification.init(onNotificationClick: (payload) {}); + Navigator.of(context).pushReplacement( + MaterialPageRoute( + builder: (BuildContext context) => LandingPage(), + ), + ); + // } else {} + }); + // }, + // ); + + var zoom = ZoomVideoSdk(); + InitConfig initConfig = InitConfig( + domain: "zoom.us", + enableLog: true, + ); + zoom.initSdk(initConfig); + + // AppSharedPreferences().getAll().then((value) { + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + // }); + } + + /// load the Privilege from service + Future loadPrivilege() async { + // ProjectViewModel projectProvider = Provider.of(context, listen: false); + // projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); + // projectProvider.setVidaPlusProjectList(_privilegeService.vidaPlusProjectListModel); + // projectProvider.setHMCProjectList(_privilegeService.hMCProjectListModel); + // projectProvider.setProjectsDetailList(_privilegeService.projectDetailListModel); + // double lat = await AppSharedPreferences().getDouble(USER_LAT) ?? 0.0; + // double long = await AppSharedPreferences().getDouble(USER_LONG) ?? 0.0; + // AppSharedPreferences().clear(); // Clearing Shared Preferences On App Launch + // await AppSharedPreferences().setDouble(USER_LAT, lat); + // await AppSharedPreferences().setDouble(USER_LONG, long); + // AppSharedPreferences().setString(APP_LANGUAGE, projectProvider.isArabic ? "ar" : "en"); + // var themeNotifier = Provider.of(context, listen: false); + // themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); + PushNotificationHandler().init(context); // Asyncronously + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xffF8F8F8), + body: Stack( + alignment: Alignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 53), + child: Image.asset( + 'assets/images/new/hmg_logo.png', + fit: BoxFit.fitWidth, + width: MediaQuery.of(context).size.width, + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Powered by", + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: Color(0xff333C45), letterSpacing: -0.56, height: 16 / 14), + ), + SizedBox( + height: 5, + ), + SvgPicture.asset( + 'assets/images/new/cloud_logo.svg', + width: 40, + height: 40, + ), + SizedBox( + height: 7, + ), + // Text( + // "Version 1.1.0", + // style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10), + // ), + SizedBox( + height: 18, + ) + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart new file mode 100644 index 0000000..2539e88 --- /dev/null +++ b/lib/theme/app_theme.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class AppTheme { + static ThemeData getTheme(isArabic) => ThemeData( + fontFamily: isArabic ? 'NotoSansArabic' : 'Jost', + primarySwatch: Colors.red, + visualDensity: VisualDensity.adaptivePlatformDensity, + brightness: Brightness.light, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: ZoomPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + hintColor: Colors.grey[400], + // colorScheme: ColorScheme.fromSwatch(accentColor: MyColors.backgroundColor), + disabledColor: Colors.grey[300], + // errorColor: const Colors, + // scaffoldBackgroundColor: MyColors.backgroundColor, + textSelectionTheme: const TextSelectionThemeData(cursorColor: Colors.grey, selectionColor: Color.fromRGBO(80, 100, 253, 0.5), selectionHandleColor: Colors.grey), + canvasColor: Colors.white, + // backgroundColor: const Color.fromRGBO(255, 255, 255, 1), + highlightColor: Colors.grey[100]!.withOpacity(0.4), + splashColor: Colors.transparent, + // primaryColor: primaryColor, + // primaryColorDark: primaryColor, + // toggleableActiveColor: secondaryColor, + // indicatorColor: secondaryColor, + bottomSheetTheme: const BottomSheetThemeData( + backgroundColor: Color(0xFFE0E0E0), + ), + // primaryTextTheme: const TextTheme( + // bodyText2: TextStyle(color: Colors.white), + // ), + // iconTheme: const IconThemeData(color: MyColors.darkTextColor), + // textTheme: const TextTheme( + // bodyText1: TextStyle(color: Colors.black, letterSpacing: 0.6), + // headline1: TextStyle(color: Colors.white, letterSpacing: 0.6), + // headline2: TextStyle(color: Colors.white, letterSpacing: 0.6), + // ), + floatingActionButtonTheme: const FloatingActionButtonThemeData(highlightElevation: 2, disabledElevation: 0, elevation: 2), + appBarTheme: AppBarTheme( + color: const Color(0xff515A5D), + elevation: 0.0, + actionsIconTheme: IconThemeData( + color: Colors.grey[800], + ), + systemOverlayStyle: SystemUiOverlayStyle.light, + ), + ); +} + +extension ExtendedRevoCheckTheme on TextTheme { + //add custom styles and colors here + //taken from https://medium.com/@crizantlai/flutter-how-to-extend-themedata-b5b987a95bb5 + TextStyle get price => const TextStyle(color: Colors.redAccent); +} diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart new file mode 100644 index 0000000..5296ada --- /dev/null +++ b/lib/theme/colors.dart @@ -0,0 +1,18 @@ +import 'package:flutter/material.dart'; + +const mainPurple = Color(0xFF7954F7); +const purpleBg = Color(0xFFAEA4FC); +const deepPurple = Color(0xFF7C65E7); +const logoColor = Color(0xFF7C65E7); +const buttonColor = Color(0xFF6A46F5); +const splashBgColor = Color(0xFF3C355D); +const whiteColor = Color(0xFFffffff); +const blackColor = Color(0xFF000000); +const lightGray = Color(0xFFF4F5F7); +const lightPurple = Color(0xFFB7A3E6); +const scaffoldBgColor = Color(0xFFF8F8F8); +const lightGreyEFColor = Color(0xffeaeaff); +const greyF7Color = Color(0xffF7F7F7); +const lightGrayColor = Color(0xff808080); +const buttonGrayColor = Color(0xffF1F1F1); +const lightPurpleAlpha = Color(0x5AB7A3E6); diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart new file mode 100644 index 0000000..9a7906d --- /dev/null +++ b/lib/widgets/app_bar_widget.dart @@ -0,0 +1,32 @@ +import 'package:hmg_patient_app_new/widgets/arrow_back.dart'; +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; + +AppBar AppBarWidget( + BuildContext context, { + required String title, + String? image, + bool isNeedLeading = true, + List? actions, + Function? onTap, + Color? backgroundColor, + Color? foregroundColor, + bool? isCenter, +}) { + return AppBar( + // leadingWidth: 0, + titleSpacing: -8, + leading: isNeedLeading + ? ArrowBack( + onTap: onTap, + color: foregroundColor ?? whiteColor, + ) + : Container(), + title: title.toText16(color: foregroundColor ?? whiteColor, isBold: true), + centerTitle: isCenter ?? true, + elevation: 0, + backgroundColor: backgroundColor ?? mainPurple, + actions: actions, + ); +} diff --git a/lib/widgets/arrow_back.dart b/lib/widgets/arrow_back.dart new file mode 100644 index 0000000..56d46e8 --- /dev/null +++ b/lib/widgets/arrow_back.dart @@ -0,0 +1,24 @@ +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:flutter/material.dart'; + +class ArrowBack extends StatelessWidget { + final Function? onTap; + final Color color; + + ArrowBack({Key? key, this.onTap, this.color = whiteColor}) : super(key: key); + + @override + Widget build(BuildContext context) { + // ProjectViewModel projectViewModel = Provider.of(context); + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: Feedback.wrapForTap(() { + onTap != null ? onTap!() : Navigator.maybePop(context); + }, context), + child: Icon( + Icons.arrow_back_ios, + color: color, + ), + ); + } +} diff --git a/lib/widgets/attachment_options.dart b/lib/widgets/attachment_options.dart new file mode 100644 index 0000000..7848bdd --- /dev/null +++ b/lib/widgets/attachment_options.dart @@ -0,0 +1,58 @@ +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/theme/colors.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class AttachmentOptions extends StatelessWidget { + VoidCallback onCameraTap; + VoidCallback onGalleryTap; + VoidCallback onFilesTap; + bool showFilesOption; + + AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap, this.showFilesOption = true}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Upload Attachment".toSectionHeading(), + "Select from gallery or open camera".toText11(weight: FontWeight.w500), + GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 9, mainAxisSpacing: 9), + physics: const NeverScrollableScrollPhysics(), + padding: const EdgeInsets.only(top: 21, bottom: 14), + shrinkWrap: true, + children: [ + itemView("open_camera.svg", "Open\nCamera", onCameraTap), + itemView("gallery.svg", "Upload from\nGallery", onGalleryTap), + if (showFilesOption) itemView("files.svg", "Upload from\nFiles", onFilesTap), + ], + ) + ], + ).paddingOnly(left: 21, right: 21, bottom: 21), + ); + } + + Widget itemView(String icon, String title, VoidCallback onTap) { + return InkWell( + onTap: onTap, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset("assets/images/$icon", color: mainPurple,), + title.toText11(isBold: true), + ], + ).paddingOnly(left: 13, right: 13, top: 16, bottom: 12).expanded.objectContainerBorderView( + disablePadding: true, + radius: 10, + color: greyF7Color.withOpacity(.48), + borderColor: lightGreyEFColor.withOpacity(.48), + ), + ); + } +} diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart new file mode 100644 index 0000000..4aef0ef --- /dev/null +++ b/lib/widgets/bottom_sheet.dart @@ -0,0 +1,89 @@ +import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; +import 'package:flutter/material.dart'; + +void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? type}) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (BuildContext context) { + return Container( + constraints: BoxConstraints( + maxHeight: type =='CONTINUE_ACTION' ? MediaQuery.of(context).size.height *.75 : double.infinity,), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topRight: Radius.circular(25), + topLeft: Radius.circular(25), + ), + ), + padding: MediaQuery.of(context).viewInsets, + clipBehavior: Clip.antiAlias, + child:SingleChildScrollView(child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + 13.height, + Container( + height: 6, + width: 60, + decoration: const BoxDecoration( + color: Color(0xff9A9A9A), + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + ), + ), + 8.height, + child, + ], + )), + ); + }, + ).then((value) { + // print("BACK FROM DELEGATE!!!!"); + // print("value: $value"); + if (value == "delegate_reload") { + callBackFunc(); + } + }); +} + +class BottomSheetItem extends StatelessWidget { + final Function onTap; + final IconData icon; + final String title; + final Color color; + + const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (onTap != null) { + Navigator.pop(context); + onTap(); + } + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: color, + size: 18.0, + ), + if (icon != null) SizedBox(width: 24.0), + Text( + title ?? "", + style: TextStyle(color: color), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/category_buttons.dart b/lib/widgets/category_buttons.dart new file mode 100644 index 0000000..331c2e0 --- /dev/null +++ b/lib/widgets/category_buttons.dart @@ -0,0 +1,34 @@ +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:flutter/material.dart'; + +import '../theme/colors.dart'; + +class CategoryButtons extends StatelessWidget { + CategoryButtons({super.key, required this.label, required this.selected, required this.onTap}); + + late String label; + late bool selected; + late Function onTap; + + @override + Widget build(BuildContext context) { + return Expanded( + child: InkWell( + onTap: () { + onTap(); + }, + child: Container( + height: 64.h, + decoration: BoxDecoration( + color: selected ? mainPurple : Colors.grey.shade200, + borderRadius: BorderRadius.circular(16), + ), + child: Center( + child: label.toText13(color: selected ? Colors.white : Colors.black, isBold: true), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/custom_dropdown.dart b/lib/widgets/custom_dropdown.dart new file mode 100644 index 0000000..b1234ef --- /dev/null +++ b/lib/widgets/custom_dropdown.dart @@ -0,0 +1,73 @@ +// Dropdown Field +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:flutter/material.dart'; + +import '../theme/colors.dart'; + +class DropdownField extends StatelessWidget { + late String hint; + late T? value; + late IconData? icon; + late List? items; + late ValueChanged? onChanged; + late bool isEnabled; + + final String keyName = "dropdown_field"; + + DropdownField({ + required this.hint, + this.value, + this.icon, + this.items, + this.onChanged, + this.isEnabled = true, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 54.h, + margin: const EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(horizontal: 16), + decoration: BoxDecoration( + color: const Color(0xFFF4F5F7), + borderRadius: BorderRadius.circular(13), + ), + child: Row( + children: [ + if (icon != null) Icon(icon, color: mainPurple), + if (icon != null) SizedBox(width: 8.h), + Expanded( + child: items != null + ? DropdownButton( + value: value, + isExpanded: true, + icon: const Icon(Icons.keyboard_arrow_down_rounded, color: mainPurple), + underline: const SizedBox(), + items: items! + .map( + (item) => DropdownMenuItem( + value: item, + child: item.toString().toText15(isBold: true), + ), + ) + .toList(), + hint: hint.toText15(color: Colors.black45), + onChanged: onChanged, + ) + : Text( + value?.toString() ?? hint, + style: TextStyle( + color: value != null ? Colors.black : Colors.black45, + fontWeight: value != null ? FontWeight.bold : FontWeight.normal, + fontSize: 15, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/default_button.dart b/lib/widgets/default_button.dart new file mode 100644 index 0000000..2b72762 --- /dev/null +++ b/lib/widgets/default_button.dart @@ -0,0 +1,133 @@ +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; + +extension WithContainer on Widget { + Widget get insideContainer => Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: this, + ); +} + +class DefaultButton extends StatelessWidget { + final String text; + final VoidCallback? onPress; + final Color textColor; + final Color? color; + final Color? disabledColor; + final IconData? iconData; + final String? svgIcon; + final double? fontSize; + final bool isTextExpanded; + final int count; + final List? colors; + final double height; + final double borderRadius; + + const DefaultButton(this.text, this.onPress, + {Key? key, + this.color, + this.isTextExpanded = true, + this.svgIcon, + this.disabledColor, + this.count = 0, + this.textColor = Colors.white, + this.iconData, + this.fontSize, + this.colors, + this.height = 50, + this.borderRadius = 100}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onPress, + child: Container( + height: height, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(borderRadius), + gradient: onPress == null + ? LinearGradient( + colors: [ + disabledColor ?? const Color(0xffEAEAEA), + disabledColor ?? const Color(0xffEAEAEA), + ], + ) + : LinearGradient( + transform: const GradientRotation(.83), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: colors ?? + [ + buttonColor, + buttonColor, + ], + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (iconData != null) Icon(iconData, color: textColor), + if (svgIcon != null) SvgPicture.asset(svgIcon ?? "", color: textColor), + if (!isTextExpanded) + Padding( + padding: EdgeInsets.only( + left: (iconData ?? svgIcon) != null ? 6 : 0, + ), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: fontSize ?? 18.fSize, + fontWeight: FontWeight.w600, + color: textColor, + letterSpacing: -0.48, + ), + ), + ), + if (isTextExpanded) + Expanded( + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: fontSize ?? 18.fSize, + fontWeight: FontWeight.w600, + color: textColor, + letterSpacing: -0.48, + ), + ), + ), + if (count > 0) + Align( + alignment: Alignment.topCenter, + child: Container( + margin: const EdgeInsets.only(top: 6, bottom: 6), + padding: const EdgeInsets.only(left: 5, right: 5), + alignment: Alignment.center, + height: 16, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: Colors.white, + ), + child: Text( + "$count", + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w700, + color: Color(0xffD02127), + letterSpacing: -0.6, + ), + ), + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart new file mode 100644 index 0000000..4ee8c38 --- /dev/null +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -0,0 +1,65 @@ +import 'package:easy_localization/easy_localization.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/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/widgets/default_button.dart'; +import 'package:flutter/material.dart'; + +import '../../theme/colors.dart'; + +class ConfirmDialog extends StatelessWidget { + final String? title; + final String message; + final String? okTitle; + final VoidCallback? onTap; + final VoidCallback? onCloseTap; + + const ConfirmDialog({Key? key, this.title, required this.message, this.okTitle, this.onTap, this.onCloseTap}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Dialog( + backgroundColor: Colors.white, + shape: const RoundedRectangleBorder(), + insetPadding: const EdgeInsets.only(left: 21, right: 21), + child: Padding( + padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + title ?? LocaleKeys.confirm.tr(), + style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: blackColor, height: 35 / 24, letterSpacing: -0.96), + ).paddingOnly(top: 16), + ), + IconButton( + padding: EdgeInsets.zero, + icon: const Icon(Icons.close), + color: blackColor, + constraints: const BoxConstraints(), + onPressed: () => onCloseTap ?? Navigator.pop(context), + // onPressed: () => Navigator.pop(context), + ) + ], + ), + 14.height, + message.toText16(color: lightGrayColor), + 28.height, + DefaultButton( + okTitle ?? LocaleKeys.ok.tr(), + onTap ?? () => Navigator.pop(context), + textColor: Colors.white, + //color: Ap.green, + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/image_picker.dart b/lib/widgets/image_picker.dart new file mode 100644 index 0000000..fa9f44b --- /dev/null +++ b/lib/widgets/image_picker.dart @@ -0,0 +1,214 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/attachment_options.dart'; +import 'package:hmg_patient_app_new/widgets/bottom_sheet.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; + +final ImagePicker picker = ImagePicker(); + +class ImageOptions { + static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) { + showMyBottomSheet( + context, + callBackFunc: () {}, + child: AttachmentOptions( + showFilesOption: showFilesOption, + onCameraTap: () async { + if (Platform.isAndroid) { + cameraImageAndroid(image); + } else { + File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 20))?.path ?? ""); + // XFile? media = await picker.pickMedia(); + String? fileName = _image.path; + var bytes = File(fileName!).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } + } + }, + onGalleryTap: () async { + if (Platform.isAndroid) { + galleryImageAndroid(image); + } else { + File _image = File((await picker.pickMedia())?.path ?? ""); + String fileName = _image.path; + var bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } + } + }, + onFilesTap: () async { + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: [ + 'jpg', + 'jpeg ', + 'pdf', + 'txt', + 'docx', + 'doc', + 'pptx', + 'xlsx', + 'png', + 'rar', + 'zip', + ], + ); + List files = result!.paths.map((path) => File(path!)).toList(); + image(result.files.first.path.toString(), files.first); + }, + ), + ); + } + +// static void showImageOptions(BuildContext context, Function(String, File) image) { +// showModalBottomSheet( +// backgroundColor: Colors.transparent, +// context: context, +// builder: (BuildContext bc) { +// return _BottomSheet( +// children: [ +// _BottomSheetItem( +// title: "Select File Source", +// onTap: () {}, +// icon: Icons.file_present, +// color: MyColors.black, +// ), +// _BottomSheetItem( +// title: "Gallery", +// icon: Icons.image, +// onTap: () async { +// if (Platform.isAndroid) { +// galleryImageAndroid(image); +// } else { +// File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 10))?.path ?? ""); +// String fileName = _image.path; +// var bytes = File(fileName).readAsBytesSync(); +// String base64Encode = base64.encode(bytes); +// if (base64Encode != null) { +// image(base64Encode, _image); +// } +// } +// }, +// ), +// _BottomSheetItem( +// title: "Camera", +// icon: Icons.camera_alt, +// onTap: () async { +// if (Platform.isAndroid) { +// cameraImageAndroid(image); +// } else { +// File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.camera, imageQuality: 10))?.path ?? ""); +// String fileName = _image.path; +// var bytes = File(fileName).readAsBytesSync(); +// String base64Encode = base64.encode(bytes); +// if (base64Encode != null) { +// image(base64Encode, _image); +// } +// } +// }, +// ), +// _BottomSheetItem( +// title: "Cancel", +// onTap: () {}, +// icon: Icons.cancel, +// color: MyColors.redColor, +// ) +// ], +// ); +// }); +// } +} + +void galleryImageAndroid(Function(String, File) image) async { + File _image = File((await picker.pickMedia())?.path ?? ""); + + String fileName = _image.path; + var bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } +} + +void cameraImageAndroid(Function(String, File) image) async { + File _image = File((await picker.pickMedia())?.path ?? ""); + String fileName = _image.path; + var bytes = File(fileName).readAsBytesSync(); + String base64Encode = base64.encode(bytes); + if (base64Encode != null) { + image(base64Encode, _image); + } +} + +class _BottomSheet extends StatelessWidget { + final List children; + + const _BottomSheet({Key? key, required this.children}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(vertical: 12.0), + decoration: BoxDecoration(color: Theme.of(context).scaffoldBackgroundColor, borderRadius: const BorderRadius.only(topLeft: Radius.circular(16.0), topRight: Radius.circular(16.0))), + child: SafeArea( + top: false, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + decoration: BoxDecoration(color: Theme.of(context).dividerColor, borderRadius: BorderRadius.circular(3.0)), + width: 40.0, + height: 6.0, + ), + ...children + ], + ), + ), + ); + } +} + +class _BottomSheetItem extends StatelessWidget { + final Function onTap; + final IconData icon; + final String title; + final Color color; + + _BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = mainPurple}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (onTap != null) { + Navigator.pop(context); + onTap(); + } + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: color, + size: 18.0, + ), + if (icon != null) const SizedBox(width: 24.0), + title.toText17(), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart new file mode 100644 index 0000000..9b200b0 --- /dev/null +++ b/lib/widgets/input_widget.dart @@ -0,0 +1,164 @@ +import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +// import 'package:sizer/sizer.dart'; + +class CustomTextField extends StatefulWidget { + final String labelText; + final String? hintText; + final TextEditingController controller; + final VoidCallback? suffixTap; + final IconData? suffixIcon; + final bool isEnable; + final bool hasSelection; + final int? lines; + final bool isInputTypeNum; + final bool isTextIsPassword; + final bool isBackgroundEnable; + final bool isEnableBorder; + final double verticalPadding; + final double horizontalPadding; + final Function(String)? onChange; + final Function()? onEditComplete; + final Function(String)? onSubmit; + final Function? onClick; + final FocusNode? focusNode; + List? inputFormatters; + + CustomTextField( + this.labelText, + this.controller, { + Key? key, + this.isTextIsPassword = false, + this.suffixTap, + this.suffixIcon, + this.hintText, + this.isEnable = true, + this.hasSelection = false, + this.isEnableBorder = true, + this.lines = 1, + this.onChange, + this.onEditComplete, + this.onSubmit, + this.onClick, + this.isInputTypeNum = false, + this.isBackgroundEnable = false, + this.focusNode, + this.verticalPadding = 15, + this.horizontalPadding = 16, + this.inputFormatters, + }) : super(key: key); + + @override + CustomTextFieldState createState() => CustomTextFieldState(); +} + +class CustomTextFieldState extends State { + late bool isObscureText; + late FocusNode focusNode; + + @override + void initState() { + super.initState(); + focusNode = FocusNode(); + isObscureText = widget.isTextIsPassword; + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + focusNode.requestFocus(); + if (widget.hasSelection) widget.onClick!(); + }, + child: Container( + padding: EdgeInsets.only(left: widget.horizontalPadding, right: widget.horizontalPadding, bottom: widget.verticalPadding, top: widget.verticalPadding), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: widget.isBackgroundEnable ? const Color(0xffF7F7F7) : Colors.white, + border: Border.all(color: widget.isEnableBorder ? Colors.grey.shade300 : Colors.transparent, width: 1), + ), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + widget.labelText, + style: TextStyle( + fontSize: 12.h, + fontWeight: FontWeight.w600, + color: const Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + focusNode: focusNode, + autofocus: false, + enabled: widget.isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: widget.isInputTypeNum ? TextInputType.number : TextInputType.text, + controller: widget.controller, + maxLines: widget.lines, + obscuringCharacter: "*", + obscureText: isObscureText, + onChanged: widget.onChange, + onEditingComplete: widget.onEditComplete, + onSubmitted: widget.onSubmit, + inputFormatters: widget.inputFormatters, + style: const TextStyle( + fontSize: 16, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: widget.hintText, + hintStyle: const TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + suffixIconConstraints: const BoxConstraints(minWidth: 50), + suffixIcon: widget.suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: blackColor), onPressed: widget.suffixTap), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (widget.isTextIsPassword) ...[ + 16.width, + Icon(isObscureText ? Icons.visibility_rounded : Icons.visibility_off_rounded).onPress(() { + setState(() { + isObscureText = !isObscureText; + }); + }) + ], + if (widget.hasSelection) const Icon(Icons.keyboard_arrow_down_outlined), + if (widget.suffixIcon != null && widget.suffixTap == null) Icon(widget.suffixIcon!), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/loading_dialog.dart b/lib/widgets/loading_dialog.dart new file mode 100644 index 0000000..b2ea410 --- /dev/null +++ b/lib/widgets/loading_dialog.dart @@ -0,0 +1,66 @@ +import 'package:easy_localization/easy_localization.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/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:lottie/lottie.dart'; + +class LoadingDialog extends StatefulWidget { + LoadingDialog({Key? key}) : super(key: key); + + @override + _LoadingDialogState createState() { + return _LoadingDialogState(); + } +} + +class _LoadingDialogState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Dialog( + insetPadding: const EdgeInsets.symmetric(horizontal: 60.0, vertical: 24.0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + elevation: 0, + backgroundColor: whiteColor, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Center( + child: Padding( + padding: const EdgeInsets.all(24.0), + child: Column( + children: [ + Lottie.asset('assets/json/loading_animation.json', repeat: true, reverse: false, frameRate: FrameRate(60)), + 24.height, + LocaleKeys.loadingText.tr(context: context).toText16(color: blackColor) + ], + ), + ), + // Image.asset( + // "assets/images/loading.gif", + // height: 96.0, + // width: 96.0, + // ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/otp_widget.dart b/lib/widgets/otp_widget.dart new file mode 100644 index 0000000..d606090 --- /dev/null +++ b/lib/widgets/otp_widget.dart @@ -0,0 +1,377 @@ +import 'dart:async'; + +import 'package:flutter/animation.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/services.dart'; + +typedef OnDone = void Function(String text); + +class ProvidedPinBoxTextAnimation { + static AnimatedSwitcherTransitionBuilder scalingTransition = (child, animation) { + return ScaleTransition( + child: child, + scale: animation, + ); + }; + + static AnimatedSwitcherTransitionBuilder defaultNoTransition = (Widget child, Animation animation) { + return child; + }; +} + +class OTPWidget extends StatefulWidget { + final int maxLength; + late TextEditingController? controller; + + final Color defaultBorderColor; + final Color pinBoxColor; + final double pinBoxBorderWidth; + final double pinBoxRadius; + final bool hideDefaultKeyboard; + + final TextStyle? pinTextStyle; + final double pinBoxHeight; + final double pinBoxWidth; + final OnDone? onDone; + final bool hasError; + final Color errorBorderColor; + final Color textBorderColor; + final Function(String)? onTextChanged; + final bool autoFocus; + final FocusNode? focusNode; + final AnimatedSwitcherTransitionBuilder? pinTextAnimatedSwitcherTransition; + final Duration pinTextAnimatedSwitcherDuration; + final TextDirection textDirection; + final TextInputType keyboardType; + final EdgeInsets pinBoxOuterPadding; + + OTPWidget({ + Key? key, + this.maxLength = 4, + this.controller, + this.pinBoxWidth = 70.0, + this.pinBoxHeight = 70.0, + this.pinTextStyle, + this.onDone, + this.defaultBorderColor = Colors.black, + this.textBorderColor = Colors.black, + this.pinTextAnimatedSwitcherTransition, + this.pinTextAnimatedSwitcherDuration = const Duration(), + this.hasError = false, + this.errorBorderColor = Colors.red, + this.onTextChanged, + this.autoFocus = false, + this.focusNode, + this.textDirection = TextDirection.ltr, + this.keyboardType = TextInputType.number, + this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0), + this.pinBoxColor = Colors.white, + this.pinBoxBorderWidth = 2.0, + this.pinBoxRadius = 0, + this.hideDefaultKeyboard = false, + }) : super(key: key); + + @override + State createState() { + return OTPWidgetState(); + } +} + +class OTPWidgetState extends State with SingleTickerProviderStateMixin { + late AnimationController _highlightAnimationController; + late FocusNode focusNode; + String text = ""; + int currentIndex = 0; + List strList = []; + bool hasFocus = false; + + @override + void didUpdateWidget(OTPWidget oldWidget) { + super.didUpdateWidget(oldWidget); + focusNode = widget.focusNode ?? focusNode; + + if (oldWidget.maxLength < widget.maxLength) { + setState(() { + currentIndex = text.length; + }); + widget.controller?.text = text; + widget.controller?.selection = TextSelection.collapsed(offset: text.length); + } else if (oldWidget.maxLength > widget.maxLength && widget.maxLength > 0 && text.length > 0 && text.length > widget.maxLength) { + setState(() { + text = text.substring(0, widget.maxLength); + currentIndex = text.length; + }); + widget.controller?.text = text; + widget.controller?.selection = TextSelection.collapsed(offset: text.length); + } + } + + _calculateStrList() { + if (strList.length > widget.maxLength) { + strList.length = widget.maxLength; + } + while (strList.length < widget.maxLength) { + strList.add(""); + } + } + + @override + void initState() { + super.initState(); + focusNode = widget.focusNode ?? FocusNode(); + _highlightAnimationController = AnimationController(vsync: this); + _initTextController(); + _calculateStrList(); + widget.controller!.addListener(_controllerListener); + focusNode.addListener(_focusListener); + } + + void _controllerListener() { + if (mounted == true) { + setState(() { + _initTextController(); + }); + var onTextChanged = widget.onTextChanged; + if (onTextChanged != null) { + onTextChanged(widget.controller?.text ?? ""); + } + } + } + + void _focusListener() { + if (mounted == true) { + setState(() { + hasFocus = focusNode?.hasFocus ?? false; + }); + } + } + + void _initTextController() { + if (widget.controller == null) { + return; + } + strList.clear(); + var text = widget.controller?.text ?? ""; + if (text.isNotEmpty) { + if (text.length > widget.maxLength) { + throw Exception("TextEditingController length exceeded maxLength!"); + } + } + for (var i = 0; i < text.length; i++) { + strList.add(text[i]); + } + } + + double get _width { + var width = 0.0; + for (var i = 0; i < widget.maxLength; i++) { + width += widget.pinBoxWidth; + if (i == 0) { + width += widget.pinBoxOuterPadding.left; + } else if (i + 1 == widget.maxLength) { + width += widget.pinBoxOuterPadding.right; + } else { + width += widget.pinBoxOuterPadding.left; + } + } + return width; + } + + @override + void dispose() { + if (widget.focusNode == null) { + focusNode.dispose(); + } else { + focusNode.removeListener(_focusListener); + } + _highlightAnimationController.dispose(); + widget.controller?.removeListener(_controllerListener); + + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + _otpTextInput(), + _touchPinBoxRow(), + ], + ); + } + + Widget _touchPinBoxRow() { + return widget.hideDefaultKeyboard + ? _pinBoxRow(context) + : GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (hasFocus) { + FocusScope.of(context).requestFocus(FocusNode()); + Future.delayed(Duration(milliseconds: 100), () { + FocusScope.of(context).requestFocus(focusNode); + }); + } else { + FocusScope.of(context).requestFocus(focusNode); + } + }, + child: _pinBoxRow(context), + ); + } + + Widget _otpTextInput() { + var transparentBorder = OutlineInputBorder( + borderSide: BorderSide( + color: Colors.transparent, + width: 0.0, + ), + ); + return Container( + width: _width, + height: widget.pinBoxHeight, + child: TextField( + autofocus: !kIsWeb ? widget.autoFocus : false, + enableInteractiveSelection: false, + focusNode: focusNode, + controller: widget.controller, + keyboardType: widget.keyboardType, + inputFormatters: widget.keyboardType == TextInputType.number ? [FilteringTextInputFormatter.digitsOnly] : null, + style: TextStyle( + height: 0.1, + color: Colors.transparent, + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.all(0), + focusedErrorBorder: transparentBorder, + errorBorder: transparentBorder, + disabledBorder: transparentBorder, + enabledBorder: transparentBorder, + focusedBorder: transparentBorder, + counterText: null, + counterStyle: null, + helperStyle: TextStyle( + height: 0.0, + color: Colors.transparent, + ), + labelStyle: TextStyle(height: 0.1), + fillColor: Colors.transparent, + border: InputBorder.none, + ), + cursorColor: Colors.transparent, + showCursor: false, + maxLength: widget.maxLength, + onChanged: _onTextChanged, + ), + ); + } + + void _onTextChanged(text) { + var onTextChanged = widget.onTextChanged; + if (onTextChanged != null) { + onTextChanged(text); + } + setState(() { + this.text = text; + if (text.length >= currentIndex) { + for (int i = currentIndex; i < text.length; i++) { + strList[i] = text[i]; + } + } + currentIndex = text.length; + }); + if (text.length == widget.maxLength) { + FocusScope.of(context).requestFocus(FocusNode()); + var onDone = widget.onDone; + if (onDone != null) { + onDone(text); + } + } + } + + Widget _pinBoxRow(BuildContext context) { + _calculateStrList(); + List pinCodes = List.generate(widget.maxLength, (int i) { + return _buildPinCode(i, context); + }); + return Row( + children: pinCodes, + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + ); + } + + Widget _buildPinCode(int i, BuildContext context) { + Color borderColor; + Color pinBoxColor = widget.pinBoxColor; + + if (widget.hasError) { + borderColor = widget.errorBorderColor; + } else if (i < text.length) { + borderColor = widget.textBorderColor; + } else { + borderColor = widget.defaultBorderColor; + pinBoxColor = widget.pinBoxColor; + } + + EdgeInsets insets; + if (i == 0) { + insets = EdgeInsets.only( + left: 0, + top: widget.pinBoxOuterPadding.top, + right: widget.pinBoxOuterPadding.right, + bottom: widget.pinBoxOuterPadding.bottom, + ); + } else if (i == strList.length - 1) { + insets = EdgeInsets.only( + left: widget.pinBoxOuterPadding.left, + top: widget.pinBoxOuterPadding.top, + right: 0, + bottom: widget.pinBoxOuterPadding.bottom, + ); + } else { + insets = widget.pinBoxOuterPadding; + } + return Container( + key: ValueKey("container$i"), + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 4.0, horizontal: 1.0), + margin: insets, + child: _animatedTextBox(strList[i], i), + decoration: BoxDecoration( + border: Border.all( + color: borderColor, + width: widget.pinBoxBorderWidth, + ), + color: pinBoxColor, + borderRadius: BorderRadius.circular(widget.pinBoxRadius), + ), + width: widget.pinBoxWidth, + height: widget.pinBoxHeight, + ); + } + + Widget _animatedTextBox(String text, int i) { + if (widget.pinTextAnimatedSwitcherTransition != null) { + return AnimatedSwitcher( + duration: widget.pinTextAnimatedSwitcherDuration, + transitionBuilder: widget.pinTextAnimatedSwitcherTransition ?? + (Widget child, Animation animation) { + return child; + }, + child: Text( + text, + key: ValueKey("$text$i"), + style: widget.pinTextStyle, + ), + ); + } else { + return Text( + text, + key: ValueKey("${strList[i]}$i"), + style: widget.pinTextStyle, + ); + } + } +} diff --git a/lib/widgets/phone_number_input.dart b/lib/widgets/phone_number_input.dart new file mode 100644 index 0000000..3266998 --- /dev/null +++ b/lib/widgets/phone_number_input.dart @@ -0,0 +1,115 @@ +import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class PhoneNumberInput extends StatefulWidget { + final void Function(String fullNumber)? onChanged; + final TextEditingController textController; + + const PhoneNumberInput({Key? key, this.onChanged, required this.textController}) : super(key: key); + + @override + State createState() => _PhoneNumberInputState(); +} + +class _PhoneNumberInputState extends State { + String _selectedCountryCode = '+966'; + final List _countryCodes = ['+966', '+971', '+1', '+44', '+91']; + + void _onCountryCodeChanged(String? code) { + if (code != null) { + setState(() { + _selectedCountryCode = code; + }); + _notifyChanged(); + } + } + + void _onPhoneChanged(String value) { + _notifyChanged(); + } + + void _notifyChanged() { + if (widget.onChanged != null) { + widget.onChanged!( + '$_selectedCountryCode${widget.textController.text}', + ); + } + } + + @override + void dispose() { + widget.textController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + decoration: BoxDecoration( + color: const Color(0xFFF4F5F7), + borderRadius: BorderRadius.circular(16), + ), + child: Row( + children: [ + // Country Code Dropdown + DropdownButtonHideUnderline( + child: DropdownButton( + value: _selectedCountryCode, + items: _countryCodes + .map( + (code) => DropdownMenuItem( + value: code, + child: code.toText16(color: mainPurple, isBold: true), + ), + ) + .toList(), + onChanged: _onCountryCodeChanged, + icon: const Icon( + Icons.keyboard_arrow_down_rounded, + color: mainPurple, + ), + ), + ), + const SizedBox(width: 8), + // Phone number input + Expanded( + child: TextField( + onTapOutside: (event) { + FocusScope.of(context).unfocus(); + }, + controller: widget.textController, + keyboardType: TextInputType.number, + textInputAction: TextInputAction.done, + maxLength: 10, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d*$')), + ], + decoration: const InputDecoration( + counterStyle: TextStyle( + height: double.minPositive, + ), + counterText: "", + hintText: '5xxxxxxxx', + border: InputBorder.none, + hintStyle: TextStyle( + color: Colors.black38, + letterSpacing: 2, + ), + ), + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + letterSpacing: 2, + color: Colors.black, + ), + onChanged: _onPhoneChanged, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/shimmer/dashboard_shimmer_widget.dart b/lib/widgets/shimmer/dashboard_shimmer_widget.dart new file mode 100644 index 0000000..ddb8253 --- /dev/null +++ b/lib/widgets/shimmer/dashboard_shimmer_widget.dart @@ -0,0 +1,256 @@ +// import 'package:easy_localization/src/public_ext.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_svg/svg.dart'; +// import 'package:MyCity/extensions/int_extensions.dart'; +// import 'package:MyCity/extensions/string_extensions.dart'; +// import 'package:MyCity/extensions/widget_extensions.dart'; +// +// import 'package:shimmer/shimmer.dart'; +// +// class GetAttendanceTrackingShimmer extends StatelessWidget { +// @override +// Widget build(BuildContext context) { +// return Container( +// width: double.infinity, +// height: double.infinity, +// clipBehavior: Clip.antiAlias, +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(15), +// boxShadow: [ +// BoxShadow( +// color: const Color(0xff000000).withOpacity(.05), +// blurRadius: 26, +// offset: const Offset(0, -3), +// ), +// ], +// ), +// child: Stack( +// alignment: Alignment.center, +// children: [ +// // SvgPicture.asset("assets/images/"), +// Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Expanded( +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true).toShimmer(), +// 16.height, +// "07:55:12".toText10(color: Colors.white, isBold: true).toShimmer(), +// 3.height, +// LocaleKeys.timeLeftToday.tr().toText10(color: Colors.white).toShimmer(), +// 9.height, +// const ClipRRect( +// borderRadius: BorderRadius.all( +// Radius.circular(20), +// ), +// child: LinearProgressIndicator( +// value: 0.7, +// minHeight: 8, +// valueColor: const AlwaysStoppedAnimation(Colors.white), +// backgroundColor: const Color(0xff196D73), +// ), +// ).toShimmer(), +// ], +// ).paddingOnly(top: 12, right: 15, left: 12), +// ), +// Row( +// children: [ +// Expanded( +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.checkIn.tr().toText12(color: Colors.white).toShimmer(), +// ], +// ).paddingOnly(left: 12), +// ), +// Container( +// width: 45, +// height: 45, +// // color: Colors.blue, +// padding: const EdgeInsets.only(left: 14, right: 14), +// ).toShimmer(), +// ], +// ), +// ], +// ), +// ], +// ), +// ); +// } +// } +// +// class MenuShimmer extends StatelessWidget { +// @override +// Widget build(BuildContext context) { +// return Container( +// clipBehavior: Clip.antiAlias, +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(15), +// boxShadow: [ +// BoxShadow( +// color: const Color(0xff000000).withOpacity(.05), +// blurRadius: 26, +// offset: const Offset(0, -3), +// ), +// ], +// ), +// child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.workList.tr().toText12(color: Colors.white).toShimmer(), +// Row( +// children: [ +// Expanded( +// flex: 3, +// child: 123.toString().toText10(color: Colors.white, isBold: true).toShimmer(), +// ), +// 12.width, +// SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white).toShimmer() +// ], +// ) +// ], +// ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), +// ); +// } +// } +// +// class ServicesHeaderShimmer extends StatelessWidget { +// @override +// Widget build(BuildContext context) { +// return Row( +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Expanded( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisSize: MainAxisSize.min, +// children: [ +// "Other".tr().toText10().toShimmer(), +// 6.height, +// LocaleKeys.services.tr().toText12(isBold: true).toShimmer(), +// ], +// ), +// ), +// LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true).toShimmer(), +// ], +// ); +// } +// } +// +// class ServicesMenuShimmer extends StatelessWidget { +// @override +// Widget build(BuildContext context) { +// return Container( +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(15), +// boxShadow: [ +// BoxShadow( +// color: const Color(0xff000000).withOpacity(.05), +// blurRadius: 26, +// offset: const Offset(0, -3), +// ), +// ], +// ), +// child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// SvgPicture.asset("assets/images/monthly_attendance.svg").toShimmer(), +// Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.start, +// children: [ +// "Attendan".toText11(isBold: false).toShimmer(), +// 5.height, +// Row( +// crossAxisAlignment: CrossAxisAlignment.end, +// children: [ +// Expanded( +// child: LocaleKeys.attendance.tr().toText11(isBold: false).toShimmer(), +// ), +// 6.width, +// SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4).toShimmer() +// ], +// ), +// ], +// ) +// ], +// ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), +// ); +// } +// } +// +// class ChatHomeShimmer extends StatelessWidget { +// @override +// Widget build(BuildContext context) { +// return Container( +// width: double.infinity, +// padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0), +// child: Column( +// mainAxisSize: MainAxisSize.max, +// children: [ +// Expanded( +// child: Shimmer.fromColors( +// baseColor: Colors.white, +// highlightColor: Colors.grey.shade100, +// child: ListView.builder( +// itemBuilder: (_, __) => Padding( +// padding: const EdgeInsets.only(bottom: 8.0), +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// width: 48.0, +// height: 48.0, +// decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(40))), +// ), +// const Padding( +// padding: EdgeInsets.symmetric(horizontal: 8.0), +// ), +// Expanded( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Container( +// width: double.infinity, +// height: 8.0, +// color: Colors.white, +// ), +// const Padding( +// padding: EdgeInsets.symmetric(vertical: 2.0), +// ), +// Container( +// width: double.infinity, +// height: 8.0, +// color: Colors.white, +// ), +// const Padding( +// padding: EdgeInsets.symmetric(vertical: 2.0), +// ), +// Container( +// width: 40.0, +// height: 8.0, +// color: Colors.white, +// ), +// ], +// ), +// ) +// ], +// ), +// ), +// itemCount: 6, +// ), +// ), +// ), +// ], +// )); +// } +// } diff --git a/lib/widgets/shimmer/movies_shimmer_widget.dart b/lib/widgets/shimmer/movies_shimmer_widget.dart new file mode 100644 index 0000000..378f0d8 --- /dev/null +++ b/lib/widgets/shimmer/movies_shimmer_widget.dart @@ -0,0 +1,43 @@ +import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:flutter/material.dart'; + +class MoviesShimmerWidget extends StatelessWidget { + const MoviesShimmerWidget({super.key}); + + @override + Widget build(BuildContext context) { + return SizedBox( + child: Container( + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(10), + ), + border: Border.all(color: lightGreyEFColor, width: 1), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + children: [ + Container(height: 100).toShimmer(), + 16.height, + Container(height: 24).toShimmer(), + 16.height, + Container(height: 48).toShimmer(), + 16.height, + Container(height: 24).toShimmer(), + 8.height + ], + ), + )), + ); + } +} diff --git a/lib/widgets/transitions/fade_page.dart b/lib/widgets/transitions/fade_page.dart new file mode 100644 index 0000000..300a297 --- /dev/null +++ b/lib/widgets/transitions/fade_page.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +/// FadePage animation +/// [page] +class FadePage extends PageRouteBuilder { + final Widget? page; + + FadePage({this.page}) + : super( + opaque: false, + fullscreenDialog: true, + barrierDismissible: true, + barrierColor: Colors.black.withOpacity(0.8), + pageBuilder: ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + ) => + page!, + transitionDuration: const Duration(milliseconds: 600), + transitionsBuilder: ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + return FadeTransition(opacity: animation, child: child); + }, + ); +} diff --git a/lib/widgets/vital_sing_chart_and_detials.dart b/lib/widgets/vital_sing_chart_and_detials.dart new file mode 100644 index 0000000..decca3f --- /dev/null +++ b/lib/widgets/vital_sing_chart_and_detials.dart @@ -0,0 +1,146 @@ +// import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/uitl/utils.dart'; +// import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +// import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +// import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +// import 'package:diplomaticquarterapp/widgets/charts/sync_fu_chart.dart'; +// import 'package:flutter/material.dart'; +// import 'package:provider/provider.dart'; +// +// import 'LineChartCurved.dart'; +// +// class VitalSingChartAndDetials extends StatefulWidget { +// VitalSingChartAndDetials({ +// Key? key, +// required this.vitalList, +// required this.name, +// required this.viewKey, +// required this.title1, +// required this.title2, +// }) : super(key: key); +// +// final List vitalList; +// final String name; +// final String viewKey; +// final String title1; +// final String title2; +// +// @override +// _VitalSingChartAndDetialsState createState() => _VitalSingChartAndDetialsState(); +// } +// +// class _VitalSingChartAndDetialsState extends State { +// List timeSeriesData = []; +// bool isExpended = true; +// late ProjectViewModel projectViewModel; +// +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// generateData(); +// } +// +// @override +// Widget build(BuildContext context) { +// projectViewModel = Provider.of(context); +// return SingleChildScrollView( +// child: Column( +// children: [ +// Container( +// height: 400, +// child: Container( +// decoration: cardRadius(12), +// margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), +// child: ShowChart( +// title: widget.name, +// timeSeries: timeSeriesData, +// indexes: timeSeriesData.length ~/ 5.5, +// horizontalInterval: 8, +// ), +// // child: SyncFuChart(), +// ), +// ), +// Container( +// decoration: cardRadius(12), +// margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), +// child: Padding( +// padding: const EdgeInsets.all(12.0), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text( +// TranslationBase.of(context).graphDetails, +// style: TextStyle( +// fontSize: 16, +// letterSpacing: -0.64, +// fontWeight: FontWeight.w600, +// ), +// ), +// Table( +// columnWidths: { +// 0: FlexColumnWidth(2), +// 1: FlexColumnWidth(1), +// // 2: FlexColumnWidth(1), +// }, +// children: fullData(widget.vitalList, context), +// ), +// ], +// ), +// ), +// ) +// ], +// ), +// ); +// } +// +// List fullData(List labResultList, context) { +// List tableRow = []; +// tableRow.add( +// TableRow( +// children: [ +// Utils.tableColumnTitle(widget.title1), +// Utils.tableColumnTitle(widget.title2), +// // Utils.tableColumnTitle(TranslationBase.of(context).range), +// ], +// ), +// ); +// +// for (int i = 0; i < labResultList.length; i++) { +// var data = labResultList[i].toJson()[widget.viewKey]; +// if (data != 0) +// tableRow.add( +// TableRow( +// children: [ +// Utils.tableColumnValue( +// "${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate!.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate!.weekday)}, ${labResultList[i].vitalSignDate!.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate!.month) : DateUtil.getMonth(labResultList[i].vitalSignDate!.month)}, ${labResultList[i].vitalSignDate!.year}", +// isLast: i == (labResultList.length - 1), mProjectViewModel: projectViewModel), +// Utils.tableColumnValue('${labResultList[i].toJson()[widget.viewKey]}', isLast: i == (labResultList.length - 1), mProjectViewModel: projectViewModel), +// ], +// ), +// ); +// } +// +// return tableRow; +// } +// +// generateData() { +// if (widget.vitalList.length > 0) { +// widget.vitalList.reversed.toList().forEach( +// (element) { +// if (element.toJson()[widget.viewKey] != null && element.toJson()[widget.viewKey]?.toInt() != 0) +// timeSeriesData.add( +// TimeSeriesSales2( +// DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day), +// element.toJson()[widget.viewKey].toDouble(), +// ), +// ); +// }, +// ); +// } +// return timeSeriesData.reversed.toList(); +// } +// } diff --git a/lib/widgets/vital_sing_chart_blood_pressure.dart b/lib/widgets/vital_sing_chart_blood_pressure.dart new file mode 100644 index 0000000..8bff71b --- /dev/null +++ b/lib/widgets/vital_sing_chart_blood_pressure.dart @@ -0,0 +1,149 @@ +// import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +// import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/uitl/utils.dart'; +// import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +// import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +// import 'package:flutter/material.dart'; +// import 'package:provider/provider.dart'; +// +// import 'LineChartCurvedBloodPressure.dart'; +// +// class VitalSingChartBloodPressure extends StatelessWidget { +// VitalSingChartBloodPressure({ +// Key? key, +// required this.vitalList, +// required this.name, +// required this.viewKey1, +// required this.viewKey2, +// required this.title1, +// required this.title2, +// required this.title3, +// }) : super(key: key); +// +// final List vitalList; +// final String name; +// final String viewKey1; +// final String viewKey2; +// final String title1; +// final String title2; +// final String title3; +// List timeSeriesData1 = []; +// List timeSeriesData2 = []; +// late ProjectViewModel projectViewModel; +// +// @override +// Widget build(BuildContext context) { +// projectViewModel = Provider.of(context); +// generateData(); +// return SingleChildScrollView( +// child: Column( +// children: [ +// Container( +// decoration: cardRadius(12), +// margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), +// child: LineChartCurvedBloodPressure( +// title: name, +// timeSeries1: timeSeriesData1, +// timeSeries2: timeSeriesData2, +// indexes: timeSeriesData1.length ~/ 5.5, +// ), +// ), +// +// // VitalSignBloodPressureWidget( +// // vitalList: vitalList, +// // title1: title1, +// // title2: title2, +// // title3: title3, +// // viewKey1: viewKey1, +// // viewKey2: viewKey2, +// // ), +// Container( +// decoration: cardRadius(12), +// margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), +// child: Padding( +// padding: const EdgeInsets.all(12.0), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text( +// TranslationBase.of(context).graphDetails, +// style: TextStyle( +// fontSize: 16, +// letterSpacing: -0.64, +// fontWeight: FontWeight.w600, +// ), +// ), +// Table( +// columnWidths: { +// 0: FlexColumnWidth(2), +// 1: FlexColumnWidth(1), +// // 2: FlexColumnWidth(1), +// }, +// children: fullData(vitalList, context), +// ), +// ], +// ), +// ), +// ) +// ], +// ), +// ); +// } +// +// List fullData(List labResultList, context) { +// List tableRow = []; +// tableRow.add( +// TableRow( +// children: [ +// Utils.tableColumnTitle(title1), +// Utils.tableColumnTitle(title2), +// Utils.tableColumnTitle(title3), +// // Utils.tableColumnTitle(TranslationBase.of(context).range), +// ], +// ), +// ); +// +// for (int i = 0; i < labResultList.length; i++) { +// var data = labResultList[i].toJson()[viewKey1]; +// if (data != 0) +// tableRow.add( +// TableRow( +// children: [ +// Utils.tableColumnValue( +// "${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate!.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate!.weekday)}, ${labResultList[i].vitalSignDate!.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate!.month) : DateUtil.getMonth(labResultList[i].vitalSignDate!.month)}, ${labResultList[i].vitalSignDate!.year}", +// isLast: i == (labResultList.length - 1), mProjectViewModel: projectViewModel), +// Utils.tableColumnValue('${labResultList[i].toJson()[viewKey1]}', isLast: i == (labResultList.length - 1), mProjectViewModel: projectViewModel), +// Utils.tableColumnValue('${labResultList[i].toJson()[viewKey2]}', isLast: i == (labResultList.length - 1), mProjectViewModel: projectViewModel), +// ], +// ), +// ); +// } +// +// return tableRow; +// } +// +// generateData() { +// if (vitalList.length > 0) { +// vitalList.reversed.toList().forEach( +// (element) { +// if (element.toJson()[viewKey1]?.toInt() != 0) +// timeSeriesData1.add( +// TimeSeriesSales2( +// new DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day), +// element.toJson()[viewKey1].toDouble(), +// ), +// ); +// if (element.toJson()[viewKey2]?.toInt() != 0) +// timeSeriesData2.add( +// TimeSeriesSales2( +// new DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day), +// element.toJson()[viewKey2].toDouble(), +// ), +// ); +// }, +// ); +// } +// } +// } diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..6946082 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1577 @@ +# 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" + 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: "2b7fff16a552486d078bfc09a8cde19f426dc6d6329262b684182597bec5b1ac" + url: "https://pub.dev" + source: hosted + version: "0.1.25" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + 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" + 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" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + 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" + 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_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" + equatable: + dependency: transitive + description: + name: equatable + sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7" + url: "https://pub.dev" + source: hosted + version: "2.0.7" + 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: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + 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: e7e16c9d15c36330b94ca0e2ad8cb61f93cd5282d0158c09805aed13b5452f22 + url: "https://pub.dev" + source: hosted + version: "10.3.2" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "19124ff4a3d8864fdc62072b6a2ef6c222d55a3404fe14893a3c02744907b60c" + url: "https://pub.dev" + source: hosted + version: "0.9.4+4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "320fcfb6f33caa90f0b58380489fc5ac05d99ee94b61aa96ec2bff0ba81d3c2b" + url: "https://pub.dev" + source: hosted + version: "0.9.3+4" + 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: "5dbc900677dcbe5873d22ad7fbd64b047750124f1f9b7ebe2a33b9ddccc838eb" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "0ed0dc292e8f9ac50992e2394e9d336a0275b6ae400d64163fdf0a8a8b556c37" + url: "https://pub.dev" + source: hosted + version: "2.24.1" + 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: + path: "." + ref: dev + resolved-ref: "4b5aa9798a77eaba1c1726c314c5de74cd37ad6d" + url: "https://github.com/hiennguyen92/flutter_callkit_incoming.git" + source: git + version: "2.5.8" + 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: a9966c850de5e445331b854fa42df96a8020066d67f125a5964cbc6556643f68 + url: "https://pub.dev" + source: hosted + version: "19.4.1" + 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: ed46d7ae4ec9d19e4c8fa2badac5fe27ba87a3fe387343ce726f927af074ec98 + url: "https://pub.dev" + source: hosted + version: "1.0.2" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b0694b7fb1689b0e6cc193b3f1fcac6423c4f93c74fb20b806c6b6f196db0c31 + url: "https://pub.dev" + source: hosted + version: "2.0.30" + flutter_rating_bar: + dependency: "direct main" + description: + name: flutter_rating_bar + sha256: d2af03469eac832c591a1eba47c91ecc871fe5708e69967073c043b2d775ed93 + url: "https://pub.dev" + source: hosted + version: "4.0.1" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: cd57f7969b4679317c17af6fd16ee233c1e60a82ed209d8a475c54fd6fd6f845 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + 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_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: "25e51620424d92d3db3832464774a6143b5053f15e382d8ffbfd40b6e795dcf1" + url: "https://pub.dev" + source: hosted + version: "8.2.12" + 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: c4e966f0a7a87e70049eac7a2617f9e16fd4c585a26e4330bdfc3a71e6a721f3 + url: "https://pub.dev" + source: hosted + version: "0.2.3" + 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" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "4d6e199c561ca06792c964fa24b2bac7197bf4b401c2e1d23e345e5f9939f531" + url: "https://pub.dev" + source: hosted + version: "8.1.1" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + sha256: e1805e5a5885bd14a1c407c59229f478af169bf4d04388586b19f53145a5db3a + url: "https://pub.dev" + source: hosted + version: "2.12.3" + google_maps_flutter_android: + dependency: transitive + description: + name: google_maps_flutter_android + sha256: a6c9d43f6a944ff4bae5c3deb34817970ac3d591dcd7f5bd2ea450ab9e9c514a + url: "https://pub.dev" + source: hosted + version: "2.18.2" + google_maps_flutter_ios: + dependency: transitive + description: + name: google_maps_flutter_ios + sha256: ca02463b19a9abc7d31fcaf22631d021d647107467f741b917a69fa26659fd75 + url: "https://pub.dev" + source: hosted + version: "2.15.5" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + sha256: f4b9b44f7b12a1f6707ffc79d082738e0b7e194bf728ee61d2b3cdf5fdf16081 + url: "https://pub.dev" + source: hosted + version: "2.14.0" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: "9d57993ba29b80bb637bb7b9784159ca93071d5940e4d0383ae2358ad371e375" + url: "https://pub.dev" + source: hosted + version: "0.5.13" + 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: "996664904194b8e0a09dfe761e168fdbf9ef43c51e7de39cd075de71c7258ada" + url: "https://pub.dev" + source: hosted + version: "13.1.3" + 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: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "28f3987ca0ec702d346eae1d90eda59603a2101b52f1e234ded62cff1d5cfa6e" + url: "https://pub.dev" + source: hosted + version: "0.8.13+1" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "40c2a6a0da15556dc0f8e38a3246064a971a9f512386c3339b89f76db87269b6" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e + url: "https://pub.dev" + source: hosted + version: "0.8.13" + 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: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04 + url: "https://pub.dev" + source: hosted + version: "0.2.2" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "9f143b0dba3e459553209e20cc425c9801af48e6dfa4f01a0fcf927be3f41665" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae + url: "https://pub.dev" + source: hosted + version: "0.2.2" + injector: + dependency: "direct main" + description: + name: injector + sha256: d692c37788872bfd4bd7c01b864b0712190a25ae5a346431ff69949d5728a2e1 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + 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: "679637a3ec5b6e00f36472f5a3663667df00ee4822cbf5dafca0f568c710960a" + url: "https://pub.dev" + source: hosted + version: "0.10.4" + 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" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + url: "https://pub.dev" + source: hosted + version: "10.0.9" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + 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: "48924f4a8b3cc45994ad5993e2e232d3b00788a305c1bf1c7db32cef281ce9a3" + url: "https://pub.dev" + source: hosted + version: "1.0.52" + local_auth_darwin: + dependency: transitive + description: + name: local_auth_darwin + sha256: "0e9706a8543a4a2eee60346294d6a633dd7c3ee60fae6b752570457c4ff32055" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + local_auth_platform_interface: + dependency: transitive + description: + name: local_auth_platform_interface + sha256: "1b842ff177a7068442eae093b64abe3592f816afd2a533c0ebcdbe40f9d2075a" + url: "https://pub.dev" + source: hosted + version: "1.0.10" + local_auth_windows: + dependency: transitive + description: + name: local_auth_windows + sha256: bc4e66a29b0fdf751aafbec923b5bed7ad6ed3614875d8151afe2578520b2ab5 + url: "https://pub.dev" + source: hosted + version: "1.0.11" + logger: + dependency: "direct main" + description: + name: logger + sha256: "55d6c23a6c15db14920e037fe7e0dc32e7cdaf3b64b4b25df2d541b5b6b81c0c" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + lottie: + dependency: "direct main" + description: + name: lottie + sha256: c5fa04a80a620066c15cf19cc44773e19e9b38e989ff23ea32e5903ef1015950 + url: "https://pub.dev" + source: hosted + version: "3.3.1" + manage_calendar_events: + dependency: "direct main" + description: + name: manage_calendar_events + sha256: f17600fcb7dc7047120c185993045e493d686930237b4e3c2689c26a64513d66 + url: "https://pub.dev" + source: hosted + version: "2.0.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" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + 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" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "16eee997588c60225bda0488b6dcfac69280a6b7a3cf02c741895dd370a02968" + url: "https://pub.dev" + source: hosted + version: "8.3.1" + 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: transitive + 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: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db" + url: "https://pub.dev" + source: hosted + version: "2.2.18" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + 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" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.dev" + source: hosted + version: "6.0.3" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + rrule: + dependency: transitive + description: + name: rrule + sha256: b7425410c594d4b6717c9f17ec8ef83c9d1ff2e513c428a135b5924fc2e8e045 + url: "https://pub.dev" + source: hosted + version: "0.2.17" + 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" + 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: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: a2608114b1ffdcbc9c120eb71a0e207c71da56202852d4aab8a5e30a82269e74 + url: "https://pub.dev" + source: hosted + version: "2.4.12" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + 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" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + 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: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + 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: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + time: + dependency: transitive + description: + name: time + sha256: "370572cf5d1e58adcb3e354c47515da3f7469dac3a95b447117e728e7be6f461" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + timezone: + dependency: transitive + 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" + 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: "69ee86740f2847b9a4ba6cffa74ed12ce500bbe2b07f3dc1e643439da60637b7" + url: "https://pub.dev" + source: hosted + version: "6.3.18" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7 + url: "https://pub.dev" + source: hosted + version: "6.3.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f + url: "https://pub.dev" + source: hosted + version: "3.2.3" + 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: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" + 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: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + url: "https://pub.dev" + source: hosted + version: "15.0.0" + web: + dependency: "direct main" + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03" + url: "https://pub.dev" + source: hosted + version: "5.14.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.8.0 <4.0.0" + flutter: ">=3.29.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..ace630a --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,76 @@ +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: 1.0.0+1 + +environment: + sdk: ">=3.6.0 <4.0.0" + +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + cupertino_icons: ^1.0.8 + cached_network_image: ^3.4.1 + http: ^1.5.0 + flutter_svg: ^2.2.0 + shared_preferences: ^2.5.3 + connectivity_plus: ^6.1.5 + auto_size_text: ^3.0.0 + shimmer: ^3.0.0 + sizer: ^3.1.3 + easy_localization: ^3.0.8 + fluttertoast: ^8.2.12 + flutter_rating_bar: ^4.0.1 + firebase_messaging: ^15.2.10 + # firebase_messaging: any + firebase_core: any + # firebase_core: ^3.13.1 + permission_handler: ^12.0.1 + flutter_local_notifications: ^19.4.1 + injector: ^4.0.0 + provider: ^6.1.5+1 + just_audio: ^0.10.4 + flutter_callkit_incoming: + git: + url: https://github.com/hiennguyen92/flutter_callkit_incoming.git + ref: dev + url_launcher: ^6.3.2 + logger: ^2.6.1 + lottie: ^3.3.1 + flutter_ios_voip_kit_karmm: ^0.8.0 + image_picker: ^1.2.0 + file_picker: ^10.3.2 + local_auth: ^2.3.0 + share_plus: ^11.1.0 + device_calendar: + git: https://github.com/bardram/device_calendar + manage_calendar_events: ^2.0.3 + flutter_inappwebview: ^6.1.5 + # webview_flutter: ^4.13.0 + syncfusion_flutter_calendar: ^30.2.7 + device_info_plus: ^11.5.0 + uuid: ^4.5.1 + health: ^13.1.3 + # health: 12.0.1 + fl_chart: ^1.0.0 + geolocator: ^14.0.2 + dropdown_search: ^6.0.2 + google_maps_flutter: ^2.12.3 + flutter_zoom_videosdk: ^2.1.10 + + web: any + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + + +flutter: + uses-material-design: true + assets: + - assets/ + - assets/langs/ diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..7600f89 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:hmg_patient_app_new/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}