@ -1,5 +1,8 @@
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/doctor_list.dart ' ;
import ' package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart ' ;
import ' package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart ' ;
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/button.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
@ -14,11 +17,15 @@ class IdealBodyResult extends StatelessWidget {
final String textResult ;
IdealBodyResult ( { this . idealBodyWeight , this . minRange , this . mixRange , this . overWeightBy , this . textResult } ) ;
@ override
Widget build ( BuildContext context ) {
return AppScaffold (
isShowAppBar: true ,
appBarTitle: ' Ideal Body Weight ' ,
isShowDecPage: false ,
showNewAppBarTitle: true ,
showNewAppBar: true ,
appBarTitle: TranslationBase . of ( context ) . idealBody ,
body: Column (
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
@ -81,8 +88,7 @@ class IdealBodyResult extends StatelessWidget {
children: [
Texts ( ' This means that the weight is a little bit more than ideal weight by ' ) ,
Texts ( overWeightBy . toStringAsFixed ( 1 ) ) ,
Texts (
' May wish to consult with the doctor for medical help. Click to view our list of Doctors ' ) ,
Texts ( ' May wish to consult with the doctor for medical help. Click to view our list of Doctors ' ) ,
] ,
)
: overWeightBy > = 18
@ -104,8 +110,7 @@ class IdealBodyResult extends StatelessWidget {
SizedBox (
height: 25.0 ,
) ,
Texts (
' May wish to consult with the doctor for \n medical help. Click to view our list of \n Doctors ' ) ,
Texts ( ' May wish to consult with the doctor for \n medical help. Click to view our list of \n Doctors ' ) ,
] ,
) ,
)
@ -148,20 +153,16 @@ class IdealBodyResult extends StatelessWidget {
SizedBox (
height: 25.0 ,
) ,
Texts (
' May wish to consult with the doctor for \n medical help. Click to view our list of \n Doctors ' ) ,
Texts ( ' May wish to consult with the doctor for \n medical help. Click to view our list of \n Doctors ' ) ,
] ,
) ,
) ,
Container (
width: 350 ,
child: Button (
label: ' See List Of Doctors ' ,
label: TranslationBase . of ( context ) . viewDocList ,
onTap: ( ) {
Navigator . push (
context ,
FadePage ( page: DoctorList ( ) ) ,
) ;
getDoctorsList ( context ) ;
} ,
) ,
) ,
@ -169,4 +170,57 @@ class IdealBodyResult extends StatelessWidget {
) ,
) ;
}
getDoctorsList ( BuildContext context ) {
GifLoaderDialogUtils . showMyDialog ( context ) ;
BariatricsService service = new BariatricsService ( ) ;
List < DoctorList > doctorsList = [ ] ;
List < PatientDoctorAppointmentList > _patientDoctorAppointmentListHospital = List ( ) ;
service . getCalculationDoctors ( calculationID: 4 ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( res [ ' List_CalculationTable ' ] . length ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' List_CalculationTable ' ] . length ! = 0 ) {
res [ ' List_CalculationTable ' ] . forEach ( ( item ) {
DoctorList docList = new DoctorList ( ) ;
docList . clinicID = item [ ' ClinicID ' ] ;
docList . clinicName = item [ ' ClinicName ' ] ;
docList . doctorID = item [ ' DoctorID ' ] ;
docList . doctorImageURL = item [ ' DoctorImageURL ' ] ;
docList . name = item [ ' DoctorName ' ] ;
docList . doctorTitle = item [ ' DoctorTitle ' ] ;
docList . gender = item [ ' Gender ' ] ;
docList . genderDescription = item [ ' GenderDescription ' ] ;
docList . nationalityName = item [ ' Nationality ' ] ;
docList . nationalityFlagURL = item [ ' NationalityFlagURL ' ] ;
docList . projectID = item [ ' ProjectID ' ] ;
docList . projectName = item [ ' ProjectName ' ] ;
docList . actualDoctorRate = 0 ;
doctorsList . add ( docList ) ;
} ) ;
doctorsList . forEach ( ( element ) {
List < PatientDoctorAppointmentList > doctorByHospital = _patientDoctorAppointmentListHospital
. where (
( elementClinic ) = > elementClinic . filterName = = element . projectName ,
)
. toList ( ) ;
if ( doctorByHospital . length ! = 0 ) {
_patientDoctorAppointmentListHospital [ _patientDoctorAppointmentListHospital . indexOf ( doctorByHospital [ 0 ] ) ] . patientDoctorAppointmentList . add ( element ) ;
} else {
_patientDoctorAppointmentListHospital . add ( PatientDoctorAppointmentList ( filterName: element . projectName , distanceInKMs: " 0 " , patientDoctorAppointment: element ) ) ;
}
} ) ;
Navigator . push ( context , FadePage ( page: SearchResults ( isLiveCareAppointment: false , doctorsList: doctorsList , patientDoctorAppointmentListHospital: _patientDoctorAppointmentListHospital ) ) ) ;
}
}
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
print ( err ) ;
} ) ;
}
}