diff --git a/android/app/gradle/wrapper/gradle-wrapper.properties b/android/app/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..8fc3bbec --- /dev/null +++ b/android/app/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Sep 20 09:53:06 EEST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/android/app/gradlew b/android/app/gradlew new file mode 100644 index 00000000..cccdd3d5 --- /dev/null +++ b/android/app/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/android/app/gradlew.bat b/android/app/gradlew.bat new file mode 100644 index 00000000..f9553162 --- /dev/null +++ b/android/app/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/app/local.properties b/android/app/local.properties new file mode 100644 index 00000000..b29c63c9 --- /dev/null +++ b/android/app/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Sun Sep 20 09:53:03 EEST 2020 +sdk.dir=/Users/erababah/Library/Android/sdk diff --git a/assets/images/BloodChrt_EN.png b/assets/images/BloodChrt_EN.png new file mode 100644 index 00000000..ac52957d Binary files /dev/null and b/assets/images/BloodChrt_EN.png differ diff --git a/assets/images/medical/BMR_calculator.png b/assets/images/medical/BMR_calculator.png new file mode 100644 index 00000000..2c32b80d Binary files /dev/null and b/assets/images/medical/BMR_calculator.png differ diff --git a/assets/images/medical/bmi_health_calculator.png b/assets/images/medical/bmi_health_calculator.png new file mode 100644 index 00000000..2eb49440 Binary files /dev/null and b/assets/images/medical/bmi_health_calculator.png differ diff --git a/assets/images/medical/body_fat.png b/assets/images/medical/body_fat.png new file mode 100644 index 00000000..3dd36150 Binary files /dev/null and b/assets/images/medical/body_fat.png differ diff --git a/assets/images/medical/body_weight.png b/assets/images/medical/body_weight.png new file mode 100644 index 00000000..d1f0b324 Binary files /dev/null and b/assets/images/medical/body_weight.png differ diff --git a/assets/images/medical/calories-calculator.png b/assets/images/medical/calories-calculator.png new file mode 100644 index 00000000..e9d72554 Binary files /dev/null and b/assets/images/medical/calories-calculator.png differ diff --git a/assets/images/medical/carb_protein.png b/assets/images/medical/carb_protein.png new file mode 100644 index 00000000..eb6c6640 Binary files /dev/null and b/assets/images/medical/carb_protein.png differ diff --git a/assets/images/medical/delivery_date_icon.png b/assets/images/medical/delivery_date_icon.png new file mode 100644 index 00000000..d578be34 Binary files /dev/null and b/assets/images/medical/delivery_date_icon.png differ diff --git a/assets/images/medical/ovulation_period_icon.png b/assets/images/medical/ovulation_period_icon.png new file mode 100644 index 00000000..c9a075d3 Binary files /dev/null and b/assets/images/medical/ovulation_period_icon.png differ diff --git a/assets/images/new-design/calender-secondary.png b/assets/images/new-design/calender-secondary.png new file mode 100644 index 00000000..a790849d Binary files /dev/null and b/assets/images/new-design/calender-secondary.png differ diff --git a/assets/images/new-design/female.png b/assets/images/new-design/female.png new file mode 100644 index 00000000..29cf8c98 Binary files /dev/null and b/assets/images/new-design/female.png differ diff --git a/assets/images/new-design/garbage.png b/assets/images/new-design/garbage.png new file mode 100644 index 00000000..b0d48797 Binary files /dev/null and b/assets/images/new-design/garbage.png differ diff --git a/assets/images/new-design/male.png b/assets/images/new-design/male.png new file mode 100644 index 00000000..e957df70 Binary files /dev/null and b/assets/images/new-design/male.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 44e7dced..203c0494 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; const MAX_SMALL_SCREEN = 660; @@ -68,6 +69,34 @@ const GET_FINDUS_REQUEST= const GET_LIVECHAT_REQUEST= 'Services/Patients.svc/REST/GetPatientICProjects'; +///babyInformation +const GET_BABYINFORMATION_REQUEST= + 'Services/Community.svc/REST/GetBabyByUserID'; + +///userInformation +const GET_USERINFORMATION_REQUEST= + 'Services/Community.svc/REST/GetUserInformation_New'; + + +///addNewChild +const GET_NEWCHILD_REQUEST= + 'Services/Community.svc/REST/CreateNewBaby'; + + +///addNewTABLE +const GET_TABLE_REQUEST= + 'Services/Community.svc/REST/CreateVaccinationTable'; + + + +///BloodDenote +const GET_CITIES_REQUEST= + 'Services/Lists.svc/REST/GetAllCities'; + +///BloodDetails +const GET_BLOOD_REQUEST= + 'services/PatientVarification.svc/REST/BloodDonation_GetBloodGroupDetails'; + ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; @@ -80,7 +109,7 @@ const IS_LAST_APPOITMENT_RATED = const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; -const GET_QR_PARKING = '/Services/SWP.svc/REST/GetQRParkingByID'; +const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; //const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment //const BASE_URL = 'https://hmgwebservices.com/Services'; // Production Environment @@ -258,6 +287,25 @@ const GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; + + +// H2O +const H2O_GET_USER_PROGRESS = "Services/H2ORemainder.svc/REST/H2O_GetUserProgress"; +const H2O_INSERT_USER_ACTIVITY="Services/H2ORemainder.svc/REST/H2O_InsertUserActivity"; + + + + + +//E_Referral Services + +const GET_ALL_RELATIONSHIP_TYPES = "Services/Patients.svc/REST/GetAllRelationshipTypes"; +const SEND_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/SendActivationCodeForEReferral'; +const CHECK_ACTIVATION_CODE_FOR_E_REFERRAL = 'Services/Authentication.svc/REST/CheckActivationCodeForEReferral'; +const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; +const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; +const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; + const TIMER_MIN = 10; class AppGlobal { diff --git a/lib/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart new file mode 100644 index 00000000..3f26abe7 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart @@ -0,0 +1,57 @@ +class CheckActivationCodeForEReferralResponseModel { + String logInTokenID; + String activationCode; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + CheckActivationCodeForEReferralResponseModel( + {this.logInTokenID, + this.activationCode, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + CheckActivationCodeForEReferralResponseModel.fromJson( + Map json) { + logInTokenID = json['LogInTokenID']; + activationCode = json['activationCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['LogInTokenID'] = this.logInTokenID; + data['activationCode'] = this.activationCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart new file mode 100644 index 00000000..e13de327 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart @@ -0,0 +1,153 @@ +class CreateEReferralRequestModel { + bool isInsuredPatient; + String cityCode; + String cityName; + String requesterName; + String requesterContactNo; + int requesterRelationship; + String otherRelationship; + String fullName; + int identificationNo; + String patientMobileNumber; + int preferredBranchCode; + String preferredBranchName; + List medicalReportAttachment; + dynamic insuranceCardAttachment; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + CreateEReferralRequestModel( + {this.isInsuredPatient, + this.cityCode, + this.cityName, + this.requesterName, + this.requesterContactNo, + this.requesterRelationship, + this.otherRelationship, + this.fullName, + this.identificationNo, + this.patientMobileNumber, + this.preferredBranchCode, + this.preferredBranchName, + this.medicalReportAttachment, + this.insuranceCardAttachment, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + CreateEReferralRequestModel.fromJson(Map json) { + isInsuredPatient = json['IsInsuredPatient']; + cityCode = json['CityCode']; + cityName = json['CityName']; + requesterName = json['RequesterName']; + requesterContactNo = json['RequesterContactNo']; + requesterRelationship = json['RequesterRelationship']; + otherRelationship = json['OtherRelationship']; + fullName = json['FullName']; + identificationNo = json['IdentificationNo']; + patientMobileNumber = json['PatientMobileNumber']; + preferredBranchCode = json['PreferredBranchCode']; + preferredBranchName = json['PreferredBranchName']; + if (json['MedicalReportAttachment'] != null) { + medicalReportAttachment = new List(); + json['MedicalReportAttachment'].forEach((v) { + medicalReportAttachment.add(new EReferralAttachment.fromJson(v)); + }); + } + insuranceCardAttachment = json['InsuranceCardAttachment'] != null + ? new EReferralAttachment.fromJson(json['InsuranceCardAttachment']) + : null; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['IsInsuredPatient'] = this.isInsuredPatient; + data['CityCode'] = this.cityCode; + data['CityName'] = this.cityName; + data['RequesterName'] = this.requesterName; + data['RequesterContactNo'] = this.requesterContactNo; + data['RequesterRelationship'] = this.requesterRelationship; + data['OtherRelationship'] = this.otherRelationship; + data['FullName'] = this.fullName; + data['IdentificationNo'] = this.identificationNo; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PreferredBranchCode'] = this.preferredBranchCode; + data['PreferredBranchName'] = this.preferredBranchName; + if (this.medicalReportAttachment != null) { + data['MedicalReportAttachment'] = + this.medicalReportAttachment.map((v) => v.toJson()).toList(); + } + if (this.insuranceCardAttachment == null) { + data['InsuranceCardAttachment'] = {}; + } else + data['InsuranceCardAttachment'] = this.insuranceCardAttachment.toJson(); + + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} + +class EReferralAttachment { + String fileName; + String base64String; + + EReferralAttachment({this.fileName, this.base64String}); + + EReferralAttachment.fromJson(Map json) { + fileName = json['FileName']; + base64String = json['Base64String']; + } + + Map toJson() { + final Map data = new Map(); + data['FileName'] = this.fileName; + data['Base64String'] = this.base64String; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_request_model.dart new file mode 100644 index 00000000..dd46a48b --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_request_model.dart @@ -0,0 +1,48 @@ +class GetAllCitiesRequestModel { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + GetAllCitiesRequestModel( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + GetAllCitiesRequestModel.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart new file mode 100644 index 00000000..224cb84d --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart @@ -0,0 +1,21 @@ +class GetAllCitiesResponseModel { + int iD; + String description; + String descriptionN; + + GetAllCitiesResponseModel({this.iD, this.description, this.descriptionN}); + + GetAllCitiesResponseModel.fromJson(Map json) { + iD = json['ID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_request_model.dart new file mode 100644 index 00000000..10eb03de --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_request_model.dart @@ -0,0 +1,48 @@ +class GetAllRelationshipTypeRequestModel { + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + GetAllRelationshipTypeRequestModel( + {this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + GetAllRelationshipTypeRequestModel.fromJson(Map json) { + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart new file mode 100644 index 00000000..997e3f3c --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart @@ -0,0 +1,25 @@ +class GetAllRelationshipTypeResponseModel { + int iD; + String text; + String textAr; + String textEn; + + GetAllRelationshipTypeResponseModel( + {this.iD, this.text, this.textAr, this.textEn}); + + GetAllRelationshipTypeResponseModel.fromJson(Map json) { + iD = json['ID']; + text = json['Text']; + textAr = json['Text_Ar']; + textEn = json['Text_En']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['Text'] = this.text; + data['Text_Ar'] = this.textAr; + data['Text_En'] = this.textEn; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart new file mode 100644 index 00000000..3ddbe331 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart @@ -0,0 +1,21 @@ +class SearchCriteriaModel { + String name; + String nameAr; + int value; + + SearchCriteriaModel({this.name, this.nameAr, this.value}); + + SearchCriteriaModel.fromJson(Map json) { + name = json['name']; + nameAr = json['name_ar']; + value = json['value']; + } + + Map toJson() { + final Map data = new Map(); + data['name'] = this.name; + data['name_ar'] = this.nameAr; + data['value'] = this.value; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart new file mode 100644 index 00000000..b06ce8e7 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart @@ -0,0 +1,60 @@ +class SearchEReferralRequestModel { + String patientMobileNumber; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int referralNumber; + String identificationNo; + + SearchEReferralRequestModel( + {this.patientMobileNumber, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.referralNumber, + this.identificationNo}); + + SearchEReferralRequestModel.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + referralNumber = json['ReferralNumber']; + identificationNo = json['IdentificationNo']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['ReferralNumber'] = this.referralNumber; + data['IdentificationNo'] = this.identificationNo; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart new file mode 100644 index 00000000..801d8e13 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart @@ -0,0 +1,60 @@ +class SearchEReferralResponseModel { + String patientMobileNumber; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int referralNumber; + String identificationNo; + + SearchEReferralResponseModel( + {this.patientMobileNumber, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.referralNumber, + this.identificationNo}); + + SearchEReferralResponseModel.fromJson(Map json) { + patientMobileNumber = json['PatientMobileNumber']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + referralNumber = json['ReferralNumber']; + identificationNo = json['IdentificationNo']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['ReferralNumber'] = this.referralNumber; + data['IdentificationNo'] = this.identificationNo; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart b/lib/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart new file mode 100644 index 00000000..622ef143 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart @@ -0,0 +1,57 @@ +class SendActivationCodeForEReferralRequestModel { + int patientMobileNumber; + String zipCode; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + Null sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + SendActivationCodeForEReferralRequestModel( + {this.patientMobileNumber, + this.zipCode, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + SendActivationCodeForEReferralRequestModel.fromJson( + Map json) { + patientMobileNumber = json['PatientMobileNumber']; + zipCode = json['ZipCode']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMobileNumber'] = this.patientMobileNumber; + data['ZipCode'] = this.zipCode; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart b/lib/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart new file mode 100644 index 00000000..2d27729b --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart @@ -0,0 +1,76 @@ +class InsertUserActivityRequestModel { + String identificationNo; + String mobileNumber; + int quantityIntake; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + InsertUserActivityRequestModel( + {this.identificationNo, + this.mobileNumber, + this.quantityIntake, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + InsertUserActivityRequestModel.fromJson(Map json) { + identificationNo = json['IdentificationNo']; + mobileNumber = json['MobileNumber']; + quantityIntake = json['QuantityIntake']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['IdentificationNo'] = this.identificationNo; + data['MobileNumber'] = this.mobileNumber; + data['QuantityIntake'] = this.quantityIntake; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/user_progress_for_month_data_model.dart b/lib/core/model/AlHabibMedicalService/user_progress_for_month_data_model.dart new file mode 100644 index 00000000..a7f7805e --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/user_progress_for_month_data_model.dart @@ -0,0 +1,22 @@ +class UserProgressForMonthDataModel { + int monthNumber; + String monthName; + int percentageConsumed; + + UserProgressForMonthDataModel( + {this.monthNumber, this.monthName, this.percentageConsumed}); + + UserProgressForMonthDataModel.fromJson(Map json) { + monthNumber = json['MonthNumber']; + monthName = json['MonthName']; + percentageConsumed = json['PercentageConsumed']; + } + + Map toJson() { + final Map data = new Map(); + data['MonthNumber'] = this.monthNumber; + data['MonthName'] = this.monthName; + data['PercentageConsumed'] = this.percentageConsumed; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart b/lib/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart new file mode 100644 index 00000000..63c7093b --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart @@ -0,0 +1,28 @@ +class UserProgressForTodayDataModel { + dynamic quantityConsumed; + dynamic percentageConsumed; + dynamic percentageLeft; + dynamic quantityLimit; + + UserProgressForTodayDataModel( + {this.quantityConsumed, + this.percentageConsumed, + this.percentageLeft, + this.quantityLimit}); + + UserProgressForTodayDataModel.fromJson(Map json) { + quantityConsumed = json['QuantityConsumed']; + percentageConsumed = json['PercentageConsumed']; + percentageLeft = json['PercentageLeft']; + quantityLimit = json['QuantityLimit']; + } + + Map toJson() { + final Map data = new Map(); + data['QuantityConsumed'] = this.quantityConsumed; + data['PercentageConsumed'] = this.percentageConsumed; + data['PercentageLeft'] = this.percentageLeft; + data['QuantityLimit'] = this.quantityLimit; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/user_progress_for_week_data_model.dart b/lib/core/model/AlHabibMedicalService/user_progress_for_week_data_model.dart new file mode 100644 index 00000000..2641a678 --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/user_progress_for_week_data_model.dart @@ -0,0 +1,25 @@ +class UserProgressForWeekDataModel { + int dayNumber; + dynamic dayDate; + String dayName; + int percentageConsumed; + + UserProgressForWeekDataModel( + {this.dayNumber, this.dayDate, this.dayName, this.percentageConsumed}); + + UserProgressForWeekDataModel.fromJson(Map json) { + dayNumber = json['DayNumber']; + dayDate = json['DayDate']; + dayName = json['DayName']; + percentageConsumed = json['PercentageConsumed']; + } + + Map toJson() { + final Map data = new Map(); + data['DayNumber'] = this.dayNumber; + data['DayDate'] = this.dayDate; + data['DayName'] = this.dayName; + data['PercentageConsumed'] = this.percentageConsumed; + return data; + } +} diff --git a/lib/core/model/AlHabibMedicalService/user_progress_request_model.dart b/lib/core/model/AlHabibMedicalService/user_progress_request_model.dart new file mode 100644 index 00000000..d06e053b --- /dev/null +++ b/lib/core/model/AlHabibMedicalService/user_progress_request_model.dart @@ -0,0 +1,76 @@ +class UserProgressRequestModel { + int progress; + String mobileNumber; + String identificationNo; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + UserProgressRequestModel( + {this.progress, + this.mobileNumber, + this.identificationNo, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + UserProgressRequestModel.fromJson(Map json) { + progress = json['Progress']; + mobileNumber = json['MobileNumber']; + identificationNo = json['IdentificationNo']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['Progress'] = this.progress; + data['MobileNumber'] = this.mobileNumber; + data['IdentificationNo'] = this.identificationNo; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} diff --git a/lib/core/model/blooddonation/blood_groub_details.dart b/lib/core/model/blooddonation/blood_groub_details.dart new file mode 100644 index 00000000..34dcafe0 --- /dev/null +++ b/lib/core/model/blooddonation/blood_groub_details.dart @@ -0,0 +1,77 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +class List_BloodGroupDetailsModel { + int iD; + int patientID; + int patientType; + bool patientOutSA; + int zipCode; + String cellNumber; + String cityCode; + String city; + int gender; + String bloodGroup; + String nationalID; + bool isActive; + int createdBy; + DateTime createdOn; + int editedBy; + DateTime editedOn; + + List_BloodGroupDetailsModel( + {this.iD, + this.patientID, + this.patientType, + this.patientOutSA, + this.zipCode, + this.cellNumber, + this.cityCode, + this.city, + this.gender, + this.bloodGroup, + this.nationalID, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + List_BloodGroupDetailsModel.fromJson(Map json) { + iD = json['ID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + patientOutSA = json['PatientOutSA']; + zipCode = json['ZipCode']; + cellNumber = json['CellNumber']; + cityCode = json['CityCode']; + city = json['City']; + gender = json['Gender']; + bloodGroup = json['BloodGroup']; + nationalID = json['NationalID']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = DateUtil.convertStringToDate(json['CreatedOn']);// json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = DateUtil.convertStringToDate(json['EditedOn']);//json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['PatientOutSA'] = this.patientOutSA; + data['ZipCode'] = this.zipCode; + data['CellNumber'] = this.cellNumber; + data['CityCode'] = this.cityCode; + data['City'] = this.city; + data['Gender'] = this.gender; + data['BloodGroup'] = this.bloodGroup; + data['NationalID'] = this.nationalID; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/blooddonation/get_all_cities.dart b/lib/core/model/blooddonation/get_all_cities.dart new file mode 100644 index 00000000..3d685bb6 --- /dev/null +++ b/lib/core/model/blooddonation/get_all_cities.dart @@ -0,0 +1,21 @@ +class CitiesModel { + int iD; + String description; + String descriptionN; + + CitiesModel({this.iD, this.description, this.descriptionN}); + + CitiesModel.fromJson(Map json) { + iD = json['ID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/List_BabyInformationModel.dart b/lib/core/model/childvaccines/List_BabyInformationModel.dart new file mode 100644 index 00000000..0711b8a2 --- /dev/null +++ b/lib/core/model/childvaccines/List_BabyInformationModel.dart @@ -0,0 +1,45 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +class List_BabyInformationModel { + int alertBy; + int babyID; + String babyName; + DateTime dOB; + int gender; + String genderDescription; + int patientID; + int userID; + + List_BabyInformationModel( + {this.alertBy, + this.babyID, + this.babyName, + this.dOB, + this.gender, + this.genderDescription, + this.patientID, + this.userID}); + + List_BabyInformationModel.fromJson(Map json) { + alertBy = json['AlertBy']; + babyID = json['BabyID']; + babyName = json['BabyName']; + dOB = DateUtil.convertStringToDate(json['DOB']); + gender = json['Gender']; + genderDescription = json['GenderDescription']; + patientID = json['PatientID']; + userID = json['UserID']; + } + + Map toJson() { + final Map data = new Map(); + data['AlertBy'] = this.alertBy; + data['BabyID'] = this.babyID; + data['BabyName'] = this.babyName; + data['DOB'] = this.dOB; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['PatientID'] = this.patientID; + data['UserID'] = this.userID; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/add_newchild_model.dart b/lib/core/model/childvaccines/add_newchild_model.dart new file mode 100644 index 00000000..9bbfe6ad --- /dev/null +++ b/lib/core/model/childvaccines/add_newchild_model.dart @@ -0,0 +1,100 @@ +class CreateNewBaby { + String babyName; + String gender; + String strDOB; + int editedBy; + int createdBy; + bool tempValue; + int userID; + bool isLogin; + int alertBy; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + int patientID; + String tokenID; + int patientTypeID; + int patientType; + + CreateNewBaby( + {this.babyName, + this.gender, + this.strDOB, + this.editedBy, + this.createdBy, + this.tempValue, + this.userID, + this.isLogin, + this.alertBy, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); + + CreateNewBaby.fromJson(Map json) { + babyName = json['BabyName']; + gender = json['Gender']; + strDOB = json['StrDOB']; + editedBy = json['EditedBy']; + createdBy = json['CreatedBy']; + tempValue = json['TempValue']; + userID = json['UserID']; + isLogin = json['IsLogin']; + alertBy = json['AlertBy']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + patientID = json['PatientID']; + tokenID = json['TokenID']; + patientTypeID = json['PatientTypeID']; + patientType = json['PatientType']; + } + + Map toJson() { + final Map data = new Map(); + data['BabyName'] = this.babyName; + data['Gender'] = this.gender; + data['StrDOB'] = this.strDOB; + data['EditedBy'] = this.editedBy; + data['CreatedBy'] = this.createdBy; + data['TempValue'] = this.tempValue; + data['UserID'] = this.userID; + data['IsLogin'] = this.isLogin; + data['AlertBy'] = this.alertBy; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + data['PatientID'] = this.patientID; + data['TokenID'] = this.tokenID; + data['PatientTypeID'] = this.patientTypeID; + data['PatientType'] = this.patientType; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/create_vaccination_table.dart b/lib/core/model/childvaccines/create_vaccination_table.dart new file mode 100644 index 00000000..d39f2a64 --- /dev/null +++ b/lib/core/model/childvaccines/create_vaccination_table.dart @@ -0,0 +1,25 @@ +class CreateVaccinationTable { + String givenAt; + String status; + String vaccinesDescription; + String visit; + + CreateVaccinationTable( + {this.givenAt, this.status, this.vaccinesDescription, this.visit}); + + CreateVaccinationTable.fromJson(Map json) { + givenAt = json['GivenAt']; + status = json['Status']; + vaccinesDescription = json['VaccinesDescription']; + visit = json['Visit']; + } + + Map toJson() { + final Map data = new Map(); + data['GivenAt'] = this.givenAt; + data['Status'] = this.status; + data['VaccinesDescription'] = this.vaccinesDescription; + data['Visit'] = this.visit; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart b/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart new file mode 100644 index 00000000..14891852 --- /dev/null +++ b/lib/core/model/childvaccines/get_vacainations_itemsmodel.dart @@ -0,0 +1,18 @@ +class GET_VACCINATIONS_ITEMSMODEL { + String dESCRIPTION; + String iTEMCODE; + + GET_VACCINATIONS_ITEMSMODEL({this.dESCRIPTION, this.iTEMCODE}); + + GET_VACCINATIONS_ITEMSMODEL.fromJson(Map json) { + dESCRIPTION = json['DESCRIPTION']; + iTEMCODE = json['ITEM_CODE']; + } + + Map toJson() { + final Map data = new Map(); + data['DESCRIPTION'] = this.dESCRIPTION; + data['ITEM_CODE'] = this.iTEMCODE; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/childvaccines/user_information_model.dart b/lib/core/model/childvaccines/user_information_model.dart new file mode 100644 index 00000000..9e1687d3 --- /dev/null +++ b/lib/core/model/childvaccines/user_information_model.dart @@ -0,0 +1,48 @@ +class List_UserInformationModel { + int userID; + String mobileNumber; + String nationalID; + String emailAddress; + int patientID; + int patientType; + bool patientOutSA; + int createdBy; + int editedBy; + + List_UserInformationModel( + {this.userID, + this.mobileNumber, + this.nationalID, + this.emailAddress, + this.patientID, + this.patientType, + this.patientOutSA, + this.createdBy, + this.editedBy}); + + List_UserInformationModel.fromJson(Map json) { + userID = json['UserID']; + mobileNumber = json['MobileNumber']; + nationalID = json['NationalID']; + emailAddress = json['EmailAddress']; + patientID = json['PatientID']; + patientType = json['PatientType']; + patientOutSA = json['PatientOutSA']; + createdBy = json['CreatedBy']; + editedBy = json['EditedBy']; + } + + Map toJson() { + final Map data = new Map(); + data['UserID'] = this.userID; + data['MobileNumber'] = this.mobileNumber; + data['NationalID'] = this.nationalID; + data['EmailAddress'] = this.emailAddress; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['PatientOutSA'] = this.patientOutSA; + data['CreatedBy'] = this.createdBy; + data['EditedBy'] = this.editedBy; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/my_balance/AdvanceModel.dart b/lib/core/model/my_balance/AdvanceModel.dart index 40472b13..b95e08a2 100644 --- a/lib/core/model/my_balance/AdvanceModel.dart +++ b/lib/core/model/my_balance/AdvanceModel.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; class AdvanceModel { @@ -7,6 +8,7 @@ class AdvanceModel { String email; String note; String depositorName; + CitiesModel citiessModel; AdvanceModel( {this.amount, @@ -14,5 +16,6 @@ class AdvanceModel { this.note, this.hospitalsModel, this.fileNumber, - this.depositorName}); + this.depositorName, + this.citiessModel}); } diff --git a/lib/core/service/AlHabibMedicalService/H2O_service.dart b/lib/core/service/AlHabibMedicalService/H2O_service.dart new file mode 100644 index 00000000..d44b50ef --- /dev/null +++ b/lib/core/service/AlHabibMedicalService/H2O_service.dart @@ -0,0 +1,89 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_month_data_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_week_data_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class H2OService extends BaseService { + List userProgressForTodayDataList = List(); + List userProgressForWeekDataList = List(); + List userProgressForMonthDataList = List(); + UserProgressRequestModel userProgressRequestModel = + UserProgressRequestModel(); + + Future getUserProgressForTodayData() async { + userProgressRequestModel.progress = 1; + userProgressRequestModel.mobileNumber = user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = user.patientIdentificationNo; + + hasError = false; + await baseAppClient.post(H2O_GET_USER_PROGRESS, + onSuccess: (dynamic response, int statusCode) { + userProgressForTodayDataList.clear(); + response['UserProgressForTodayData'].forEach((progressData) { + userProgressForTodayDataList + .add(UserProgressForTodayDataModel.fromJson(progressData)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); + } + + Future getUserProgressForWeekData() async { + userProgressRequestModel.progress = 2; + userProgressRequestModel.mobileNumber = super.user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; + + hasError = false; + await baseAppClient.post(H2O_GET_USER_PROGRESS, + onSuccess: (dynamic response, int statusCode) { + userProgressForTodayDataList.clear(); + response['UserProgressForWeekData'].forEach((hospital) { + userProgressForWeekDataList.add(UserProgressForWeekDataModel.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); + } + + Future getUserProgressForMonthData() async { + userProgressRequestModel.progress = 3; + userProgressRequestModel.mobileNumber = super.user.mobileNumber.substring(1); + userProgressRequestModel.identificationNo = super.user.patientIdentificationNo; + + hasError = false; + await baseAppClient.post(H2O_GET_USER_PROGRESS, + onSuccess: (dynamic response, int statusCode) { + userProgressForMonthDataList.clear(); + response['UserProgressForMonthData'].forEach((hospital) { + userProgressForMonthDataList.add(UserProgressForMonthDataModel.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: userProgressRequestModel.toJson()); + } + + + + + Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async { + + hasError = false; + await baseAppClient.post(H2O_INSERT_USER_ACTIVITY, + onSuccess: (dynamic response, int statusCode) { + userProgressForTodayDataList.clear(); + response['UserProgressForTodayData'].forEach((progressData) { + userProgressForTodayDataList + .add(UserProgressForTodayDataModel.fromJson(progressData)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: insertUserActivityRequestModel.toJson()); + } +} diff --git a/lib/core/service/AlHabibMedicalService/e_referral_service.dart b/lib/core/service/AlHabibMedicalService/e_referral_service.dart new file mode 100644 index 00000000..6c356f5c --- /dev/null +++ b/lib/core/service/AlHabibMedicalService/e_referral_service.dart @@ -0,0 +1,125 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class EReferralService extends BaseService { + List _relationTypes = List(); + List get relationTypes => _relationTypes; + List _allCities = List(); + List get allCities => _allCities; + + List _allReferral = List(); + List get allReferral => _allReferral; + String _activationCode; + String _logInTokenID; + + String get activationCode => _activationCode; + + bool _isActivationCodeValid = false; + + bool get isActivationCodeValid => _isActivationCodeValid; + + Future getRelationTypes() async { + await baseAppClient.post(GET_ALL_RELATIONSHIP_TYPES, + onSuccess: (dynamic response, int statusCode) { + _relationTypes.clear(); + response['List_EReferralResult'].forEach((relation) { + _relationTypes + .add(GetAllRelationshipTypeResponseModel.fromJson(relation)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); + } + + Future getAllCities() async { + await baseAppClient.post(GET_ALL_CITIES, + onSuccess: (dynamic response, int statusCode) { + _allCities.clear(); + response['ListCities'].forEach((city) { + _allCities + .add(GetAllCitiesResponseModel.fromJson(city)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: {}); + } + + Future sendActivationCodeForEReferral( + + SendActivationCodeForEReferralRequestModel + sendActivationCodeForEReferralRequestModel) async { + hasError = false; + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_E_REFERRAL, + onSuccess: (dynamic response, int statusCode) { + _activationCode = response["VerificationCode"]; + _logInTokenID = response["LogInTokenID"]; + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: sendActivationCodeForEReferralRequestModel.toJson()); + } + + + + Future checkActivationCodeForEReferral( + CheckActivationCodeForEReferralResponseModel + checkActivationCodeForEReferralRequestModel) async { + checkActivationCodeForEReferralRequestModel.isDentalAllowedBackend = false; + checkActivationCodeForEReferralRequestModel.logInTokenID= _logInTokenID; + hasError =false; + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL, + onSuccess: (dynamic response, int statusCode) { + _isActivationCodeValid = true; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: checkActivationCodeForEReferralRequestModel.toJson()); + } + + Future createEReferral( + CreateEReferralRequestModel createEReferralRequestModel + ) async { + hasError = false; + await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/, + onSuccess: (dynamic response, int statusCode) { + // TODO Waiting for fix service + var asd= ("EEEEEE"); + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: createEReferralRequestModel.toJson()); + } + + Future getEReferrals( + SearchEReferralRequestModel searchEReferralRequestModel + ) async { + hasError = false; + // TODO return this code when the fix the server + // await baseAppClient.post(GET_E_REFERRALS, + // onSuccess: (dynamic response, int statusCode) { + // print("EEEEEE"); + // // TODO Waiting for fix service + // // ToDo change this one when you have data + // _allReferral.clear(); + // // response['ListCities'].forEach((city) { + // // _allReferral + // // .add(SearchEReferralResponseModel.fromJson(city)); + // // }); + // + // }, onFailure: (String error, int statusCode) { + // hasError = true; + // super.error = error; + // }, body: searchEReferralRequestModel.toJson()); + } +} diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart new file mode 100644 index 00000000..1aaa4755 --- /dev/null +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -0,0 +1,23 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; + +class AuthenticatedUserObject{ + AuthenticatedUser user; + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isLogin = false; + AuthenticatedUserObject(){ + getUser(); + } + + getUser() async { + if (user==null) { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); + } + + var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); + this.isLogin = isLogin != null; + } + +} diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index bef0e1f4..f2820dc1 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'AuthenticatedUserObject.dart'; import 'client/base_app_client.dart'; class BaseService { @@ -10,14 +12,19 @@ class BaseService { BaseAppClient baseAppClient = BaseAppClient(); AuthenticatedUser user; + AuthenticatedUserObject authenticatedUserObject = locator(); + AppSharedPreferences sharedPref = AppSharedPreferences(); BaseService() { - _getUser(); + user = authenticatedUserObject.user; + // getUser(); } - _getUser() async { - var userData = await sharedPref.getObject(USER_PROFILE); - if (userData != null) user = AuthenticatedUser.fromJson(userData); + getUser() async { + if (user==null) { + var userData = await sharedPref.getObject(USER_PROFILE); + if (userData != null) user = AuthenticatedUser.fromJson(userData); + } } } diff --git a/lib/core/service/blood/blood_details_servies.dart b/lib/core/service/blood/blood_details_servies.dart new file mode 100644 index 00000000..644d96d9 --- /dev/null +++ b/lib/core/service/blood/blood_details_servies.dart @@ -0,0 +1,31 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; + +import '../base_service.dart'; + +class BloodDetailsService extends BaseService{ + + // List CitiesModelList = List(); + // Map body = Map(); + + List BloodModelList = List(); + Map body = Map(); + Future getAllBloodOrders() async { + hasError = false; + body['List_BloodGroupDetails'] = false; + await baseAppClient.post(GET_BLOOD_REQUEST, + onSuccess: (dynamic response, int statusCode) { + BloodModelList.clear(); + + response['List_BloodGroupDetails'].forEach((vital) { + BloodModelList.add(List_BloodGroupDetailsModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + +} \ No newline at end of file diff --git a/lib/core/service/blood/blood_donation_service.dart b/lib/core/service/blood/blood_donation_service.dart new file mode 100644 index 00000000..326407a3 --- /dev/null +++ b/lib/core/service/blood/blood_donation_service.dart @@ -0,0 +1,28 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; + +import '../base_service.dart'; + +class BloodDonationService extends BaseService { + //List LivechatModelList = List(); + +// Map body = Map(); + + List CitiesModelList = List(); + Map body = Map(); + Future getAllCitiesOrders() async { + hasError = false; + body['ListCities'] = false; + await baseAppClient.post(GET_CITIES_REQUEST, + onSuccess: (dynamic response, int statusCode) { + CitiesModelList.clear(); + + response['ListCities'].forEach((vital) { + CitiesModelList.add(CitiesModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/childvaccines/add_new_child_service.dart b/lib/core/service/childvaccines/add_new_child_service.dart new file mode 100644 index 00000000..22a081a3 --- /dev/null +++ b/lib/core/service/childvaccines/add_new_child_service.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import '../base_service.dart'; + +class CreteNewBabyService extends BaseService { + List createNewBabyModelList = List(); + + + Future getCreateNewBabyOrders({ CreateNewBaby newChild}) async { + hasError = false; + await baseAppClient.post(GET_NEWCHILD_REQUEST, + onSuccess: (dynamic response, int statusCode) { + createNewBabyModelList.clear(); + + response['List_UserInformationModel_New'].forEach((vital) { + createNewBabyModelList.add( + CreateNewBaby.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: newChild.toJson()); + } + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/child_vaccines_service.dart b/lib/core/service/childvaccines/child_vaccines_service.dart new file mode 100644 index 00000000..75a07338 --- /dev/null +++ b/lib/core/service/childvaccines/child_vaccines_service.dart @@ -0,0 +1,35 @@ +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import '../base_service.dart'; + +class ChildVaccinesService extends BaseService { + List babyInformationModelList = List(); + List userInformationModelList = List(); + + Map body = Map(); + Future getAllBabyInformationOrders() async { + hasError = false; + + body['isDentalAllowedBackend'] = false; + body['IsLogin'] = true; + + //body['UserID'] = userInformationModelList[0].userID;//AuthenticatedUser.fromJson(json['List'][0] //babyInformationModelList[0].userID; + body['UserID'] = 46013;//42843; + + + await baseAppClient.post(GET_BABYINFORMATION_REQUEST, + onSuccess: (dynamic response, int statusCode) { + babyInformationModelList.clear(); + + response['List_BabyInformationModel'].forEach((vital) { + babyInformationModelList.add(List_BabyInformationModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/childvaccines/get_vaccinations_item_services.dart b/lib/core/service/childvaccines/get_vaccinations_item_services.dart new file mode 100644 index 00000000..f7fe4662 --- /dev/null +++ b/lib/core/service/childvaccines/get_vaccinations_item_services.dart @@ -0,0 +1,38 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/get_vacainations_itemsmodel.dart'; + +import '../base_service.dart'; + +class GetVccinationsItemsService extends BaseService { + List getVaccinationsItemModelList = List(); + Map body = Map(); + + + + Future getaccinationsitemOrders() async { + hasError = false; + // await getUser(); + // body['BabyName']="fffffffffff eeeeeeeeeeeeee"; + // body['DOB'] = "/Date(1585774800000+0300)/"; + // body['EmailAddress'] = user.emailAddress; + // body['isDentalAllowedBackend'] = false; + // body['SendEmail'] = false; + // body['IsLogin'] =true; + + + + + await baseAppClient.post(GET_TABLE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + getVaccinationsItemModelList.clear(); + response['List_CreateVaccinationTableModel'].forEach((vital) { + getVaccinationsItemModelList.add( + GET_VACCINATIONS_ITEMSMODEL.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/user_information_service.dart b/lib/core/service/childvaccines/user_information_service.dart new file mode 100644 index 00000000..7651ef0f --- /dev/null +++ b/lib/core/service/childvaccines/user_information_service.dart @@ -0,0 +1,41 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import '../base_service.dart'; + +class UserInformationService extends BaseService{ + + List userInformationModelList = List(); + Map body = Map(); + + + + Future getUserInformationOrders() async { + hasError = false; + await getUser(); + body['CreatedBy'] = 102; + body['EditedBy'] = 102; + body['EmailAddress'] = user.emailAddress; + body['IsLogin'] =true; + body['LogInTokenID'] = 'ZBGoQFUG50eQJd6Y7u1ykA=='; + body['MobileNumber'] = user.mobileNumber; + body['NationalID'] = user.nationalityID; + body['ZipCode'] = user.zipCode; + body['isDentalAllowedBackend'] = false; + + + await baseAppClient.post(GET_USERINFORMATION_REQUEST, + onSuccess: (dynamic response, int statusCode) { + userInformationModelList.clear(); + + response['List_UserInformationModel_New'].forEach((vital) { + userInformationModelList.add(List_UserInformationModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + +} \ No newline at end of file diff --git a/lib/core/service/childvaccines/vaccination_table_service.dart b/lib/core/service/childvaccines/vaccination_table_service.dart new file mode 100644 index 00000000..7f987b76 --- /dev/null +++ b/lib/core/service/childvaccines/vaccination_table_service.dart @@ -0,0 +1,39 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import '../base_service.dart'; + +class VaccinationTableService extends BaseService { + List createVaccinationTableModelList = List(); + Map body = Map(); + + + + Future getCreateVaccinationTableOrders() async { + hasError = false; + await getUser(); + body['BabyName']="fffffffffff eeeeeeeeeeeeee"; + body['DOB'] = "/Date(1585774800000+0300)/"; + body['EmailAddress'] = user.emailAddress; + body['isDentalAllowedBackend'] = false; + body['SendEmail'] = false; + body['IsLogin'] =true; + + + + + await baseAppClient.post(GET_TABLE_REQUEST, + onSuccess: (dynamic response, int statusCode) { + createVaccinationTableModelList.clear(); + response['List_CreateVaccinationTableModel'].forEach((vital) { + createVaccinationTableModelList.add( + CreateVaccinationTable.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + +} \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 4d04378a..f5494049 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -78,8 +78,9 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); + var asd=""; if (await Utils.checkConnection()) { - final response = await http.post(url, + final response = await http.post(url.trim(), body: json.encode(body), headers: { 'Content-Type': 'application/json', diff --git a/lib/core/service/contactus/livechat_service.dart b/lib/core/service/contactus/livechat_service.dart index ae8fabc9..b806d56b 100644 --- a/lib/core/service/contactus/livechat_service.dart +++ b/lib/core/service/contactus/livechat_service.dart @@ -4,36 +4,24 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart import 'package:diplomaticquarterapp/core/model/contactus/get_patientI_cprojects.dart'; import '../base_service.dart'; -class LiveChatService extends BaseService{ - - - - - List LivechatModelList=List(); - +class LiveChatService extends BaseService { + List LivechatModelList = List(); Map body = Map(); - - Future getAllLiveChatOrders() async { hasError = false; - body['List_PatientICProjects'] =false; + body['List_PatientICProjects'] = false; await baseAppClient.post(GET_LIVECHAT_REQUEST, onSuccess: (dynamic response, int statusCode) { - LivechatModelList.clear(); - - - response['List_PatientICProjects'].forEach((vital) { - - LivechatModelList.add(GetPatientICProjectsModel.fromJson(vital)); - - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + LivechatModelList.clear(); + + response['List_PatientICProjects'].forEach((vital) { + LivechatModelList.add(GetPatientICProjectsModel.fromJson(vital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - - -} \ No newline at end of file +} diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart new file mode 100644 index 00000000..73a56d9b --- /dev/null +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -0,0 +1,125 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_month_data_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_week_data_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:charts_flutter/flutter.dart' as charts; +import '../../../locator.dart'; + +class H2OViewModel extends BaseViewModel { + + H2OService _h2OService = locator(); + + List userProgressForWeekDataSeries; + List userProgressForMonthDataSeries; + + UserProgressForTodayDataModel get userProgressData { + if (_h2OService.userProgressForTodayDataList.length != 0) + return _h2OService.userProgressForTodayDataList[0]; + return null; + } + + + Future getUserProgressForTodayData() async { + // if(_h2OService.userProgressForTodayDataList.length==0){ + setState(ViewState.Busy); + await _h2OService.getUserProgressForTodayData(); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getUserProgressForWeekData() async { + setState(ViewState.Busy); + await _h2OService.getUserProgressForWeekData(); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.Error); + } else { + userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + setState(ViewState.Idle); + } + } + + Future getUserProgressForMonthData() async { + setState(ViewState.Busy); + await _h2OService.getUserProgressForMonthData(); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.Error); + } else { + userProgressForMonthDataSeries = createUserProgressForMonthDataSeries(); + setState(ViewState.Idle); + } + } + + + List> createUserProgressForWeekDataSeries() { + List globalData = [ + ]; + _h2OService.userProgressForWeekDataList.forEach(( + UserProgressForWeekDataModel data) { + globalData.add(new ChartSeries(data.dayName, data.percentageConsumed)); + }); + return [ + new charts.Series( + id: 'Global Revenue', + domainFn: (ChartSeries sales, _) => sales.y, + measureFn: (ChartSeries sales, _) => sales.x, + data: globalData, + ), + ]; + } + + List> createUserProgressForMonthDataSeries() { + List globalData = [ + ]; + _h2OService.userProgressForMonthDataList.forEach(( + UserProgressForMonthDataModel data) { + globalData.add(new ChartSeries(data.monthName, data.percentageConsumed)); + }); + return [ + new charts.Series( + id: 'Global Revenue', + domainFn: (ChartSeries sales, _) => sales.y, + measureFn: (ChartSeries sales, _) => sales.x, + data: globalData, + ), + ]; + } + + + Future insertUserActivity( + InsertUserActivityRequestModel insertUserActivityRequestModel) async { + setState(ViewState.BusyLocal); + insertUserActivityRequestModel.mobileNumber = + user.mobileNumber.substring(1); + insertUserActivityRequestModel.identificationNo = + user.patientIdentificationNo; + + await _h2OService.insertUserActivity(insertUserActivityRequestModel); + if (_h2OService.hasError) { + error = _h2OService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + +} + + +/// Sample ordinal data type. +class ChartSeries { + final String y; + final int x; + + ChartSeries(this.y, this.x); +} diff --git a/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart new file mode 100644 index 00000000..1972e08f --- /dev/null +++ b/lib/core/viewModels/all_habib_medical_services/e_referral_view_model.dart @@ -0,0 +1,91 @@ +import 'dart:core'; + +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/e_referral_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class EReferralViewModel extends BaseViewModel { + EReferralService _eReferralService = locator(); + + List get relationTypes => + _eReferralService.relationTypes; + List get allCities => _eReferralService.allCities; + List get allReferral => _eReferralService.allReferral; + + + + void getRelationTypes() async { + setState(ViewState.Busy); + await _eReferralService.getRelationTypes(); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.Error); + } else{ + setState(ViewState.Idle); + } + } + void getAllCities() async { + setState(ViewState.Busy); + await _eReferralService.getAllCities(); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.Error); + } else{ + setState(ViewState.Idle); + } + } + + void sendActivationCodeForEReferral(SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel) async { + setState(ViewState.BusyLocal); + await _eReferralService.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.ErrorLocal); + } else{ + setState(ViewState.Idle); + } + } + + checkActivationCodeForEReferral(CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel) async { + setState(ViewState.BusyLocal); + await _eReferralService.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.ErrorLocal); + } else{ + setState(ViewState.Idle); + } + } + + void createEReferral( + CreateEReferralRequestModel createEReferralRequestModel) async { + setState(ViewState.BusyLocal); + await _eReferralService.createEReferral(createEReferralRequestModel); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + getEReferrals(SearchEReferralRequestModel searchEReferralRequestModel) async { + setState(ViewState.BusyLocal); + await _eReferralService.getEReferrals(searchEReferralRequestModel); + if (_eReferralService.hasError) { + error = _eReferralService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 3d7122bd..7e16d22d 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -1,9 +1,12 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; +import '../../locator.dart'; + class BaseViewModel extends ChangeNotifier { ViewState _state = ViewState.Idle; bool isInternetConnection = true; diff --git a/lib/core/viewModels/blooddonation/blood_details_view_model.dart b/lib/core/viewModels/blooddonation/blood_details_view_model.dart new file mode 100644 index 00000000..a6b341cf --- /dev/null +++ b/lib/core/viewModels/blooddonation/blood_details_view_model.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class BloodDeatailsViewModel extends BaseViewModel{ + + + BloodDetailsService _bloodDetailsService =locator(); + List get BloodDetailsModelList => _bloodDetailsService.BloodModelList;//_bloodDonationService.CitiesModelList; + + + Future getBlood() async { + setState(ViewState.Busy); + await _bloodDetailsService .getAllBloodOrders();; + + if (_bloodDetailsService.hasError) { + error = _bloodDetailsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + + +} \ No newline at end of file diff --git a/lib/core/viewModels/blooddonation/booddonation_view_model.dart b/lib/core/viewModels/blooddonation/booddonation_view_model.dart new file mode 100644 index 00000000..b9c13c57 --- /dev/null +++ b/lib/core/viewModels/blooddonation/booddonation_view_model.dart @@ -0,0 +1,24 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class BloodDonationViewModel extends BaseViewModel{ + + + + BloodDonationService _bloodDonationService =locator(); + List get CitiesModelList => _bloodDonationService.CitiesModelList; + Future getCities() async { + setState(ViewState.Busy); + await _bloodDonationService.getAllCitiesOrders(); + // getHospitals(); + if (_bloodDonationService.hasError) { + error = _bloodDonationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart new file mode 100644 index 00000000..26355bd7 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/add_new_child_view_model.dart @@ -0,0 +1,28 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + + +class AddNewChildViewModel extends BaseViewModel{ + + CreteNewBabyService _creteNewBabyService = locator(); + + + + List get creteNewBabyModelList=> _creteNewBabyService.createNewBabyModelList; + getNewBabyOrders({ CreateNewBaby newChild}) async { + setState(ViewState.Busy); + + await _creteNewBabyService.getCreateNewBabyOrders(newChild: newChild); + + if ( _creteNewBabyService.hasError) { + error = _creteNewBabyService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + +} diff --git a/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart new file mode 100644 index 00000000..e6a8ca60 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/child_vaccines_view_model.dart @@ -0,0 +1,29 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; + +import 'package:diplomaticquarterapp/core/service/childvaccines/child_vaccines_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + +class ChildVaccinesViewModel extends BaseViewModel{ + + + ChildVaccinesService _childVaccinesService = locator(); + + + + List get babyInformationModelList=> _childVaccinesService.babyInformationModelList;//BabyInformationModelList; + getBabyInformatioRequestOrders() async { + setState(ViewState.Busy); + + await _childVaccinesService.getAllBabyInformationOrders(); + + if (_childVaccinesService.hasError) { + error = _childVaccinesService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + +} \ No newline at end of file diff --git a/lib/core/viewModels/child_vaccines/user_information_view_model.dart b/lib/core/viewModels/child_vaccines/user_information_view_model.dart new file mode 100644 index 00000000..c362ef73 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/user_information_view_model.dart @@ -0,0 +1,25 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/user_information_service.dart'; +import '../../../locator.dart'; +import '../base_view_model.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; + +class UserInformationViewModel extends BaseViewModel { + UserInformationService _userInformationService = + locator(); + + List get userInformationModelList => + _userInformationService.userInformationModelList; + + getUserInformatioRequestOrders() async { + setState(ViewState.Busy); + + await _userInformationService.getUserInformationOrders(); + + if (_userInformationService.hasError) { + error = _userInformationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart new file mode 100644 index 00000000..3b72dd50 --- /dev/null +++ b/lib/core/viewModels/child_vaccines/vaccination_table_view_model.dart @@ -0,0 +1,30 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart'; +import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart'; + +import '../../../locator.dart'; +import '../base_view_model.dart'; + + +class VaccinationTableViewModel extends BaseViewModel{ + + VaccinationTableService _creteVaccinationTableService = locator(); + + // String get creteVaccinationTableContent => _creteVaccinationTableService.userAgreementContent; + //String get userAgreementContent => _creteNewBabyService.v//_reportsService.userAgreementContent; + List get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;//.createNewBabyModelList; + getCreateVaccinationTable() async { + setState(ViewState.Busy); + + await _creteVaccinationTableService.getCreateVaccinationTableOrders();//getCreateNewBabyOrders(); + + if ( _creteVaccinationTableService.hasError) { + error = _creteVaccinationTableService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + +} diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index 350e9d89..b110edcb 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -1,8 +1,12 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart'; import 'package:diplomaticquarterapp/core/service/hospital_service.dart'; import 'package:diplomaticquarterapp/core/service/medical/my_balance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; @@ -20,6 +24,15 @@ class MyBalanceViewModel extends BaseViewModel { List get patientAdvanceBalanceAmountList => _myBalanceService.patientAdvanceBalanceAmountList; + //======================== + BloodDonationService _bloodDonationService =locator(); + List get CitiesModelList => _bloodDonationService.CitiesModelList; + BloodDetailsService _bloodDetailsService =locator(); + List get BloodDetailsModelList => _bloodDetailsService.BloodModelList;//_bloodDonationService.CitiesModelList; + + + //=========================== + double get totalAdvanceBalanceAmount => _myBalanceService.totalAdvanceBalanceAmount; @@ -55,6 +68,28 @@ class MyBalanceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + //============== + Future getCities() async { + setState(ViewState.Busy); + await _bloodDonationService.getAllCitiesOrders(); + // getHospitals(); + if (_bloodDonationService.hasError) { + error = _bloodDonationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future getBlood() async { + setState(ViewState.Busy); + await _bloodDetailsService .getAllBloodOrders();; + + if (_bloodDetailsService.hasError) { + error = _bloodDetailsService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + //=============== Future getPatientInfoByPatientID({String id}) async { setState(ViewState.Busy); diff --git a/lib/locator.dart b/lib/locator.dart index 06db861c..46b97fce 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,9 +1,20 @@ +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/service/qr_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/AlHabibMedicalService/e_referral_service.dart'; +import 'core/service/AuthenticatedUserObject.dart'; import 'core/service/appointment_rate_service.dart'; +import 'core/service/blood/blood_details_servies.dart'; +import 'core/service/blood/blood_donation_service.dart'; +import 'core/service/childvaccines/add_new_child_service.dart'; +import 'core/service/childvaccines/child_vaccines_service.dart'; +import 'core/service/childvaccines/user_information_service.dart'; +import 'core/service/childvaccines/vaccination_table_service.dart'; import 'core/service/contactus/finadus_service.dart'; import 'core/service/contactus/livechat_service.dart'; import 'core/service/dashboard_service.dart'; @@ -27,7 +38,13 @@ import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; +import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; +import 'core/viewModels/blooddonation/blood_details_view_model.dart'; +import 'core/viewModels/blooddonation/booddonation_view_model.dart'; +import 'core/viewModels/child_vaccines/add_new_child_view_model.dart'; +import 'core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'core/viewModels/child_vaccines/vaccination_table_view_model.dart'; import 'core/viewModels/contactus/findus_view_model.dart'; import 'core/viewModels/contactus/livechat_view_model.dart'; import 'core/viewModels/er/am_request_view_model.dart'; @@ -65,6 +82,7 @@ GetIt locator = GetIt.instance; ///di void setupLocator() { /// Services + locator.registerLazySingleton(() => AuthenticatedUserObject()); locator.registerLazySingleton(() => HospitalService()); locator.registerLazySingleton(() => PharmacyService()); locator.registerLazySingleton(() => MyDoctorService()); @@ -84,6 +102,9 @@ void setupLocator() { locator.registerLazySingleton(() => ReportsMonthlyService()); locator.registerLazySingleton(() => ErService()); locator.registerLazySingleton(() => AmService()); + locator.registerLazySingleton(() => EReferralService()); + + locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); locator.registerLazySingleton(() => BloodSugarService()); @@ -95,6 +116,15 @@ void setupLocator() { locator.registerLazySingleton(() => AllergiesService()); locator.registerLazySingleton(() => FindusService()); locator.registerLazySingleton(() => LiveChatService()); + locator.registerLazySingleton(() => H2OService()); + + locator.registerLazySingleton(() => BloodDonationService()); + locator.registerLazySingleton(() => BloodDetailsService()); + locator.registerLazySingleton(() => ChildVaccinesService()); + locator.registerLazySingleton(() => UserInformationService()); + locator.registerLazySingleton(() => CreteNewBabyService()); + locator.registerLazySingleton(() => VaccinationTableService()); + /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -117,8 +147,19 @@ void setupLocator() { locator.registerFactory(() => AmRequestViewModel()); locator.registerFactory(() => PatientSickLeaveViewMode()); locator.registerFactory(() => MyBalanceViewModel()); + locator.registerFactory(() => EReferralViewModel()); locator.registerFactory(() => FindusViewModel()); locator.registerFactory(() => LiveChatViewModel()); + locator.registerFactory(() => BloodDonationViewModel()); + locator.registerFactory(() => BloodDeatailsViewModel()); + locator.registerFactory(() => ChildVaccinesViewModel()); + locator.registerFactory(() => UserInformationViewModel()); + locator.registerFactory(() => VaccinationTableViewModel()); + + + + locator.registerFactory(() => AddNewChildViewModel()); + locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); locator.registerFactory(() => BloodPressureViewMode()); diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart new file mode 100644 index 00000000..5787af66 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart @@ -0,0 +1,81 @@ + + +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart'; +import 'package:flutter/material.dart'; + +import 'new_e_referral_step_three_page.dart'; +import 'new_e_referral_step_two_page.dart'; + +class StartIndexForNewEReferral extends StatefulWidget { + + StartIndexForNewEReferral(); + + @override + _StartIndexForNewEReferralState createState() => + _StartIndexForNewEReferralState(); +} + +class _StartIndexForNewEReferralState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 1; + int pageSelected = 2; + + + CreateEReferralRequestModel createEReferralRequestModel = new CreateEReferralRequestModel(); + + @override + void initState() { + super.initState(); + _controller = new PageController(); + } + + @override + void dispose() { + super.dispose(); + } + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + NewEReferralStepOnePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + ), + NewEReferralStepTowPage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + + ), + NewEReferralStepThreePage( + changePageViewIndex: changePageViewIndex, + createEReferralRequestModel: createEReferralRequestModel, + + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart new file mode 100644 index 00000000..6460de03 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart @@ -0,0 +1,308 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/send_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class NewEReferralStepOnePage extends StatefulWidget { + final CreateEReferralRequestModel createEReferralRequestModel; + final Function changePageViewIndex; + + const NewEReferralStepOnePage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + + @override + _NewEReferralStepOnePageState createState() => _NewEReferralStepOnePageState(); +} + +class _NewEReferralStepOnePageState extends State { + TextEditingController _nameTextController = TextEditingController(); + TextEditingController _mobileTextController = TextEditingController(); + GetAllRelationshipTypeResponseModel _selectedRelation; + String email; + AuthenticatedUser authenticatedUser; + GetAllSharedRecordsByStatusList selectedPatientFamily; + AdvanceModel advanceModel = AdvanceModel(); + + // todo create a model for Country + // todo use country from the json + dynamic _selectedCountry = { + "name": "Saudi Arabia", + "name_ar": "المملكة العربية السعودية", + "code": "+966", + "countryCode": "SA", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + void showSMSDialog() { + showDialog( + context: context, + barrierDismissible: false, + child: EReferralConfirmSMSDialog( + phoneNumber: _selectedCountry['code']+_mobileTextController.text, + onSucces: (){ + Navigator.of(context).pop(); + widget.changePageViewIndex(1); + widget.createEReferralRequestModel.requesterName=_nameTextController.text; + widget.createEReferralRequestModel.requesterContactNo = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; + widget.createEReferralRequestModel.requesterRelationship=_selectedRelation.iD; + + + } + + + ), + ).then((value) { + print("dialog dismissed"); + print(value); + if (value != null && value) { + + } + }); + } + return BaseView( + onModelReady: (model) => model.getRelationTypes(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Center( + child: Texts( +// TranslationBase.of(context).advancePaymentLabel, + "Referral requester information", + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Enter Referral Requester Name*", + controller: _nameTextController, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectCountryTypeDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getCountryName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + MobileNumberTextFiled( + controller: _mobileTextController, + code: _selectedCountry == null + ? "11" + : _selectedCountry["code"], + ), + SizedBox( + height: 12, + ), + Center( + child: Texts( +// TranslationBase.of(context).advancePaymentLabel, + "Requester Relationship", + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectRelationTypeDialog( + model.relationTypes), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getRelationName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + ], + ), + ), + ), + ), + ), + bottomSheet: Container( + height: MediaQuery + .of(context) + .size + .height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(9), + child: SecondaryButton( + textColor: Colors.white, + label: "Next", + onTap: () async { + SendActivationCodeForEReferralRequestModel sendActivationCodeForEReferralRequestModel = + SendActivationCodeForEReferralRequestModel( + zipCode: _selectedCountry['code'], + patientMobileNumber: int.parse( + _mobileTextController.text),); + await model.sendActivationCodeForEReferral(sendActivationCodeForEReferralRequestModel); + + showSMSDialog(); + }, + loading: model.state == ViewState.BusyLocal, + disabled: + _nameTextController.text.isEmpty || + _selectedRelation == null || + _mobileTextController.text.isEmpty, + ), + ))); + + + } + + void confirmSelectRelationTypeDialog( + List relations) { + showDialog( + context: context, + child: SelectRelationTypeDialog( + relationTypes: relations, + selectedRelation: _selectedRelation, + onValueSelected: (value) { + setState(() { + _selectedRelation = value; + }); + }, + ), + ); + } + + void confirmSelectCountryTypeDialog() { + showDialog( + context: context, + child: SelectCountryDialog( + selectedCountry: _selectedCountry, + onValueSelected: (value) { + setState(() { + _selectedCountry = value; + }); + }, + ), + ); + } + + String getRelationName() { + if (_selectedRelation != null) + return _selectedRelation.text; + else + return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; + } + + String getCountryName() { + if (_selectedCountry != null) + return _selectedCountry["name"]; + else + return "Country"; + } +} + +class MobileNumberTextFiled extends StatelessWidget { + const MobileNumberTextFiled({ + Key key, + this.controller, + this.code + }) : super(key: key); + + + final TextEditingController controller; + final String code; + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), color: Colors.white), + child: Row(children: [ + Expanded( + flex: 1, + child: Icon( + Icons.phone, + color: Colors.red, + )), + Expanded( + flex: 1, + child: Text( + code.toString(), + overflow: TextOverflow.clip, + )), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(5), + child: TextField( + controller: controller, + keyboardType: TextInputType.phone, + decoration: InputDecoration( + border: InputBorder.none, hintText: '5xxxxxxxx'), + ), + ), + ) + ]), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart new file mode 100644 index 00000000..d84b9d61 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_three_page.dart @@ -0,0 +1,427 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import '../dialogs/select_city_dialog.dart'; + +class NewEReferralStepThreePage extends StatefulWidget { + final CreateEReferralRequestModel createEReferralRequestModel; + final Function changePageViewIndex; + + const NewEReferralStepThreePage( + {Key key, this.createEReferralRequestModel, this.changePageViewIndex}) + : super(key: key); + + @override + _NewEReferralStepThreePageState createState() => + _NewEReferralStepThreePageState(); +} + +class _NewEReferralStepThreePageState extends State { + TextEditingController _nameTextController = TextEditingController(); + TextEditingController _mobileTextController = TextEditingController(); + GetAllCitiesResponseModel _selectedCity; + + GetAllSharedRecordsByStatusList selectedPatientFamily; + List medicalReportImages = []; + List insuredPatientImages = []; + + bool isPatientInsured = false; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Center( + child: Texts( +// TranslationBase.of(context).advancePaymentLabel, + "Other details", + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 9), + child: Texts( + "Medical Report", + color: Colors.grey, + fontSize: 17, + ), + ), + ], + ), + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, + (String image) { + setState(() { + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image ); + medicalReportImages.add(eReferralAttachment); + }); + }); + }, + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Center( + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Icon(Icons.attach_file), + Texts( + 'selected attachment', + variant: 'bodyText', + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + SizedBox( + height: 12, + ), + ...List.generate( + medicalReportImages.length, + (index) => Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Icon( + FontAwesomeIcons.paperclip), + SizedBox( + width: 8, + ), + Texts( + medicalReportImages[index].fileName, + ), + ], + ), + InkWell( + onTap: () { + setState(() { + medicalReportImages + .remove(medicalReportImages[index]); + }); + }, + child: Icon( + FontAwesomeIcons.trashAlt, + color: Colors.red[300], + )) + ], + ), + )), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + padding: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 9), + child: Texts( + "Preferred Branch", + color: Colors.grey, + fontSize: 17, + ), + ), + ], + ), + InkWell( + onTap: () => + confirmSelectCityDialog(model.allCities), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts(getRelationName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + ], + ), + ), + SizedBox( + height: 12, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + Checkbox( + value: isPatientInsured, + activeColor: Colors.black38, + onChanged: (bool newValue) { + setState(() { + isPatientInsured = newValue; + }); + }), + Padding( + padding: const EdgeInsets.all(20.0), + child: Texts( + "Insured Patient", + fontSize: 17, + ), + ), + ], + ), + ], + ), + ], + ), + ), + if(isPatientInsured) + SizedBox( + height: 12, + ), + Opacity( + opacity: isPatientInsured?1:0, + child: Container( + padding: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + child: Column( + children: [ + + InkWell( + onTap: () { + ImageOptions.showImageOptions(context, + (String image) { + setState(() { + + EReferralAttachment eReferralAttachment = new EReferralAttachment(fileName: 'image ${ medicalReportImages.length +1}.png',base64String: image ); + + insuredPatientImages=[eReferralAttachment]; + }); + }); + }, + child: Container( + margin: EdgeInsets.only( + left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Center( + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Icon(Icons.attach_file), + Texts( + 'selected attachment', + variant: 'bodyText', + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + SizedBox( + height: 12, + ), + ...List.generate( + insuredPatientImages.length, + (index) => Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Icon( + FontAwesomeIcons.paperclip), + SizedBox( + width: 8, + ), + Texts( + 'image ${index + 1}.png', + ), + ], + ), + InkWell( + onTap: () { + setState(() { + insuredPatientImages + .remove(insuredPatientImages[index]); + }); + }, + child: Icon( + FontAwesomeIcons.trashAlt, + color: Colors.red[300], + )) + ], + ), + )), + ], + ), + ), + ), + SizedBox( + height: 12, + ), + ], + ), + ), + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(9), + child: SecondaryButton( + textColor: Colors.white, + label: "Submit", + onTap: () async { + this.widget.createEReferralRequestModel.medicalReportAttachment = medicalReportImages; + this.widget.createEReferralRequestModel.insuranceCardAttachment = insuredPatientImages.length !=0?insuredPatientImages[0]:null; + this.widget.createEReferralRequestModel.isInsuredPatient = isPatientInsured; + // ToDo make the preferred Branch info dynamic + this.widget.createEReferralRequestModel.preferredBranchCode = 15; + this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; + + + + // this.widget.createEReferralRequestModel.fullName= ""; + this.widget.createEReferralRequestModel.otherRelationship= ""; + // this.widget.createEReferralRequestModel.; + // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; + // this.widget.createEReferralRequestModel. preferredBranchName= "Arryan Hospital"; + + await model.createEReferral(this.widget.createEReferralRequestModel); + }, + loading: model.state == ViewState.BusyLocal, + disabled: medicalReportImages.length == 0 , + ), + ))); + } + + void confirmSelectCityDialog(List cities) { + showDialog( + context: context, + child: SelectCityDialog( + cities: cities, + selectedCity: _selectedCity, + onValueSelected: (value) { + setState(() { + _selectedCity = value; + }); + }, + ), + ); + } + + + String getRelationName() { + if (_selectedCity != null) + return _selectedCity.description; + else + return "Select Relationship" /*TranslationBase.of(context).selectHospital*/; + } + +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart new file mode 100644 index 00000000..5f85fe12 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_two_page.dart @@ -0,0 +1,294 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/create_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import '../dialogs/select_city_dialog.dart'; + + +class NewEReferralStepTowPage extends StatefulWidget { + final CreateEReferralRequestModel createEReferralRequestModel; + final Function changePageViewIndex; + + const NewEReferralStepTowPage({Key key, this.createEReferralRequestModel, this.changePageViewIndex}) : super(key: key); + + @override + _NewEReferralStepTowPageState createState() => _NewEReferralStepTowPageState(); +} + +class _NewEReferralStepTowPageState extends State { + TextEditingController _patientNameTextController = TextEditingController(); + TextEditingController _patientIdentificationTextController = TextEditingController(); + TextEditingController _mobileTextController = TextEditingController(); + GetAllCitiesResponseModel _selectedCity ; + GetAllSharedRecordsByStatusList selectedPatientFamily; + + // todo create a model for Country + // todo use country from the json + dynamic _selectedCountry = { + "name": "Saudi Arabia", + "name_ar": "المملكة العربية السعودية", + "code": "+966", + "countryCode": "SA", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }; + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getAllCities(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Center( + child: Texts( +// TranslationBase.of(context).advancePaymentLabel, + "Patient information", + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Enter Identification Number", + controller: _patientIdentificationTextController, + keyboardType:TextInputType.number , + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Enter Patient Name", + controller: _patientNameTextController, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectCountryTypeDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getCountryName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + MobileNumberTextFiled( + controller: _mobileTextController, + code: _selectedCountry == null + ? "11" + : _selectedCountry["code"], + ), + SizedBox( + height: 12, + ), + Center( + child: Texts( +// TranslationBase.of(context).advancePaymentLabel, + "Where the patient located", + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectCityDialog( + model.allCities), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getRelationName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + + SizedBox( + height: 12, + ), + ], + ), + ), + ), + ), + ), + bottomSheet: Container( + height: MediaQuery + .of(context) + .size + .height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(9), + child: SecondaryButton( + textColor: Colors.white, + label: "Next", + onTap: () async { + this.widget.changePageViewIndex(2); + this.widget.createEReferralRequestModel.identificationNo = int.parse( _patientIdentificationTextController.text); + this.widget.createEReferralRequestModel.fullName = _patientNameTextController.text; + this.widget.createEReferralRequestModel.patientMobileNumber = _selectedCountry['code'].toString().substring(1)+_mobileTextController.text; + this.widget.createEReferralRequestModel.cityCode = _selectedCity.iD.toString(); + this.widget.createEReferralRequestModel.cityName = _selectedCity.description; + + + }, + loading: model.state == ViewState.BusyLocal, + disabled: + _patientNameTextController.text.isEmpty || _patientIdentificationTextController.text.isEmpty|| + _selectedCity == null || + _mobileTextController.text.isEmpty, + ), + ))); + + + } + + void confirmSelectCityDialog( + List cities) { + showDialog( + context: context, + child: SelectCityDialog( + cities: cities, + selectedCity: _selectedCity, + onValueSelected: (value) { + setState(() { + _selectedCity = value; + }); + }, + ), + ); + } + + void confirmSelectCountryTypeDialog() { + showDialog( + context: context, + child: SelectCountryDialog( + selectedCountry: _selectedCountry, + onValueSelected: (value) { + setState(() { + _selectedCountry = value; + }); + }, + ), + ); + } + + String getRelationName() { + if (_selectedCity != null) + return _selectedCity.description; + else + return "Select City" /*TranslationBase.of(context).selectHospital*/; + } + + String getCountryName() { + if (_selectedCountry != null) + return _selectedCountry["name"]; + else + return "Country"; + } +} + +class MobileNumberTextFiled extends StatelessWidget { + const MobileNumberTextFiled({ + Key key, + this.controller, + this.code + }) : super(key: key); + + + final TextEditingController controller; + final String code; + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), color: Colors.white), + child: Row(children: [ + Expanded( + flex: 1, + child: Icon( + Icons.phone, + color: Colors.red, + )), + Expanded( + flex: 1, + child: Text( + code.toString(), + overflow: TextOverflow.clip, + )), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(5), + child: TextField( + controller: controller, + keyboardType: TextInputType.phone, + decoration: InputDecoration( + border: InputBorder.none, hintText: 'Mobile No'), + ), + ), + ) + ]), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart new file mode 100644 index 00000000..2fb7e41a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_city_dialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_cities_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectCityDialog extends StatefulWidget { + final List cities; + final Function(GetAllCitiesResponseModel) onValueSelected; + GetAllCitiesResponseModel selectedCity; + + SelectCityDialog( + {Key key, this.cities, this.onValueSelected, this.selectedCity}); + + @override + _SelectCityDialogState createState() => _SelectCityDialogState(); +} + +class _SelectCityDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedCity = widget.selectedCity ?? widget.cities[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.cities.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedCity = widget.cities[index]; + }); + }, + child: ListTile( + title: Text(widget.cities[index].description), + leading: Radio( + value: widget.cities[index], + groupValue: widget.selectedCity, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedCity = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedCity); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart new file mode 100644 index 00000000..f714bfb9 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart @@ -0,0 +1,1584 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectCountryDialog extends StatefulWidget { + final Function(dynamic) onValueSelected; + dynamic selectedCountry; + + SelectCountryDialog( + {Key key, /*this.relationTypes,*/ this.onValueSelected, this.selectedCountry}); + + @override + _SelectCountryDialogState createState() => _SelectCountryDialogState(); +} + +class _SelectCountryDialogState extends State { + + // todo create a model for Country + List countryList = + [ + { + "name": "Saudi Arabia", + "name_ar":"المملكة العربية السعودية", + "code": "+966", + "countryCode": "SA", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }, + { + "name": "United Arab Emirates", + "name_ar":"الإمارات العربية المتحدة", + "code": "+971", + "countryCode": "AE", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }, + { + "name": "Bahrain", + "name_ar":"البحرين", + "code": "+973", + "countryCode": "BH", + "maxLength": 8 + }, + { + "name": "Kuwait", + "name_ar":"الكويت", + "code": "+965", + "countryCode": "KW" + }, + { + "name": "Afghanistan", + "name_ar":"أفغانستان", + "code": "+93", + "countryCode": "AF" + }, + { + "name": "Aland Islands", + "name_ar":"جزر آلاند", + "code": "+358", + "countryCode": "AX" + }, + { + "name": "Albania", + "name_ar":"ألبانيا", + "code": "+355", + "countryCode": "AL" + }, + { + "name": "Algeria", + "name_ar":"الجزائر", + "code": "+213", + "countryCode": "DZ" + }, + { + "name": "AmericanSamoa", + "name_ar":"ساموا الأمريكية", + "code": "+1 684", + "countryCode": "AS" + }, + { + "name": "Andorra", + "name_ar":"أندورا", + "code": "+376", + "countryCode": "AD" + }, + { + "name": "Angola", + "name_ar":"أنغولا", + "code": "+244", + "countryCode": "AO" + }, + { + "name": "Anguilla", + "name_ar":"أنغيلا", + "code": "+1 264", + "countryCode": "AI" + }, + { + "name": "Antarctica", + "name_ar":"القارة القطبية الجنوبية", + "code": "+672", + "countryCode": "AQ" + }, + { + "name": "Antigua and Barbuda", + "name_ar":"أنتيغوا وبربودا", + "code": "+1268", + "countryCode": "AG" + }, + { + "name": "Argentina", + "name_ar":"الأرجنتين", + "code": "+54", + "countryCode": "AR" + }, + { + "name": "Armenia", + "name_ar":"أرمينيا", + "code": "+374", + "countryCode": "AM" + }, + { + "name": "Aruba", + "name_ar":"أروبا", + "code": "+297", + "countryCode": "AW" + }, + { + "name": "Australia", + "name_ar":"أستراليا", + "code": "+61", + "countryCode": "AU" + }, + { + "name": "Austria", + "name_ar":"النمسا", + "code": "+43", + "countryCode": "AT" + }, + { + "name": "Azerbaijan", + "name_ar":"أذربيجان", + "code": "+994", + "countryCode": "AZ" + }, + { + "name": "Bahamas", + "name_ar":"الباهاما", + "code": "+1 242", + "countryCode": "BS" + }, + { + "name": "Bangladesh", + "name_ar":"بنغلاديش", + "code": "+880", + "countryCode": "BD" + }, + { + "name": "Barbados", + "name_ar":"بربادوس", + "code": "+1 246", + "countryCode": "BB" + }, + { + "name": "Belarus", + "name_ar":"روسيا البيضاء", + "code": "+375", + "countryCode": "BY" + }, + { + "name": "Belgium", + "name_ar":"بلجيكا", + "code": "+32", + "countryCode": "BE" + }, + { + "name": "Belize", + "name_ar":"بليز", + "code": "+501", + "countryCode": "BZ" + }, + { + "name": "Benin", + "name_ar":"بنين", + "code": "+229", + "countryCode": "BJ" + }, + { + "name": "Bermuda", + "name_ar":"برمودا", + "code": "+1 441", + "countryCode": "BM" + }, + { + "name": "Bhutan", + "name_ar":"بوتان", + "code": "+975", + "countryCode": "BT" + }, + { + "name": "Bolivia, Plurinational State of", + "name_ar":"دولة بوليفيا المتعددة القوميات", + "code": "+591", + "countryCode": "BO" + }, + { + "name": "Bosnia and Herzegovina", + "name_ar":"البوسنة والهرسك", + "code": "+387", + "countryCode": "BA" + }, + { + "name": "Botswana", + "name_ar":"بوتسوانا", + "code": "+267", + "countryCode": "BW" + }, + { + "name": "Brazil", + "name_ar":"البرازيل", + "code": "+55", + "countryCode": "BR" + }, + { + "name": "British Indian Ocean Territory", + "name_ar":"إقليم المحيط البريطاني الهندي", + "code": "+246", + "countryCode": "IO" + }, + { + "name": "Brunei Darussalam", + "name_ar":"بروناي دار السلام", + "code": "+673", + "countryCode": "BN" + }, + { + "name": "Bulgaria", + "name_ar":"بلغاريا", + "code": "+359", + "countryCode": "BG" + }, + { + "name": "Burkina Faso", + "name_ar":"بوركينا فاسو", + "code": "+226", + "countryCode": "BF" + }, + { + "name": "Burundi", + "name_ar":"بوروندي", + "code": "+257", + "countryCode": "BI" + }, + { + "name": "Cambodia", + "name_ar":"كمبوديا", + "code": "+855", + "countryCode": "KH" + }, + { + "name": "Cameroon", + "name_ar":"الكاميرون", + "code": "+237", + "countryCode": "CM" + }, + { + "name": "Canada", + "name_ar":"كندا", + "code": "+1", + "countryCode": "CA" + }, + { + "name": "Cape Verde", + "name_ar":"الرأس الأخضر", + "code": "+238", + "countryCode": "CV" + }, + { + "name": "Cayman Islands", + "name_ar":"جزر كايمان", + "code": "+345", + "countryCode": "KY" + }, + { + "name": "Central African Republic", + "name_ar":"جمهورية افريقيا الوسطى", + "code": "+236", + "countryCode": "CF" + }, + { + "name": "Chad", + "name_ar":"تشاد", + "code": "+235", + "countryCode": "TD" + }, + { + "name": "Chile", + "name_ar":"تشيلي", + "code": "+56", + "countryCode": "CL" + }, + { + "name": "China", + "name_ar":"الصين", + "code": "+86", + "countryCode": "CN" + }, + { + "name": "Christmas Island", + "name_ar":"جزيرة الكريسماس", + "code": "+61", + "countryCode": "CX" + }, + { + "name": "Cocos (Keeling) Islands", + "name_ar":"جزر كوكوس كيلينغ", + "code": "+61", + "countryCode": "CC" + }, + { + "name": "Colombia", + "name_ar":"كولومبيا", + "code": "+57", + "countryCode": "CO" + }, + { + "name": "Comoros", + "name_ar":"جزر القمر", + "code": "+269", + "countryCode": "KM" + }, + { + "name": "Congo", + "name_ar":"الكونغو", + "code": "+242", + "countryCode": "CG" + }, + { + "name": "Congo, The Democratic Republic of the Congo", + "name_ar":"الكونغو ، جمهورية الكونغو الديمقراطية", + "code": "+243", + "countryCode": "CD" + }, + { + "name": "Cook Islands", + "name_ar":"جزر كوك", + "code": "+682", + "countryCode": "CK" + }, + { + "name": "Costa Rica", + "name_ar":"كوستا ريكا", + "code": "+506", + "countryCode": "CR" + }, + { + "name": "Cote d'Ivoire", + "name_ar":"ساحل العاج", + "code": "+225", + "countryCode": "CI" + }, + { + "name": "Croatia", + "name_ar":"كرواتيا", + "code": "+385", + "countryCode": "HR" + }, + { + "name": "Cuba", + "name_ar":"كوبا", + "code": "+53", + "countryCode": "CU" + }, + { + "name": "Cyprus", + "name_ar":"قبرص", + "code": "+357", + "countryCode": "CY" + }, + { + "name": "Czech Republic", + "name_ar":"جمهورية التشيك", + "code": "+420", + "countryCode": "CZ" + }, + { + "name": "Denmark", + "name_ar":"الدنمارك", + "code": "+45", + "countryCode": "DK" + }, + { + "name": "Djibouti", + "name_ar":"جيبوتي", + "code": "+253", + "countryCode": "DJ" + }, + { + "name": "Dominica", + "name_ar":"دومينيكا", + "code": "+1 767", + "countryCode": "DM" + }, + { + "name": "Dominican Republic", + "name_ar":"جمهورية الدومنيكان", + "code": "+1 849", + "countryCode": "DO" + }, + { + "name": "Ecuador", + "name_ar":"الإكوادور", + "code": "+593", + "countryCode": "EC" + }, + { + "name": "Egypt", + "name_ar":"مصر", + "code": "+20", + "countryCode": "EG" + }, + { + "name": "El Salvador", + "name_ar":"السلفادور", + "code": "+503", + "countryCode": "SV" + }, + { + "name": "Equatorial Guinea", + "name_ar":"غينيا الإستوائية", + "code": "+240", + "countryCode": "GQ" + }, + { + "name": "Eritrea", + "name_ar":"إريتريا", + "code": "+291", + "countryCode": "ER" + }, + { + "name": "Estonia", + "name_ar":"استونيا", + "code": "+372", + "countryCode": "EE" + }, + { + "name": "Ethiopia", + "name_ar":"أثيوبيا", + "code": "+251", + "countryCode": "ET" + }, + { + "name": "Falkland Islands (Malvinas)", + "name_ar":"جزر فوكلاند مالفيناس", + "code": "+500", + "countryCode": "FK" + }, + { + "name": "Faroe Islands", + "name_ar":"جزر صناعية", + "code": "+298", + "countryCode": "FO" + }, + { + "name": "Fiji", + "name_ar":"فيجي", + "code": "+679", + "countryCode": "FJ" + }, + { + "name": "Finland", + "name_ar":"فنلندا", + "code": "+358", + "countryCode": "FI" + }, + { + "name": "France", + "name_ar":"فرنسا", + "code": "+33", + "countryCode": "FR" + }, + { + "name": "French Guiana", + "name_ar":"غيانا الفرنسية", + "code": "+594", + "countryCode": "GF" + }, + { + "name": "French Polynesia", + "name_ar":"بولينيزيا الفرنسية", + "code": "+689", + "countryCode": "PF" + }, + { + "name": "Gabon", + "name_ar":"الغابون", + "code": "+241", + "countryCode": "GA" + }, + { + "name": "Gambia", + "name_ar":"غامبيا", + "code": "+220", + "countryCode": "GM" + }, + { + "name": "Georgia", + "name_ar":"جورجيا", + "code": "+995", + "countryCode": "GE" + }, + { + "name": "Germany", + "name_ar":"ألمانيا", + "code": "+49", + "countryCode": "DE" + }, + { + "name": "Ghana", + "name_ar":"غانا", + "code": "+233", + "countryCode": "GH" + }, + { + "name": "Gibraltar", + "name_ar":"جبل طارق", + "code": "+350", + "countryCode": "GI" + }, + { + "name": "Greece", + "name_ar":"اليونان", + "code": "+30", + "countryCode": "GR" + }, + { + "name": "Greenland", + "name_ar":"الأرض الخضراء", + "code": "+299", + "countryCode": "GL" + }, + { + "name": "Grenada", + "name_ar":"غرينادا", + "code": "+1 473", + "countryCode": "GD" + }, + { + "name": "Guadeloupe", + "name_ar":"جوادلوب", + "code": "+590", + "countryCode": "GP" + }, + { + "name": "Guam", + "name_ar":"غوام", + "code": "+1 671", + "countryCode": "GU" + }, + { + "name": "Guatemala", + "name_ar":"غواتيمالا", + "code": "+502", + "countryCode": "GT" + }, + { + "name": "Guernsey", + "name_ar":"غيرنسي", + "code": "+44", + "countryCode": "GG" + }, + { + "name": "Guinea", + "name_ar":"غينيا", + "code": "+224", + "countryCode": "GN" + }, + { + "name": "Guinea-Bissau", + "name_ar":"غينيا بيساو", + "code": "+245", + "countryCode": "GW" + }, + { + "name": "Guyana", + "name_ar":"غيانا", + "code": "+595", + "countryCode": "GY" + }, + { + "name": "Haiti", + "name_ar":"هايتي", + "code": "+509", + "countryCode": "HT" + }, + { + "name": "Holy See (Vatican City State)", + "name_ar":"الكرسي الرسولي دولة الفاتيكان", + "code": "+379", + "countryCode": "VA" + }, + { + "name": "Honduras", + "name_ar":"هندوراس", + "code": "+504", + "countryCode": "HN" + }, + { + "name": "Hong Kong", + "name_ar":"هونج كونج", + "code": "+852", + "countryCode": "HK" + }, + { + "name": "Hungary", + "name_ar":"اليونان", + "code": "+36", + "countryCode": "HU" + }, + { + "name": "Iceland", + "name_ar":"أيسلندا", + "code": "+354", + "countryCode": "IS" + }, + { + "name": "India", + "name_ar":"الهند", + "code": "+91", + "countryCode": "IN" + }, + { + "name": "Indonesia", + "name_ar":"أندونيسيا", + "code": "+62", + "countryCode": "ID" + }, + { + "name": "Iran, Islamic Republic of Persian Gulf", + "name_ar":"جمهورية إيران الإسلامية الخليج الفارسي", + "code": "+98", + "countryCode": "IR" + }, + { + "name": "Iraq", + "name_ar":"العراق", + "code": "+964", + "countryCode": "IQ" + }, + { + "name": "Ireland", + "name_ar":"أيرلندا", + "code": "+353", + "countryCode": "IE" + }, + { + "name": "Isle of Man", + "name_ar":"جزيرة آيل أوف مان", + "code": "+44", + "countryCode": "IM" + }, + { + "name": "Israel", + "name_ar":"إسرائيل", + "code": "+972", + "countryCode": "IL" + }, + { + "name": "Italy", + "name_ar":"إيطاليا", + "code": "+39", + "countryCode": "IT" + }, + { + "name": "Jamaica", + "name_ar":"جامايكا", + "code": "+1 876", + "countryCode": "JM" + }, + { + "name": "Japan", + "name_ar":"اليابان", + "code": "+81", + "countryCode": "JP" + }, + { + "name": "Jersey", + "name_ar":"جيرسي", + "code": "+44", + "countryCode": "JE" + }, + { + "name": "Jordan", + "name_ar":"الأردن", + "code": "+962", + "countryCode": "JO" + }, + { + "name": "Kazakhstan", + "name_ar":"كازاخستان", + "code": "+77", + "countryCode": "KZ" + }, + { + "name": "Kenya", + "name_ar":"كينيا", + "code": "+254", + "countryCode": "KE" + }, + { + "name": "Kiribati", + "name_ar":"كيريباس", + "code": "+686", + "countryCode": "KI" + }, + { + "name": "Korea, Democratic People's Republic of Korea", + "name_ar":"جمهورية كوريا الديمقراطية الشعبية", + "code": "+850", + "countryCode": "KP" + }, + { + "name": "Korea, Republic of South Korea", + "name_ar":"جمهورية كوريا الديمقراطية الشعبية", + "code": "+82", + "countryCode": "KR" + }, + { + "name": "Kyrgyzstan", + "name_ar":"قرغيزستان", + "code": "+996", + "countryCode": "KG" + }, + { + "name": "Laos", + "name_ar":"لاوس", + "code": "+856", + "countryCode": "LA" + }, + { + "name": "Latvia", + "name_ar":"لاتفيا", + "code": "+371", + "countryCode": "LV" + }, + { + "name": "Lebanon", + "name_ar":"لبنان", + "code": "+961", + "countryCode": "LB" + }, + { + "name": "Lesotho", + "name_ar":"ليسوتو", + "code": "+266", + "countryCode": "LS" + }, + { + "name": "Liberia", + "name_ar":"ليبيريا", + "code": "+231", + "countryCode": "LR" + }, + { + "name": "Libyan Arab Jamahiriya", + "name_ar":"الجماهيرية العربية الليبية", + "code": "+218", + "countryCode": "LY" + }, + { + "name": "Liechtenstein", + "name_ar":"ليختنشتاين", + "code": "+423", + "countryCode": "LI" + }, + { + "name": "Lithuania", + "name_ar":"ليتوانيا", + "code": "+370", + "countryCode": "LT" + }, + { + "name": "Luxembourg", + "name_ar":"لوكسمبورغ", + "code": "+352", + "countryCode": "LU" + }, + { + "name": "Macao", + "name_ar":"ماكاو", + "code": "+853", + "countryCode": "MO" + }, + { + "name": "Macedonia", + "name_ar":"مقدونيا", + "code": "+389", + "countryCode": "MK" + }, + { + "name": "Madagascar", + "name_ar":"مدغشقر", + "code": "+261", + "countryCode": "MG" + }, + { + "name": "Malawi", + "name_ar":"مالاوي", + "code": "+265", + "countryCode": "MW" + }, + { + "name": "Malaysia", + "name_ar":"ماليزيا", + "code": "+60", + "countryCode": "MY" + }, + { + "name": "Maldives", + "name_ar":"جزر المالديف", + "code": "+960", + "countryCode": "MV" + }, + { + "name": "Mali", + "name_ar":"مالي", + "code": "+223", + "countryCode": "ML" + }, + { + "name": "Malta", + "name_ar":"مالطا", + "code": "+356", + "countryCode": "MT" + }, + { + "name": "Marshall Islands", + "name_ar":"جزر مارشال", + "code": "+692", + "countryCode": "MH" + }, + { + "name": "Martinique", + "name_ar":"مارتينيك", + "code": "+596", + "countryCode": "MQ" + }, + { + "name": "Mauritania", + "name_ar":"موريتانيا", + "code": "+222", + "countryCode": "MR" + }, + { + "name": "Mauritius", + "name_ar":"موريشيوس", + "code": "+230", + "countryCode": "MU" + }, + { + "name": "Mayotte", + "name_ar":"مايوت", + "code": "+262", + "countryCode": "YT" + }, + { + "name": "Mexico", + "name_ar":"المكسيك", + "code": "+52", + "countryCode": "MX" + }, + { + "name": "Micronesia, Federated States of Micronesia", + "name_ar":"ميكرونيزيا ، ولايات ميكرونيزيا الموحدة", + "code": "+691", + "countryCode": "FM" + }, + { + "name": "Moldova", + "name_ar":"مولدوفا", + "code": "+373", + "countryCode": "MD" + }, + { + "name": "Monaco", + "name_ar":"موناكو", + "code": "+377", + "countryCode": "MC" + }, + { + "name": "Mongolia", + "name_ar":"منغوليا", + "code": "+976", + "countryCode": "MN" + }, + { + "name": "Montenegro", + "name_ar":"الجبل الأسود", + "code": "+382", + "countryCode": "ME" + }, + { + "name": "Montserrat", + "name_ar":"مونتسيرات", + "code": "+1664", + "countryCode": "MS" + }, + { + "name": "Morocco", + "name_ar":"المغرب", + "code": "+212", + "countryCode": "MA" + }, + { + "name": "Mozambique", + "name_ar":"موزمبيق", + "code": "+258", + "countryCode": "MZ" + }, + { + "name": "Myanmar", + "name_ar":"ميانمار", + "code": "+95", + "countryCode": "MM" + }, + { + "name": "Namibia", + "name_ar":"ناميبيا", + "code": "+264", + "countryCode": "NA" + }, + { + "name": "Nauru", + "name_ar":"ناورو", + "code": "+674", + "countryCode": "NR" + }, + { + "name": "Nepal", + "name_ar":"نيبال", + "code": "+977", + "countryCode": "NP" + }, + { + "name": "Netherlands", + "name_ar":"هولندا", + "code": "+31", + "countryCode": "NL" + }, + { + "name": "Netherlands Antilles", + "name_ar":"جزر الأنتيل الهولندية", + "code": "+599", + "countryCode": "AN" + }, + { + "name": "New Caledonia", + "name_ar":"كاليدونيا الجديدة", + "code": "+687", + "countryCode": "NC" + }, + { + "name": "New Zealand", + "name_ar":"نيوزيلندا", + "code": "+64", + "countryCode": "NZ" + }, + { + "name": "Nicaragua", + "name_ar":"نيكاراغوا", + "code": "+505", + "countryCode": "NI" + }, + { + "name": "Niger", + "name_ar":"النيجر", + "code": "+227", + "countryCode": "NE" + }, + { + "name": "Nigeria", + "name_ar":"نيجيريا", + "code": "+234", + "countryCode": "NG" + }, + { + "name": "Niue", + "name_ar":"نيوي", + "code": "+683", + "countryCode": "NU" + }, + { + "name": "Norfolk Island", + "name_ar":"جزيرة نورفولك", + "code": "+672", + "countryCode": "NF" + }, + { + "name": "Northern Mariana Islands", + "name_ar":"جزر مريانا الشمالية", + "code": "+1 670", + "countryCode": "MP" + }, + { + "name": "Norway", + "name_ar":"النرويج", + "code": "+47", + "countryCode": "NO" + }, + { + "name": "Oman", + "name_ar":"سلطنة عمان", + "code": "+968", + "countryCode": "OM" + }, + { + "name": "Pakistan", + "name_ar":"باكستان", + "code": "+92", + "countryCode": "PK" + }, + { + "name": "Palau", + "name_ar":"بالاو", + "code": "+680", + "countryCode": "PW" + }, + { + "name": "Palestinian Territory, Occupied", + "name_ar":"الأراضي الفلسطينية المحتلة", + "code": "+970", + "countryCode": "PS" + }, + { + "name": "Panama", + "name_ar":"بناما", + "code": "+507", + "countryCode": "PA" + }, + { + "name": "Papua New Guinea", + "name_ar":"بابوا غينيا الجديدة", + "code": "+675", + "countryCode": "PG" + }, + { + "name": "Paraguay", + "name_ar":"باراغواي", + "code": "+595", + "countryCode": "PY" + }, + { + "name": "Peru", + "name_ar":"بيرو", + "code": "+51", + "countryCode": "PE" + }, + { + "name": "Philippines", + "name_ar":"الفلبين", + "code": "+63", + "countryCode": "PH" + }, + { + "name": "Pitcairn", + "name_ar":"بيتكيرن", + "code": "+872", + "countryCode": "PN" + }, + { + "name": "Poland", + "name_ar":"بولندا", + "code": "+48", + "countryCode": "PL" + }, + { + "name": "Portugal", + "name_ar":"البرتغال", + "code": "+351", + "countryCode": "PT" + }, + { + "name": "Puerto Rico", + "name_ar":"بورتوريكو", + "code": "+1 939", + "countryCode": "PR" + }, + { + "name": "Qatar", + "name_ar":"دولة قطر", + "code": "+974", + "countryCode": "QA" + }, + { + "name": "Romania", + "name_ar":"رومانيا", + "code": "+40", + "countryCode": "RO" + }, + { + "name": "Russia", + "name_ar":"روسيا", + "code": "+7", + "countryCode": "RU" + }, + { + "name": "Rwanda", + "name_ar":"رواندا", + "code": "+250", + "countryCode": "RW" + }, + { + "name": "Reunion", + "name_ar":"جمع شمل", + "code": "+262", + "countryCode": "RE" + }, + { + "name": "Saint Barthelemy", + "name_ar":"سانت بارتيليمي", + "code": "+590", + "countryCode": "BL" + }, + { + "name": "Saint Helena, Ascension and Tristan Da Cunha", + "name_ar":"سانت هيلانة ، أسنشن وتريستان دا كونها", + "code": "+290", + "countryCode": "SH" + }, + { + "name": "Saint Kitts and Nevis", + "name_ar":"سانت كيتس ونيفيس", + "code": "+1 869", + "countryCode": "KN" + }, + { + "name": "Saint Lucia", + "name_ar":"القديسة لوسيا", + "code": "+1 758", + "countryCode": "LC" + }, + { + "name": "Saint Martin", + "name_ar":"القديس مارتن", + "code": "+590", + "countryCode": "MF" + }, + { + "name": "Saint Pierre and Miquelon", + "name_ar":"سانت بيير وميكلون", + "code": "+508", + "countryCode": "PM" + }, + { + "name": "Saint Vincent and the Grenadines", + "name_ar":"سانت فنسنت وجزر غرينادين", + "code": "+1 784", + "countryCode": "VC" + }, + { + "name": "Samoa", + "name_ar":"ساموا", + "code": "+685", + "countryCode": "WS" + }, + { + "name": "San Marino", + "name_ar":"سان مارينو", + "code": "+378", + "countryCode": "SM" + }, + { + "name": "Sao Tome and Principe", + "name_ar":"ساو تومي وبرينسيبي", + "code": "+239", + "countryCode": "ST" + }, + { + "name": "Senegal", + "name_ar":"السنغال", + "code": "+221", + "countryCode": "SN" + }, + { + "name": "Serbia", + "name_ar":"صربيا", + "code": "+381", + "countryCode": "RS" + }, + { + "name": "Seychelles", + "name_ar":"سيشيل", + "code": "+248", + "countryCode": "SC" + }, + { + "name": "Sierra Leone", + "name_ar":"سيرا ليون", + "code": "+232", + "countryCode": "SL" + }, + { + "name": "Singapore", + "name_ar":"سنغافورة", + "code": "+65", + "countryCode": "SG" + }, + { + "name": "Slovakia", + "name_ar":"سلوفاكيا", + "code": "+421", + "countryCode": "SK" + }, + { + "name": "Slovenia", + "name_ar":"سلوفينيا", + "code": "+386", + "countryCode": "SI" + }, + { + "name": "Solomon Islands", + "name_ar":"جزر سليمان", + "code": "+677", + "countryCode": "SB" + }, + { + "name": "Somalia", + "name_ar":"الصومال", + "code": "+252", + "countryCode": "SO" + }, + { + "name": "South Africa", + "name_ar":"جنوب أفريقيا", + "code": "+27", + "countryCode": "ZA" + }, + { + "name": "South Georgia and the South Sandwich Islands", + "name_ar":"جورجيا الجنوبية وجزر ساندويتش الجنوبية", + "code": "+500", + "countryCode": "GS" + }, + { + "name": "Spain", + "name_ar":"إسبانيا", + "code": "+34", + "countryCode": "ES" + }, + { + "name": "Sri Lanka", + "name_ar":"سيريلانكا", + "code": "+94", + "countryCode": "LK" + }, + { + "name": "Sudan", + "name_ar":"سودان", + "code": "+249", + "countryCode": "SD" + }, + { + "name": "Suriname", + "name_ar":"سورينام", + "code": "+597", + "countryCode": "SR" + }, + { + "name": "Svalbard and Jan Mayen", + "name_ar":"سفالبارد وجان ماين", + "code": "+47", + "countryCode": "SJ" + }, + { + "name": "Swaziland", + "name_ar":"سوازيلاند", + "code": "+268", + "countryCode": "SZ" + }, + { + "name": "Sweden", + "name_ar":"السويد", + "code": "+46", + "countryCode": "SE" + }, + { + "name": "Switzerland", + "name_ar":"سويسرا", + "code": "+41", + "countryCode": "CH" + }, + { + "name": "Syrian Arab Republic", + "name_ar":"الجمهورية العربية السورية", + "code": "+963", + "countryCode": "SY" + }, + { + "name": "Taiwan", + "name_ar":"تايوان", + "code": "+886", + "countryCode": "TW" + }, + { + "name": "Tajikistan", + "name_ar":"طاجيكستان", + "code": "+992", + "countryCode": "TJ" + }, + { + "name": "Tanzania, United Republic of Tanzania", + "name_ar":"تنزانيا ، جمهورية تنزانيا المتحدة", + "code": "+255", + "countryCode": "TZ" + }, + { + "name": "Thailand", + "name_ar":"تايلاند", + "code": "+66", + "countryCode": "TH" + }, + { + "name": "Timor-Leste", + "name_ar":"تيمور الشرقية", + "code": "+670", + "countryCode": "TL" + }, + { + "name": "Togo", + "name_ar":"ليذهب", + "code": "+228", + "countryCode": "TG" + }, + { + "name": "Tokelau", + "name_ar":"توكيلاو", + "code": "+690", + "countryCode": "TK" + }, + { + "name": "Tonga", + "name_ar":"تونغا", + "code": "+676", + "countryCode": "TO" + }, + { + "name": "Trinidad and Tobago", + "name_ar":"ترينداد وتوباغو", + "code": "+1 868", + "countryCode": "TT" + }, + { + "name": "Tunisia", + "name_ar":"تونس", + "code": "+216", + "countryCode": "TN" + }, + { + "name": "Turkey", + "name_ar":"ديك رومي", + "code": "+90", + "countryCode": "TR" + }, + { + "name": "Turkmenistan", + "name_ar":"تركمانستان", + "code": "+993", + "countryCode": "TM" + }, + { + "name": "Turks and Caicos Islands", + "name_ar":"جزر تركس وكايكوس", + "code": "+1 649", + "countryCode": "TC" + }, + { + "name": "Tuvalu", + "name_ar":"توفالو", + "code": "+688", + "countryCode": "TV" + }, + { + "name": "Uganda", + "name_ar":"أوغندا", + "code": "+256", + "countryCode": "UG" + }, + { + "name": "Ukraine", + "name_ar":"أوكرانيا", + "code": "+380", + "countryCode": "UA" + }, + { + "name": "United Kingdom", + "name_ar":"المملكة المتحدة", + "code": "+44", + "countryCode": "GB" + }, + { + "name": "United States", + "name_ar":"الولايات المتحدة الامريكانية", + "code": "+1", + "countryCode": "US" + }, + { + "name": "Uruguay", + "name_ar":"أوروغواي", + "code": "+598", + "countryCode": "UY" + }, + { + "name": "Uzbekistan", + "name_ar":"أوزبكستان", + "code": "+998", + "countryCode": "UZ" + }, + { + "name": "Vanuatu", + "name_ar":"فانواتو", + "code": "+678", + "countryCode": "VU" + }, + { + "name": "Venezuela, Bolivarian Republic of Venezuela", + "name_ar":"فنزويلا ، جمهورية فنزويلا البوليفارية", + "code": "+58", + "countryCode": "VE" + }, + { + "name": "Vietnam", + "name_ar":"فيتنام", + "code": "+84", + "countryCode": "VN" + }, + { + "name": "Virgin Islands, British", + "name_ar":"جزر العذراء البريطانية", + "code": "+1 284", + "countryCode": "VG" + }, + { + "name": "Virgin Islands, U.S.", + "name_ar":"جزر فيرجن ، الولايات المتحدة", + "code": "+1 340", + "countryCode": "VI" + }, + { + "name": "Wallis and Futuna", + "name_ar":"واليس وفوتونا", + "code": "+681", + "countryCode": "WF" + }, + { + "name": "Yemen", + "name_ar":"اليمن", + "code": "+967", + "countryCode": "YE" + }, + { + "name": "Zambia", + "name_ar":"زامبيا", + "code": "+260", + "countryCode": "ZM" + }, + { + "name": "Zimbabwe", + "name_ar":"زيمبابوي", + "code": "+263", + "countryCode": "ZW" + } + ]; + + @override + void initState() { + super.initState(); + widget.selectedCountry = widget.selectedCountry ?? countryList[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + countryList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedCountry = countryList[index]; + }); + }, + child: ListTile( + title: Text(countryList[index]["name"]), + leading: Radio( + value: countryList[index], + groupValue: widget.selectedCountry, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedCountry = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedCountry); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart new file mode 100644 index 00000000..e8d4bb7d --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_relation_type_dialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/get_all_relationship_types_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectRelationTypeDialog extends StatefulWidget { + final List relationTypes; + final Function(GetAllRelationshipTypeResponseModel) onValueSelected; + GetAllRelationshipTypeResponseModel selectedRelation; + + SelectRelationTypeDialog( + {Key key, this.relationTypes, this.onValueSelected, this.selectedRelation}); + + @override + _SelectRelationTypeDialogState createState() => _SelectRelationTypeDialogState(); +} + +class _SelectRelationTypeDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedRelation = widget.selectedRelation ?? widget.relationTypes[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.relationTypes.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedRelation = widget.relationTypes[index]; + }); + }, + child: ListTile( + title: Text(widget.relationTypes[index].text), + leading: Radio( + value: widget.relationTypes[index], + groupValue: widget.selectedRelation, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedRelation = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedRelation); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart new file mode 100644 index 00000000..f4c8d989 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/dialogs/select_search_criteria_dialog.dart @@ -0,0 +1,137 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectSearchCriteriaDialog extends StatefulWidget { + List searchCriteria = [ + SearchCriteriaModel(name: "Identification Number",nameAr:"رقم المحول",value: 1), + SearchCriteriaModel(name: "Referral Number",nameAr:"رقم المحول",value: 2), + ]; + final Function(SearchCriteriaModel) onValueSelected; + SearchCriteriaModel selectedCriteria; + + SelectSearchCriteriaDialog( + {Key key, this.onValueSelected, this.selectedCriteria}); + + @override + _SelectSearchCriteriaDialogState createState() => _SelectSearchCriteriaDialogState(); +} + +class _SelectSearchCriteriaDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedCriteria = widget.selectedCriteria ?? widget.searchCriteria[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Texts(" Select Search Criteria", fontSize: 20,), + Divider(), + ...List.generate( + widget.searchCriteria.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedCriteria = widget.searchCriteria[index]; + }); + }, + child: ListTile( + title: Text(widget.searchCriteria[index].name), + leading: Radio( + value: widget.searchCriteria[index], + groupValue: widget.selectedCriteria, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedCriteria = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedCriteria); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} + + + + diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart new file mode 100644 index 00000000..ba9a123d --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_confirm_sms_dialog.dart @@ -0,0 +1,380 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/check_activation_code_for_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class EReferralConfirmSMSDialog extends StatefulWidget { + final String phoneNumber; + final Function onSucces; + // final AdvanceModel advanceModel; + // final PatientInfoAndMobileNumber patientInfoAndMobileNumber; + // final String selectedPaymentMethod; + + const EReferralConfirmSMSDialog( + {Key key, + this.phoneNumber, + this.onSucces + // this.advanceModel, + // this.selectedPaymentMethod, + // this.patientInfoAndMobileNumber + }) + : super(key: key); + + @override + _EReferralConfirmSMSDialogState createState() => _EReferralConfirmSMSDialogState(); +} + +class _EReferralConfirmSMSDialogState extends State { + final verifyAccountForm = GlobalKey(); + Map verifyAccountFormValue = { + 'digit1': null, + 'digit2': null, + 'digit3': null, + 'digit4': null, + }; + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + + String timerText = (TIMER_MIN - 1).toString() + ':59'; + int min = TIMER_MIN - 1; + int sec = 59; + Timer _timer; + + resendCode() { + min = TIMER_MIN - 1; + sec = 59; + _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { + if (min <= 0 && sec <= 0) { + timer.cancel(); + } else { + setState(() { + sec = sec - 1; + if (sec == 0 && min == 0) { + Navigator.pop(context); + min = 0; + sec = 0; + } else if (sec == 0) { + min = min - 1; + sec = 59; + } + timerText = min.toString() + ':' + sec.toString(); + }); + } + }); + } + + FocusNode focusD1; + FocusNode focusD2; + FocusNode focusD3; + FocusNode focusD4; + + @override + void initState() { + super.initState(); + resendCode(); + focusD1 = FocusNode(); + focusD2 = FocusNode(); + focusD3 = FocusNode(); + focusD4 = FocusNode(); + } + + @override + void dispose() { + _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => Dialog( + elevation: 0.6, + child: Container( + height: 520, + child: ListView( + children: [ + Container( + width: double.infinity, + height: 40, + color: Colors.grey[700], + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Center( + child: Texts( + 'SMS', + color: Colors.white, + textAlign: TextAlign.center, + ))), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.pop(context), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, color: Colors.white), + child: Icon( + Icons.clear, + color: Colors.grey[900], + )), + ), + ) + ], + ), + ), + Image.asset( + 'assets/images/login/103.png', + height: MediaQuery.of(context).size.width * 0.25, + width: MediaQuery.of(context).size.width * 0.25, + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).pleaseEnterTheVerificationCode + + '[${widget.phoneNumber}]', + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + Form( + key: verifyAccountForm, + child: Container( + width: SizeConfig.realScreenWidth * 0.90, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: 65, + child: TextFormField( + textInputAction: TextInputAction.next, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + focusNode: focusD1, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) { + verifyAccountFormValue['digit1'] = val; + }, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD2); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD2, + controller: digit2, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit2'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD3); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD3, + controller: digit3, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit3'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + } + }, + )), + Container( + width: 65, + child: TextFormField( + focusNode: focusD4, + controller: digit4, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit4'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + submit(model); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + submit(model); + } + }), + ) + ], + ), + SizedBox( + height: 8, + ), + if (model.state == ViewState.ErrorLocal || + model.state == ViewState.Error) + Container( + margin: EdgeInsets.only(left: 8, right: 8), + width: double.maxFinite, + child: Texts( + model.error, + color: Colors.red, + ), + ), + SizedBox(height: 20), + // buildText(), + + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context) + .theVerificationCodeExpiresIn + + ' $timerText', + textAlign: TextAlign.center, + ), + ), + SizedBox(height: 20), + + Container( + width: double.maxFinite, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: + TranslationBase.of(context).submit.toUpperCase(), + onTap: () { + submit(model); + }, + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + ); + } + + void submit(EReferralViewModel model) async { + if (verifyAccountForm.currentState.validate()) { + final activationCode = + digit1.text + digit2.text + digit3.text + digit4.text; + + + // ToDo call service + CheckActivationCodeForEReferralResponseModel checkActivationCodeForEReferralRequestModel= new CheckActivationCodeForEReferralResponseModel(activationCode: activationCode); + await model.checkActivationCodeForEReferral(checkActivationCodeForEReferralRequestModel); + if(model.state == ViewState.ErrorLocal) { + // Utils.showErrorToast(model.error); + } else { + widget.onSucces(); + // Navigator.push(context, FadePage(page: StartIndexForAddProduct())); + // Navigate to new page + } + } + } + + String validateCodeDigit(value) { + if (value.isEmpty) { + return ''; + } + return null; + } + + InputDecoration buildInputDecoration(BuildContext context) { + return InputDecoration( + // ts/images/password_icon.png + contentPadding: EdgeInsets.only(top: 20, bottom: 20), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5)), + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart new file mode 100644 index 00000000..00148889 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart @@ -0,0 +1,82 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/qr_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/CarouselSlider.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../d_q_icons_icons.dart'; +import 'e_referral_page.dart'; + +class EReferralIndexPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Service Information", + body: SingleChildScrollView( + padding: EdgeInsets.all(12), + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "E-Referral: ", + fontWeight: FontWeight.normal, + fontSize: 25, + color: Hexcolor("#60686b"), + ), + SizedBox( + height: 12, + ), + Texts( + "This service allows you to submit a Referral request from any health care providers either inside or outside the kingdom of Saudi Arabia to any of HMG Hospitals, By filling some of the patient's data and attaching the medical reports, moreover you can track the request status (Under process, Accepted or Rejected)", + fontWeight: FontWeight.normal, + fontSize: 17, + ), + SizedBox( + height: 22, + ), + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: CarouselSlider( + imagesUrlList: [ + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/0.png", + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png" + ], + ), + ), + ), + SizedBox( + height: 77, + ), + ], + ) + + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + onTap: ()=> Navigator.push(context, FadePage(page: EReferralPage())), + label: "E-Referral", + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart new file mode 100644 index 00000000..9f836860 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart @@ -0,0 +1,128 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/New_E_Referral/new_e_referral_step_one_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_history_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class EReferralPage extends StatefulWidget { + @override + _EReferralPageState createState() => _EReferralPageState(); +} + +class _EReferralPageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: "E-Referral", + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Stack( + children: [ + Positioned( + bottom: 1, + left: 0, + right: 0, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + color: Theme.of(context) + .scaffoldBackgroundColor + .withOpacity(0.8), + height: 70.0, + ), + ), + ), + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.7), + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: true, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.label, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 18.0, right: 18.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts("New Referral"), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.37, + child: Center( + child: Texts("Search for Referrals"), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + StartIndexForNewEReferral( + ), + SearchForReferralsPage( + ) + ], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart new file mode 100644 index 00000000..0b75705d --- /dev/null +++ b/lib/pages/AlHabibMedicalService/E-Referral/search_for_referrals_page.dart @@ -0,0 +1,227 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_criteria_model.dart'; +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_request_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'New_E_Referral/new_e_referral_step_one_page.dart'; +import 'dialogs/select_country_ingo_Dialog.dart'; +import 'dialogs/select_search_criteria_dialog.dart'; + +class SearchForReferralsPage extends StatefulWidget { + SearchForReferralsPage({Key key}); + + @override + _SearchForReferralsPageState createState() => _SearchForReferralsPageState(); +} + +class _SearchForReferralsPageState extends State { + TextEditingController _searchTextController = TextEditingController(); + + TextEditingController _mobileTextController = TextEditingController(); + bool _isSubmitted = false; + + dynamic _selectedCountry = { + "name": "Saudi Arabia", + "name_ar": "المملكة العربية السعودية", + "code": "+966", + "countryCode": "SA", + "pattern": "5xxxxxxxx", + "maxLength": 9 + }; + + SearchCriteriaModel selectedCriteria = SearchCriteriaModel( + name: "Identification Number", nameAr: "رقم المحول", value: 1); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getAllCities(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 77, + ), + InkWell( + onTap: () => selectSearchCriteriaDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getSearchCriteriaName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: selectedCriteria.value == 1 + ? "Enter Patient Identification No" + : "Enter Referral Number", + controller: _searchTextController, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectCountryTypeDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getCountryName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + MobileNumberTextFiled( + controller: _mobileTextController, + code: _selectedCountry == null + ? "11" + : _selectedCountry["code"], + ), + SizedBox( + height: 12, + ), + if ((model.state == ViewState.Idle && + model.allReferral.length == 0)) + Text("There's No Referral To deliver"), + if (( + model.state == ViewState.ErrorLocal)) + AppEmbeddedError( error:model.error), + NetworkBaseView( + baseViewModel: model, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.allReferral == null + ? 0 + : model.allReferral.length < 3 + ? model.allReferral.length + : 3, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 0.2), + child: Container( + child: Texts("TODO add referral info"), + ), + ); + }, + ), + ), + ], + ), + ), + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(9), + child: SecondaryButton( + textColor: Colors.white, + label: "Search", + onTap: () async { + SearchEReferralRequestModel searchEReferralRequestModel = + new SearchEReferralRequestModel( + patientMobileNumber: + _selectedCountry['code'] + _mobileTextController.text, + ); + if (selectedCriteria.value == 1) { + searchEReferralRequestModel.identificationNo = + _searchTextController.text; + searchEReferralRequestModel.referralNumber = 0; + } else { + searchEReferralRequestModel.referralNumber = + int.parse(_searchTextController.text); + searchEReferralRequestModel.identificationNo = ''; + } + await model.getEReferrals(searchEReferralRequestModel); + setState(() { + _isSubmitted = true; + }); + }, + loading: model.state == ViewState.BusyLocal, + disabled: _searchTextController.text.isEmpty || + _mobileTextController.text.isEmpty, + ), + ))); + } + + void confirmSelectCountryTypeDialog() { + showDialog( + context: context, + child: SelectCountryDialog( + selectedCountry: _selectedCountry, + onValueSelected: (value) { + setState(() { + _selectedCountry = value; + }); + }, + ), + ); + } + + String getCountryName() { + if (_selectedCountry != null) + return _selectedCountry["name"]; + else + return "Country"; + } + + void selectSearchCriteriaDialog() { + showDialog( + context: context, + child: SelectSearchCriteriaDialog( + selectedCriteria: selectedCriteria, + onValueSelected: (value) { + setState(() { + selectedCriteria = value; + }); + }, + ), + ); + } + + String getSearchCriteriaName() { + return selectedCriteria.name; + } +} diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index c8ac3b34..e1bc0af7 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -1,7 +1,14 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; +import 'package:diplomaticquarterapp/pages/Blood/advance_payment_page.dart'; +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; + import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/family/my-family.dart'; @@ -21,6 +28,8 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:webview_flutter/webview_flutter.dart'; +import 'h2o/h2o_page.dart'; + class AllHabibMedicalService extends StatefulWidget { @override _AllHabibMedicalServiceState createState() => _AllHabibMedicalServiceState(); @@ -166,7 +175,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage(page: EReferralIndexPage()), ), imageLocation: 'assets/images/ereferral_service_icon.png', title: 'E-Referral', @@ -185,7 +194,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage(page: ChildVaccinesPage()), ), imageLocation: 'assets/images/new-design/children_vaccines_icon.png', @@ -212,7 +221,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage(page: BloodDonationPage()), ), imageLocation: 'assets/images/new-design/blood_icon.png', title: 'Blood Donation', @@ -220,7 +229,9 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage(), + FadePage( + page: (HealthCalculators()), + ), ), imageLocation: 'assets/images/new-design/health_calculator_icon.png', @@ -241,7 +252,7 @@ class _AllHabibMedicalServiceState extends State { onTap: () => Navigator.push( context, FadePage( - page: ParkingPage(), + page: H2OPageIndexPage(), ), ), imageLocation: 'assets/images/new-design/water_icon.png', @@ -278,7 +289,8 @@ class _AllHabibMedicalServiceState extends State { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: "HMG News", - selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + selectedUrl: + "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ))); }, imageLocation: diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart new file mode 100644 index 00000000..2b2873e4 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart @@ -0,0 +1,107 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class ConfirmAddAmountDialog extends StatefulWidget { + final int amount; + final String unit; + final H2OViewModel model; + + + ConfirmAddAmountDialog( + {Key key, this.model,this.amount,this.unit ="ml"}); + + @override + _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); +} + +class _ConfirmAddAmountDialogState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + title: Center( + child: Texts( + "Confirm", + color: Colors.black, + ), + ), + children: [ + Column( + children: [ + Divider(), + Center( + child: Texts( + "Are you sure you want to Add ${widget.amount} ${widget.unit} ?", + color: Colors.grey, + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () async{ + InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount ); + await widget.model.insertUserActivity(insertUserActivityRequestModel); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} + + + diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart new file mode 100644 index 00000000..d70aec4e --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/select_amount_dialog.dart @@ -0,0 +1,157 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class SelectAmountDialog extends StatefulWidget { + List searchAmount = [ + AmountModel(name: "l",nameAr:"لتر",value: 1), + AmountModel(name: "ml",nameAr:"مم لتر",value: 2), + ]; + final Function(AmountModel) onValueSelected; + AmountModel selectedAmount; + + SelectAmountDialog( + {Key key, this.onValueSelected, this.selectedAmount}); + + @override + _SelectAmountDialogState createState() => _SelectAmountDialogState(); +} + +class _SelectAmountDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedAmount = widget.selectedAmount ?? widget.searchAmount[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Texts("Select the preferred unit", fontSize: 20,), + Divider(), + ...List.generate( + widget.searchAmount.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedAmount = widget.searchAmount[index]; + }); + }, + child: ListTile( + title: Text(widget.searchAmount[index].name), + leading: Radio( + value: widget.searchAmount[index], + groupValue: widget.selectedAmount, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedAmount = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedAmount); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} +class AmountModel { + String name; + String nameAr; + int value; + + AmountModel({this.name, this.nameAr, this.value}); + + AmountModel.fromJson(Map json) { + name = json['name']; + nameAr = json['nameAr']; + value = json['value']; + } + + Map toJson() { + final Map data = new Map(); + data['name'] = this.name; + data['nameAr'] = this.nameAr; + data['value'] = this.value; + return data; + } +} + + + + diff --git a/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart new file mode 100644 index 00000000..036ed186 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/add_custom_amount.dart @@ -0,0 +1,131 @@ +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'Dialog/select_amount_dialog.dart'; + +class AddCustomAmount extends StatefulWidget { + final H2OViewModel model; + final Function changePageViewIndex; + + const AddCustomAmount({Key key, this.model, this.changePageViewIndex}) + : super(key: key); + + @override + _AddCustomAmountState createState() => _AddCustomAmountState(); +} + +class _AddCustomAmountState extends State { + TextEditingController _nameTextController = TextEditingController(); + AmountModel selectedAmount; + + @override + void initState() { + setState(() { + _nameTextController.text = "0"; + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Enter amount", + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.94, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Enter the amount of water:", + // type: "Number", + controller: _nameTextController, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmAmountTypeDialog(), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getAmountName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + SecondaryButton( + textColor: Colors.white, + label: "OK", + onTap: () async { + Navigator.of(context).pop(); + showConfirmMessage (int.parse(_nameTextController.text), widget.model); + }, + // loading: model.state == ViewState.BusyLocal, + disabled: _nameTextController.text.isEmpty || selectedAmount == null), + SizedBox( + height: 12, + ), + ], + ), + ), + ), + ), + ), + ); + } + + +void confirmAmountTypeDialog() { + showDialog( + context: context, + child: SelectAmountDialog( + selectedAmount: selectedAmount, + onValueSelected: (value) { + setState(() { + selectedAmount = value; + }); + }, + ), + ); +} + + + String getAmountName() { + if (selectedAmount != null) + return selectedAmount.name; + else + return "Select unit"; + } + + + + void showConfirmMessage(int amount, H2OViewModel model) { + showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart new file mode 100644 index 00000000..9ce35d27 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_index_page.dart @@ -0,0 +1,73 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/CarouselSlider.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class H2OPageIndexPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Service Information", + body: SingleChildScrollView( + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "Water Tracker:", + fontWeight: FontWeight.normal, + fontSize: 25, + color: Hexcolor("#60686b"), + ), + SizedBox( + height: 12, + ), + Texts( + "This service is designed to help you to set drinking water goals and track the volume of water you are drinking on a daily basis. This service allows for schedule reminders and offers a basic statistical analysis of the amount of what you have consumed over the course of a day, week or month.", + fontWeight: FontWeight.normal, + fontSize: 17, + ), + SizedBox( + height: 22, + ), + Center( + child: SizedBox( + height: MediaQuery.of(context).size.height * 0.55, + width: MediaQuery.of(context).size.width * 0.50, + child: CarouselSlider( + imagesUrlList: [ + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/0.png", + "https://hmgwebservices.com/Images/MobileApp/images-info-home/referal/en/1.png" + ], + ), + ), + ), + SizedBox( + height: 77, + ), + ], + )), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.10, + width: double.infinity, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.9, + child: SecondaryButton( + onTap: () => + Navigator.push(context, FadePage(page: H2OPage())), + label: "Water Tracker", + textColor: Theme.of(context).backgroundColor), + ), + ], + ), + )); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart new file mode 100644 index 00000000..ad2c6ece --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -0,0 +1,120 @@ +import 'dart:ui'; + +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class H2OPage extends StatefulWidget { + @override + _H2OPageState createState() => _H2OPageState(); +} + +class _H2OPageState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 3, vsync: this,); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: "Water Tracker", + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(65.0), + child: Stack( + children: [ + Positioned( + bottom: 1, + left: 0, + right: 0, + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Container( + color: Theme.of(context) + .scaffoldBackgroundColor + .withOpacity(0.8), + height: 70.0, + ), + ), + ), + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 0.9, + + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorWeight: 5.0, + indicatorSize: TabBarIndicatorSize.label, + indicatorColor: Colors.red[800], + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts( + "Today"), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts("Week"), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts("Month"), + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [TodayPage(), WeekPage(), MonthPage()], + ), + ) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart new file mode 100644 index 00000000..f0baf34d --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -0,0 +1,27 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; +import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:flutter/cupertino.dart'; + +class MonthPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getUserProgressForMonthData(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + appBarTitle: "Water Tracker", + baseViewModel:model , + body: SingleChildScrollView( + padding: EdgeInsets.symmetric(vertical: 12), + child: AppBarChart( + seriesList: model.userProgressForMonthDataSeries), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart new file mode 100644 index 00000000..55767e5a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -0,0 +1,166 @@ +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; +class TodayPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getUserProgressForTodayData(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + appBarTitle: "Water Tracker", + baseViewModel: model, + body: SingleChildScrollView( + padding: EdgeInsets.symmetric(vertical: 12), + child: Container( + margin: EdgeInsets.only(top: 60), + child: Column( + children: [ + Center( + child: CircularPercentIndicator( + radius: 180.0, + animation: true, + animationDuration: 1200, + lineWidth: 15.0, + percent:model.userProgressData ==null ?0.0: + (model.userProgressData.percentageConsumed / + 100) >= 1 ? 1 : (model.userProgressData + .percentageConsumed / + 100), + //, + center: Center( + child: Column( + children: [ + SizedBox( + height: 40, + ), + Text( + "Consumed", + style: TextStyle(fontSize: 20.0), + ), + SizedBox( + height: 4, + ), + Text(model.userProgressData ==null ?"0.0": + model.userProgressData.quantityConsumed + .toString() + 'ml', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20.0, + color: Hexcolor("#60BCF9")), + ), + SizedBox( + height: 4, + ), + SizedBox( + height: 5, + width: 50, + child: Container( + + ), + ), + SizedBox( + height: 4, + ), + Text( + "Remaining", + style: TextStyle(fontSize: 20.0), + ), + SizedBox( + height: 4, + ), + Text(model.userProgressData ==null ?"0.0": + (model.userProgressData.quantityLimit - + model.userProgressData + .quantityConsumed) < 0 ? "0 ml" : + (model.userProgressData.quantityLimit - + model.userProgressData + .quantityConsumed).toString() + ' ml', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0), + ), + ], + ), + ), + circularStrokeCap: CircularStrokeCap.butt, + backgroundColor: Hexcolor("#D1E3F6"), + progressColor: Hexcolor("#60BCF9"), + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + margin: EdgeInsets.only(left: 20), + height: 30, + width: 70, + decoration: BoxDecoration( + color: Hexcolor("#D1E3F6"), + borderRadius: BorderRadius.all( + Radius.circular(30))), + ), + ), + Text( + "Remaining % ", + style: TextStyle(fontSize: 20.0), + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + margin: EdgeInsets.only(left: 20), + height: 30, + width: 70, + decoration: BoxDecoration( + color: Hexcolor("#60BCF9"), + borderRadius: BorderRadius.all( + Radius.circular(30))), + ), + ), + Text( + "Consumed % ", + style: TextStyle(fontSize: 20.0), + ) + ], + ) + ], + ), + SizedBox( + height: 30, + ), + SizedBox( + height: 0.5, + width: MediaQuery + .of(context) + .size + .width, + child: Container( + color: Colors.grey, + ), + ), + ], + ), + ), + ), + floatingActionButton: H20FloatingActionButton( + // controller: _controller, + model: model, + ), + ), + ); + } +} + diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart new file mode 100644 index 00000000..e42eb19b --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -0,0 +1,30 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; +import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class WeekPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getUserProgressForWeekData(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, + appBarTitle: "Water Tracker", + baseViewModel: model, + body: SingleChildScrollView( + padding: EdgeInsets.symmetric(vertical: 12), + child: AppBarChart(seriesList: model.userProgressForWeekDataSeries), + ), + ), + ); + } +} + + + diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart new file mode 100644 index 00000000..a2fa1adf --- /dev/null +++ b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart @@ -0,0 +1,200 @@ +import 'dart:math' as math; + +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../add_custom_amount.dart'; + +class H20FloatingActionButton extends StatefulWidget { + const H20FloatingActionButton({ + Key key, + @required AnimationController controller, + @required this.model + + }) : + super(key: key); + + final H2OViewModel model; + + @override + _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); +} + +class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { + AnimationController _controller; + @override + void initState() { + _controller = new AnimationController( + vsync: this, + duration: const Duration(milliseconds: 500), + ); + super.initState(); + } + + @override + Widget build(BuildContext context) { + + void showConfirmMessage(int amount, H2OViewModel model) { + showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); + } + + return Container( + margin: EdgeInsets.only(left: 20), + child: new Column(mainAxisSize: MainAxisSize.min, children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + ActionButton( + controller: _controller, + text: "600ml", + onTap: () { + showConfirmMessage(600, widget.model); + }, + ), + ActionButton( + controller: _controller, + text: "330ml", + onTap: () { + showConfirmMessage(330, widget.model); + }, + ), + ActionButton( + controller: _controller, + text: "200ml", + onTap: () { + showConfirmMessage(200, widget.model); + }, + ), + ], + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + FloatingActionButton( + heroTag: null, + child: new AnimatedBuilder( + animation: _controller, + builder: (BuildContext context, Widget child) { + return new Transform( + transform: new Matrix4.rotationZ( + _controller.value * 0.5 * math.pi), + alignment: FractionalOffset.center, + child: new Icon( + _controller.isDismissed ? Icons.add : Icons.close), + ); + }, + ), + onPressed: () { + if (_controller.isDismissed) { + _controller.forward(); + } else { + _controller.reverse(); + } + }, + ), + new Container( + alignment: FractionalOffset.topCenter, + child: new ScaleTransition( + scale: new CurvedAnimation( + parent: _controller, + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, + curve: Curves.easeOut), + ), + child: new FloatingActionButton( + backgroundColor: Colors.white, + heroTag: null, + mini: true, + child: Text( + "Custom", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 14.0, color: Colors.grey), + ), + onPressed: () { + Navigator.push( + context, + FadePage( + page: AddCustomAmount( + model: widget.model, + ), + ), + ); + }, + ), + ), + ), + new Container( + alignment: FractionalOffset.topCenter, + child: new ScaleTransition( + scale: new CurvedAnimation( + parent: _controller, + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, + curve: Curves.easeOut), + ), + child: new FloatingActionButton( + backgroundColor: Colors.white, + heroTag: null, + mini: true, + child: Text( + "Undo", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 14.0, color: Colors.grey), + ), + onPressed: () {}, + ), + ), + ), + ], + ), + ]), + ); + } +} + +class ActionButton extends StatelessWidget { + const ActionButton( + {Key key, + @required AnimationController controller, + @required this.text, + this.onTap}) + : _controller = controller, + super(key: key); + + final AnimationController _controller; + final String text; + final Function onTap; + + @override + Widget build(BuildContext context) { + return Container( + alignment: FractionalOffset.topCenter, + child: new ScaleTransition( + scale: new CurvedAnimation( + parent: _controller, + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), + ), + child: new FloatingActionButton( + heroTag: null, + backgroundColor: Colors.white, + mini: true, + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 14.0, color: Colors.grey), + ), + onPressed: onTap + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart new file mode 100644 index 00000000..62729222 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart @@ -0,0 +1,521 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'dart:math'; + +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BMICalculator extends StatefulWidget { + @override + _BMICalculatorState createState() => _BMICalculatorState(); +} + +class _BMICalculatorState extends State { + TextEditingController textController = new TextEditingController(); + String textResult; + String msg; + double bmiResult; + int height = 150; + int weight = 40; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + Color lbCard = inactiveCardColor; + Color kgCard = activeCardColor; + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (cmCard == inactiveCardColor) { + cmCard = activeCardColor; + ftCard = inactiveCardColor; + } else { + cmCard = inactiveCardColor; + } + } + if (type == 2) { + if (ftCard == inactiveCardColor) { + ftCard = activeCardColor; + cmCard = inactiveCardColor; + } else { + ftCard = inactiveCardColor; + } + } + } + + void updateColorWeight(int type) { + //MG/DLT card + if (type == 1) { + if (kgCard == inactiveCardColor) { + kgCard = activeCardColor; + lbCard = inactiveCardColor; + } else { + kgCard = inactiveCardColor; + } + } + if (type == 2) { + if (lbCard == inactiveCardColor) { + lbCard = activeCardColor; + kgCard = inactiveCardColor; + } else { + lbCard = inactiveCardColor; + } + } + } + + double convertToCm(double number) { + return number * 30.48; + } + + double convertToKg(double number) { + return number / 2.205; + } + + double calculateBMI() { + if (ftCard == activeCardColor) { + convertToCm(height.toDouble()); + } + bmiResult = weight / pow(height / 100, 2); + + return bmiResult; + } + + void showTextResult() { + if (bmiResult >= 30) { + textResult = 'Obese'; + } else if (bmiResult < 30 && bmiResult >= 25) { + textResult = 'OverWeight'; + } else if (bmiResult < 25 && bmiResult >= 18.5) { + textResult = 'Healthy'; + } else if (bmiResult < 18.5) { + textResult = 'UnderWeight'; + } + } + + void showMsg() { + if (bmiResult >= 30) { + msg = + 'A BMI of over 30 indicates that are heavily overweight. Health may be at risk if not lose weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.'; + } else if (bmiResult < 30 && bmiResult >= 25) { + msg = + 'A BMI of 25 - 30 indicates that are slightly overweight. May be advised to lose some weight for health reasons. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get '; + } else if (bmiResult < 25 && bmiResult >= 18.5) { + msg = + 'A BMI of 18.5 - 25 indicates that are at a healthy weight for the height. By maintaining a healthy weight, lower the risk of developing severe health problems. To book an appointment, click below to get started.'; + } else if (bmiResult < 18.5) { + msg = + 'A BMI of less than 18.5 indicates that are underweight, so may need to put on some weight. Recommended talking to a doctor or a dietician for advice. To book an appointment, click below to get started.'; + } + } + + @override + void initState() { + super.initState(); + textController.text = '0'; // Setting the initial value for the field. + } + + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'BMI Calculator', + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + width: 350.0, + child: Padding( + padding: EdgeInsets.symmetric(vertical: 15.0), + child: Text( + 'Calculate the BMI value and weight\n status to identify the healthy weight .\n Not appropriate for children and women\n who are pregnant or breastfeeding', + style: TextStyle(fontSize: 18.0), + ), + ), + ), + ), + Container( + height: 200.0, + width: 350.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Height'), + ), + ], + ), + Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(height.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (height < 250) height++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (height > 120) height--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Slider( + value: height.toDouble(), + min: 120, + max: 250, + onChanged: (double newValue) { + setState(() { + height = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ], + ), + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Select Unit'), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColor(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + color: cmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColor(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: ftCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('FT')), + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 25.0, + ), + Container( + height: 200.0, + width: 350.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + ), + child: Column( + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Weight'), + ), + ], + ), + Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(weight.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight < 250) weight++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight > 40) weight--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Slider( + value: weight.toDouble(), + min: 40, + max: 250, + onChanged: (double newValue) { + setState(() { + weight = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ], + ), + Row( + children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Texts('Select Unit'), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + color: kgCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('KG')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: lbCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('LB')), + ), + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 25.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBMI(); + showTextResult(); + showMsg(); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ResultPage( + finalResult: bmiResult, + textResult: textResult, + msg: msg, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart new file mode 100644 index 00000000..bfbd10b7 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/result_page.dart @@ -0,0 +1,101 @@ +import 'dart:ffi'; + +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:percent_indicator/percent_indicator.dart'; + +class ResultPage extends StatelessWidget { + final double finalResult; + final String textResult; + final String msg; + + ResultPage({this.finalResult, this.textResult, this.msg}); + Color inductorColor; + double percent; + + Color colorInductor() { + if (finalResult >= 30) { + inductorColor = Color(0xffC70D00); + } else if (finalResult < 30 && finalResult >= 25) { + inductorColor = Color(0xffC25400); + } else if (finalResult < 25 && finalResult >= 18.5) { + inductorColor = Color(0xff36D600); + } else if (finalResult < 18.5) { + inductorColor = Color(0xff1BE0EE); + } + return inductorColor; + } + + double percentInductor() { + if (finalResult >= 30) { + percent = 1.0; + } else if (finalResult < 30 && finalResult >= 25) { + percent = 0.73; + } else if (finalResult < 25 && finalResult >= 18.5) { + percent = 0.5; + } else if (finalResult < 18.5) { + percent = 0.25; + } + return percent; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "BMI Calculator", + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + // height: 40.0, + ), + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 20.0, + percent: percentInductor(), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + finalResult.toStringAsFixed(1), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5.0, + ), + Text( + textResult, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + progressColor: colorInductor(), + backgroundColor: Colors.white, + ), + ), + Container( + height: 120, + width: 280.0, + child: Texts(msg), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart new file mode 100644 index 00000000..05d3d07a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_calculator.dart @@ -0,0 +1,721 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BmrCalculator extends StatefulWidget { + @override + _BmrCalculatorState createState() => _BmrCalculatorState(); +} + +class _BmrCalculatorState extends State { + bool isMale = false; + bool isHeightCm = true; + Color maleCard = activeCardColorGender; + Color femaleCard = inactiveCardColorGender; + Color kgCard = activeCardColor; + Color lbCard = inactiveCardColor; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + int age = 0; + int height = 0; + int weight = 0; + double bmrResult = 0; + String dropdownValue = 'Lighty Active (1-3) days per week'; + double calories = 0; + + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + void updateColorHeight(int type) { + //MG/DLT card + if (type == 1) { + if (cmCard == inactiveCardColor) { + cmCard = activeCardColor; + ftCard = inactiveCardColor; + } else { + cmCard = inactiveCardColor; + } + } + if (type == 2) { + if (ftCard == inactiveCardColor) { + ftCard = activeCardColor; + cmCard = inactiveCardColor; + } else { + ftCard = inactiveCardColor; + } + } + } + + void updateColorWeight(int type) { + //MG/DLT card + if (type == 1) { + if (kgCard == inactiveCardColor) { + kgCard = activeCardColor; + lbCard = inactiveCardColor; + } else { + kgCard = inactiveCardColor; + } + } + if (type == 2) { + if (lbCard == inactiveCardColor) { + lbCard = activeCardColor; + kgCard = inactiveCardColor; + } else { + lbCard = inactiveCardColor; + } + } + } + + void calculateBmr() { + if (isMale == true) { + bmrResult = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age); + } else if (isMale == false) { + bmrResult = + 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + } + + bmrResult = bmrResult.roundToDouble(); + } + + void calculateCalories() { + if (dropdownValue == "Almost Inactive(Little or no exercises)") { + calories = bmrResult * 1.2; + } else if (dropdownValue == "Lighty Active (1-3) days per week") { + calories = bmrResult * 1.375; + } else if (dropdownValue == "very Active(6-7) days per week") { + calories = bmrResult * 1.55; + } else if (dropdownValue == "Super Active(very hard exercises)") { + calories = bmrResult * 1.725; + } else if (dropdownValue == "") { + calories = bmrResult * 10.725; + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Bmr Calculator', + body: Padding( + padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), + child: SingleChildScrollView( + child: Container( + height: 850, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Texts( + 'Calculates the amount of energy that the person’s body expends in a day'), + ), + Divider( + thickness: 2.0, + ), + SizedBox( + height: 5.0, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Gender'), + SizedBox( + height: 5.0, + ), + Container( + width: 350, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(35.0), + color: Colors.white, + border: Border.all( + color: Colors.black45, + )), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColor(1); + isMale = false; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: maleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('FEMALE')), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColor(2); + isMale = true; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: femaleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('MALE')), + ), + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Texts( + 'The Age ( 11 - 120 ) yrs', + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(age.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (age < 120) age++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (age > 0) age--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: age.toDouble(), + min: 0, + max: 120, + onChanged: (double newValue) { + setState(() { + age = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts( + 'Height', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(height.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (height < 250) + height++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (height > 0) height--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: height.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + height = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: cmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: ftCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 5.0, + ), + Texts( + 'Weight', + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(weight.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight < 250) + weight++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight > 0) weight--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: weight.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + weight = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: kgCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('KG')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: lbCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('LB')), + ), + ), + ), + ], + ), + SizedBox( + height: 45.0, + ), + Divider( + thickness: 2.0, + ), + SizedBox( + height: 5.0, + ), + Texts('Activity level'), + Container( + width: 300, + child: DropdownButton( + value: dropdownValue, + icon: Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + 'Almost Inactive(Little or no exercises)', + 'Lighty Active (1-3) days per week', + 'very Active(6-7) days per week', + 'Super Active(very hard exercises)' + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + SizedBox( + height: 30.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBmr(); + calculateCalories(); + + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => BmrResultPage( + bmrResult: bmrResult, + calories: calories, + )), + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart new file mode 100644 index 00000000..a3fdb5f7 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmr_calculator/bmr_result_page.dart @@ -0,0 +1,65 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; + +class BmrResultPage extends StatelessWidget { + final double bmrResult; + final double calories; + BmrResultPage({this.bmrResult, this.calories}); + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'BMR Calculator', + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 20.0, + percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + bmrResult.toStringAsFixed(1), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5.0, + ), + Text( + 'Calories/Day', + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + progressColor: Color(0xff3C3939), + ), + ), + Container( + height: 120, + width: 280.0, + child: Texts( + 'This means the body will burn ( ${bmrResult.toStringAsFixed(1)} ) calories each day, if engaged in no activity for the entire day.. Note: Daily calorie requirement is ( ${calories.toStringAsFixed(1)} ) calories, to maintain the current weight.'), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart new file mode 100644 index 00000000..4a939b3f --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart @@ -0,0 +1,1003 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class BodyFat extends StatefulWidget { + @override + _BodyFatState createState() => _BodyFatState(); +} + +class _BodyFatState extends State { + bool isMale = false; + bool isHeightCm = true; + Color maleCard = activeCardColorGender; + Color femaleCard = inactiveCardColorGender; + Color neckCmCard = activeCardColor; + Color neckFtCard = inactiveCardColor; + Color waistCmCard = activeCardColor; + Color waistFtCard = inactiveCardColor; + Color hipCmCard = activeCardColor; + Color hipFtCard = inactiveCardColor; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + int neck = 10; + int heightCm = 0; + int heightFt = 0; + int hip = 5; + double heightInches; + double minRange; + double maxRange; + double overWeightBy; + int waist = 5; + double bodyFat = 0; + double fat = 0; + String dropdownValue; + double calories = 0; + String textResult = ''; + + void updateColorHeight(int type) { + //MG/DLT card + if (type == 1) { + if (cmCard == inactiveCardColor) { + cmCard = activeCardColor; + ftCard = inactiveCardColor; + } else { + cmCard = inactiveCardColor; + } + } + if (type == 2) { + if (ftCard == inactiveCardColor) { + ftCard = activeCardColor; + cmCard = inactiveCardColor; + } else { + ftCard = inactiveCardColor; + } + } + } + + void updateColorNeck(int type) { + //MG/DLT card + if (type == 1) { + if (neckCmCard == inactiveCardColor) { + neckCmCard = activeCardColor; + neckFtCard = inactiveCardColor; + } else { + neckCmCard = inactiveCardColor; + } + } + if (type == 2) { + if (neckFtCard == inactiveCardColor) { + neckFtCard = activeCardColor; + neckCmCard = inactiveCardColor; + } else { + neckFtCard = inactiveCardColor; + } + } + } + + void updateColorWaist(int type) { + //MG/DLT card + if (type == 1) { + if (waistCmCard == inactiveCardColor) { + waistCmCard = activeCardColor; + waistFtCard = inactiveCardColor; + } else { + waistCmCard = inactiveCardColor; + } + } + if (type == 2) { + if (waistFtCard == inactiveCardColor) { + waistFtCard = activeCardColor; + waistCmCard = inactiveCardColor; + } else { + waistFtCard = inactiveCardColor; + } + } + } + + void updateColorHip(int type) { + //MG/DLT card + if (type == 1) { + if (hipCmCard == inactiveCardColor) { + hipCmCard = activeCardColor; + hipFtCard = inactiveCardColor; + } else { + hipCmCard = inactiveCardColor; + } + } + if (type == 2) { + if (hipFtCard == inactiveCardColor) { + hipFtCard = activeCardColor; + hipCmCard = inactiveCardColor; + } else { + hipFtCard = inactiveCardColor; + } + } + } + + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + void calculateBodyFat() { + if (isMale == true) { + bodyFat = 495 / + (1.0324 - + 0.19077 * (log(waist - neck) / ln10) + + 0.15456 * (log(heightCm) / ln10)) - + 450; + fat = (bodyFat * 10) / 10.round(); + } else if (isMale == false) { + bodyFat = 495 / + (1.29579 - + 0.35004 * (log(waist + hip - neck) / ln10) + + 0.22100 * (log(heightCm) / ln10)) - + 450; + fat = (bodyFat * 10) / 10.round(); + } + if (fat <= 0) { + fat = 0; + } + } + + void showTextResult() { + if (isMale == false) { + if (bodyFat > 9 && bodyFat <= 13) { + textResult = 'The category falls under essential'; + } else if (bodyFat > 13 && bodyFat <= 20) { + textResult = 'The category falls under athlete'; + } else if (bodyFat > 20 && bodyFat <= 24) { + textResult = 'The category falls under fitness'; + } else if (bodyFat > 24 && bodyFat <= 31) { + textResult = 'The category falls under acceptable'; + } else if (bodyFat > 31 && bodyFat <= 60) { + textResult = 'The category falls under obese'; + } else if (bodyFat > 60) { + textResult = + 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + } else if (bodyFat <= 9) { + textResult = + 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + } + } else { + if (bodyFat > 5 && fat <= 13) { + textResult = 'The category falls under essential'; + } else if (bodyFat > 13 && bodyFat <= 17) { + textResult = 'The category falls under athlete'; + } else if (bodyFat > 17 && bodyFat <= 24) { + textResult = 'The category falls under fitness'; + } else if (bodyFat > 24 && bodyFat <= 45) { + textResult = 'The category falls under obese'; + } else if (bodyFat > 45) { + textResult = + 'Please check the value you have entered, since the body fat percentage has crosed the limits.'; + } else if (bodyFat <= 5) { + textResult = + 'Please check the value you have entered, since the body fat percentage cannot be this low.'; + } + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Body Fat', + body: Padding( + padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), + child: SingleChildScrollView( + child: Container( + height: 1000.0, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: + Texts('Estimates the total body fat based on\n the size'), + ), + Divider( + thickness: 2.0, + ), + SizedBox( + height: 5.0, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Gender'), + SizedBox( + height: 5.0, + ), + Container( + width: 350, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(35.0), + color: Colors.white, + border: Border.all( + color: Colors.black45, + )), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColor(1); + isMale = false; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: maleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('FEMALE')), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColor(2); + isMale = true; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: femaleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('MALE')), + ), + ), + ], + ), + ), + Texts( + 'Height', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(heightCm.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (heightCm < 250) + heightCm++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (heightCm > 0) + heightCm--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: heightCm.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + heightCm = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: cmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: ftCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + Texts( + 'Neck', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(neck.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (neck < 60) neck++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (neck > 5) neck--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: neck.toDouble(), + min: 5, + max: 60, + onChanged: (double newValue) { + setState(() { + neck = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorNeck(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: neckCmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorNeck(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: neckFtCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + Texts( + 'Waist', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(waist.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (waist < 200) waist++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (waist > 5) waist--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: waist.toDouble(), + min: 5, + max: 200, + onChanged: (double newValue) { + setState(() { + waist = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorWaist(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: waistCmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorWaist(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: waistFtCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 10.0, + ), + Texts( + 'Hip', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(hip.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (hip < 140) hip++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (hip > 5) hip--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: hip.toDouble(), + min: 5, + max: 140, + onChanged: (double newValue) { + setState(() { + hip = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHip(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: hipCmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHip(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: hipFtCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 35.0, + ), + ], + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateBodyFat(); + showTextResult(); + + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => FatResult( + bodyFat: bodyFat, + fat: fat, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart new file mode 100644 index 00000000..c8c5476e --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat_result_page.dart @@ -0,0 +1,77 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; + +class FatResult extends StatelessWidget { + final double bodyFat; + final double fat; + final String textResult; + + FatResult({this.bodyFat, this.fat, this.textResult = ''}); + Color inductorColor; + Color colorInductor() { + if (bodyFat >= 17) { + inductorColor = Color(0xffC70D00); + } else if (bodyFat < 20 && bodyFat >= 24) { + inductorColor = Color(0xffC25400); + } else if (bodyFat < 24 && bodyFat >= 31) { + inductorColor = Color(0xff36D600); + } else if (bodyFat > 45) { + inductorColor = Color(0xff1BE0EE); + } + return inductorColor; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Body Fat', + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + // height: 40.0, + ), + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 20.0, + percent: ((fat > 70) ? 100 : fat / 100), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + fat.toStringAsFixed(1) + '%', + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5.0, + ), + ], + ), + progressColor: inductorColor, + backgroundColor: Colors.white, + ), + ), + Container( + height: 120, + width: 280.0, + child: Texts(textResult), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart new file mode 100644 index 00000000..ac1aacc3 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart @@ -0,0 +1,676 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +const activeCardColorGender = Color(0xffC5272D); +const inactiveCardColorGender = Color(0xffFAFAFd); +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class CalorieCalculator extends StatefulWidget { + @override + _CalorieCalculatorState createState() => _CalorieCalculatorState(); +} + +class _CalorieCalculatorState extends State { + bool isMale = false; + Color maleCard = activeCardColorGender; + Color femaleCard = inactiveCardColorGender; + Color kgCard = activeCardColor; + Color lbCard = inactiveCardColor; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + int age = 0; + int height = 0; + int weight = 0; + double calories; + String dropdownValue; + void updateColor(int type) { + //MG/DLT card + if (type == 1) { + if (maleCard == inactiveCardColorGender) { + maleCard = activeCardColorGender; + femaleCard = inactiveCardColorGender; + } else { + maleCard = inactiveCardColorGender; + } + } + if (type == 2) { + if (femaleCard == inactiveCardColorGender) { + femaleCard = activeCardColorGender; + maleCard = inactiveCardColorGender; + } else { + femaleCard = inactiveCardColorGender; + } + } + } + + void updateColorWeight(int type) { + //MG/DLT card + if (type == 1) { + if (kgCard == inactiveCardColor) { + kgCard = activeCardColor; + lbCard = inactiveCardColor; + } else { + kgCard = inactiveCardColor; + } + } + if (type == 2) { + if (lbCard == inactiveCardColor) { + lbCard = activeCardColor; + kgCard = inactiveCardColor; + } else { + lbCard = inactiveCardColor; + } + } + } + + void updateColorHeight(int type) { + //MG/DLT card + if (type == 1) { + if (cmCard == inactiveCardColor) { + cmCard = activeCardColor; + ftCard = inactiveCardColor; + } else { + cmCard = inactiveCardColor; + } + } + if (type == 2) { + if (ftCard == inactiveCardColor) { + ftCard = activeCardColor; + cmCard = inactiveCardColor; + } else { + ftCard = inactiveCardColor; + } + } + } + + void calculateCalories() { + if (isMale == true) { + calories = 66.5 + (13.75 * weight) + (5.003 * height) - (6.755 * age); + } else if (isMale == false) { + calories = + 655.0955 + (9.5634 * weight) + (1.850 * height) - (4.676 * age); + } + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Calorie Calculator', + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), + child: SingleChildScrollView( + child: Container( + height: 890.0, + child: Column( + //mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(10.0), + child: Texts( + 'Calculates daily calorie intake based on several factors, like height, weight, age, gender and daily physical activity rate', + ), + ), + Padding( + padding: + EdgeInsets.symmetric(horizontal: 10.0, vertical: 15.0), + child: Texts('Gender'), + ), + Container( + width: 350, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(35.0), + color: Colors.white, + border: Border.all( + color: Colors.black45, + )), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColor(1); + isMale = false; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: maleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('FEMALE')), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColor(2); + isMale = true; + }); + }, + child: Container( + height: 55.0, + width: 170.0, + decoration: BoxDecoration( + color: femaleCard, + borderRadius: BorderRadius.circular(35.0), + ), + child: Center(child: Texts('MALE')), + ), + ), + ], + ), + ), + SizedBox( + height: 15.0, + ), + Texts( + 'The Age ( 11 - 120 ) yrs', + ), + SizedBox( + height: 10.0, + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(age.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (age < 120) age++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (age > 0) age--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: age.toDouble(), + min: 0, + max: 120, + onChanged: (double newValue) { + setState(() { + age = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts( + 'Height', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(height.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (height < 250) height++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (height > 0) height--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: height.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + height = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + color: cmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: ftCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 5.0, + ), + Texts( + 'Weight', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(weight.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight < 250) weight++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight > 0) weight--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: weight.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + weight = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + color: kgCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('KG')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: lbCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: + Offset(0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('LB')), + ), + ), + ), + ], + ), + SizedBox( + height: 5.0, + ), + Texts('Activity level'), + Container( + width: 300, + child: DropdownButton( + value: dropdownValue, + icon: Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + 'Almost Inactive(Little or no exercises)', + 'Lighty Active (1-3) days per week', + 'very Active(6-7) days per week', + 'Super Active(very hard exercises)' + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + SizedBox( + height: 25.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + calculateCalories(); + print(calories); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CalorieResultPage( + calorie: calories, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart new file mode 100644 index 00000000..5c52ecb0 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_result_page.dart @@ -0,0 +1,59 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:percent_indicator/circular_percent_indicator.dart'; + +class CalorieResultPage extends StatelessWidget { + final double calorie; + + CalorieResultPage({this.calorie}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: 'Calorie Calculator', + isShowAppBar: true, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Center( + child: CircularPercentIndicator( + radius: 220.0, + lineWidth: 20.0, + percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500), + center: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + calorie.toStringAsFixed(1), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + SizedBox( + height: 5.0, + ), + Texts('Calories'), + ], + ), + progressColor: Color(0xff3C3939), + backgroundColor: Colors.white, + ), + ), + Container( + child: + Texts('Daily intake is ${calorie.toStringAsFixed(1)} calories'), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart new file mode 100644 index 00000000..32ec9262 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart @@ -0,0 +1,367 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +import 'package:flutter/services.dart'; + +class Carbs extends StatefulWidget { + @override + _CarbsState createState() => _CarbsState(); +} + +class _CarbsState extends State { + TextEditingController textController = new TextEditingController(); + int calories; + String dropdownValue; + bool _visible = false; + int meals; + int protein; + int carbs; + + int fat; + double pCal; + double cCal; + double fCal; + double pCalGram; + double cCalGram; + double fCalGram; + double pCalMeal; + double cCalMeal; + double fCalMeal; + + void calculateDietRatios() { + if (dropdownValue == 'Very Low Carb') { + meals = 3; + protein = 45; + carbs = 10; + fat = 45; + } else if (dropdownValue == 'Low Carb') { + meals = 3; + protein = 40; + carbs = 30; + fat = 30; + } else if (dropdownValue == 'Moderate Carb') { + meals = 3; + protein = 25; + carbs = 50; + fat = 25; + } else if (dropdownValue == 'USDA Gudilines') { + meals = 3; + protein = 15; + carbs = 55; + fat = 30; + } else if (dropdownValue == 'Zone Diet') { + meals = 3; + protein = 30; + carbs = 40; + fat = 30; + } + } + + void calculate() { + pCal = (protein / 100.0) * int.parse(textController.text).ceil(); + cCal = (carbs / 100.0) * int.parse(textController.text); + ; + fCal = (fat / 100) * int.parse(textController.text); + ; + pCalGram = pCal / 4.0; + cCalGram = cCal / 4.0; + fCalGram = fCal / 9.0; + pCalMeal = pCalGram / meals.ceil(); + cCalMeal = cCalGram / meals.ceil(); + fCalMeal = fCalGram / meals.ceil(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Carb Protein Fat', + body: Padding( + padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 15.0), + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'Calculates carbohydrate protein and fat\n ratio in calories and grams according to a\n pre-set ratio', + ), + SizedBox( + height: 15.0, + ), + Column( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 300.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: TextFormField( + controller: textController, + inputFormatters: [ + FilteringTextInputFormatter + .digitsOnly + ], + keyboardType: TextInputType.number, + decoration: InputDecoration( + hintText: " The Calories per day ", + labelStyle: TextStyle( + color: Colors.black87, + ), + ), + ), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + int currentValue = int.parse( + textController.text); + currentValue++; + textController.text = + (currentValue).toString(); + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + int currentValue = int.parse( + textController.text); + currentValue--; + textController.text = + (currentValue).toString(); + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + ), + SizedBox( + height: 20.0, + ), + Button( + backgroundColor: Color(0xffC5272D), + label: 'NOT SURE? CLICK HERE ', + onTap: () { + setState(() { + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CalorieCalculator()), + ); + } + }); + }, + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Select Diet Type'), + Container( + width: 400, + child: DropdownButton( + value: dropdownValue, + icon: Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + calculateDietRatios(); + + dropdownValue == null + ? _visible = false + : _visible = true; + }); + }, + items: [ + 'Very Low Carb', + 'Low Carb', + 'Moderate Carb', + 'USDA Gudilines', + 'Zone Diet', + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + Visibility( + visible: _visible, + child: Container( + height: 170.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Texts( + 'Ratios are divided according to the selected diet'), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan(text: 'Meals Per Day '), + TextSpan( + text: '$meals', + style: TextStyle(color: Color(0xffC5272D)), + ), + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: 'Protein ', + ), + TextSpan( + text: '$protein%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: 'Carbohydrate ', + ), + TextSpan( + text: '$carbs%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + RichText( + text: TextSpan( + style: TextStyle(color: Colors.black), + children: [ + TextSpan( + text: 'Fat ', + ), + TextSpan( + text: '$fat%', + style: TextStyle(color: Color(0xffC5272D)), + ) + ], + ), + ), + ], + ), + ), + ) + ], + ), + SizedBox( + height: 55.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + { + calculate(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CarbsResult( + cCal: cCal, + pCal: pCal, + fCal: fCal, + pCalGram: pCalGram, + pCalMeal: pCalMeal, + fCalGram: fCalGram, + fCalMeal: fCalMeal, + cCalGram: cCalGram, + cCalMeal: cCalMeal, + )), + ); + } + }); + }, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart new file mode 100644 index 00000000..f8d0815a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/carbs/carbs_result_page.dart @@ -0,0 +1,175 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +import 'package:flutter/painting.dart'; + +class CarbsResult extends StatelessWidget { + double pCal; + double cCal; + double fCal; + double pCalGram; + double cCalGram; + double fCalGram; + double pCalMeal; + double cCalMeal; + double fCalMeal; + + CarbsResult( + {this.pCal, + this.cCal, + this.fCal, + this.pCalGram, + this.cCalGram, + this.fCalGram, + this.fCalMeal, + this.cCalMeal, + this.pCalMeal}); + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Carb Protein Fat', + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 30.0, horizontal: 10.0), + child: Table( + border: TableBorder( + verticalInside: BorderSide(width: 1, color: Colors.black54), + bottom: BorderSide(width: 1, color: Colors.black54), + left: BorderSide(width: 1, color: Colors.black54), + right: BorderSide(width: 1, color: Colors.black54), + top: BorderSide(width: 1, color: Colors.black54), + ), + children: [ + TableRow( + decoration: BoxDecoration( + color: Colors.white, + ), + children: [ + TableCell( + child: Center( + child: Texts('Description'), + ), + ), + TableCell( + child: Center( + child: Texts('Protein'), + ), + ), + TableCell( + child: Center( + child: Texts( + 'Carbohydrate', + ), + ), + ), + TableCell( + child: Center( + child: Texts('Fat'), + ), + ), + ]), + TableRow(children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: TableCell( + child: Center( + child: Texts('Calories\n Per Day'), + ), + ), + ), + TableCell( + child: Center( + child: Texts(pCal.ceil().toString() + ' Cals'), + ), + ), + TableCell( + child: Center( + child: Texts(cCal.ceil().toString() + ' Cals'), + ), + ), + TableCell( + child: Center( + child: Texts(fCal.ceil().toString() + ' Cals'), + ), + ), + ]), + TableRow(children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: TableCell( + child: Center( + child: Texts('Grams Per\n Day'), + ), + ), + ), + TableCell( + child: Center( + child: Texts(pCalGram.ceil().toString() + ' gr'), + ), + ), + TableCell( + child: Center( + child: Texts(cCalGram.ceil().toString() + ' gr'), + ), + ), + TableCell( + child: Center( + child: Texts(fCalGram.ceil().toString() + ' gr'), + ), + ), + ]), + TableRow(children: [ + Padding( + padding: EdgeInsets.all(8.0), + child: TableCell( + child: Center( + child: Texts('Grams Per\n Meal'), + ), + ), + ), + TableCell( + child: Center( + child: Texts(pCalMeal.ceil().toString() + ' gr'), + ), + ), + TableCell( + child: Center( + child: Texts(cCalMeal.ceil().toString() + ' gr'), + ), + ), + TableCell( + child: Center( + child: Texts(fCalMeal.ceil().toString() + ' gr'), + ), + ), + ]), + ], + ), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + + // Texts(pCal.ceil().toString()), + // Texts(cCal.ceil().toString()), + // Texts(fCal.ceil().toString()), + // Texts(pCalGram.ceil().toString()), + // Texts(cCalGram.ceil().toString()), + // Texts(fCalGram.ceil().toString()), + // Texts(pCalMeal.ceil().toString()), + // Texts(cCalMeal.ceil().toString()), + // Texts(fCalMeal.ceil().toString()), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart new file mode 100644 index 00000000..f534416f --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body.dart @@ -0,0 +1,550 @@ +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +const activeCardColor = Color(0xff70777A); +const inactiveCardColor = Color(0xffFAFAFd); + +class IdealBody extends StatefulWidget { + @override + _IdealBodyState createState() => _IdealBodyState(); +} + +class _IdealBodyState extends State { + bool isMale = false; + bool isHeightCm = true; + + Color kgCard = activeCardColor; + Color lbCard = inactiveCardColor; + Color cmCard = activeCardColor; + Color ftCard = inactiveCardColor; + int age = 0; + int height = 0; + double heightInches; + double minRange; + double maxRange; + double overWeightBy; + int weight = 0; + double idealWeight = 0; + String dropdownValue; + double calories = 0; + String textResult = ''; + double maxIdealWeight; + double heightFeet; + + void updateColorHeight(int type) { + //MG/DLT card + if (type == 1) { + if (cmCard == inactiveCardColor) { + cmCard = activeCardColor; + ftCard = inactiveCardColor; + } else { + cmCard = inactiveCardColor; + } + } + if (type == 2) { + if (ftCard == inactiveCardColor) { + ftCard = activeCardColor; + cmCard = inactiveCardColor; + } else { + ftCard = inactiveCardColor; + } + } + } + + void updateColorWeight(int type) { + //MG/DLT card + if (type == 1) { + if (kgCard == inactiveCardColor) { + kgCard = activeCardColor; + lbCard = inactiveCardColor; + } else { + kgCard = inactiveCardColor; + } + } + if (type == 2) { + if (lbCard == inactiveCardColor) { + lbCard = activeCardColor; + kgCard = inactiveCardColor; + } else { + lbCard = inactiveCardColor; + } + } + } + + void calculateIdealWeight() { + heightInches = height * .39370078740157477; + heightFeet = heightInches / 12; + idealWeight = (50 + 2.3 * (heightInches - 60)); + if (dropdownValue == 'Small(fingers overlap)') { + idealWeight = idealWeight - 10; + } else if (dropdownValue == 'Medium(fingers touch)') { + idealWeight = idealWeight; + } else if (dropdownValue == 'Large(fingers don\'n touch)') { + idealWeight = idealWeight + 10; + } + + maxIdealWeight = (((idealWeight) * 1.1).round() * 100) / 100; + overWeightBy = weight - maxIdealWeight.roundToDouble(); + minRange = ((idealWeight / 1.1) * 10).round() / 10; + maxRange = maxIdealWeight; + idealWeight = idealWeight; + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Ideal Body Weight', + body: Padding( + padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0), + child: SingleChildScrollView( + child: Container( + height: 800.0, + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Texts( + 'Calculates the ideal body weight based on height, Weight, and Body Size', + ), + ), + Divider( + thickness: 2.0, + ), + SizedBox( + height: 5.0, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'Height', + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(height.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (height < 250) + height++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (height > 0) height--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: height.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + height = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(1); + isHeightCm = true; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: cmCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('CM')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorHeight(2); + isHeightCm = false; + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: ftCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('Ft')), + ), + ), + ), + ], + ), + SizedBox( + height: 45.0, + ), + Divider( + thickness: 2.0, + ), + Texts( + 'Weight', + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Container( + width: 335.0, + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 8.0), + child: Center( + child: Container( + width: 60.0, + foregroundDecoration: BoxDecoration( + borderRadius: BorderRadius.circular(5.0), + border: Border.all( + color: Colors.blueGrey, + width: 2.0, + ), + ), + child: Row( + children: [ + Expanded( + child: Center( + child: Text(weight.toString()), + ), + ), + Container( + height: 38.0, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0.5, + ), + ), + ), + child: InkWell( + child: Icon( + Icons.arrow_drop_up, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight < 250) + weight++; + }); + }, + ), + ), + InkWell( + child: Icon( + Icons.arrow_drop_down, + size: 18.0, + ), + onTap: () { + setState(() { + if (weight > 0) weight--; + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + ), + Expanded( + child: Slider( + value: weight.toDouble(), + min: 0, + max: 250, + onChanged: (double newValue) { + setState(() { + weight = newValue.round(); + }); + }, + activeColor: Color(0xffC5272D), + inactiveColor: Color(0xffF3C5C6), + ), + ), + ], + ), + ), + ], + ), + Texts('Select Unit'), + SizedBox( + height: 5.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(1); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + color: kgCard, + borderRadius: BorderRadius.circular(3.0), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 0.0, horizontal: 18.0), + child: Center(child: Texts('KG')), + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + updateColorWeight(2); + }); + }, + child: Container( + height: 55.0, + width: 150.0, + decoration: BoxDecoration( + color: lbCard, + borderRadius: BorderRadius.circular(3.0), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 3, + blurRadius: 7, + offset: Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 16.0), + child: Center(child: Texts('LB')), + ), + ), + ), + ], + ), + SizedBox( + height: 45.0, + ), + Divider( + thickness: 2.0, + ), + SizedBox( + height: 5.0, + ), + Texts('Body Frame Size'), + Container( + width: 300, + child: DropdownButton( + value: dropdownValue, + icon: Icon(Icons.arrow_downward), + iconSize: 24, + elevation: 16, + style: TextStyle(color: Colors.black87), + underline: Container( + height: 2, + color: Colors.black54, + ), + onChanged: (String newValue) { + setState(() { + dropdownValue = newValue; + }); + }, + items: [ + 'Small(fingers overlap)', + 'Medium(fingers touch)', + 'Large(fingers don\'n touch)', + ].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + ), + SizedBox( + height: 30.0, + ), + Container( + height: 100.0, + width: 350.0, + child: Button( + label: 'CALCULATE', + onTap: () { + setState(() { + // calculateBmr(); + // calculateCalories(); + calculateIdealWeight(); + + print(idealWeight); + //print(overWeightBy); + { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IdealBodyResult( + idealBodyWeight: idealWeight, + minRange: minRange, + mixRange: maxRange, + overWeightBy: overWeightBy, + textResult: textResult, + )), + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart new file mode 100644 index 00000000..605e499a --- /dev/null +++ b/lib/pages/AlHabibMedicalService/health_calculator/ideal_body/ideal_body_result_page.dart @@ -0,0 +1,170 @@ +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'dart:math'; + +class IdealBodyResult extends StatelessWidget { + final double idealBodyWeight; + final double minRange; + final double mixRange; + final double overWeightBy; + final String textResult; + + IdealBodyResult( + {this.idealBodyWeight, + this.minRange, + this.mixRange, + this.overWeightBy, + this.textResult}); + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Ideal Body Weight', + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Texts( + 'Ideal weight range is', + fontSize: 23.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Row( + children: [ + Texts( + minRange.toStringAsFixed(1), + fontSize: 30.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, left: 4.0), + child: Text( + 'Kg', + style: TextStyle(color: Colors.red), + ), + ), + ], + ), + Icon( + Icons.arrow_forward, + color: Colors.red, + size: 55.0, + ), + Row( + children: [ + Texts( + mixRange.toStringAsFixed(1), + fontSize: 30.0, + ), + Padding( + padding: EdgeInsets.only(top: 8.0, left: 4.0), + child: Text( + 'Kg', + style: TextStyle(color: Colors.red), + ), + ), + ], + ), + ], + ), + overWeightBy >= 0 && overWeightBy <= 10 + ? Column( + children: [ + Texts( + 'Congratulations! The current weight is\n perfect and considered healthy', + fontSize: 20.0, + ), + ], + ) + : overWeightBy > 10 && overWeightBy < 17 + ? Column( + children: [ + Texts( + 'This means that the weight is a little bit more than ideal weight by'), + Texts(overWeightBy.toStringAsFixed(1)), + Texts( + 'May wish to consult with the doctor for medical help. Click to view our list of Doctors'), + ], + ) + : overWeightBy >= 18 + ? Container( + height: 250.0, + width: 350, + child: Column( + children: [ + Texts( + 'Means that you suffer from excessive\n obesity by', + ), + SizedBox( + height: 55.0, + ), + Texts( + overWeightBy.toStringAsFixed(1), + fontSize: 40.0, + ), + SizedBox( + height: 25.0, + ), + Texts( + 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + ], + ), + ) + : overWeightBy < -18 + ? Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Under Weight', + fontSize: 18.0, + ), + ), + SizedBox( + height: 55.0, + ), + Texts( + overWeightBy.toStringAsFixed(1), + fontSize: 20.0, + ), + ], + ) + : Container( + height: 250.0, + width: 350.0, + child: Column( + children: [ + Texts( + 'under wheight', + fontSize: 20.0, + ), + SizedBox( + height: 55.0, + ), + Texts( + overWeightBy.toStringAsFixed(1), + fontSize: 20.0, + ), + SizedBox( + height: 25.0, + ), + Texts( + 'May wish to consult with the doctor for\n medical help. Click to view our list of\n Doctors'), + ], + ), + ), + Container( + width: 350, + child: Button( + label: 'See List Of Doctors', + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index 712de3f7..58caee36 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -96,7 +96,7 @@ class _BloodCholesterolState extends State { children: [ Texts( 'Convert from', - ) + ), ], ), ), diff --git a/lib/pages/AlHabibMedicalService/my_web_view.dart b/lib/pages/AlHabibMedicalService/my_web_view.dart index e614c8d0..59163c15 100644 --- a/lib/pages/AlHabibMedicalService/my_web_view.dart +++ b/lib/pages/AlHabibMedicalService/my_web_view.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; -import 'package:tweet_webview/tweet_webview.dart'; class MyWebView extends StatelessWidget { final String title; diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart new file mode 100644 index 00000000..56fb0428 --- /dev/null +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -0,0 +1,279 @@ +import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart'; +import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart'; +import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; + +import 'health_calculator/bmr_calculator/bmr_calculator.dart'; +import 'health_calculator/ideal_body/ideal_body.dart'; + +class HealthCalculators extends StatefulWidget { + @override + _HealthCalculatorsState createState() => _HealthCalculatorsState(); +} + +class _HealthCalculatorsState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + } + + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Health Calculators', + body: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight(70.0), + child: Stack( + children: [ + Center( + child: Container( + height: 60.0, + margin: EdgeInsets.only(top: 10.0), + width: MediaQuery.of(context).size.width * 1.9, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 5.7, + ), + ), + color: Colors.white, + ), + child: Center( + child: TabBar( + controller: _tabController, + isScrollable: true, + indicatorWeight: 4.0, + indicatorColor: Colors.red, + labelColor: Theme.of(context).primaryColor, + labelPadding: + EdgeInsets.symmetric(horizontal: 13.0, vertical: 2.0), + unselectedLabelColor: Colors.grey, + tabs: [ + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Texts('General Health'), + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.35, + child: Center( + child: Texts("Women's Health"), + ), + ), + ], + ), + ), + ), + ) + ], + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + Container( + child: Column( + children: [ + Container( + width: double.infinity, + height: 80, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage(page: BMICalculator()), + ); + }, + child: MedicalProfileItem( + title: 'BMI', + imagePath: 'bmi_health_calculator.png', + subTitle: 'Calculators', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: CalorieCalculator(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Calories', + imagePath: 'calories-calculator.png', + subTitle: 'Calculators', + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: BmrCalculator(), + ), + ); + }, + child: MedicalProfileItem( + title: 'BMR', + imagePath: 'BMR_calculator.png', + subTitle: 'Calculators', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: IdealBody(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Ideal Body', + imagePath: 'body_weight.png', + subTitle: 'Weight', + ), + ), + ), + ], + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: BodyFat(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Body', + imagePath: 'body_fat.png', + subTitle: 'Fat', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: Carbs(), + ), + ); + }, + child: MedicalProfileItem( + title: 'Carbohydrate', + imagePath: 'carb_protein.png', + subTitle: 'Protein Fat', + ), + ), + ), + ], + ), + ], + ), + ), + Container( + child: Column( + children: [ + Container( + width: double.infinity, + height: 80, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + // Navigator.push( + // context, + // FadePage(page: BloodSugar()), + // ); + }, + child: MedicalProfileItem( + title: 'Ovulation', + imagePath: 'ovulation_period_icon.png', + subTitle: 'Period', + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + // Navigator.push( + // context, + // FadePage( + // page: BloodCholesterol(), + // ), + // ); + }, + child: MedicalProfileItem( + title: 'Delivery', + imagePath: 'delivery_date_icon.png', + subTitle: 'Due Date', + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/Blood/advance_payment_page.dart b/lib/pages/Blood/advance_payment_page.dart new file mode 100644 index 00000000..dd3ea666 --- /dev/null +++ b/lib/pages/Blood/advance_payment_page.dart @@ -0,0 +1,397 @@ +// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +// import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +// import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +// import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +// import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +// import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +// import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +// import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +// import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +// import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +// import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; +// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +// import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +// import 'package:diplomaticquarterapp/uitl/utils.dart'; +// import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +// import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/material.dart'; +// import 'package:smart_progress_bar/smart_progress_bar.dart'; +// +// //import '../../../core/model/my_balance/AdvanceModel.dart'; +// import 'confirm_payment_page.dart'; +// import 'dialogs/SelectBeneficiaryDialog.dart'; +// import 'dialogs/SelectPatientFamilyDialog.dart'; +// import 'dialogs/SelectPatientInfoDialog.dart'; +// import 'new_text_Field.dart'; +// +// enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } +// +// class AdvancePaymentPage extends StatefulWidget { +// @override +// _AdvancePaymentPageState createState() => _AdvancePaymentPageState(); +// } +// +// class _AdvancePaymentPageState extends State { +// TextEditingController _fileTextController = TextEditingController(); +// TextEditingController _notesTextController = TextEditingController(); +// BeneficiaryType beneficiaryType = BeneficiaryType.NON; +// HospitalsModel _selectedHospital; +// String amount = ""; +// String email; +// PatientInfo _selectedPatientInfo; +// AuthenticatedUser authenticatedUser; +// GetAllSharedRecordsByStatusList selectedPatientFamily; +// AdvanceModel advanceModel = AdvanceModel(); +// +// AppSharedPreferences sharedPref = AppSharedPreferences(); +// AuthenticatedUser authUser; +// +// @override +// void initState() { +// super.initState(); +// getAuthUser(); +// } +// +// @override +// Widget build(BuildContext context) { +// return BaseView( +// onModelReady: (model) => model.getHospitals(), +// builder: (_, model, w) => AppScaffold( +// isShowAppBar: true, +// appBarTitle: TranslationBase.of(context).advancePayment, +// body: SingleChildScrollView( +// physics: ScrollPhysics(), +// child: Container( +// margin: EdgeInsets.all(12), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Texts( +// TranslationBase.of(context).advancePaymentLabel, +// textAlign: TextAlign.center, +// ), +// SizedBox( +// height: 12, +// ), +// InkWell( +// onTap: () => confirmSelectBeneficiaryDialog(model), +// child: Container( +// padding: EdgeInsets.all(12), +// width: double.infinity, +// height: 65, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(12), +// color: Colors.white), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts(getBeneficiaryType()), +// Icon(Icons.arrow_drop_down) +// ], +// ), +// ), +// ), +// if (beneficiaryType == BeneficiaryType.MyFamilyFiles) +// SizedBox( +// height: 12, +// ), +// if (beneficiaryType == BeneficiaryType.MyFamilyFiles) +// InkWell( +// onTap: () { +// model.getFamilyFiles().then((value) { +// confirmSelectFamilyDialog(model +// .getAllSharedRecordsByStatusResponse +// .getAllSharedRecordsByStatusList); +// }).showProgressBar( +// text: "Loading", +// backgroundColor: Colors.blue.withOpacity(0.6)); +// }, +// child: Container( +// padding: EdgeInsets.all(12), +// width: double.infinity, +// height: 65, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(12), +// color: Colors.white), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts(getFamilyMembersName()), +// Icon(Icons.arrow_drop_down) +// ], +// ), +// ), +// ), +// SizedBox( +// height: 12, +// ), +// NewTextFields( +// hintText: TranslationBase.of(context).fileNumber, +// controller: _fileTextController, +// ), +// if (beneficiaryType == BeneficiaryType.OtherAccount) +// SizedBox( +// height: 12, +// ), +// if (beneficiaryType == BeneficiaryType.OtherAccount) +// InkWell( +// onTap: () { +// if (_fileTextController.text.isNotEmpty) +// model +// .getPatientInfoByPatientID( +// id: _fileTextController.text) +// .then((value) { +// confirmSelectPatientDialog(model.patientInfoList); +// }).showProgressBar( +// text: "Loading", +// backgroundColor: +// Colors.blue.withOpacity(0.6)); +// else +// AppToast.showErrorToast( +// message: 'Please Enter The File Number'); +// }, +// child: Container( +// padding: EdgeInsets.all(12), +// width: double.infinity, +// height: 65, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(12), +// color: Colors.white), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts(getPatientName()), +// Icon(Icons.arrow_drop_down) +// ], +// ), +// ), +// ), +// SizedBox( +// height: 12, +// ), +// InkWell( +// onTap: () => confirmSelectHospitalDialog(model.hospitals), +// child: Container( +// padding: EdgeInsets.all(12), +// width: double.infinity, +// height: 65, +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(12), +// color: Colors.white), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts(getHospitalName()), +// Icon(Icons.arrow_drop_down) +// ], +// ), +// ), +// ), +// SizedBox( +// height: 12, +// ), +// NewTextFields( +// hintText: TranslationBase.of(context).amount, +// keyboardType: TextInputType.number, +// onChanged: (value) { +// setState(() { +// amount = value; +// }); +// }, +// ), +// SizedBox( +// height: 12, +// ), +// NewTextFields( +// hintText: TranslationBase.of(context).depositorEmail, +// initialValue: model.user.emailAddress, +// onChanged: (value) { +// email = value; +// }, +// ), +// SizedBox( +// height: 12, +// ), +// NewTextFields( +// hintText: TranslationBase.of(context).notes, +// controller: _notesTextController, +// ), +// SizedBox( +// height: MediaQuery.of(context).size.height * 0.15, +// ) +// ], +// ), +// ), +// ), +// bottomSheet: Container( +// height: MediaQuery.of(context).size.height * 0.1, +// width: double.infinity, +// padding: EdgeInsets.all(12), +// child: SecondaryButton( +// textColor: Colors.white, +// label: TranslationBase.of(context).submit, +// disabled: amount.isEmpty || +// _fileTextController.text.isEmpty || +// _selectedHospital == null, +// onTap: () { +// advanceModel.fileNumber = _fileTextController.text; +// advanceModel.hospitalsModel = _selectedHospital; +// advanceModel.note = _notesTextController.text; +// advanceModel.email = email ?? model.user.emailAddress; +// advanceModel.amount = amount; +// +// model.getPatientInfoByPatientIDAndMobileNumber().then((value) { +// if (model.state != ViewState.Error && +// model.state != ViewState.ErrorLocal) { +// Utils.hideKeyboard(context); +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) => PaymentMethod())).then( +// (value) { +// Navigator.push( +// context, +// FadePage( +// page: ConfirmPaymentPage( +// advanceModel: advanceModel, +// selectedPaymentMethod: value, +// patientInfoAndMobileNumber: +// model.patientInfoAndMobileNumber, +// authenticatedUser: authUser, +// ), +// ), +// ); +// }, +// ); +// } +// }).showProgressBar( +// text: "Loading", +// backgroundColor: Colors.blue.withOpacity(0.6)); +// }, +// ), +// )), +// ); +// } +// +// void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { +// showDialog( +// context: context, +// child: SelectBeneficiaryDialog( +// beneficiaryType: beneficiaryType, +// onValueSelected: (value) { +// setState(() { +// if (value == BeneficiaryType.MyAccount) { +// _fileTextController.text = model.user.patientID.toString(); +// advanceModel.depositorName = +// model.user.firstName + " " + model.user.lastName; +// } else +// _fileTextController.text = ""; +// +// beneficiaryType = value; +// }); +// }, +// ), +// ); +// } +// +// void confirmSelectHospitalDialog(List hospitals) { +// showDialog( +// context: context, +// child: SelectHospitalDialog( +// hospitals: hospitals, +// selectedHospital: _selectedHospital, +// onValueSelected: (value) { +// setState(() { +// _selectedHospital = value; +// }); +// }, +// ), +// ); +// } +// +// void confirmSelectPatientDialog(List patientInfoList) { +// showDialog( +// context: context, +// child: SelectPatientInfoDialog( +// patientInfoList: patientInfoList, +// selectedPatientInfo: _selectedPatientInfo, +// onValueSelected: (value) { +// setState(() { +// advanceModel.depositorName = value.fullName; +// _selectedPatientInfo = value; +// }); +// }, +// ), +// ); +// } +// +// void confirmSelectFamilyDialog( +// List getAllSharedRecordsByStatusList) { +// showDialog( +// context: context, +// child: SelectPatientFamilyDialog( +// getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, +// selectedPatientFamily: selectedPatientFamily, +// onValueSelected: (value) { +// setState(() { +// selectedPatientFamily = value; +// _fileTextController.text = +// selectedPatientFamily.patientID.toString(); +// advanceModel.depositorName = value.patientName; +// }); +// }, +// ), +// ); +// } +// +// String getBeneficiaryType() { +// switch (beneficiaryType) { +// case BeneficiaryType.MyAccount: +// return TranslationBase.of(context).myAccount; +// case BeneficiaryType.MyFamilyFiles: +// return TranslationBase.of(context).myFamilyFiles; +// break; +// case BeneficiaryType.OtherAccount: +// return TranslationBase.of(context).otherAccount; +// break; +// case BeneficiaryType.NON: +// return TranslationBase.of(context).selectBeneficiary; +// } +// return TranslationBase.of(context).selectBeneficiary; +// } +// +// String getHospitalName() { +// if (_selectedHospital != null) +// return _selectedHospital.name; +// else +// return TranslationBase.of(context).selectHospital; +// } +// +// String getPatientName() { +// if (_selectedPatientInfo != null) +// return _selectedPatientInfo.fullName; +// else +// return TranslationBase.of(context).selectPatientName; +// } +// +// getAuthUser() async { +// if (await this.sharedPref.getObject(USER_PROFILE) != null) { +// var data = AuthenticatedUser.fromJson( +// await this.sharedPref.getObject(USER_PROFILE)); +// setState(() { +// authUser = data; +// }); +// } +// } +// +// String getFamilyMembersName() { +// if (selectedPatientFamily != null) +// return selectedPatientFamily.patientName; +// else +// return TranslationBase.of(context).selectFamilyPatientName; +// } +// } diff --git a/lib/pages/Blood/blood_donation.dart b/lib/pages/Blood/blood_donation.dart new file mode 100644 index 00000000..99e5242e --- /dev/null +++ b/lib/pages/Blood/blood_donation.dart @@ -0,0 +1,684 @@ + +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; +//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/core/service/blood/blood_details_servies.dart'; +import 'package:diplomaticquarterapp/core/viewModels/blooddonation/blood_details_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectCiteisDialog.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:giffy_dialog/giffy_dialog.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +//import '../../../core/model/my_balance/AdvanceModel.dart'; +import 'confirm_payment_page.dart'; +import 'dialogs/SelectBeneficiaryDialog.dart'; +import 'dialogs/SelectBloodDialog.dart'; +import 'dialogs/SelectGenderDialog.dart'; +import 'dialogs/SelectPatientFamilyDialog.dart'; +import 'dialogs/SelectPatientInfoDialog.dart'; +import 'new_text_Field.dart'; + +enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } +enum Gender{Male,Female,NON} +enum Blood{Oplus,Ominus,Aplus,Aminus,Bplus,Bminus,ABplus,ABminus,NON} + +class BloodDonationPage extends StatefulWidget { + @override + _BloodDonationPageState createState() => _BloodDonationPageState(); +} + +class _BloodDonationPageState extends State { + TextEditingController _fileTextController = TextEditingController(); + TextEditingController _notesTextController = TextEditingController(); + BeneficiaryType beneficiaryType = BeneficiaryType.NON; + Gender gender = Gender.Male;//Gender.NON; + Blood blood = Blood.Aminus;//Blood.NON; + //HospitalsModel _selectedHospital; + CitiesModel _selectedHospital; + + String amount = ""; + String email; + PatientInfo _selectedPatientInfo; + AuthenticatedUser authenticatedUser; + GetAllSharedRecordsByStatusList selectedPatientFamily; + AdvanceModel advanceModel = AdvanceModel(); + List_BloodGroupDetailsModel bloodDetails=List_BloodGroupDetailsModel(); + AppSharedPreferences sharedPref = AppSharedPreferences(); + AuthenticatedUser authUser; + var checkedValue = false; + @override + void initState() { + super.initState(); + getAuthUser(); + } + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getCities(),//model.getHospitals(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: "Blood Donation",//TranslationBase.of(context).advancePayment, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + // TranslationBase.of(context).advancePaymentLabel, + "Enter the required information, In order to register for Blood Donation Service",//+model.user.firstName, + textAlign: TextAlign.center, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectHospitalDialog(model.CitiesModelList),//model.hospitals + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + InkWell( + //======Gender======== + onTap: () => confirmSelectGenderDialog(),//confirmSelectBeneficiaryDialog(model), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + //Texts(getBeneficiaryType()), + Texts(getGender()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // InkWell( + // onTap: () { + // model.getFamilyFiles().then((value) { + // confirmSelectFamilyDialog(model + // .getAllSharedRecordsByStatusResponse + // .getAllSharedRecordsByStatusList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: Colors.blue.withOpacity(0.6)); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getFamilyMembersName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + SizedBox( + height: 12, + ), + InkWell( + //======Gender======== + onTap: () => confirmSelectBloodDialog(),//confirmSelectBeneficiaryDialog(model), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + //Texts(getBeneficiaryType()), + Texts(getBlood()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // InkWell( + // onTap: () { + // model.getFamilyFiles().then((value) { + // confirmSelectFamilyDialog(model + // .getAllSharedRecordsByStatusResponse + // .getAllSharedRecordsByStatusList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: Colors.blue.withOpacity(0.6)); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getFamilyMembersName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + SizedBox( + height: 12, + ), + Row( + children: [ + Container( + child: Text(" To view the terms and conditions "), + ), + SizedBox( + width: MediaQuery.of(context).size.height * 0.10, + ), + InkWell( + onTap: () { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => UserAgreementPage())); + }, + child: Container( + child: Texts(" Click here ",color: Colors.blue,), + ), + ) + ], + ), + SizedBox( + height: 12, + ), + Row( + children: [ + Checkbox( + onChanged: (bool value) { + setState(() { + checkedValue = value; + }); + }, + // tristate: checkedValue==true,//i == 1, + value: checkedValue, + activeColor: Colors.red,//Color(0xFF6200EE), + ), + SizedBox(height: 10,), + Row(children: [ + + ],), + SizedBox( + width: 10, + ), + Text( + 'I agree to the terms and conditions ', + style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black), + ), + ], + ), + // NewTextFields( + // hintText: TranslationBase.of(context).fileNumber, + // controller: _fileTextController, + // ), + // if (beneficiaryType == BeneficiaryType.OtherAccount) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.OtherAccount) + // InkWell( + // onTap: () { + // if (_fileTextController.text.isNotEmpty) + // model + // .getPatientInfoByPatientID( + // id: _fileTextController.text) + // .then((value) { + // confirmSelectPatientDialog(model.patientInfoList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: + // Colors.blue.withOpacity(0.6)); + // else + // AppToast.showErrorToast( + // message: 'Please Enter The File Number'); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getPatientName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + + // NewTextFields( + // hintText: TranslationBase.of(context).amount, + // keyboardType: TextInputType.number, + // onChanged: (value) { + // setState(() { + // amount = value; + // }); + // }, + // ), + // SizedBox( + // height: 12, + // ), + // NewTextFields( + // hintText: TranslationBase.of(context).depositorEmail, + // initialValue: model.user.emailAddress, + // onChanged: (value) { + // email = value; + // }, + // ), + // SizedBox( + // height: 12, + // ), + // NewTextFields( + // hintText: TranslationBase.of(context).notes, + // controller: _notesTextController, + // ), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Container( + color: Colors.white, + width: 350, + child: InkWell( + onTap: () { + showDialog( + context: context, + builder: (_) => + AssetGiffyDialog( + title: Text( + "", + style: TextStyle( + fontSize: 22.0, + fontWeight: + FontWeight + .w600), + ), + image: Image.asset( + 'assets/images/BloodChrt_EN.png'), + buttonCancelText: + Text('cancel'), + buttonCancelColor: + Colors.grey, + onlyCancelButton: true, + )); + }, + child: Container( + width: 250, + height: 200, + child:Image.asset( + 'assets/images/BloodChrt_EN.png')), + ), + ), + ), + ], + ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "Save", + // + onTap: (){ + + bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + + + ), + )), + ); + } + //============== + void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { + showDialog( + context: context, + child: SelectBeneficiaryDialog( + beneficiaryType: beneficiaryType, + onValueSelected: (value) { + setState(() { + if (value == BeneficiaryType.MyAccount) { + _fileTextController.text = model.user.patientID.toString(); + advanceModel.depositorName = + model.user.firstName + " " + model.user.lastName; + } else + _fileTextController.text = ""; + + beneficiaryType = value; + }); + }, + ), + ); + } + void confirmSelectBloodDialog(){ + showDialog( + context: context, + child: SelectBloodDialog(bloodType: blood, + onValueSelected: (value) { + setState(() { + if (value == Blood.Oplus) { + bloodDetails.bloodGroup="O+"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.Ominus) { + // _fileTextController.text = model.user.patientID.toString(); + bloodDetails.bloodGroup="O-"; + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.ABplus) { + bloodDetails.bloodGroup="AB+"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.ABminus) { + bloodDetails.bloodGroup="AB-"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.Aplus) { + bloodDetails.bloodGroup="A+"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.Aminus) { + bloodDetails.bloodGroup="A-"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.Bplus) { + bloodDetails.bloodGroup="B+"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + }else + if (value == Blood.Bminus) { + bloodDetails.bloodGroup="B-"; + // _fileTextController.text = model.user.patientID.toString(); + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + } + + + else + _fileTextController.text = ""; + + // beneficiaryType = value; + blood=value; + } + + + + + ); + }, + ), + ); + } + void confirmSelectGenderDialog(){ + showDialog( + context: context, + child: SelectGenderDialog(beneficiaryType: gender, + onValueSelected: (value) { + setState(() { + if (value == Gender.Male) { + // _fileTextController.text = model.user.patientID.toString(); + bloodDetails.patientType=1; + // advanceModel.depositorName = + // model.user.firstName + " " + model.user.lastName; + } else + // _fileTextController.text = ""; + {bloodDetails.gender=2;} + + // beneficiaryType = value; + gender=value; + }); + }, + ), + ); + } + +//void confirmSelectHospitalDialog(List hospitals) { + void confirmSelectHospitalDialog(List hospitals) { + showDialog( + context: context, + child: SelectCiteisDialog( + hospitals: hospitals, + selectedHospital: _selectedHospital, + onValueSelected: (value) { + setState(() { + _selectedHospital = value; + }); + }, + ), + ); + } + + void confirmSelectPatientDialog(List patientInfoList) { + showDialog( + context: context, + child: SelectPatientInfoDialog( + patientInfoList: patientInfoList, + selectedPatientInfo: _selectedPatientInfo, + onValueSelected: (value) { + setState(() { + advanceModel.depositorName = value.fullName; + _selectedPatientInfo = value; + }); + }, + ), + ); + } + + void confirmSelectFamilyDialog( + List getAllSharedRecordsByStatusList) { + showDialog( + context: context, + child: SelectPatientFamilyDialog( + getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, + selectedPatientFamily: selectedPatientFamily, + onValueSelected: (value) { + setState(() { + selectedPatientFamily = value; + _fileTextController.text = + selectedPatientFamily.patientID.toString(); + advanceModel.depositorName = value.patientName; + }); + }, + ), + ); + } + + String getBeneficiaryType() { + switch (beneficiaryType) { + case BeneficiaryType.MyAccount: + return TranslationBase.of(context).myAccount; + case BeneficiaryType.MyFamilyFiles: + return TranslationBase.of(context).myFamilyFiles; + break; + case BeneficiaryType.OtherAccount: + return TranslationBase.of(context).otherAccount; + break; + case BeneficiaryType.NON: + return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + } + return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + } + String getGender() { + switch (gender) { + case Gender.Male: + return "Male"; + case Gender.Female: + return "Female"; + break; + + case Gender.NON: + return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + } + return "Select Gender";//TranslationBase.of(context).selectBeneficiary; + } + String getBlood() { + switch (blood) { + case Blood.Oplus: + return "O+"; + break; + case Blood.Ominus: + return "O-"; + break; + case Blood.ABplus: + return "AB+"; + break; + case Blood.ABminus: + return "AB-"; + break; + case Blood.Aplus: + return "A+"; + break; + case Blood.Aminus: + return "A-"; + break; + case Blood.Bplus: + return "B-"; + break; + case Blood.Bminus: + return "B-"; + break; + case Blood.Bplus: + return "B+"; + break; + + case Blood.NON: + return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; + } + return "Select Blood Type";//TranslationBase.of(context).selectBeneficiary; + } + + String getHospitalName() { + if (_selectedHospital != null) + return _selectedHospital.description; + else + return + "Riyadh"; + // return List_BloodGroupDetailsModel.fromJson(0).city.toString();//"Select City";//TranslationBase.of(context).selectHospital; + } + + String getPatientName() { + if (_selectedPatientInfo != null) + return _selectedPatientInfo.fullName; + else + return TranslationBase.of(context).selectPatientName; + } + + getAuthUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + } + + String getFamilyMembersName() { + if (selectedPatientFamily != null) + return selectedPatientFamily.patientName; + else + return TranslationBase.of(context).selectFamilyPatientName; + } + + + //================ + + +} diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart new file mode 100644 index 00000000..cc5df0a6 --- /dev/null +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -0,0 +1,306 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +import 'dialogs/ConfirmSMSDialog.dart'; +import 'new_text_Field.dart'; + +class ConfirmPaymentPage extends StatelessWidget { + final AdvanceModel advanceModel; + final PatientInfoAndMobileNumber patientInfoAndMobileNumber; + final String selectedPaymentMethod; + MyInAppBrowser browser; + AuthenticatedUser authenticatedUser; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + ConfirmPaymentPage( + {this.advanceModel, + this.patientInfoAndMobileNumber, + this.selectedPaymentMethod, + this.authenticatedUser}); + + @override + Widget build(BuildContext context) { + void showSMSDialog() { + showDialog( + context: context, + barrierDismissible: false, + child: ConfirmSMSDialog( + phoneNumber: patientInfoAndMobileNumber.mobileNumber, + ), + ).then((value) { + print("dialog dismissed"); + print(value); + if (value != null && value) { + AppoitmentAllHistoryResultList appo = + new AppoitmentAllHistoryResultList(); + appo.projectID = patientInfoAndMobileNumber.projectID; + openPayment(selectedPaymentMethod, authenticatedUser, + double.parse(advanceModel.amount), appo); + } + }); + } + + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).advancePayment, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).confirmThePayment, + textAlign: TextAlign.center, + fontWeight: FontWeight.w500, + fontSize: 24, + ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 100.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset(getImagePath(selectedPaymentMethod)), + ), + Texts( + '${advanceModel.amount} SAR', + fontSize: 26, + bold: true, + ) + ], + ), + SizedBox( + height: 12, + ), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: TranslationBase.of(context).fileNumber, + initialValue: advanceModel.fileNumber, + isEnabled: false, + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: TranslationBase.of(context).name, + initialValue: patientInfoAndMobileNumber.firstName, + isEnabled: false, + ), + ), + ), + ], + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).mobileNumber, + initialValue: patientInfoAndMobileNumber.mobileNumber, + isEnabled: false, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).depositorName, + initialValue: advanceModel.depositorName, + isEnabled: false, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).notes, + initialValue: advanceModel.note, + isEnabled: false, + ), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: TranslationBase.of(context).confirm.toUpperCase(), + disabled: model.state == ViewState.Busy, + onTap: () { + model + .sendActivationCodeForAdvancePayment( + patientID: int.parse(advanceModel.fileNumber), + projectID: advanceModel.hospitalsModel.iD) + .then((value) { + if (model.state != ViewState.ErrorLocal && + model.state != ViewState.Error) showSMSDialog(); + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); + }, + ), + ), + ), + ); + } + + String getImagePath(String paymentMethod) { + switch (paymentMethod) { + case "MADA": + return 'assets/images/new-design/mada.png'; + break; + case "SADAD": + return 'assets/images/new-design/sadad.png'; + break; + case "VISA": + return 'assets/images/new-design/visa.png'; + break; + case "MASTERCARD": + return 'assets/images/new-design/mastercard.png'; + break; + case "Installment": + return 'assets/images/new-design/installment.png'; + break; + } + + return 'assets/images/new-design/mada.png'; + } + + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, + double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser( + onExitCallback: onBrowserExit, + appo: appo, + onLoadStartCallback: onBrowserLoadStart); + + browser.openPaymentBrowser( + amount, + "Advance Payment", + Utils.getAdvancePaymentTransID( + authenticatedUser.projectID, authenticatedUser.patientID), + appo.projectID.toString(), + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser, + browser); + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + if (isPaymentMade) checkPaymentStatus(appo); + } + + checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .checkPaymentStatus( + Utils.getAppointmentTransID( + appo.projectID, appo.clinicID, appo.appointmentNo), + AppGlobal.context) + .then((res) { + print("Printing Payment Status Reponse!!!!"); + print(res); + String paymentInfo = res['Response_Message']; + if (paymentInfo == 'Success') { + createAdvancePayment(res, appo); + } else { + AppToast.showErrorToast(message: res['Response_Message']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + String paymentReference = res['Fort_id'].toString(); + service + .createAdvancePayment(appo, res['Amount'], res['Fort_id'], + res['PaymentMethod'], AppGlobal.context) + .then((res) { + print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); + addAdvancedNumberRequest( + res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), + paymentReference, + appo.appointmentNo.toString(), + appo); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + addAdvancedNumberRequest(String advanceNumber, String paymentReference, + String appointmentID, AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .addAdvancedNumberRequest( + advanceNumber, paymentReference, appointmentID, AppGlobal.context) + .then((res) { + print(res); + navigateToHome(AppGlobal.context); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + Future navigateToHome(context) async { + Navigator.of(context).pushNamed(HOME); + } + +} diff --git a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart new file mode 100644 index 00000000..8dd2b29e --- /dev/null +++ b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart @@ -0,0 +1,375 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class ConfirmSMSDialog extends StatefulWidget { + final String phoneNumber; + final AdvanceModel advanceModel; + final PatientInfoAndMobileNumber patientInfoAndMobileNumber; + final String selectedPaymentMethod; + + const ConfirmSMSDialog( + {Key key, + this.phoneNumber, + this.advanceModel, + this.selectedPaymentMethod, + this.patientInfoAndMobileNumber}) + : super(key: key); + + @override + _ConfirmSMSDialogState createState() => _ConfirmSMSDialogState(); +} + +class _ConfirmSMSDialogState extends State { + final verifyAccountForm = GlobalKey(); + Map verifyAccountFormValue = { + 'digit1': null, + 'digit2': null, + 'digit3': null, + 'digit4': null, + }; + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + + String timerText = (TIMER_MIN - 1).toString() + ':59'; + int min = TIMER_MIN - 1; + int sec = 59; + Timer _timer; + + resendCode() { + min = TIMER_MIN - 1; + sec = 59; + _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { + if (min <= 0 && sec <= 0) { + timer.cancel(); + } else { + setState(() { + sec = sec - 1; + if (sec == 0 && min == 0) { + Navigator.pop(context); + min = 0; + sec = 0; + } else if (sec == 0) { + min = min - 1; + sec = 59; + } + timerText = min.toString() + ':' + sec.toString(); + }); + } + }); + } + + FocusNode focusD1; + FocusNode focusD2; + FocusNode focusD3; + FocusNode focusD4; + + @override + void initState() { + super.initState(); + resendCode(); + focusD1 = FocusNode(); + focusD2 = FocusNode(); + focusD3 = FocusNode(); + focusD4 = FocusNode(); + } + + @override + void dispose() { + _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => Dialog( + elevation: 0.6, + child: Container( + height: 520, + child: ListView( + children: [ + Container( + width: double.infinity, + height: 40, + color: Colors.grey[700], + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Center( + child: Texts( + 'SMS', + color: Colors.white, + textAlign: TextAlign.center, + ))), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.pop(context), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, color: Colors.white), + child: Icon( + Icons.clear, + color: Colors.grey[900], + )), + ), + ) + ], + ), + ), + Image.asset( + 'assets/images/login/103.png', + height: MediaQuery.of(context).size.width * 0.25, + width: MediaQuery.of(context).size.width * 0.25, + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context).pleaseEnterTheVerificationCode + + '[${widget.phoneNumber}]', + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + Form( + key: verifyAccountForm, + child: Container( + width: SizeConfig.realScreenWidth * 0.90, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: 65, + child: TextFormField( + textInputAction: TextInputAction.next, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + focusNode: focusD1, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) { + verifyAccountFormValue['digit1'] = val; + }, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD2); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD2, + controller: digit2, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit2'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD3); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD3, + controller: digit3, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit3'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + } + }, + )), + Container( + width: 65, + child: TextFormField( + focusNode: focusD4, + controller: digit4, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit4'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + submit(model); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + submit(model); + } + }), + ) + ], + ), + SizedBox( + height: 8, + ), + if (model.state == ViewState.ErrorLocal || + model.state == ViewState.Error) + Container( + margin: EdgeInsets.only(left: 8, right: 8), + width: double.maxFinite, + child: Texts( + model.error, + color: Colors.red, + ), + ), + SizedBox(height: 20), + // buildText(), + + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + TranslationBase.of(context) + .theVerificationCodeExpiresIn + + ' $timerText', + textAlign: TextAlign.center, + ), + ), + SizedBox(height: 20), + + Container( + width: double.maxFinite, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: + TranslationBase.of(context).submit.toUpperCase(), + onTap: () { + submit(model); + }, + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + ); + } + + void submit(MyBalanceViewModel model) { + if (verifyAccountForm.currentState.validate()) { + final activationCode = + digit1.text + digit2.text + digit3.text + digit4.text; + model + .checkActivationCodeForAdvancePayment(activationCode: activationCode) + .then((value) {}) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.pop(context, true); + }); + } + } + + String validateCodeDigit(value) { + if (value.isEmpty) { + return ''; + } + return null; + } + + InputDecoration buildInputDecoration(BuildContext context) { + return InputDecoration( + // ts/images/password_icon.png + contentPadding: EdgeInsets.only(top: 20, bottom: 20), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5)), + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart new file mode 100644 index 00000000..eae22f36 --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectBeneficiaryDialog.dart @@ -0,0 +1,177 @@ +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +//import '../advance_payment_page.dart'; + +class SelectBeneficiaryDialog extends StatefulWidget { + final BeneficiaryType beneficiaryType; + final Function(BeneficiaryType) onValueSelected; + + SelectBeneficiaryDialog( + {Key key, this.beneficiaryType, this.onValueSelected}); + + @override + _SelectBeneficiaryDialogState createState() => + _SelectBeneficiaryDialogState(this.beneficiaryType); +} + +class _SelectBeneficiaryDialogState extends State { + _SelectBeneficiaryDialogState(this.beneficiaryType); + + BeneficiaryType beneficiaryType; + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.MyAccount; + }); + }, + child: ListTile( + title: Text(TranslationBase.of(context).myAccount), + leading: Radio( + value: BeneficiaryType.MyAccount, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.MyFamilyFiles; + }); + }, + child: ListTile( + title: Text(TranslationBase.of(context).myFamilyFiles), + leading: Radio( + value: BeneficiaryType.MyFamilyFiles, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.OtherAccount; + }); + }, + child: ListTile( + title: Text(TranslationBase.of(context).otherAccount), + leading: Radio( + value: BeneficiaryType.OtherAccount, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(beneficiaryType); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectBloodDialog.dart b/lib/pages/Blood/dialogs/SelectBloodDialog.dart new file mode 100644 index 00000000..23e9e753 --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectBloodDialog.dart @@ -0,0 +1,328 @@ +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + +class SelectBloodDialog extends StatefulWidget { + + final Blood bloodType; + final Function(Blood) onValueSelected; + + SelectBloodDialog({Key key, this.bloodType, this.onValueSelected}); + + + + @override + _SelectBloodDialogState createState() => _SelectBloodDialogState(this.bloodType); +} + +class _SelectBloodDialogState extends State { + _SelectBloodDialogState(this.bloodType); + Blood bloodType; + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Oplus; + }); + }, + child: ListTile( + title: Text("O+"), + leading: Radio( + value: Blood.Oplus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Ominus; + }); + }, + child: ListTile( + title: Text("O-"), + leading: Radio( + value: Blood.Ominus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.ABminus; + }); + }, + child: ListTile( + title: Text("AB-"), + leading: Radio( + value: Blood.ABminus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.ABplus; + }); + }, + child: ListTile( + title: Text("AB+"), + leading: Radio( + value: Blood.ABplus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Aplus; + }); + }, + child: ListTile( + title: Text("A+"), + leading: Radio( + value: Blood.Aplus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Aminus; + }); + }, + child: ListTile( + title: Text("A-"), + leading: Radio( + value: Blood.Aminus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Bplus; + }); + }, + child: ListTile( + title: Text("B+"), + leading: Radio( + value: Blood.Bplus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + bloodType = Blood.Bminus; + }); + }, + child: ListTile( + title: Text("B-"), + leading: Radio( + value: Blood.Bminus, + groupValue: bloodType, + activeColor: Colors.red[800], + onChanged: (Blood value) { + setState(() { + bloodType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(bloodType); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectGenderDialog.dart b/lib/pages/Blood/dialogs/SelectGenderDialog.dart new file mode 100644 index 00000000..295c6dcd --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectGenderDialog.dart @@ -0,0 +1,146 @@ +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectGenderDialog extends StatefulWidget { + final Gender beneficiaryType; + final Function(Gender) onValueSelected; + + SelectGenderDialog({Key key, this.beneficiaryType, this.onValueSelected}); + + @override + _SelectGenderDialogState createState() => + _SelectGenderDialogState(this.beneficiaryType); +} + +class _SelectGenderDialogState extends State { + _SelectGenderDialogState(this.beneficiaryType); + Gender beneficiaryType; + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Male"), + leading: Radio( + value: Gender.Male, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (Gender value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = Gender.Female; + }); + }, + child: ListTile( + title: Text("Female"), + leading: Radio( + value: Gender.Female, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (Gender value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(beneficiaryType); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectHospitalDialog.dart b/lib/pages/Blood/dialogs/SelectHospitalDialog.dart new file mode 100644 index 00000000..9a4a359d --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectHospitalDialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectHospitalDialog extends StatefulWidget { + final List hospitals; + final Function(HospitalsModel) onValueSelected; + HospitalsModel selectedHospital; + + SelectHospitalDialog( + {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + + @override + _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); +} + +class _SelectHospitalDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.hospitals.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedHospital = widget.hospitals[index]; + }); + }, + child: ListTile( + title: Text(widget.hospitals[index].name + + ' ${widget.hospitals[index].distanceInKilometers} KM'), + leading: Radio( + value: widget.hospitals[index], + groupValue: widget.selectedHospital, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedHospital = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedHospital); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart new file mode 100644 index 00000000..5808aed8 --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectPatientFamilyDialog.dart @@ -0,0 +1,130 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectPatientFamilyDialog extends StatefulWidget { + final List getAllSharedRecordsByStatusList; + final Function(GetAllSharedRecordsByStatusList) onValueSelected; + GetAllSharedRecordsByStatusList selectedPatientFamily; + + SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected,this.selectedPatientFamily}); + + @override + _SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState(); +} + +class _SelectPatientFamilyDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedPatientFamily = widget.selectedPatientFamily?? widget.getAllSharedRecordsByStatusList[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.getAllSharedRecordsByStatusList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusList[index]; + }); + }, + child: ListTile( + title: Text(widget.getAllSharedRecordsByStatusList[index].patientName), + leading: Radio( + value: widget.getAllSharedRecordsByStatusList[index], + groupValue: widget.selectedPatientFamily, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedPatientFamily = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedPatientFamily); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart new file mode 100644 index 00000000..bea4f694 --- /dev/null +++ b/lib/pages/Blood/dialogs/SelectPatientInfoDialog.dart @@ -0,0 +1,130 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectPatientInfoDialog extends StatefulWidget { + final List patientInfoList ; + final Function(PatientInfo) onValueSelected; + PatientInfo selectedPatientInfo; + + SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo}); + + @override + _SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState(); +} + +class _SelectPatientInfoDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedPatientInfo = widget.selectedPatientInfo?? widget.patientInfoList[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.patientInfoList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedPatientInfo = widget.patientInfoList[index]; + }); + }, + child: ListTile( + title: Text(widget.patientInfoList[index].fullName), + leading: Radio( + value: widget.patientInfoList[index], + groupValue: widget.selectedPatientInfo, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedPatientInfo = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedPatientInfo); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/Blood/my_balance_page.dart b/lib/pages/Blood/my_balance_page.dart new file mode 100644 index 00000000..07d27e2d --- /dev/null +++ b/lib/pages/Blood/my_balance_page.dart @@ -0,0 +1,109 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import 'advance_payment_page.dart'; +import 'blood_donation.dart'; + +class MyBalancePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).myBalances, + body: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).balanceAmount, + color: Colors.black, + bold: true, + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(8), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + color: Hexcolor('#B61422'), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).totalBalance, + color: Colors.white, + ), + Texts( + '${model.totalAdvanceBalanceAmount ?? 0} SAR', + color: Colors.white, + bold: true, + ), + ], + ), + ), + SizedBox( + height: 9, + ), + ...List.generate( + model.patientAdvanceBalanceAmountList.length, + (index) => Container( + padding: EdgeInsets.all(8), + height: 65, + margin: EdgeInsets.only(top: 8), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(model.patientAdvanceBalanceAmountList[index] + .projectDescription), + Texts( + '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} SAR', + bold: true, + ), + ], + ), + ), + ), + ], + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + // color: Colors.grey[900], + textColor: Colors.white, + label: TranslationBase.of(context).createAdvancedPayment, + onTap: () { + Navigator.push(context, + //FadePage(page: AdvancePaymentPage())); + FadePage(page: BloodDonationPage())); + }, + ), + ), + ), + ); + } +} diff --git a/lib/pages/Blood/new_text_Field.dart b/lib/pages/Blood/new_text_Field.dart new file mode 100644 index 00000000..ad9eb580 --- /dev/null +++ b/lib/pages/Blood/new_text_Field.dart @@ -0,0 +1,239 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class NumberTextInputFormatter extends TextInputFormatter { + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + final int newTextLength = newValue.text.length; + int selectionIndex = newValue.selection.end; + int usedSubstringIndex = 0; + final StringBuffer newText = StringBuffer(); + if (newTextLength >= 1) { + newText.write('('); + if (newValue.selection.end >= 1) selectionIndex++; + } + if (newTextLength >= 4) { + newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + if (newValue.selection.end >= 3) selectionIndex += 2; + } + if (newTextLength >= 7) { + newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + if (newValue.selection.end >= 6) selectionIndex++; + } + if (newTextLength >= 11) { + newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + if (newValue.selection.end >= 10) selectionIndex++; + } + // Dump the rest. + if (newTextLength >= usedSubstringIndex) + newText.write(newValue.text.substring(usedSubstringIndex)); + return TextEditingValue( + text: newText.toString(), + selection: TextSelection.collapsed(offset: selectionIndex), + ); + } +} + +final _mobileFormatter = NumberTextInputFormatter(); + +class NewTextFields extends StatefulWidget { + NewTextFields( + {Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.hintColor,this.isEnabled=true}) + : super(key: key); + + final String hintText; + + // final String initialValue; + final String type; + final bool autoFocus; + final IconData suffixIcon; + final Color suffixIconColor; + final Icon prefixIcon; + final VoidCallback onTap; + final TextEditingController controller; + final TextInputType keyboardType; + final FormFieldValidator validator; + final Function onSaved; + final Function onSuffixTap; + final Function onChanged; + final Function onSubmit; + final bool readOnly; + final int maxLength; + final int minLines; + final int maxLines; + final bool maxLengthEnforced; + final bool bare; + final bool isEnabled; + final TextInputAction inputAction; + final double fontSize; + final FontWeight fontWeight; + final bool keepPadding; + final TextCapitalization textCapitalization; + final List inputFormatters; + final bool autoValidate; + final EdgeInsets padding; + final bool focus; + final bool borderOnlyError; + final Color hintColor; + final String initialValue; + @override + _NewTextFieldsState createState() => _NewTextFieldsState(); +} + +class _NewTextFieldsState extends State { + final FocusNode _focusNode = FocusNode(); + bool focus = false; + bool view = false; + + @override + void initState() { + super.initState(); + _focusNode.addListener(() { + setState(() { + focus = _focusNode.hasFocus; + }); + }); + } + + @override + void didUpdateWidget(NewTextFields oldWidget) { + if (widget.focus) _focusNode.requestFocus(); + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + + + bool _determineReadOnly() { + if (widget.readOnly != null && widget.readOnly) { + _focusNode.unfocus(); + return true; + } else { + return false; + } + } + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration:BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Container( + margin: EdgeInsets.only(top: 8), + + child: TextFormField( + enabled: widget.isEnabled, + initialValue: widget.initialValue, + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + onChanged: widget.onChanged, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + + style: Theme.of(context) + .textTheme + .body2 + .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.hintText, + labelStyle: TextStyle(color: Colors.black), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(12.0)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(8.0)), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + disabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/Blood/user_agreement_page.dart b/lib/pages/Blood/user_agreement_page.dart new file mode 100644 index 00000000..d05725b4 --- /dev/null +++ b/lib/pages/Blood/user_agreement_page.dart @@ -0,0 +1,55 @@ +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; + +class UserAgreementPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "User Agreement", + + body: + Container( + child:ListView( + scrollDirection: Axis.vertical, + children: [ + /////////// + Column( + children: [ + SizedBox( + height: 20, + ), + Container( + child:Text("Communication via email, text messages and phone calls",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), + ), + SizedBox( + height: 20, + ), + Container( + child: + Text("I understand that the contact number or Email that \n I have provided on registration will be used for communication by HMG.\n I hereby agree to be notified by HMG through SMS, Email or any other method for appointments notifications, current HMG’s medical services, and any services introduced by the HMG in the future or any modifications made to the services offered by the HMG. And these messages may be submitted as evidence where the HMG has the right to use at any time whatsoever and as it sees fit.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), + ), + SizedBox( + height: 20, + ), + Container( + child: + Text("I understand the risks of communicating by email and text messages, in particular the privacy risks. \nI understand that HMG cannot guarantee the security and confidentiality of email or text communication. HMG will not be responsible for messages that are not received or delivered due to technical failure, or for disclosure of confidential information unless caused by intentional misconduct.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), + ), + SizedBox( + height: 20, + ), + Container( + child: + Text("\b I hereby agree to receive emails, text messages, phone calls for appointments notifications, special promotions and new features or products introduced by HMG or any third party.",textAlign: TextAlign.center,style: TextStyle(fontWeight: FontWeight.bold,fontSize: 16)), + ), + ], + ) + /////////// + ]) + + + + )); + } +} diff --git a/lib/pages/ChildVaccines/add_newchild_page.dart b/lib/pages/ChildVaccines/add_newchild_page.dart new file mode 100644 index 00000000..f2970cad --- /dev/null +++ b/lib/pages/ChildVaccines/add_newchild_page.dart @@ -0,0 +1,331 @@ +import 'package:device_calendar/device_calendar.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart'; +import 'package:diplomaticquarterapp/core/model/childvaccines/user_information_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/add_new_child_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/Blood/new_text_Field.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/active_medications/DayCheckBoxDialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + + + +enum Gender { Male, Female, NON } +enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + +class AddNewChildPage extends StatefulWidget { + final int frequency; + final int days; + final String itemDescription; + String dateAdd; + + List _scheduleList = List(); + List daysOfWeek = [ + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday, + DayOfWeek.Sunday + ]; + + DateTime startDay; + DateTime endDay; + + //AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) : super(key: key); + AddNewChildPage({Key key, this.frequency, this.days, this.itemDescription}) { + startDay = DateTime.now(); + endDay = + DateTime.now(); //endDay = DateTime.now().add(Duration(days: days)); + int hour = 24; //(24 / frequency).round(); + int durations = 24 ~/ hour; + for (int count = 0; count < durations; count++) { + _scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, + DateTime.now().day, (hour * count))); + } + } + @override + _AddNewChildPageState createState() => _AddNewChildPageState(); +} + +class _AddNewChildPageState extends State { + int tappedIndex; + int checkedValue; + + @override + void initState() { + super.initState(); + tappedIndex = -1; + } + + TextEditingController _firstTextController = TextEditingController(); + TextEditingController _secondTextController = TextEditingController(); + TextEditingController _notesTextController = TextEditingController(); + BeneficiaryType beneficiaryType = BeneficiaryType.NON; + Gender gender = Gender.Male; + //ChildVaccinesViewModel addvancedModel = ChildVaccinesViewModel(); + List_BabyInformationModel addvancedModel = List_BabyInformationModel(); + CreateNewBaby newChild=CreateNewBaby(); + List_UserInformationModel informationModel =List_UserInformationModel(); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_,model,w)=> AppScaffold( + isShowAppBar: true, + appBarTitle: "Vaccintion", + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 50, + ), + Texts( + "Add the child's information below to recieve the schedule of vaccinations.", //+model.user.firstName, + textAlign: TextAlign.center, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "First Name", + controller: _firstTextController, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: "Second Name", + controller: _secondTextController, + ), + SizedBox( + height: 12, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Gender:", + textAlign: TextAlign.end, + ), + ], + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 170, + child: SecondaryButton( + textColor: + checkedValue == 1 ? Colors.white : Colors.black, + color: checkedValue == 1 ? Colors.red : Colors.white, + + label: "Male", + // + onTap: () { + // bloodDetails.city=_selectedHospital.toString(); + setState(() { + checkedValue = 1; + print("checkedValue=" + checkedValue.toString()); + }); + + // bloodDetails. + }, + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: 170, + child: SecondaryButton( + textColor: + checkedValue == 2 ? Colors.white : Colors.black, + color: checkedValue == 2 ? Colors.red : Colors.white, + label: "Female", + // + onTap: () { + setState(() { + checkedValue = 2; + print("checkedValue=" + checkedValue.toString()); + }); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + ), + ) + ], + ), + ), + //========== + SizedBox( + height: 6, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Date Of Birth::", + textAlign: TextAlign.end, + ), + ], + ), + InkWell( + onTap: () { + DatePicker.showDatePicker( + context, + showTitleActions: true, + // minTime: DateTime( + // DateTime.now().year, DateTime.now().month - 1, 1), + minTime: DateTime(1, 1, 1), + maxTime: DateTime.now(), + onConfirm: (date) { + setState(() { + widget.startDay = date; + }); + }, + currentTime: widget.startDay, + // locale: projectViewModel.localeType + ); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(//getStartDay() + // DateUtil.yearMonthDay(DateTime.now()) + getStartDay() + ), + Icon( + Icons.calendar_today, + color: Colors.black, + ) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + //========= + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue == false + ? Colors.white24 + : Color.fromRGBO( + 63, + 72, + 74, + 1, + ), + label: "Add", + // + onTap: () { + + newChild.babyName = + _firstTextController.text + " " + _secondTextController.text; + newChild.gender = checkedValue.toString(); + newChild.strDOB=getStartDay() ; + newChild.alertBy=addvancedModel.alertBy; + newChild.createdBy=informationModel.createdBy ; + newChild.editedBy=informationModel.createdBy; + newChild.tempValue=true; + // newChild.userID=46013;//informationModel.userID; + newChild.isLogin=true; + //newChild.tokenID='qMgbP94U23RkXtWWT0Sw=='; + //'ZBGoQFUG50eQJd6Y7u1ykA=='; + + + model.getNewBabyOrders(newChild: newChild); + + + + AppToast.showSuccessToast(message: "Record Added"); + //============ + Navigator.push( + context, + FadePage( + page: ChildPage(), + + ), + ); + //============== + + // bloodDetails. + }, + ), + ), + ), + ); + } + + String getStartDay() { + return "${DateUtil.getMonth(widget.startDay.month)} ${widget.startDay.day}, ${widget.startDay.year}"; + } + + String getEndDay() { + return "${DateUtil.getMonth(widget.endDay.month)} ${widget.endDay.day}, ${widget.endDay.year}"; + } + + String getDateTime(DateTime dateTime) { + return '${dateTime.hour}:${dateTime.minute}'; + } + + String getDays() { + String days = ""; + widget.daysOfWeek.forEach((element) { + days += "${DateUtil.getDay(element)},"; + }); + return days; + } + + void confirmSelectDayDialog() { + showDialog( + context: context, + child: DayCheckBoxDialog( + title: 'Select Day', + selectedDaysOfWeek: widget.daysOfWeek, + onValueSelected: (value) { + setState(() { + widget.daysOfWeek = value; + }); + }, + ), + ); + } +} diff --git a/lib/pages/ChildVaccines/child_page.dart b/lib/pages/ChildVaccines/child_page.dart new file mode 100644 index 00000000..6a937aad --- /dev/null +++ b/lib/pages/ChildVaccines/child_page.dart @@ -0,0 +1,150 @@ +import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/add_newchild_page.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/vaccinationtable_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class ChildPage extends StatefulWidget { + + + @override + _ChildPageState createState() => _ChildPageState(); +} + +class _ChildPageState extends State with SingleTickerProviderStateMixin { + @override + Widget build(BuildContext context) { + var checkedValue= true; + return BaseView( + onModelReady: (model) => model.getBabyInformatioRequestOrders(),//model.getCOC(),getFindUsRequestOrders() + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: " Vaccination", + baseViewModel: model, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 15,right: 15,top: 70), + child: Column( + children: [ + ...List.generate(model.babyInformationModelList.length, (index) => + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.white, + + ), + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + + children: [ + Row(children:[Texts("CHILD NAME"),]), + Row(children:[Texts(model.babyInformationModelList[index].babyName.trim()),]), + + Row( + children: [IconButton( + icon: Image.asset(model.babyInformationModelList[index].gender==1? 'assets/images/new-design/male.png':'assets/images/new-design/female.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(model.babyInformationModelList[index].genderDescription), + IconButton( + icon: Icon(Icons.remove_red_eye,color: Colors.red,), + tooltip: 'Increase volume by 10', + onPressed: () { + Navigator.push( + context, + FadePage( + page: VaccinationTablePage(), + + //ChildPage(babyInformationModelList:model.BabyInformationModelList) + // HospitalsPage( + // findusHospitalModelList: model.FindusHospitalModelList, + // ) + + ), + ); + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + }, + )] + ), + Row(children:[Texts("Birthday"),]), + Row(children:[IconButton( + icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + tooltip: 'Increase volume by 10', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),]), + Row(children:[IconButton( + icon: new Image.asset('assets/images/new-design/garbage.png'), + tooltip: '', + onPressed: () { + setState(() { + // _volume += 10; + // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + }); + }, + ), + Texts("Birthday"),]), + ], + ) + + + ) + + ) + + ], + + + ) + ) + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "ADD NEW CHILD ", + // + onTap: () => Navigator.push( + context, + FadePage( + page: AddNewChildPage(), + + + ), + ), + + + ), + ), + ) + ); + } +} diff --git a/lib/pages/ChildVaccines/child_vaccines_page.dart b/lib/pages/ChildVaccines/child_vaccines_page.dart new file mode 100644 index 00000000..ba4589a9 --- /dev/null +++ b/lib/pages/ChildVaccines/child_vaccines_page.dart @@ -0,0 +1,457 @@ + +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/child_vaccines_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/user_information_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/ChildVaccines/child_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + + + +class ChildVaccinesPage extends StatefulWidget { + @override + _ChildVaccinesPageState createState() => _ChildVaccinesPageState(); +} + +class _ChildVaccinesPageState extends State + with SingleTickerProviderStateMixin{ + TextEditingController titleController = TextEditingController(); + var checkedValue=false; + String addEmail=""; + @override + Widget build(BuildContext context) { + + return BaseView( + onModelReady: (model) => model.getUserInformatioRequestOrders(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: " Vaccination",//TranslationBase.of(context).advancePayment, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 20, + ), + + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Welcome back",fontSize: 20,), + ) , + ), + Divider(color:Colors.black ,), + SizedBox( + height: 20, + ), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + child: Texts("Please ensure that the email address is up-to-date and process to view the schedule",fontSize: 20,), + ) , + ), + + Divider(color:Colors.black ,), + Padding( + padding: const EdgeInsets.all(10.0), + child:Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: model.user.emailAddress,//'Title', + controller: titleController, + fontSize: 20, + hintColor: Colors.black, + fontWeight: FontWeight.w600, + onChanged: (text) { + addEmail=text; + model.user.emailAddress==addEmail?checkedValue=false:checkedValue=true; + // checkedValue=true; + // print("First text field: $text"); + // print("First text field:"+ model.user.emailAddress); + + }, + validator: (value) { + + if (value == null) + { + return model.user.emailAddress; + + } + else + + { + return model.user.emailAddress;} + }, + ), + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "UPDATE EMAIL", + // + onTap: (){ + model.user.emailAddress=addEmail.toString(); + AppToast.showSuccessToast( + message: "Email updated"); + // bloodDetails.city=_selectedHospital.toString(); + + // bloodDetails. + }, + + + ), + ), + Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: Color.fromRGBO(63, 72, 74, 1,), + label: " VIEW LIST OF CHILDREN", + // + onTap: () => Navigator.push( + context, + FadePage( + page: ChildPage(), + + //ChildPage(babyInformationModelList:model.BabyInformationModelList) + // HospitalsPage( + // findusHospitalModelList: model.FindusHospitalModelList, + // ) + + ), + ), + + + ), + ), + // Texts( + // // TranslationBase.of(context).advancePaymentLabel, + // model.user.emailAddress, + // textAlign: TextAlign.center, + // ), + SizedBox( + height: 12, + ), + // InkWell( + // onTap: () => confirmSelectHospitalDialog(model.CitiesModelList),//model.hospitals + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getHospitalName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + SizedBox( + height: 12, + ), + // InkWell( + // //======Gender======== + // onTap: () => confirmSelectGenderDialog(),//confirmSelectBeneficiaryDialog(model), + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // //Texts(getBeneficiaryType()), + // Texts(getGender()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // InkWell( + // onTap: () { + // model.getFamilyFiles().then((value) { + // confirmSelectFamilyDialog(model + // .getAllSharedRecordsByStatusResponse + // .getAllSharedRecordsByStatusList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: Colors.blue.withOpacity(0.6)); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getFamilyMembersName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + SizedBox( + height: 12, + ), + // InkWell( + // //======Gender======== + // onTap: () => confirmSelectBloodDialog(),//confirmSelectBeneficiaryDialog(model), + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // //Texts(getBeneficiaryType()), + // Texts(getBlood()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + // InkWell( + // onTap: () { + // model.getFamilyFiles().then((value) { + // confirmSelectFamilyDialog(model + // .getAllSharedRecordsByStatusResponse + // .getAllSharedRecordsByStatusList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: Colors.blue.withOpacity(0.6)); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getFamilyMembersName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + SizedBox( + height: 12, + ), + // Row( + // children: [ + // Container( + // child: Text(" To view the terms and conditions "), + // ), + // SizedBox( + // width: MediaQuery.of(context).size.height * 0.10, + // ), + // // InkWell( + // // onTap: () { + // // Navigator.of(context).push(MaterialPageRoute( + // // builder: (BuildContext context) => UserAgreementPage())); + // // }, + // // child: Container( + // // child: Texts(" Click here ",color: Colors.blue,), + // // ), + // // ) + // ], + // ), + SizedBox( + height: 12, + ), + // Row( + // children: [ + // Checkbox( + // onChanged: (bool value) { + // setState(() { + // checkedValue = value; + // }); + // }, + // // tristate: checkedValue==true,//i == 1, + // value: checkedValue, + // activeColor: Colors.red,//Color(0xFF6200EE), + // ), + // SizedBox(height: 10,), + // Row(children: [ + // + // ],), + // SizedBox( + // width: 10, + // ), + // Text( + // 'I agree to the terms and conditions ', + // style: Theme.of(context).textTheme.subtitle1.copyWith(color: checkedValue? Colors.red : Colors.black), + // ), + // ], + // ), + // NewTextFields( + // hintText: TranslationBase.of(context).fileNumber, + // controller: _fileTextController, + // ), + // if (beneficiaryType == BeneficiaryType.OtherAccount) + // SizedBox( + // height: 12, + // ), + // if (beneficiaryType == BeneficiaryType.OtherAccount) + // InkWell( + // onTap: () { + // if (_fileTextController.text.isNotEmpty) + // model + // .getPatientInfoByPatientID( + // id: _fileTextController.text) + // .then((value) { + // confirmSelectPatientDialog(model.patientInfoList); + // }).showProgressBar( + // text: "Loading", + // backgroundColor: + // Colors.blue.withOpacity(0.6)); + // else + // AppToast.showErrorToast( + // message: 'Please Enter The File Number'); + // }, + // child: Container( + // padding: EdgeInsets.all(12), + // width: double.infinity, + // height: 65, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(12), + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // Texts(getPatientName()), + // Icon(Icons.arrow_drop_down) + // ], + // ), + // ), + // ), + // SizedBox( + // height: 12, + // ), + + // NewTextFields( + // hintText: TranslationBase.of(context).amount, + // keyboardType: TextInputType.number, + // onChanged: (value) { + // setState(() { + // amount = value; + // }); + // }, + // ), + // SizedBox( + // height: 12, + // ), + // NewTextFields( + // hintText: TranslationBase.of(context).depositorEmail, + // initialValue: model.user.emailAddress, + // onChanged: (value) { + // email = value; + // }, + // ), + // SizedBox( + // height: 12, + // ), + // NewTextFields( + // hintText: TranslationBase.of(context).notes, + // controller: _notesTextController, + // ), + SizedBox( + height: 10, + ), + // Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Center( + // child: Container( + // color: Colors.white, + // width: 350, + // child: InkWell( + // onTap: () { + // showDialog( + // context: context, + // builder: (_) => + // AssetGiffyDialog( + // title: Text( + // "", + // style: TextStyle( + // fontSize: 22.0, + // fontWeight: + // FontWeight + // .w600), + // ), + // image: Image.asset( + // 'assets/images/BloodChrt_EN.png'), + // buttonCancelText: + // Text('cancel'), + // buttonCancelColor: + // Colors.grey, + // onlyCancelButton: true, + // )); + // }, + // child: Container( + // width: 250, + // height: 200, + // child:Image.asset( + // 'assets/images/BloodChrt_EN.png')), + // ), + // ), + // ), + // ], + // ), + + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), + + ), + ), + ); + } +} + diff --git a/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart new file mode 100644 index 00000000..f84dea29 --- /dev/null +++ b/lib/pages/ChildVaccines/dialogs/SelectGenderDialog.dart @@ -0,0 +1,105 @@ +import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectGenderDialog extends StatefulWidget { + @override + _SelectGenderDialogState createState() => _SelectGenderDialogState(); +} + +class _SelectGenderDialogState extends State { + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + //beneficiaryType = Gender.Male; + }); + }, + child: ListTile( + title: Text("Send the child's schedule to the email\n Tamer.dasdasdas@gmail.com "), + + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + + SizedBox( + height: 5.0, + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + // widget.onValueSelected(beneficiaryType); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ); + } + + + +} diff --git a/lib/pages/ChildVaccines/vaccinationtable_page.dart b/lib/pages/ChildVaccines/vaccinationtable_page.dart new file mode 100644 index 00000000..6ac11e4f --- /dev/null +++ b/lib/pages/ChildVaccines/vaccinationtable_page.dart @@ -0,0 +1,164 @@ +import 'package:diplomaticquarterapp/core/viewModels/child_vaccines/vaccination_table_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/reports_monthly_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/flutter_html.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; + +import 'dialogs/SelectGenderDialog.dart'; + +class VaccinationTablePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + var checkedValue; + return BaseView( + onModelReady: (model) => model.getCreateVaccinationTable(),//getUserTermsAndConditions(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + baseViewModel: model, + appBarTitle: "Vaccination", + body: SingleChildScrollView( + child:Container( + margin: EdgeInsets.only(left: 15,right: 15,top: 70), + child: Column( + children: [//babyInformationModelList.length + ...List.generate(model.creteVaccinationTableModelList.length, (index) => + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.white, width: 0.5), + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.white, + + ), + padding: EdgeInsets.all(12), + width: double.infinity, + child: Column( + + children: [ + Row(children: [ + Text(model.creteVaccinationTableModelList[index].visit), + SizedBox(width: 10,), + + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Html( + // data:"
BCG
HEPATITIS B
"//model.creteVaccinationTableModelList[index].vaccinesDescription + data:model.creteVaccinationTableModelList[index].vaccinesDescription, + + ), + ],), + ), + Text(model.creteVaccinationTableModelList[index].givenAt), + + + ],), + Divider(color:Colors.black ,), + // Row(children:[Texts("CHILD NAME"),]), + // Row(children:[Texts(model.babyInformationModelList[index].babyName.trim()),]), + + // Row( + // children: [IconButton( + // icon: Image.asset(model.babyInformationModelList[index].gender==1? 'assets/images/new-design/male.png':'assets/images/new-design/female.png'), + // tooltip: '', + // onPressed: () { + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + // }, + // ), + // Texts(model.babyInformationModelList[index].genderDescription), + // IconButton( + // icon: Icon(Icons.remove_red_eye,color: Colors.red,), + // tooltip: 'Increase volume by 10', + // onPressed: () { + // Navigator.push( + // context, + // FadePage( + // page: VaccinationTablePage(), + // + // //ChildPage(babyInformationModelList:model.BabyInformationModelList) + // // HospitalsPage( + // // findusHospitalModelList: model.FindusHospitalModelList, + // // ) + // + // ), + // ); + // // setState(() { + // // // _volume += 10; + // // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // // }); + // }, + // )] + // ), + // Row(children:[Texts("Birthday"),]), + // Row(children:[IconButton( + // icon: new Image.asset('assets/images/new-design/calender-secondary.png'), + // tooltip: 'Increase volume by 10', + // onPressed: () { + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + // }, + // ), + // Texts(DateUtil.yearMonthDay(model.babyInformationModelList[index].dOB)),]), + // Row(children:[IconButton( + // icon: new Image.asset('assets/images/new-design/garbage.png'), + // tooltip: '', + // onPressed: () { + // setState(() { + // // _volume += 10; + // // launch("tel://" +model.FindusHospitalModelList[index].phoneNumber); + // }); + // }, + // ), + // Texts("Birthday"),]), + ], + ) + + + ) + + ) + ], + ), + + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.12, + width: double.infinity, + + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + color: checkedValue== false ?Colors.white24:Color.fromRGBO(63, 72, 74, 1,), + label: "Send Email ", + // + onTap: () { + //SelectGenderDialog(); +//=============== + showDialog( + context: context, + child: SelectGenderDialog( + ), + ); + //========= + } + + + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 5cef835f..02d08682 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -29,6 +29,7 @@ import 'new_text_Field.dart'; enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + class AdvancePaymentPage extends StatefulWidget { @override _AdvancePaymentPageState createState() => _AdvancePaymentPageState(); diff --git a/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart new file mode 100644 index 00000000..3d07c08c --- /dev/null +++ b/lib/pages/medical/balance/dialogs/SelectCiteisDialog.dart @@ -0,0 +1,132 @@ +//import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectCiteisDialog extends StatefulWidget { + final List hospitals; + final Function(CitiesModel) onValueSelected; + CitiesModel selectedHospital; + + SelectCiteisDialog( + {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + @override + _SelectCiteisDialogState createState() => _SelectCiteisDialogState(); +} + +class _SelectCiteisDialogState extends State { + @override + void initState() { + super.initState(); + + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + } + + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.hospitals.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedHospital = widget.hospitals[index]; + }); + }, + child: ListTile( + // title: Text(widget.hospitals[index].description + + // ' ${widget.hospitals[index].distanceInKilometers} KM'), + title: Text(widget.hospitals[index].description), + leading: Radio( + value: widget.hospitals[index], + groupValue: widget.selectedHospital, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedHospital = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + TranslationBase.of(context).cancel.toUpperCase(), + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedHospital); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + TranslationBase.of(context).ok, + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 65bb8d36..dc794f7b 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -18,7 +18,7 @@ class SecondaryButton extends StatefulWidget { this.label = "", this.icon, this.iconOnly = false, - this.color: const Color.fromRGBO(63, 72, 74, 1), + this.color:const Color.fromRGBO(63, 72, 74, 1), this.textColor, this.onTap, this.loading: false, @@ -139,7 +139,7 @@ class _SecondaryButtonState extends State onTapCancel: () { _animationController.forward(); }, - onTap: Feedback.wrapForTap(widget.onTap, context), + onTap: widget.disabled?null:Feedback.wrapForTap(widget.onTap, context), behavior: HitTestBehavior.opaque, child: Transform.scale( scale: _buttonSize, diff --git a/lib/widgets/charts/app_bar_chart.dart b/lib/widgets/charts/app_bar_chart.dart new file mode 100644 index 00000000..98ef3cfa --- /dev/null +++ b/lib/widgets/charts/app_bar_chart.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:charts_flutter/flutter.dart' as charts; + +class AppBarChart extends StatelessWidget { + const AppBarChart({ + Key key, + @required this.seriesList, + }) : super(key: key); + + final List seriesList; + + @override + Widget build(BuildContext context) { + return Container( + height: 400, + margin: EdgeInsets.only(top: 60), + child: charts.BarChart( + seriesList, + // animate: animate, + + /// Customize the primary measure axis using a small tick renderer. + /// Use String instead of num for ordinal domain axis + /// (typically bar charts). + primaryMeasureAxis: new charts.NumericAxisSpec( + renderSpec: new charts.GridlineRendererSpec( + // Display the measure axis labels below the gridline. + // + // 'Before' & 'after' follow the axis value direction. + // Vertical axes draw 'before' below & 'after' above the tick. + // Horizontal axes draw 'before' left & 'after' right the tick. + labelAnchor: charts.TickLabelAnchor.before, + + // Left justify the text in the axis. + // + // Note: outside means that the secondary measure axis would right + // justify. + labelJustification: + charts.TickLabelJustification.outside, + )), + ), + ); + } +} diff --git a/lib/widgets/data_display/CarouselSlider.dart b/lib/widgets/data_display/CarouselSlider.dart new file mode 100644 index 00000000..b8af33ac --- /dev/null +++ b/lib/widgets/data_display/CarouselSlider.dart @@ -0,0 +1,66 @@ +import 'package:carousel_pro/carousel_pro.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; + +class CarouselSlider extends StatelessWidget { + const CarouselSlider({ + @required this.imagesUrlList, + @required this.width, + @required this.height, + this.onImageChange, + this.autoPlay = false, + Key key, + }) : super(key: key); + + final List imagesUrlList; + final double height; + final double width; + final bool autoPlay; + final Function onImageChange; + @override + Widget build(BuildContext context) { + return Carousel( + boxFit: BoxFit.cover, + autoplay: true, + animationCurve: Curves.fastOutSlowIn, + animationDuration: Duration(milliseconds: 1000), + dotSize: 0.0, + dotIncreasedColor: Colors.transparent, + dotBgColor: Colors.transparent, + dotPosition: DotPosition.bottomCenter, + dotVerticalPadding: 10.0, + onImageChange: onImageChange, + showIndicator: true, + indicatorBgPadding: 7.0, + + images: imagesUrlList.map((image) { + return Builder(builder: (BuildContext context) { + return Container( + child: Image.network(image, loadingBuilder: (BuildContext context, + Widget child, ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator( +// background: Theme +// .of(context) +// .primaryColor, +// value: loadingProgress.expectedTotalBytes != null +// ? loadingProgress.cumulativeBytesLoaded / +// loadingProgress.expectedTotalBytes +// : 0, + ), + ), + ); + }, + width: width, + height: height, + fit: BoxFit.fill), + ); + }); + }).toList(), + ); + } +} diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 56e06939..80a3e7af 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -25,6 +25,7 @@ class AppScaffold extends StatelessWidget { final bool isShowAppBar; final bool hasAppBarParam; final BaseViewModel baseViewModel; + final Widget floatingActionButton; AppScaffold( {@required this.body, @@ -33,7 +34,7 @@ class AppScaffold extends StatelessWidget { this.isShowAppBar = false, this.hasAppBarParam, this.bottomSheet, - this.baseViewModel}); + this.baseViewModel, this.floatingActionButton}); @override Widget build(BuildContext context) { @@ -75,7 +76,7 @@ class AppScaffold extends StatelessWidget { : buildBodyWidget(), bottomSheet: bottomSheet, // bottomNavigationBar: BottomBarSearch() - //floatingActionButton: FloatingSearchButton(), + floatingActionButton: floatingActionButton??floatingActionButton, ); } diff --git a/pubspec.yaml b/pubspec.yaml index ce3bc4e3..6fa52a67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,6 @@ dependencies: intl: ^0.16.1 # web view webview_flutter: ^0.3.24 - tweet_webview: ^0.2.2 # http client http: ^0.12.1 connectivity: ^0.4.9 @@ -111,8 +110,14 @@ dependencies: #Popup_window popup_box: ^0.1.0 + #Numbers + number_inc_dec: ^0.6.6 + #datetime_picker flutter_datetime_picker: ^1.4.0 + # Carousel + carousel_pro: ^1.0.0 + #local_notifications flutter_local_notifications: ^1.4.4+4