import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/operation_report_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; import 'CustomEditableText.dart'; class RegisterConfirmationPatientPage extends StatefulWidget { final OperationReportViewModel operationReportViewModel; final PatiantInformtion patient; final PatientRegistrationViewModel model; const RegisterConfirmationPatientPage( {Key key, this.operationReportViewModel, this.patient, this.model}) : super(key: key); @override _RegisterConfirmationPatientPageState createState() => _RegisterConfirmationPatientPageState(); } class _RegisterConfirmationPatientPageState extends State { bool isSubmitted = false; ProjectViewModel projectViewModel; TextEditingController firstName; TextEditingController middleName ; TextEditingController lastName; TextEditingController emailAddressController; @override void initState() { firstName = TextEditingController(text: widget.model.getPatientInfoResponseModel.firstNameEn); middleName = TextEditingController(text: ""); lastName = TextEditingController(text: widget.model.getPatientInfoResponseModel.lastNameEn); super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: false, backgroundColor: Color(0xFFF8F8F8), body: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 1.0, child: Padding( padding: EdgeInsets.all(0.0), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10.0, ), SingleChildScrollView( child: Center( child: FractionallySizedBox( widthFactor: 0.9, child: Column( children: [ CustomEditableText( controller: firstName, hint: TranslationBase.of(context).firstName), SizedBox( height: 4, ), CustomEditableText( controller: middleName, hint: TranslationBase.of(context).middleName), SizedBox( height: 4, ), CustomEditableText( controller: lastName, hint: TranslationBase.of(context).lastName), SizedBox( height: 20, ), FractionallySizedBox( widthFactor: .9, child: Center( child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context) .healthID, fontSize: 12, color: Colors.black), AppText( "${widget.model.getPatientInfoResponseModel.healthId}", fontSize: 12, color: Colors.grey[600], ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context) .identityNumber, fontSize: 12, color: Colors.black), AppText( "${widget.model.getPatientInfoResponseModel.idNumber}", fontSize: 12, color: Colors.grey[600], ), ], ), SizedBox( width: 20, ) ], ), SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context) .nationality, fontSize: 12, color: Colors.black), AppText( "${widget.model.getPatientInfoResponseModel.nationality}", fontSize: 12, color: Colors.grey[600], ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context) .occupation, fontSize: 12, color: Colors.black), AppText( "${widget.model.getPatientInfoResponseModel.occupation}", fontSize: 12, color: Colors.grey[600], ), ], ), SizedBox( width: 20, ) ], ), SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( TranslationBase.of(context) .mobileNo, fontSize: 12, color: Colors.black), AppText( "${widget.model.checkPatientForRegistrationModel.patientMobileNumber}", fontSize: 12, color: Colors.grey[600], ), ], ), SizedBox( width: 20, ) ], ), SizedBox( height: 20, ), ], ), ), ), AppTextFieldCustom( height: Helpers.getTextFieldHeight(), enabled: false, onClick: () { openMaritalStatusList(context); }, hintText: TranslationBase.of(context).maritalStatus, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, // controller: doseController, // validationError: isFormSubmitted && // _selectedMedicationDose == null // ? TranslationBase.of(context) // .emptyMessage // : null, ), SizedBox( height: 20, ), AppTextFieldCustom( height: Helpers.getTextFieldHeight(), enabled: false, onClick: () { openLangList(context); }, hintText: TranslationBase.of(context).lanEnglish, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, // controller: doseController, // validationError: isFormSubmitted && // _selectedMedicationDose == null // ? TranslationBase.of(context) // .emptyMessage // : null, ), SizedBox( height: 20, ), AppTextFieldCustom( hintText: "Email Address", //TranslationBase.of(context).addoperationReports, controller: emailAddressController, maxLines: 1, minLines: 1, hasBorder: true, ), SizedBox( height: 400, ), ], ), ), ), ), ], ), ), ), ), ), bottomSheet: Container( height: 60, margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Row( children: [ Expanded( child: Container( child: AppButton( title: TranslationBase.of(context).cancel, hasBorder: true, vPadding: 12, hPadding: 8, borderColor: Color(0xFFeaeaea), color: Color(0xFFeaeaea), fontColor: Colors.black, fontSize: 2.2, onPressed: () { Navigator.of(context).pop(); }, ), ), ), SizedBox( width: 8, ), Expanded( child: Container( child: AppButton( title: TranslationBase.of(context).next, hasBorder: true, vPadding: 12, hPadding: 8, borderColor: Color(0xFFB8382B), color: Color(0xFFB8382B), fontColor: Colors.white, fontSize: 2.0, onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); PatientRegistrationModel patientRegistrationModel = PatientRegistrationModel( // patientIdentificationID: // int.parse(_idController.text), // patientMobileNumber: // int.parse(_phoneController.text), // zipCode: _phoneCode.text, isHijri: 0, isDentalAllowedBackend: false, patientOutSA: 0, generalid: GENERAL_ID, // dOB: // "${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "yyyy/MM/dd")}" ); await widget.model.registrationPatient( patientRegistrationModel); if(widget.model.state == ViewState.ErrorLocal){ Helpers.showErrorToast(widget.model.error); } else { Navigator.of(context).pop(); } GifLoaderDialogUtils.hideDialog(context); }, ), ), ), ], ), ), ); } openMaritalStatusList(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, isDismissible: true, isScrollControlled: true, context: context, builder: (context) { return FractionallySizedBox( heightFactor: .3, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: const EdgeInsets.all(8.0), child: AppText( "${TranslationBase.of(context).maritalStatus} :", fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 18, ), ), Padding( padding: const EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.of(context).pop(); }, child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))), ), ], ), SizedBox( height: 10, ), InkWell( onTap: () {}, child: Row( children: [ Radio( value: 1, groupValue: 1, onChanged: (value) { setState(() {}); }, activeColor: Colors.red, ), AppText( "Single", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, ), ], ), ), InkWell( onTap: () {}, child: Row( children: [ Radio( value: 1, groupValue: 1, onChanged: (value) { setState(() {}); }, activeColor: Colors.red, ), AppText( "Married", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, ), ], ), ), InkWell( onTap: () {}, child: Row( children: [ Radio( value: 1, groupValue: 1, onChanged: (value) { setState(() {}); }, activeColor: Colors.red, ), AppText( "Divorce", fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, ), ], ), ), ], ), ); }); } openLangList(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, isDismissible: true, isScrollControlled: true, context: context, builder: (context) { return FractionallySizedBox( heightFactor: .3, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Padding( padding: const EdgeInsets.all(8.0), child: AppText( "language:", fontFamily: 'Poppins', fontWeight: FontWeight.w700, fontSize: 18, ), ), Padding( padding: const EdgeInsets.all(8.0), child: InkWell( onTap: () { Navigator.of(context).pop(); }, child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))), ), ], ), SizedBox( height: 10, ), InkWell( onTap: () {}, child: Row( children: [ Radio( value: 1, groupValue: 1, onChanged: (value) { setState(() {}); }, activeColor: Colors.red, ), AppText( TranslationBase.of(context).lanEnglish, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, ), ], ), ), InkWell( onTap: () {}, child: Row( children: [ Radio( value: 1, groupValue: 1, onChanged: (value) { setState(() {}); }, activeColor: Colors.red, ), AppText( TranslationBase.of(context).lanArabic, fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 15, ), ], ), ), ], ), ); }); } }