From b83c48abe55467cb8f880725c93efee6d1f64630 Mon Sep 17 00:00:00 2001 From: Aamir Date: Thu, 7 Dec 2023 10:32:12 +0300 Subject: [PATCH] Updates --- ios/Runner/Info.plist | 4 + lib/client/base_app_client.dart | 19 +- lib/core/service/authentication_service.dart | 77 ++--- .../viewModel/authentication_view_model.dart | 18 +- lib/core/viewModel/project_view_model.dart | 5 +- lib/landing_page.dart | 1 - lib/locator.dart | 1 - lib/main.dart | 84 +++--- lib/routes.dart | 6 +- lib/screens/auth/login_screen.dart | 221 ++++++-------- .../auth/verification_methods_screen.dart | 6 +- .../live-care_transfer_to_admin.dart | 42 ++- .../live_care/live_care_patient_screen.dart | 1 + .../medicine/medicine_search_screen.dart | 2 +- .../add_patient_sick_leave_screen.dart | 18 +- .../patients/DischargedPatientPage.dart | 274 +++++------------- .../In_patient/in_patient_list_page.dart | 2 +- .../out_patient/out_patient_screen.dart | 2 +- .../patient_search_result_screen.dart | 4 +- .../patient_search/patient_search_screen.dart | 110 +++---- .../profile/UCAF/ucaf_input_screen.dart | 46 +-- .../admission_request_first_screen.dart | 22 +- .../admission_request_second_screen.dart | 33 ++- .../admission_request_third_screen.dart | 8 +- .../profile/notes/note/update_note.dart | 12 +- .../update_operation_report.dart | 65 ++++- .../refer-patient-screen-in-patient.dart | 23 +- .../refer_details/refer-patient-screen.dart | 16 +- .../add_replay_on_referral_patient.dart | 67 ++--- .../assessment/add_assessment_details.dart | 19 +- .../objective/add_examination_widget.dart | 4 +- .../examinations_list_search_widget.dart | 32 +- .../soap_update/plan/update_plan_page.dart | 249 ++++++---------- .../subjective/allergies/allergies_item.dart | 16 +- ..._key_checkbox_search_allergies_widget.dart | 41 ++- .../update_Chief_complaints.dart | 9 + .../subjective/medication/add_medication.dart | 33 ++- .../register_patient/CustomEditableText.dart | 8 +- .../RegisterConfirmationPatientPage.dart | 253 ++++++---------- .../RegisterSearchPatientPage.dart | 214 +++++--------- .../prescription_form_widget.dart | 39 ++- .../prescription_checkout_screen.dart | 19 +- .../prescription/prescription_text_filed.dart | 6 +- .../procedures/add_procedure_page.dart | 79 ++--- .../entity_list_fav_procedure.dart | 24 +- lib/update_page.dart | 1 - lib/utils/utils.dart | 51 +--- .../shared/buttons/app_buttons_widget.dart | 11 +- .../shared/loader/gif_loader_container.dart | 10 +- .../master_key_checkbox_search_widget.dart | 51 +--- .../text_fields/app-textfield-custom.dart | 81 ++---- .../app_text_field_custom_serach.dart | 48 ++- .../text_fields/country_textfield_custom.dart | 28 +- 53 files changed, 1034 insertions(+), 1481 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 2314a2c8..5fc389f9 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -65,5 +65,9 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 6d08a7c2..c12158e5 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,19 +3,17 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/core/service/NavigationService.dart'; -import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/service/NavigationService.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; -import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; import 'package:provider/provider.dart'; -import '../locator.dart'; -import '../routes.dart'; - DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Utils helpers = new Utils(); @@ -37,7 +35,7 @@ class BaseAppClient { bool callLog = true; try { Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); - String token = await sharedPref.getString(TOKEN); + String? token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); @@ -90,7 +88,10 @@ class BaseAppClient { body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } - int projectID = await sharedPref.getInt(PROJECT_ID); + int? projectID = await sharedPref.getInt(PROJECT_ID); + // if (projectID != null) { + // projectID = 2; + // } if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3) @@ -148,7 +149,7 @@ class BaseAppClient { {required Map body, required Function(dynamic response, int statusCode) onSuccess, required Function(String error, int statusCode) onFailure, - PatiantInformtion? patient, + PatiantInformtion? patient, bool isExternal = false}) async { String url = BASE_URL + endPoint; diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 45c06ea9..54f4696e 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -1,4 +1,3 @@ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/core/model/auth/activation_code_for_verification_screen_model.dart'; @@ -8,39 +7,29 @@ import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; -import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/model/doctor/user_model.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class AuthenticationService extends BaseService { List _imeiDetails = []; List get dashboardItemsList => _imeiDetails; - NewLoginInformationModel _loginInfo = NewLoginInformationModel(); + late NewLoginInformationModel _loginInfo; NewLoginInformationModel get loginInfo => _loginInfo; - SendActivationCodeForDoctorAppResponseModel - _activationCodeVerificationScreenRes = - SendActivationCodeForDoctorAppResponseModel(); + SendActivationCodeForDoctorAppResponseModel _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); - SendActivationCodeForDoctorAppResponseModel - get activationCodeVerificationScreenRes => - _activationCodeVerificationScreenRes; + SendActivationCodeForDoctorAppResponseModel get activationCodeVerificationScreenRes => _activationCodeVerificationScreenRes; - SendActivationCodeForDoctorAppResponseModel _activationCodeForDoctorAppRes = - SendActivationCodeForDoctorAppResponseModel(); + SendActivationCodeForDoctorAppResponseModel _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); - SendActivationCodeForDoctorAppResponseModel - get activationCodeForDoctorAppRes => _activationCodeForDoctorAppRes; - CheckActivationCodeForDoctorAppResponseModel - _checkActivationCodeForDoctorAppRes = - CheckActivationCodeForDoctorAppResponseModel(); + SendActivationCodeForDoctorAppResponseModel get activationCodeForDoctorAppRes => _activationCodeForDoctorAppRes; + CheckActivationCodeForDoctorAppResponseModel _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); - CheckActivationCodeForDoctorAppResponseModel - get checkActivationCodeForDoctorAppRes => - _checkActivationCodeForDoctorAppRes; - Map _insertDeviceImeiRes = {}; + CheckActivationCodeForDoctorAppResponseModel get checkActivationCodeForDoctorAppRes => _checkActivationCodeForDoctorAppRes; + late Map _insertDeviceImeiRes; List _doctorProfilesList = []; @@ -48,8 +37,7 @@ class AuthenticationService extends BaseService { Future selectDeviceImei(imei) async { try { - await baseAppClient.post(SELECT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { _imeiDetails = []; response['List_DoctorDeviceDetails'].forEach((v) { _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); @@ -68,8 +56,7 @@ class AuthenticationService extends BaseService { hasError = false; _loginInfo = NewLoginInformationModel(); try { - await baseAppClient.post(LOGIN_URL, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(LOGIN_URL, onSuccess: (dynamic response, int statusCode) { _loginInfo = NewLoginInformationModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; @@ -81,16 +68,12 @@ class AuthenticationService extends BaseService { } } - Future sendActivationCodeVerificationScreen( - ActivationCodeForVerificationScreenModel activationCodeModel) async { + Future sendActivationCodeVerificationScreen(ActivationCodeForVerificationScreenModel activationCodeModel) async { hasError = false; - _activationCodeVerificationScreenRes = - SendActivationCodeForDoctorAppResponseModel(); + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel(); try { - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, - onSuccess: (dynamic response, int statusCode) { - _activationCodeVerificationScreenRes = - SendActivationCodeForDoctorAppResponseModel.fromJson(response); + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_VERIFICATION_SCREEN, onSuccess: (dynamic response, int statusCode) { + _activationCodeVerificationScreenRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -101,16 +84,12 @@ class AuthenticationService extends BaseService { } } - Future sendActivationCodeForDoctorApp( - ActivationCodeModel activationCodeModel) async { + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel) async { hasError = false; - _activationCodeForDoctorAppRes = - SendActivationCodeForDoctorAppResponseModel(); + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel(); try { - await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - _activationCodeForDoctorAppRes = - SendActivationCodeForDoctorAppResponseModel.fromJson(response); + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { + _activationCodeForDoctorAppRes = SendActivationCodeForDoctorAppResponseModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -121,16 +100,12 @@ class AuthenticationService extends BaseService { } } - Future checkActivationCodeForDoctorApp( - CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { hasError = false; - _checkActivationCodeForDoctorAppRes = - CheckActivationCodeForDoctorAppResponseModel(); + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel(); try { - await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, - onSuccess: (dynamic response, int statusCode) { - _checkActivationCodeForDoctorAppRes = - CheckActivationCodeForDoctorAppResponseModel.fromJson(response); + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { + _checkActivationCodeForDoctorAppRes = CheckActivationCodeForDoctorAppResponseModel.fromJson(response); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -145,8 +120,7 @@ class AuthenticationService extends BaseService { hasError = false; _insertDeviceImeiRes = {}; try { - await baseAppClient.post(INSERT_DEVICE_IMEI, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { _insertDeviceImeiRes = response; }, onFailure: (String error, int statusCode) { hasError = true; @@ -161,8 +135,7 @@ class AuthenticationService extends BaseService { Future getDoctorProfileBasedOnClinic(ProfileReqModel profileReqModel) async { hasError = false; try { - await baseAppClient.post(GET_DOC_PROFILES, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { _doctorProfilesList.clear(); response['DoctorProfileList'].forEach((v) { _doctorProfilesList.add(DoctorProfileModel.fromJson(v)); diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index f7b8dcbf..f4544062 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -11,19 +11,19 @@ import 'package:doctor_app_flutter/core/model/auth/imei_details.dart'; import 'package:doctor_app_flutter/core/model/auth/insert_imei_model.dart'; import 'package:doctor_app_flutter/core/model/auth/new_login_information_response_model.dart'; import 'package:doctor_app_flutter/core/model/auth/send_activation_code_for_doctor_app_response_model.dart'; +import 'package:doctor_app_flutter/core/model/doctor/clinic_model.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/core/model/doctor/profile_req_Model.dart'; +import 'package:doctor_app_flutter/core/model/doctor/user_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_request_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/hospitals/hospitals_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; -import 'package:doctor_app_flutter/core/model/doctor/clinic_model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/profile_req_Model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/user_model.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/services.dart'; import 'package:local_auth/local_auth.dart'; @@ -113,11 +113,11 @@ class AuthenticationViewModel extends BaseViewModel { error = _authService.error; setState(ViewState.ErrorLocal); } else { - sharedPref.setInt(PROJECT_ID, userInfo.projectID!); + await sharedPref.setInt(PROJECT_ID, userInfo.projectID!); loggedUser = loginInfo; - saveObjToString(LOGGED_IN_USER, loginInfo); - sharedPref.remove(LAST_LOGIN_USER); - sharedPref.setString(TOKEN, loginInfo.logInTokenID!); + await saveObjToString(LOGGED_IN_USER, loginInfo); + await sharedPref.remove(LAST_LOGIN_USER); + await sharedPref.setString(TOKEN, loginInfo.logInTokenID!); setState(ViewState.Idle); } } diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index 215e11cd..9f8afe7f 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -17,9 +17,10 @@ Utils helpers = Utils(); class ProjectViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); - late Locale _appLocale; - String currentLanguage = 'ar'; + Locale _appLocale = Locale('ar'); + + String? currentLanguage = 'ar'; bool _isArabic = false; bool isInternetConnection = true; List doctorClinicsList = []; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 39157266..89973192 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -8,7 +8,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_drawer_widget.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/bottom_nav_bar.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; diff --git a/lib/locator.dart b/lib/locator.dart index 0001354e..e82934bd 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -118,7 +118,6 @@ void setupLocator() { locator.registerLazySingleton(() => InterventionMedicationService()); locator.registerLazySingleton(() => ERSignInService()); - /// View Model locator.registerFactory(() => DoctorReplayViewModel()); locator.registerFactory(() => ScheduleViewModel()); diff --git a/lib/main.dart b/lib/main.dart index 8d0cf8c4..ad3be8ab 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,21 +1,19 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; +import 'package:doctor_app_flutter/core/service/NavigationService.dart'; +import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:firebase_analytics/firebase_analytics.dart'; -import 'package:firebase_analytics/observer.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import './config/size_config.dart'; -import './routes.dart'; -import 'config/config.dart'; -import 'core/service/AnalyticsService.dart'; -import 'core/service/NavigationService.dart'; -import 'core/viewModel/authentication_view_model.dart'; -import 'locator.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:provider/provider.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -34,8 +32,7 @@ class MyApp extends StatelessWidget { SizeConfig().init(constraints, orientation); return MultiProvider( providers: [ - ChangeNotifierProvider( - create: (context) => AuthenticationViewModel()), + ChangeNotifierProvider(create: (context) => AuthenticationViewModel()), ChangeNotifierProvider( create: (context) => ProjectViewModel(), ), @@ -48,37 +45,38 @@ class MyApp extends StatelessWidget { ) ], child: Consumer( - builder: (context, projectProvider, child) => MaterialApp( - showSemanticsDebugger: false, - title: 'Doctors App', - locale: projectProvider.appLocal, - localizationsDelegates: [ - TranslationBaseDelegate(), - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - DefaultCupertinoLocalizations.delegate - ], - supportedLocales: [ - const Locale('ar', ''), // Arabic - const Locale('en', ''), // English - ], - theme: ThemeData( - primarySwatch: Colors.grey, - primaryColor: Colors.grey, - //buttonColor: HexColor('#D02127'), - fontFamily: 'Poppins', - dividerColor: Colors.grey[350], - backgroundColor: Color.fromRGBO(255, 255, 255, 1), - ), - navigatorKey: locator().navigatorKey, - navigatorObservers: [ - locator().getAnalyticsObserver(), - ], - initialRoute: INIT_ROUTE, - routes: routes, - debugShowCheckedModeBanner: false, - )), + builder: (context, projectProvider, child) => MaterialApp( + showSemanticsDebugger: false, + title: 'Doctors App', + locale: projectProvider.appLocal, + localizationsDelegates: [ + TranslationBaseDelegate(), + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + DefaultCupertinoLocalizations.delegate + ], + supportedLocales: [ + const Locale('ar', ''), // Arabic + const Locale('en', ''), // English + ], + theme: ThemeData( + primarySwatch: Colors.grey, + primaryColor: Colors.grey, + //buttonColor: HexColor('#D02127'), + fontFamily: 'Poppins', + dividerColor: Colors.grey[350], + backgroundColor: Color.fromRGBO(255, 255, 255, 1), + useMaterial3: false), + navigatorKey: locator().navigatorKey, + navigatorObservers: [ + locator().getAnalyticsObserver(), + ], + initialRoute: INIT_ROUTE, + routes: routes, + debugShowCheckedModeBanner: false, + ), + ), ); }); }, diff --git a/lib/routes.dart b/lib/routes.dart index 114e6dca..71434262 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -55,8 +55,7 @@ const String ORDER_NOTE = 'patients/order-note'; const String MY_REFERRAL_DETAIL = 'my_referral_detail'; const String REFER_PATIENT_TO_DOCTOR = 'patients/refer-to-doctor'; const String REFER_IN_PATIENT_TO_DOCTOR = 'patients/refer-in-patient-to-doctor'; -const String PATIENT_INSURANCE_APPROVALS_NEW = - 'patients/patient_insurance_approvals_new'; +const String PATIENT_INSURANCE_APPROVALS_NEW = 'patients/patient_insurance_approvals_new'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; const String CREATE_EPISODE = 'patients/create-episode'; const String UPDATE_EPISODE = 'patients/update-episode'; @@ -83,12 +82,11 @@ const String NURSING_PROGRESS_NOTE = 'nursing_progress_note'; const String DIAGNOSIS_FOR_IN_PATIENT = 'get_diagnosis_for_in_patient'; const String DIABETIC_CHART_VALUES = 'get_diabetic_chart_values'; -const String VTE_ASSESSMENT = 'vte_assessment '; +const String VTE_ASSESSMENT = 'vte_assessment '; const String DISCHARGE_SUMMARY = 'discharge_summary'; const String PHARMACY_INTERVENTION = 'new_medication'; const String INTERVENTION_MEDICATION = 'intervention_medication'; - //todo: change the routing way. var routes = { ROOT: (_) => RootPage(), diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 13489fe6..502e65ee 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -3,8 +3,8 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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/text_fields/app-textfield-custom.dart'; @@ -44,146 +44,106 @@ class _LoginScreenState extends State { Container( margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), alignment: Alignment.topLeft, - child: Column( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( + Container( + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - //TODO Use App Text rather than text - Container( - child: Column( + Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - ], + SizedBox( + height: 30, ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Text( - TranslationBase.of(context).welcomeTo, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase.of(context) - .drSulaimanAlHabib, - style: TextStyle( - color: Color(0xFF2B353E), - fontWeight: FontWeight.bold, - fontSize: SizeConfig.isMobile - ? 24 - : SizeConfig.realScreenWidth! * - 0.029, - fontFamily: 'Poppins'), - ), - Text( - "Doctor App", - style: TextStyle( - fontSize: SizeConfig.isMobile - ? 16 - : SizeConfig.realScreenWidth! * - 0.030, - fontWeight: FontWeight.w600, - color: Color(0xFFD02127)), - ), - ]), ], - )), - SizedBox( - height: 40, ), - Form( - key: loginFormKey, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: SizeConfig.realScreenWidth! * 0.90, - height: SizeConfig.realScreenHeight! * 0.65, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - buildSizedBox(), - AppTextFieldCustom( - hintText: - TranslationBase.of(context).enterId, - hasBorder: true, - controller: userIdController, - onChanged: (value) { - if (value != null) - setState(() { - authenticationViewModel.userInfo - .userID = value.trim(); - }); - }, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .enterPassword, - hasBorder: true, - isSecure: true, - controller: passwordController, - onChanged: (value) { - if (value != null) - setState(() { - authenticationViewModel.userInfo - .password = value.trim(); - }); - // if(allowCallApi) { - this.getProjects( - authenticationViewModel - .userInfo.userID); - // setState(() { - // allowCallApi = false; - // }); - // } - }, - onClick: () {}, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .selectYourProject, - hasBorder: true, - controller: projectIdController, - isTextFieldHasSuffix: true, - enabled: false, - onClick: () { - Utils.showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject, - authenticationViewModel); - }, - ), - buildSizedBox() - ]), - ), - ], + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 10, + ), + Text( + TranslationBase.of(context).welcomeTo, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, fontFamily: 'Poppins'), + ), + Text( + TranslationBase.of(context).drSulaimanAlHabib, + style: TextStyle(color: Color(0xFF2B353E), fontWeight: FontWeight.bold, fontSize: SizeConfig.isMobile ? 24 : SizeConfig.realScreenWidth! * 0.029, fontFamily: 'Poppins'), + ), + Text( + "Doctor App", + style: TextStyle(fontSize: SizeConfig.isMobile ? 16 : SizeConfig.realScreenWidth! * 0.030, fontWeight: FontWeight.w600, color: Color(0xFFD02127)), ), - ) + ]), ], + )), + SizedBox( + height: 40, + ), + Form( + key: loginFormKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: SizeConfig.realScreenWidth! * 0.90, + height: SizeConfig.realScreenHeight! * 0.65, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterId, + hasBorder: true, + controller: userIdController, + onChanged: (value) { + if (value != null) authenticationViewModel.userInfo.userID = value.trim(); + print(authenticationViewModel.userInfo.userID); + //setState(() {}); + }, + onClick: () {}, + onFieldSubmitted: () {}, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterPassword, + hasBorder: true, + isSecure: true, + controller: passwordController, + onChanged: (value) { + if (value != null) authenticationViewModel.userInfo.password = value.trim(); + getProjects(authenticationViewModel.userInfo.userID); + setState(() {}); + }, + onClick: () {}, + onFieldSubmitted: () {}, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).selectYourProject, + hasBorder: true, + controller: projectIdController, + isTextFieldHasSuffix: true, + enabled: false, + onClick: () { + if (projectsList.isNotEmpty) Utils.showCupertinoPicker(context, projectsList, 'facilityName', onSelectProject, authenticationViewModel); + }, + onFieldSubmitted: () {}, + onChanged: (value) {}, + ), + buildSizedBox() + ]), + ), + ], + ), ) - ])) + ], + ) + ])) ]), ), bottomSheet: Container( - height: 90, + height: 100, width: double.infinity, child: Center( child: FractionallySizedBox( @@ -195,8 +155,7 @@ class _LoginScreenState extends State { title: TranslationBase.of(context).login, color: AppGlobal.appRedColor, fontWeight: FontWeight.w600, - disabled: authenticationViewModel.userInfo.userID == null || - authenticationViewModel.userInfo.password == null, + disabled: authenticationViewModel.userInfo.userID == null || authenticationViewModel.userInfo.password == null, onPressed: () { login(context); }, @@ -246,8 +205,7 @@ class _LoginScreenState extends State { onSelectProject(index) { setState(() { - authenticationViewModel.userInfo.projectID = - projectsList[index].facilityId; + authenticationViewModel.userInfo.projectID = projectsList[index].facilityId; projectIdController.text = projectsList[index].facilityName!; }); @@ -264,8 +222,7 @@ class _LoginScreenState extends State { if (authenticationViewModel.state == ViewState.Idle) { projectsList = authenticationViewModel.hospitals; setState(() { - authenticationViewModel.userInfo.projectID = - projectsList[0].facilityId; + authenticationViewModel.userInfo.projectID = projectsList[0].facilityId; projectIdController.text = projectsList[0].facilityName!; }); } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index c6a0b68f..8ced2aeb 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -23,7 +23,7 @@ import '../../utils/dr_app_shared_pref.dart'; import '../../utils/utils.dart'; import '../../widgets/auth/verification_methods_list.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); Utils helpers = Utils(); ///TODO Elham* check if this still in user or not @@ -45,7 +45,7 @@ class _VerificationMethodsScreenState extends State { late AuthMethodTypes fingerPrintBefore; late AuthMethodTypes selectedOption; - AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); + late AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { @@ -94,7 +94,7 @@ class _VerificationMethodsScreenState extends State { letterSpacing: -0.72, ), AppText( - Utils.convertToTitleCase(authenticationViewModel.user.doctorName!), + Utils.convertToTitleCase(authenticationViewModel.user.doctorName ?? ""), fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 6, color: AppGlobal.appTextColor, fontWeight: FontWeight.bold, diff --git a/lib/screens/live_care/live-care_transfer_to_admin.dart b/lib/screens/live_care/live-care_transfer_to_admin.dart index b5fd9594..3730861d 100644 --- a/lib/screens/live_care/live-care_transfer_to_admin.dart +++ b/lib/screens/live_care/live-care_transfer_to_admin.dart @@ -1,14 +1,14 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.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/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/button_bottom_sheet.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; @@ -26,8 +26,7 @@ class LivaCareTransferToAdmin extends StatefulWidget { const LivaCareTransferToAdmin({Key? key, this.patient}) : super(key: key); @override - _LivaCareTransferToAdminState createState() => - _LivaCareTransferToAdminState(); + _LivaCareTransferToAdminState createState() => _LivaCareTransferToAdminState(); } class _LivaCareTransferToAdminState extends State { @@ -59,8 +58,7 @@ class _LivaCareTransferToAdminState extends State { onModelReady: (model) {}, builder: (_, model, w) => AppScaffold( baseViewModel: model, - appBarTitle: - "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", backgroundColor: Theme.of(context).scaffoldBackgroundColor, isShowAppBar: true, body: Container( @@ -81,21 +79,21 @@ class _LivaCareTransferToAdminState extends State { minLines: 25, hasBorder: true, validationError: noteError!, + onClick: () {}, + + onFieldSubmitted: () {}, + onChanged: (String? value) {}, ), Positioned( top: -2, //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context).size.width * 0.75 - : 15, + right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * 0.75 : 15, child: Column( children: [ IconButton( - icon: Icon(DoctorApp.speechtotext, - color: Colors.black, size: 35), + icon: Icon(DoctorApp.speechtotext, color: Colors.black, size: 35), onPressed: () { - initSpeechState() - .then((value) => {onVoiceText()}); + initSpeechState().then((value) => {onVoiceText()}); }, ), ], @@ -106,8 +104,7 @@ class _LivaCareTransferToAdminState extends State { ), ), ButtonBottomSheet( - title: - "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", + title: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}", onPressed: () { setState(() { if (noteController.text.isEmpty) { @@ -116,19 +113,16 @@ class _LivaCareTransferToAdminState extends State { noteError = null; } if (noteController.text.isNotEmpty) { - Utils.showConfirmationDialog(context, - "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?", + Utils.showConfirmationDialog(context, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?", () async { Navigator.of(context).pop(); GifLoaderDialogUtils.showMyDialog(context); - await model.transferToAdmin( - widget.patient!.vcId!, noteController.text); + await model.transferToAdmin(widget.patient!.vcId!, noteController.text); GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast( - "You successfully transfer to admin"); + DrAppToastMsg.showSuccesToast("You successfully transfer to admin"); Navigator.of(context).pop(); Navigator.of(context).pop(); Navigator.of(context).pop(); @@ -148,8 +142,7 @@ class _LivaCareTransferToAdminState extends State { onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, @@ -193,8 +186,7 @@ class _LivaCareTransferToAdminState extends State { } Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); + bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener); print(hasSpeech); if (!mounted) return; } diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index df8feedf..1ab0b411 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -86,6 +86,7 @@ class _LiveCarePatientScreenState extends State { iconSize: 20, onPressed: () {}, ), + onFieldSubmitted: () {}, ), model.state == ViewState.Idle ? Expanded( diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 9637338d..e67c7a84 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -95,7 +95,7 @@ class _MedicineSearchState extends State { onFieldSubmitted: (value) { searchMedicine(context, model); }, - marginTop: 5, + marginTop: 5, onChangeFun: (){}, ), Container( margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 0), diff --git a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart index 5990bdc8..0fb93724 100644 --- a/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart +++ b/lib/screens/patient-sick-leave/add_patient_sick_leave_screen.dart @@ -1,23 +1,22 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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/text_fields/app-textfield-custom.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -113,12 +112,14 @@ class _AddPatientSickLeaveScreenState extends State { inputType: TextInputType.number, controller: _numberOfDayController, onChanged: (value) { - if (value.isNotEmpty) + if (value != null) setState(() { addSickLeave.noOfDays = value; }); }, validationError: isFormSubmitted && (addSickLeave.noOfDays == null) ? TranslationBase.of(context).pleaseEnterNoOfDays : "", + onClick: () {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -146,6 +147,7 @@ class _AddPatientSickLeaveScreenState extends State { }); }, validationError: isFormSubmitted && (addSickLeave.startDate == null) ? TranslationBase.of(context).pleaseEnterDate : "", + onFieldSubmitted: () {}, ), SizedBox( height: 5, @@ -161,6 +163,8 @@ class _AddPatientSickLeaveScreenState extends State { inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], controller: _clinicController, onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -207,6 +211,8 @@ class _AddPatientSickLeaveScreenState extends State { inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], controller: _doctorController, onChanged: (value) {}, + onClick: () {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -224,6 +230,8 @@ class _AddPatientSickLeaveScreenState extends State { addSickLeave.remarks = value; }); }, + onClick: () {}, + onFieldSubmitted: () {}, ), SizedBox( height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10) + 20, diff --git a/lib/screens/patients/DischargedPatientPage.dart b/lib/screens/patients/DischargedPatientPage.dart index 97464ca9..30cf3642 100644 --- a/lib/screens/patients/DischargedPatientPage.dart +++ b/lib/screens/patients/DischargedPatientPage.dart @@ -58,8 +58,10 @@ class _DischargedPatientState extends State { DoctorApp.filter_1, color: Colors.black, ), - iconSize: 20, onPressed: () { }, + iconSize: 20, + onPressed: () {}, ), + onFieldSubmitted: () {}, ), SizedBox( height: 5, @@ -72,136 +74,70 @@ class _DischargedPatientState extends State { model.filterData.length, (index) => InkWell( onTap: () { - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": - model.filterData[index], - "patientType": "1", - "isSearch": false, - "isInpatient": true, - "isDischargedPatient": true - }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, + arguments: {"patient": model.filterData[index], "patientType": "1", "isSearch": false, "isInpatient": true, "isDischargedPatient": true}); }, child: Container( width: double.maxFinite, margin: EdgeInsets.all(8), - padding: EdgeInsets.only( - left: 0, - right: 5, - bottom: 5, - top: 5), + padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(15), + borderRadius: BorderRadius.circular(15), color: Colors.white, ), child: Column( children: [ Padding( - padding: EdgeInsets.only( - left: 12.0), + padding: EdgeInsets.only(left: 12.0), child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(children: [ Container( width: 170, child: AppText( - (Utils.capitalize(model - .filterData[ - index] - .firstName) + - " " + - Utils.capitalize(model - .filterData[ - index] - .lastName)), + (Utils.capitalize(model.filterData[index].firstName) + " " + Utils.capitalize(model.filterData[index].lastName)), fontSize: 16, - fontWeight: - FontWeight - .bold, - fontFamily: - 'Poppins', - textOverflow: - TextOverflow - .ellipsis, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + textOverflow: TextOverflow.ellipsis, ), ), - model.filterData[index] - .gender == - 1 + model.filterData[index].gender == 1 ? Icon( - DoctorApp - .male_2, - color: Colors - .blue, + DoctorApp.male_2, + color: Colors.blue, ) : Icon( - DoctorApp - .female_1, - color: Colors - .pink, + DoctorApp.female_1, + color: Colors.pink, ), ]), Row( children: [ AppText( - model.filterData[index].nationalityName != - null - ? model - .filterData[ - index] - .nationalityName - !.trim() - : model.filterData[index].nationality != - null - ? model - .filterData[ - index] - .nationality - !.trim() - : model.filterData[index].nationalityId != - null + model.filterData[index].nationalityName != null + ? model.filterData[index].nationalityName!.trim() + : model.filterData[index].nationality != null + ? model.filterData[index].nationality!.trim() + : model.filterData[index].nationalityId != null ? model.filterData[index].nationalityId! : "", - fontWeight: - FontWeight - .bold, + fontWeight: FontWeight.bold, fontSize: 14, - textOverflow: - TextOverflow - .ellipsis, + textOverflow: TextOverflow.ellipsis, ), - model.filterData[index].nationality != - null || - model.filterData[index].nationalityId != - null + model.filterData[index].nationality != null || model.filterData[index].nationalityId != null ? ClipRRect( - borderRadius: - BorderRadius.circular( - 20.0), - child: Image - .network( - model.filterData[index].nationalityFlagURL != - null - ? model.filterData[index].nationalityFlagURL! - : '', - height: - 25, - width: - 30, - errorBuilder: (BuildContext context, - Object - exception, - StackTrace? - stackTrace) { + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + model.filterData[index].nationalityFlagURL != null ? model.filterData[index].nationalityFlagURL! : '', + height: 25, + width: 30, + errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return AppText( '', - fontSize: - 10, + fontSize: 10, ); }, )) @@ -213,26 +149,16 @@ class _DischargedPatientState extends State { Row( children: [ Column( - mainAxisAlignment: - MainAxisAlignment - .start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: - EdgeInsets.only( - left: 12.0), + padding: EdgeInsets.only(left: 12.0), child: Container( width: 60, height: 60, - child: - Image.asset( - model.filterData[index] - .gender == - 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', - fit: BoxFit - .cover, + child: Image.asset( + model.filterData[index].gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', + fit: BoxFit.cover, ), ), ), @@ -243,118 +169,57 @@ class _DischargedPatientState extends State { ), Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: RichText( - text: + text: new TextSpan( + style: new TextStyle(fontSize: 2.0 * SizeConfig.textMultiplier!, color: Colors.black), + children: [ + new TextSpan(text: TranslationBase.of(context).fileNumber, style: TextStyle(fontSize: 14, fontFamily: 'Poppins')), new TextSpan( - style: new TextStyle( - fontSize: 2.0 * - SizeConfig - .textMultiplier!, - color: Colors - .black), - children: < - TextSpan>[ - new TextSpan( - text: TranslationBase.of(context) - .fileNumber, - style: TextStyle( - fontSize: - 14, - fontFamily: - 'Poppins')), - new TextSpan( - text: model - .filterData[ - index] - .patientId - .toString(), - style: TextStyle( - fontWeight: FontWeight - .w700, - fontFamily: - 'Poppins', - fontSize: - 15)), + text: model.filterData[index].patientId.toString(), + style: TextStyle(fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 15)), ], ), ), ), Container( child: RichText( - text: - new TextSpan( - style: - new TextStyle( - fontSize: 2.0 * - SizeConfig - .textMultiplier!, - color: Colors - .black, - fontFamily: - 'Poppins', + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier!, + color: Colors.black, + fontFamily: 'Poppins', ), - children: < - TextSpan>[ + children: [ new TextSpan( - text: model.filterData[index].admissionDate == - null - ? "" - : TranslationBase.of(context).admissionDate + - " : ", - style: TextStyle( - fontSize: - 14)), + text: model.filterData[index].admissionDate == null ? "" : TranslationBase.of(context).admissionDate + " : ", + style: TextStyle(fontSize: 14)), new TextSpan( - text: model.filterData[index].admissionDate == - null + text: model.filterData[index].admissionDate == null ? "" : "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].admissionDate.toString(), 'yyyy-MM-dd')}", - style: TextStyle( - fontWeight: - FontWeight.w700, - fontSize: 15)), + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)), ], ), ), ), Container( child: RichText( - text: - new TextSpan( - style: - new TextStyle( - fontSize: 2.0 * - SizeConfig - .textMultiplier!, - color: Colors - .black, - fontFamily: - 'Poppins', + text: new TextSpan( + style: new TextStyle( + fontSize: 2.0 * SizeConfig.textMultiplier!, + color: Colors.black, + fontFamily: 'Poppins', ), - children: < - TextSpan>[ - new TextSpan( - text: model.filterData[index].dischargeDate == - null - ? "" - : "Discharge Date : ", - style: TextStyle( - fontSize: - 14)), + children: [ + new TextSpan(text: model.filterData[index].dischargeDate == null ? "" : "Discharge Date : ", style: TextStyle(fontSize: 14)), new TextSpan( - text: model.filterData[index].dischargeDate == - null + text: model.filterData[index].dischargeDate == null ? "" : "${AppDateUtils.convertDateFromServerFormat(model.filterData[index].dischargeDate.toString(), 'yyyy-MM-dd')}", - style: TextStyle( - fontWeight: - FontWeight.w700, - fontSize: 15)), + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)), ], ), ), @@ -364,17 +229,12 @@ class _DischargedPatientState extends State { AppText( "${TranslationBase.of(context).numOfDays}: ", fontSize: 14, - fontWeight: - FontWeight - .w300, + fontWeight: FontWeight.w300, ), AppText( "${AppDateUtils.convertStringToDate(model.filterData[index].dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(model.filterData[index].admissionDate!)).inDays + 1}", - fontSize: - 15, - fontWeight: - FontWeight - .w700), + fontSize: 15, + fontWeight: FontWeight.w700), ], ), ], diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index 536342f3..d3ebf42f 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -135,7 +135,7 @@ class _InPatientListPageState extends State { isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, - ), + ), onFieldSubmitted: (){}, ), widget.patientSearchViewModel!.state == ViewState.Idle ? (widget.isMyInPatient && widget.patientSearchViewModel!.myIinPatientList.length > 0) diff --git a/lib/screens/patients/out_patient/out_patient_screen.dart b/lib/screens/patients/out_patient/out_patient_screen.dart index e56080f6..6f376470 100644 --- a/lib/screens/patients/out_patient/out_patient_screen.dart +++ b/lib/screens/patients/out_patient/out_patient_screen.dart @@ -191,7 +191,7 @@ class _OutPatientsScreenState extends State { model.sortOutPatient(isDes: isSortDes); isSortDes = !isSortDes; }, - ), + ), onFieldSubmitted: (){}, ), Expanded( child: Container( diff --git a/lib/screens/patients/patient_search/patient_search_result_screen.dart b/lib/screens/patients/patient_search/patient_search_result_screen.dart index 8c64ea1a..2abfb1af 100644 --- a/lib/screens/patients/patient_search/patient_search_result_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_result_screen.dart @@ -1,10 +1,10 @@ import 'package:doctor_app_flutter/core/enum/patient_type.dart'; +import 'package:doctor_app_flutter/core/model/patient/patient_model.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_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/core/model/patient/patient_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; @@ -91,7 +91,7 @@ class _PatientsSearchResultScreenState ), iconSize: 20, onPressed: () { }, // padding: EdgeInsets.only(bottom: 30), - ), + ), onFieldSubmitted: (){}, ), SizedBox( height: 10.0, diff --git a/lib/screens/patients/patient_search/patient_search_screen.dart b/lib/screens/patients/patient_search/patient_search_screen.dart index 8e1c7116..b89be8f5 100644 --- a/lib/screens/patients/patient_search/patient_search_screen.dart +++ b/lib/screens/patients/patient_search/patient_search_screen.dart @@ -11,7 +11,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/text_fields/app_text_field_custom_serach.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -45,48 +44,37 @@ class _PatientSearchScreenState extends State { child: Center( child: Column( children: [ - BottomSheetTitle( - title: TranslationBase.of(context).searchPatient), + BottomSheetTitle(title: TranslationBase.of(context).searchPatient), FractionallySizedBox( // widthFactor: 0.9, child: Container( color: Theme.of(context).scaffoldBackgroundColor, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustomSearch( - searchController: patientFileInfoController, - onChangeFun: (value) {}, - marginTop: 5, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - inputType: TextInputType.number, - validationError: (isFormSubmitted && - (patientFileInfoController.text.isEmpty && - firstNameInfoController - .text.isEmpty && - middleNameInfoController - .text.isEmpty && - lastNameFileInfoController - .text.isEmpty)) - ? TranslationBase.of(context).emptyMessage - : "", - ), - SizedBox( - height: 5, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.12, - ), - ])), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 16, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustomSearch( + searchController: patientFileInfoController, + onChangeFun: (value) {}, + marginTop: 5, + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))], + inputType: TextInputType.number, + validationError: (isFormSubmitted && + (patientFileInfoController.text.isEmpty && firstNameInfoController.text.isEmpty && middleNameInfoController.text.isEmpty && lastNameFileInfoController.text.isEmpty)) + ? TranslationBase.of(context).emptyMessage + : "", + onFieldSubmitted: () {}, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.12, + ), + ])), ), ], ), @@ -137,52 +125,31 @@ class _PatientSearchScreenState extends State { setState(() { isFormSubmitted = true; }); - PatientSearchRequestModel patientSearchRequestModel = - PatientSearchRequestModel( - doctorID: authenticationViewModel.doctorProfile!.doctorID); + PatientSearchRequestModel patientSearchRequestModel = PatientSearchRequestModel(doctorID: authenticationViewModel.doctorProfile!.doctorID); if (showOther) { - patientSearchRequestModel.firstName = - firstNameInfoController.text.trim().isEmpty - ? "0" - : firstNameInfoController.text.trim(); - patientSearchRequestModel.middleName = - middleNameInfoController.text.trim().isEmpty - ? "0" - : middleNameInfoController.text.trim(); - patientSearchRequestModel.lastName = - lastNameFileInfoController.text.isEmpty - ? "0" - : lastNameFileInfoController.text.trim(); + patientSearchRequestModel.firstName = firstNameInfoController.text.trim().isEmpty ? "0" : firstNameInfoController.text.trim(); + patientSearchRequestModel.middleName = middleNameInfoController.text.trim().isEmpty ? "0" : middleNameInfoController.text.trim(); + patientSearchRequestModel.lastName = lastNameFileInfoController.text.isEmpty ? "0" : lastNameFileInfoController.text.trim(); } if (patientFileInfoController.text.isNotEmpty) { - if (patientFileInfoController.text.length == 10 && - (patientFileInfoController.text[0] == '2' || - patientFileInfoController.text[0] == '1')) { - patientSearchRequestModel.identificationNo = - patientFileInfoController.text; + if (patientFileInfoController.text.length == 10 && (patientFileInfoController.text[0] == '2' || patientFileInfoController.text[0] == '1')) { + patientSearchRequestModel.identificationNo = patientFileInfoController.text; patientSearchRequestModel.searchType = 2; patientSearchRequestModel.patientID = 0; - } else if ((patientFileInfoController.text.length == 10 || - patientFileInfoController.text.length == 9) && - ((patientFileInfoController.text[0] == '0' && - patientFileInfoController.text[1] == '5') || - patientFileInfoController.text[0] == '5')) { + } else if ((patientFileInfoController.text.length == 10 || patientFileInfoController.text.length == 9) && + ((patientFileInfoController.text[0] == '0' && patientFileInfoController.text[1] == '5') || patientFileInfoController.text[0] == '5')) { patientSearchRequestModel.mobileNo = patientFileInfoController.text; patientSearchRequestModel.searchType = 0; } else { - patientSearchRequestModel.patientID = - int.parse(patientFileInfoController.text); + patientSearchRequestModel.patientID = int.parse(patientFileInfoController.text); patientSearchRequestModel.searchType = 1; } } GifLoaderDialogUtils.hideDialog(context); - if (patientFileInfoController.text.isNotEmpty || - firstNameInfoController.text.isNotEmpty || - middleNameInfoController.text.isNotEmpty || - lastNameFileInfoController.text.isNotEmpty) { + if (patientFileInfoController.text.isNotEmpty || firstNameInfoController.text.isNotEmpty || middleNameInfoController.text.isNotEmpty || lastNameFileInfoController.text.isNotEmpty) { setState(() { isFormSubmitted = false; }); @@ -192,8 +159,7 @@ class _PatientSearchScreenState extends State { builder: (BuildContext context) => PatientsSearchResultScreen( selectedPatientType: selectedPatientType, patientSearchRequestModel: patientSearchRequestModel, - isSearchWithKeyInfo: - patientFileInfoController.text.isNotEmpty ? true : false, + isSearchWithKeyInfo: patientFileInfoController.text.isNotEmpty ? true : false, isSearch: true, isSearchAndOut: true, searchKey: patientFileInfoController.text, diff --git a/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart index 32e7d7ae..1fecc2b7 100644 --- a/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart +++ b/lib/screens/patients/profile/UCAF/ucaf_input_screen.dart @@ -10,7 +10,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; class UCAFInputScreen extends StatefulWidget { final PatiantInformtion patient; @@ -67,17 +66,14 @@ class _UCAFInputScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, - body: model.patientVitalSignsHistory != null && - model.patientVitalSignsHistory.length > 0 && - model.patientChiefComplaintList != null && - model.patientChiefComplaintList.length > 0 + body: model.patientVitalSignsHistory != null && model.patientVitalSignsHistory.length > 0 && model.patientChiefComplaintList != null && model.patientChiefComplaintList.length > 0 ? Column( children: [ Expanded( child: SingleChildScrollView( child: Center( child: FractionallySizedBox( - widthFactor: .9, + widthFactor: .9, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, @@ -98,8 +94,7 @@ class _UCAFInputScreenState extends State { ), AppText( "BP (H/L)", - fontSize: - SizeConfig.textMultiplier! * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -108,21 +103,18 @@ class _UCAFInputScreenState extends State { ), AppText( "${model.bloodPressure}", - fontSize: - SizeConfig.textMultiplier! * 2, + fontSize: SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), ], ), - Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( "${TranslationBase.of(context).temperature}", - fontSize: - SizeConfig.textMultiplier! * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -132,8 +124,7 @@ class _UCAFInputScreenState extends State { Expanded( child: AppText( "${model.temperatureCelcius}(C), ${(double.parse(model.temperatureCelcius) * (9 / 5) + 32).toStringAsFixed(2)}(F)", - fontSize: - SizeConfig.textMultiplier! * 2, + fontSize: SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -147,8 +138,7 @@ class _UCAFInputScreenState extends State { children: [ AppText( "${TranslationBase.of(context).pulseBeats}:", - fontSize: - SizeConfig.textMultiplier! * 1.8, + fontSize: SizeConfig.textMultiplier! * 1.8, color: Colors.black, fontWeight: FontWeight.normal, ), @@ -157,8 +147,7 @@ class _UCAFInputScreenState extends State { ), AppText( "${model.hartRat}", - fontSize: - SizeConfig.textMultiplier! * 2, + fontSize: SizeConfig.textMultiplier! * 2, color: Colors.grey.shade800, fontWeight: FontWeight.w700, ), @@ -168,8 +157,7 @@ class _UCAFInputScreenState extends State { height: 20, ), AppText( - Utils.convertToTitleCase(TranslationBase.of(context) - .chiefComplaintsAndSymptoms), + Utils.convertToTitleCase(TranslationBase.of(context).chiefComplaintsAndSymptoms), fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w700, @@ -179,16 +167,16 @@ class _UCAFInputScreenState extends State { height: 10, ), AppTextFieldCustom( - hintText: - TranslationBase.of(context).instruction, - dropDownText: Utils.parseHtmlString(model - .patientChiefComplaintList[0] - .chiefComplaint! + '\n'), + hintText: TranslationBase.of(context).instruction, + dropDownText: Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint! + '\n'), controller: _additionalComplaintsController, inputType: TextInputType.multiline, enabled: false, minLines: 1, maxLines: 20, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 8, @@ -201,12 +189,10 @@ class _UCAFInputScreenState extends State { ), ], ) - : model.patientChiefComplaintList != null || - model.patientVitalSignsHistory != null + : model.patientChiefComplaintList != null || model.patientVitalSignsHistory != null ? Center( child: ErrorMessage( - error: model.patientVitalSignsHistory == null || - model.patientVitalSignsHistory.length == 0 + error: model.patientVitalSignsHistory == null || model.patientVitalSignsHistory.length == 0 ? TranslationBase.of(context).vitalSignEmptyMsg : TranslationBase.of(context).chiefComplaintEmptyMsg)) : Container(), diff --git a/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart b/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart index f65ffafc..1856d31c 100644 --- a/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart +++ b/lib/screens/patients/profile/admission_request/admission_request_first_screen.dart @@ -1,11 +1,11 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -19,9 +19,9 @@ import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dar import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; + import '../../../../routes.dart'; class AdmissionRequestFirstScreen extends StatefulWidget { @@ -135,6 +135,8 @@ class _AdmissionRequestThirdScreenState extends State { } : null, child: AppTextFieldCustom( - hintText: TranslationBase.of(context).selectCondition, //'Select Condition', + hintText: TranslationBase.of(context).selectCondition, + //'Select Condition', dropDownText: model.stpMasterList.length == 1 ? model.stpMasterList[0]['Description'] : selectValue == null @@ -146,6 +148,9 @@ class _UpdateNoteOrderState extends State { : selectValue['Description'], enabled: false, isTextFieldHasSuffix: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), ), @@ -171,6 +176,9 @@ class _UpdateNoteOrderState extends State { // isTextFieldHasSuffix: true, validationError: progressNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), Positioned( top: -2, diff --git a/lib/screens/patients/profile/operation_report/update_operation_report.dart b/lib/screens/patients/profile/operation_report/update_operation_report.dart index 86b69cec..63ad0ee8 100644 --- a/lib/screens/patients/profile/operation_report/update_operation_report.dart +++ b/lib/screens/patients/profile/operation_report/update_operation_report.dart @@ -1,18 +1,18 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; -import 'package:doctor_app_flutter/core/viewModel/profile/operation_report_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/operation_report/create_update_operation_report_request_model.dart'; import 'package:doctor_app_flutter/core/model/operation_report/get_operation_details_response_modle.dart'; import 'package:doctor_app_flutter/core/model/operation_report/get_reservations_response_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; +import 'package:doctor_app_flutter/core/viewModel/profile/operation_report_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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'; @@ -144,6 +144,9 @@ class _UpdateOperationReportState extends State { minLines: 1, enabled: false, hasBorder: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -156,6 +159,9 @@ class _UpdateOperationReportState extends State { hasBorder: true, // isTextFieldHasSuffix: true, validationError: preOpDiagmosisController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -168,6 +174,9 @@ class _UpdateOperationReportState extends State { hasBorder: true, // isTextFieldHasSuffix: true, validationError: postOpDiagmosisNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -180,6 +189,9 @@ class _UpdateOperationReportState extends State { hasBorder: true, // isTextFieldHasSuffix: true, validationError: surgeonController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -193,6 +205,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: assistantNoteController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -206,6 +221,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: operationController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -220,6 +238,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: inasionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -233,6 +254,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: findingController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -246,6 +270,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: surgeryProcedureController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -259,6 +286,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: postOpInstructionController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -271,6 +301,9 @@ class _UpdateOperationReportState extends State { hasBorder: true, // isTextFieldHasSuffix: true, validationError: complicationDetailsController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -284,6 +317,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: bloodLossDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -297,6 +333,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: histopathSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -310,6 +349,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: microbiologySpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -323,6 +365,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: otherSpecimenController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -336,6 +381,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: scrubNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -349,6 +397,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: circulatingNurseController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -362,6 +413,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: BloodTransfusedDetailController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 4, @@ -375,6 +429,9 @@ class _UpdateOperationReportState extends State { // isTextFieldHasSuffix: true, validationError: anasthetistController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 250, diff --git a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart index 0abfd3d3..dd320d0b 100644 --- a/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart +++ b/lib/screens/patients/profile/referral/refer_details/refer-patient-screen-in-patient.dart @@ -1,17 +1,17 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.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'; @@ -20,7 +20,6 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils 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:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; @@ -227,6 +226,8 @@ class _PatientMakeInPatientReferralScreenState extends State { ); } : () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -250,6 +251,8 @@ class _PatientMakeReferralScreenState extends State { ); } : () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -289,6 +292,8 @@ class _PatientMakeReferralScreenState extends State { ); } : () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -330,6 +335,8 @@ class _PatientMakeReferralScreenState extends State { DrAppToastMsg.showErrorToast("There is no doctors for this clinic"); } }, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -350,6 +357,8 @@ class _PatientMakeReferralScreenState extends State { onClick: () { _selectDate(context, model); }, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -360,6 +369,9 @@ class _PatientMakeReferralScreenState extends State { inputType: TextInputType.multiline, minLines: 4, maxLines: 6, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ], ), diff --git a/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart b/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart index e18c9cb9..a40b4e53 100644 --- a/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart +++ b/lib/screens/patients/profile/referral/referral_details/add_replay_on_referral_patient.dart @@ -9,8 +9,8 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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'; @@ -27,21 +27,13 @@ class AddReplayOnReferralPatient extends StatefulWidget { final AddReferredRemarksRequestModel? myReferralInPatientRequestModel; final bool isEdited; - const AddReplayOnReferralPatient( - {Key? key, - this.patientReferralViewModel, - this.myReferralInPatientModel, - this.isEdited = false, - this.myReferralInPatientRequestModel}) - : super(key: key); + const AddReplayOnReferralPatient({Key? key, this.patientReferralViewModel, this.myReferralInPatientModel, this.isEdited = false, this.myReferralInPatientRequestModel}) : super(key: key); @override - _AddReplayOnReferralPatientState createState() => - _AddReplayOnReferralPatientState(); + _AddReplayOnReferralPatientState createState() => _AddReplayOnReferralPatientState(); } -class _AddReplayOnReferralPatientState - extends State { +class _AddReplayOnReferralPatientState extends State { bool isSubmitted = false; int replay = 1; int reject = 2; @@ -54,8 +46,7 @@ class _AddReplayOnReferralPatientState void initState() { requestPermissions(); super.initState(); - replayOnReferralController.text = - widget.myReferralInPatientModel!.referredDoctorRemarks ?? ""; + replayOnReferralController.text = widget.myReferralInPatientModel!.referredDoctorRemarks ?? ""; } @override @@ -87,11 +78,10 @@ class _AddReplayOnReferralPatientState maxLines: 35, minLines: 25, hasBorder: true, - validationError: replayOnReferralController - .text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : "", + validationError: replayOnReferralController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), Positioned( top: 0, @@ -149,25 +139,17 @@ class _AddReplayOnReferralPatientState ); if (replayOnReferralController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - await widget.patientReferralViewModel - !.replayReferred( - replayOnReferralController.text.trim(), - widget.myReferralInPatientModel!, - reject); - if (widget.patientReferralViewModel!.state == - ViewState.ErrorLocal) { - Utils.showErrorToast( - widget.patientReferralViewModel!.error); + await widget.patientReferralViewModel!.replayReferred(replayOnReferralController.text.trim(), widget.myReferralInPatientModel!, reject); + if (widget.patientReferralViewModel!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.patientReferralViewModel!.error); } else { GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - "Has been rejected"); + DrAppToastMsg.showSuccesToast("Has been rejected"); Navigator.of(context).pop(); Navigator.of(context).pop(); } } else { - Utils.showErrorToast( - "You can't add empty reply"); + Utils.showErrorToast("You can't add empty reply"); setState(() { isSubmitted = false; }); @@ -189,25 +171,17 @@ class _AddReplayOnReferralPatientState }); if (replayOnReferralController.text.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - await widget.patientReferralViewModel - !.replayReferred( - replayOnReferralController.text.trim(), - widget.myReferralInPatientModel!, - replay); - if (widget.patientReferralViewModel!.state == - ViewState.ErrorLocal) { - Utils.showErrorToast( - widget.patientReferralViewModel!.error); + await widget.patientReferralViewModel!.replayReferred(replayOnReferralController.text.trim(), widget.myReferralInPatientModel!, replay); + if (widget.patientReferralViewModel!.state == ViewState.ErrorLocal) { + Utils.showErrorToast(widget.patientReferralViewModel!.error); } else { GifLoaderDialogUtils.hideDialog(context); - DrAppToastMsg.showSuccesToast( - "Your Reply Added Successfully"); + DrAppToastMsg.showSuccesToast("Your Reply Added Successfully"); Navigator.of(context).pop(); Navigator.of(context).pop(); } } else { - Utils.showErrorToast( - "You can't add empty reply"); + Utils.showErrorToast("You can't add empty reply"); setState(() { isSubmitted = false; }); @@ -232,8 +206,7 @@ class _AddReplayOnReferralPatientState onVoiceText() async { new SpeechToText(context: context).showAlertDialog(context); var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; - bool available = await speech.initialize( - onStatus: statusListener, onError: errorListener); + bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); if (available) { speech.listen( onResult: resultListener, diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 44371a88..e16b6848 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -2,18 +2,18 @@ import 'package:autocomplete_textfield/autocomplete_textfield.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/view_state.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/patch_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/Assessment/post_assessment_request_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_assement.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -119,6 +119,9 @@ class _AddAssessmentDetailsState extends State { isTextFieldHasSuffix: false, enabled: false, controller: appointmentIdController, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), SizedBox( @@ -176,6 +179,8 @@ class _AddAssessmentDetailsState extends State { ), onPressed: () {}, ), + onChanged: (value) {}, + onFieldSubmitted: () {}, )), ), if (widget.mySelectedAssessment!.selectedICD != null) @@ -233,6 +238,8 @@ class _AddAssessmentDetailsState extends State { enabled: false, hasBorder: true, validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisCondition == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -269,6 +276,8 @@ class _AddAssessmentDetailsState extends State { controller: typeController, hasBorder: true, validationError: isFormSubmitted && widget.mySelectedAssessment!.selectedDiagnosisType == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -284,6 +293,8 @@ class _AddAssessmentDetailsState extends State { onChanged: (value) { widget.mySelectedAssessment!.remark = remarkController.text; }, + onClick: () {}, + onFieldSubmitted: () {}, ), ), SizedBox( diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart index 2ffd706b..b2afe58d 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_widget.dart @@ -1,8 +1,8 @@ // ignore: must_be_immutable import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; @@ -248,6 +248,8 @@ class _AddExaminationWidgetState extends State { onChanged: (value) { examination.remark = value; }, + onClick: () {}, + onFieldSubmitted: () {}, ), ), ], diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 6084abdc..025634f8 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -1,7 +1,7 @@ import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_examination.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -15,20 +15,13 @@ class ExaminationsListSearchWidget extends StatefulWidget { final List? masterList; final List? mySelectedExamination; - ExaminationsListSearchWidget( - {this.removeExamination, - this.addExamination, - this.isServiceSelected, - this.masterList, - this.mySelectedExamination}); + ExaminationsListSearchWidget({this.removeExamination, this.addExamination, this.isServiceSelected, this.masterList, this.mySelectedExamination}); @override - _ExaminationsListSearchWidgetState createState() => - _ExaminationsListSearchWidgetState(); + _ExaminationsListSearchWidgetState createState() => _ExaminationsListSearchWidgetState(); } -class _ExaminationsListSearchWidgetState - extends State { +class _ExaminationsListSearchWidgetState extends State { int expandedIndex = -1; List items = []; TextEditingController filteredSearchController = TextEditingController(); @@ -50,13 +43,17 @@ class _ExaminationsListSearchWidgetState hasBorder: false, controller: filteredSearchController, onChanged: (value) { - filterSearchResults(value); + if (value != null) filterSearchResults(value); }, suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), onPressed: () { },), + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + onClick: () {}, + onFieldSubmitted: () {}, ), DividerWithSpacesAround( height: 2, @@ -90,8 +87,7 @@ class _ExaminationsListSearchWidgetState if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((item) { - if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || - item.nameEn!.toLowerCase().contains(query.toLowerCase())) { + if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || item.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(item); } }); diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 30622cf0..0b558783 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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/text_fields/app-textfield-custom.dart'; @@ -30,31 +30,20 @@ class UpdatePlanPage extends StatefulWidget { final int? currentIndex; - UpdatePlanPage( - {Key? key, - this.changePageViewIndex, - this.patientInfo, - this.changeLoadingState, - this.currentIndex, - this.sOAPViewModel, - this.changeStateFun}); + UpdatePlanPage({Key? key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex, this.sOAPViewModel, this.changeStateFun}); @override _UpdatePlanPageState createState() => _UpdatePlanPageState(); } -class _UpdatePlanPageState extends State - implements PlanCallBack { +class _UpdatePlanPageState extends State implements PlanCallBack { bool isAddProgress = true; bool isProgressExpanded = true; - GetPatientProgressNoteResModel patientProgressNote = - GetPatientProgressNoteResModel(); + GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel(); - TextEditingController progressNoteController = - TextEditingController(text: null); + TextEditingController progressNoteController = TextEditingController(text: null); - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { + BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -76,35 +65,25 @@ class _UpdatePlanPageState extends State } } - getPatientProgressNote(SOAPViewModel model, - {bool isAddProgress = false}) async { - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo!.appointmentNo.toString()), - patientMRN: widget.patientInfo!.patientMRN, - episodeID: widget.patientInfo!.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await widget.sOAPViewModel - !.getPatientProgressNote(getGetProgressNoteReqModel); + getPatientProgressNote(SOAPViewModel model, {bool isAddProgress = false}) async { + GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( + appointmentNo: int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel!.getPatientProgressNote(getGetProgressNoteReqModel); ///TODO set progressNote in model; if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); + progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; + patientProgressNote.createdByName = widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = isAddProgress; widget.sOAPViewModel!.isAddProgress = isAddProgress; @@ -118,31 +97,22 @@ class _UpdatePlanPageState extends State return BaseView( onModelReady: (model) async { widget.sOAPViewModel!.setPlanCallBack(this); - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo!.appointmentNo.toString()), - patientMRN: widget.patientInfo!.patientMRN, - episodeID: widget.patientInfo!.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await widget.sOAPViewModel - !.getPatientProgressNote(getGetProgressNoteReqModel); + GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( + appointmentNo: int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel!.getPatientProgressNote(getGetProgressNoteReqModel); if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); + progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; + patientProgressNote.createdByName = widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; widget.sOAPViewModel!.progressNoteText = progressNoteController.text; setState(() { @@ -185,95 +155,70 @@ class _UpdatePlanPageState extends State children: [ if (isAddProgress) Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), + margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .progressNote, + hintText: TranslationBase.of(context).progressNote, controller: progressNoteController, minLines: 2, maxLines: 4, inputType: TextInputType.multiline, onChanged: (value) { - setState(() { - patientProgressNote.planNote = - value; - model.progressNoteText = value; - widget.changeStateFun!(); - }); + if (value != null) + setState(() { + patientProgressNote.planNote = value; + model.progressNoteText = value; + widget.changeStateFun!(); + }); }, + onClick: () {}, + onFieldSubmitted: () {}, ), ), SizedBox( height: 9, ), - if (patientProgressNote.planNote != null && - !isAddProgress) + if (patientProgressNote.planNote != null && !isAddProgress) Container( margin: EdgeInsets.only( left: 5, right: 5, ), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ AppText( 'Appointment No: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, letterSpacing: -0.4, color: Color(0xFF575757), ), AppText( - patientProgressNote - .appointmentNo != - null - ? patientProgressNote - .appointmentNo - .toString() - : '', + patientProgressNote.appointmentNo != null ? patientProgressNote.appointmentNo.toString() : '', fontWeight: FontWeight.w600, letterSpacing: -0.48, color: Color(0xFF2B353E), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.6, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, ), ], ), AppText( - patientProgressNote.createdOn != - null - ? AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.parse( - patientProgressNote - .createdOn!)) - : AppDateUtils - .getDayMonthYearDateFormatted( - DateTime.now()), + patientProgressNote.createdOn != null + ? AppDateUtils.getDayMonthYearDateFormatted(DateTime.parse(patientProgressNote.createdOn!)) + : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), fontWeight: FontWeight.w600, - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.6, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, ) ], ), Row( - mainAxisAlignment: - MainAxisAlignment.end, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, children: [ // Row( // children: [ @@ -288,19 +233,10 @@ class _UpdatePlanPageState extends State // ], // ), AppText( - patientProgressNote.createdOn != - null - ? AppDateUtils.getHour( - DateTime.parse( - patientProgressNote - .createdOn!)) - : AppDateUtils.getHour( - DateTime.now()), + patientProgressNote.createdOn != null ? AppDateUtils.getHour(DateTime.parse(patientProgressNote.createdOn!)) : AppDateUtils.getHour(DateTime.now()), fontWeight: FontWeight.w600, color: Color(0xFF575757), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.6, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, ) ], ), @@ -308,8 +244,7 @@ class _UpdatePlanPageState extends State height: 8, ), Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( child: AppText( @@ -321,8 +256,7 @@ class _UpdatePlanPageState extends State onTap: () { setState(() { isAddProgress = true; - widget.sOAPViewModel - !.isAddProgress = true; + widget.sOAPViewModel!.isAddProgress = true; }); }, child: Icon( @@ -341,8 +275,7 @@ class _UpdatePlanPageState extends State isExpanded: isProgressExpanded, ), SizedBox( - height: SizeConfig.heightMultiplier! * - (SizeConfig.isHeightVeryShort ? 20 : 10), + height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), @@ -355,53 +288,41 @@ class _UpdatePlanPageState extends State submitPlan(SOAPViewModel model) async { if (progressNoteController.text.isNotEmpty) { widget.changeLoadingState!(true); - PostProgressNoteRequestModel postProgressNoteRequestModel = - new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo!.patientMRN, - episodeId: widget.patientInfo!.episodeNo!, - appointmentNo: widget.patientInfo!.appointmentNo, - planNote: patientProgressNote.planNote, - doctorID: '', - editedBy: ''); + PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( + patientMRN: widget.patientInfo!.patientMRN, + episodeId: widget.patientInfo!.episodeNo!, + appointmentNo: widget.patientInfo!.appointmentNo, + planNote: patientProgressNote.planNote, + doctorID: '', + editedBy: ''); if (widget.sOAPViewModel!.patientProgressNoteList.isEmpty) { - await widget.sOAPViewModel - ! .postProgressNote(postProgressNoteRequestModel); + await widget.sOAPViewModel!.postProgressNote(postProgressNoteRequestModel); } else { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; - await widget.sOAPViewModel - !.patchProgressNote(postProgressNoteRequestModel); + await widget.sOAPViewModel!.patchProgressNote(postProgressNoteRequestModel); } if (widget.sOAPViewModel!.state == ViewState.ErrorLocal) { Utils.showErrorToast(widget.sOAPViewModel!.error); } else { - GetProgressNoteReqModel getGetProgressNoteReqModel = - GetProgressNoteReqModel( - appointmentNo: - int.parse(widget.patientInfo!.appointmentNo.toString()), - patientMRN: widget.patientInfo!.patientMRN, - episodeID: widget.patientInfo!.episodeNo.toString(), - editedBy: '', - doctorID: ''); - await widget.sOAPViewModel - !.getPatientProgressNote(getGetProgressNoteReqModel); + GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel( + appointmentNo: int.parse(widget.patientInfo!.appointmentNo.toString()), + patientMRN: widget.patientInfo!.patientMRN, + episodeID: widget.patientInfo!.episodeNo.toString(), + editedBy: '', + doctorID: ''); + await widget.sOAPViewModel!.getPatientProgressNote(getGetProgressNoteReqModel); if (widget.sOAPViewModel!.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = Utils.parseHtmlString( - widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); + progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel!.patientProgressNoteList[0].planNote!); patientProgressNote.planNote = progressNoteController.text; - patientProgressNote.createdByName = - widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; - patientProgressNote.createdOn = - widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; - patientProgressNote.editedOn = - widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; - patientProgressNote.editedByName = - widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; - patientProgressNote.appointmentNo = - widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; + patientProgressNote.createdByName = widget.sOAPViewModel!.patientProgressNoteList[0].createdByName; + patientProgressNote.createdOn = widget.sOAPViewModel!.patientProgressNoteList[0].createdOn; + patientProgressNote.editedOn = widget.sOAPViewModel!.patientProgressNoteList[0].editedOn; + patientProgressNote.editedByName = widget.sOAPViewModel!.patientProgressNoteList[0].editedByName; + patientProgressNote.appointmentNo = widget.sOAPViewModel!.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = false; diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart index 957c23db..8b320739 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/allergies_item.dart @@ -1,16 +1,15 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -132,9 +131,12 @@ class _AddAllergiesItemState extends State { maxLines: 1, minLines: 1, height: Utils.getTextFieldHeight(), - validationError: - mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError! ? TranslationBase.of(context).severityValidationError : "", + validationError: mySelectedAllergy != null && mySelectedAllergy.selectedAllergySeverity == null && mySelectedAllergy.hasValidationError! + ? TranslationBase.of(context).severityValidationError + : "", controller: severityController, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -149,6 +151,8 @@ class _AddAllergiesItemState extends State { mySelectedAllergy.remark = value; }, inputType: TextInputType.multiline, + onClick: () {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart index b6b64e2d..e6fab52f 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/master_key_checkbox_search_allergies_widget.dart @@ -1,11 +1,10 @@ -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'allergies_item.dart'; @@ -36,12 +35,10 @@ class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { : super(key: key); @override - _MasterKeyCheckboxSearchAllergiesWidgetState createState() => - _MasterKeyCheckboxSearchAllergiesWidgetState(); + _MasterKeyCheckboxSearchAllergiesWidgetState createState() => _MasterKeyCheckboxSearchAllergiesWidgetState(); } -class _MasterKeyCheckboxSearchAllergiesWidgetState - extends State { +class _MasterKeyCheckboxSearchAllergiesWidgetState extends State { List items = []; TextEditingController filteredSearchController = TextEditingController(); @@ -61,9 +58,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState height: Utils.getTextFieldHeight(), child: Center( child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: Column( children: [ AppTextFieldCustom( @@ -72,13 +67,17 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState hasBorder: false, controller: filteredSearchController, onChanged: (value) { - filterSearchResults(value); + if (value != null) filterSearchResults(value); }, suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), onPressed: () { },), + icon: Icon( + Icons.search, + color: Colors.black, + ), + onPressed: () {}, + ), + onClick: () {}, + onFieldSubmitted: () {}, ), DividerWithSpacesAround(), SizedBox( @@ -88,8 +87,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState child: FractionallySizedBox( widthFactor: 0.9, child: Container( - height: - MediaQuery.of(context).size.height * 0.60, + height: MediaQuery.of(context).size.height * 0.60, child: ListView.builder( itemCount: items.length, itemBuilder: (context, index) { @@ -98,10 +96,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState model: widget.model, removeAllergy: widget.removeAllergy, addAllergy: widget.addAllergy, - isServiceSelected: - widget.isServiceSelected, - getServiceSelectedAllergy: - widget.getServiceSelectedAllergy, + isServiceSelected: widget.isServiceSelected, + getServiceSelectedAllergy: widget.getServiceSelectedAllergy, ); }, ), @@ -126,8 +122,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((items) { - if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || - items.nameEn!.toLowerCase().contains(query.toLowerCase())) { + if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || items.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(items); } }); diff --git a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart index e13af574..82407d70 100644 --- a/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart +++ b/lib/screens/patients/profile/soap_update/subjective/cheif_complaints/update_Chief_complaints.dart @@ -42,6 +42,9 @@ class UpdateChiefComplaints extends StatelessWidget { hasBorder: true, inputType: TextInputType.multiline, validationError: complaintsControllerError != '' ? complaintsControllerError : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 20, @@ -55,6 +58,9 @@ class UpdateChiefComplaints extends StatelessWidget { minLines: 7, hasBorder: true, validationError: illnessControllerError != '' ? illnessControllerError : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, @@ -73,6 +79,9 @@ class UpdateChiefComplaints extends StatelessWidget { hasBorder: true, inputType: TextInputType.multiline, validationError: medicationControllerError != '' ? medicationControllerError : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 10, diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index ea899467..24bc82cc 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -2,13 +2,13 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -116,11 +116,16 @@ class _AddMedicationState extends State { maxLines: 1, isTextFieldHasSuffix: true, suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - ), onPressed: () { },), + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + ), + onPressed: () {}, + ), enabled: false, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), ), @@ -170,13 +175,15 @@ class _AddMedicationState extends State { }, ); } - : (){}, + : () {}, hintText: TranslationBase.of(context).doseTime, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, controller: doseController, validationError: isFormSubmitted && _selectedMedicationDose == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 5, @@ -207,12 +214,14 @@ class _AddMedicationState extends State { }, ); } - : (){}, + : () {}, hintText: TranslationBase.of(context).strength, maxLines: 1, minLines: 1, controller: strengthController, validationError: isFormSubmitted && _selectedMedicationStrength == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 5, @@ -246,12 +255,14 @@ class _AddMedicationState extends State { }, ); } - : (){}, + : () {}, hintText: TranslationBase.of(context).route, maxLines: 1, minLines: 1, controller: routeController, validationError: isFormSubmitted && _selectedMedicationRoute == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 5, @@ -283,7 +294,7 @@ class _AddMedicationState extends State { }, ); } - : (){}, + : () {}, hintText: TranslationBase.of(context).frequency, enabled: false, maxLines: 1, @@ -291,6 +302,8 @@ class _AddMedicationState extends State { isTextFieldHasSuffix: true, controller: frequencyController, validationError: isFormSubmitted && _selectedMedicationFrequency == null ? TranslationBase.of(context).emptyMessage : "", + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: SizeConfig.heightMultiplier! * diff --git a/lib/screens/patients/register_patient/CustomEditableText.dart b/lib/screens/patients/register_patient/CustomEditableText.dart index b029e7e2..4e370435 100644 --- a/lib/screens/patients/register_patient/CustomEditableText.dart +++ b/lib/screens/patients/register_patient/CustomEditableText.dart @@ -79,13 +79,13 @@ class _CustomEditableTextState extends State { hintText: widget.hint, //TranslationBase.of(context).addoperationReports, controller: widget.controller, - validationError: - widget.controller.text.isEmpty && widget.isSubmitted - ? TranslationBase.of(context).emptyMessage - : "", + validationError: widget.controller.text.isEmpty && widget.isSubmitted ? TranslationBase.of(context).emptyMessage : "", maxLines: 1, minLines: 1, hasBorder: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ], ); diff --git a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart index 70b7254c..82873a2a 100644 --- a/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterConfirmationPatientPage.dart @@ -2,15 +2,15 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/PatientRegistration/PatientRegistrationModel.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/profile/operation_report_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/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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'; @@ -29,22 +29,16 @@ class RegisterConfirmationPatientPage extends StatefulWidget { final PatiantInformtion? patient; final PatientRegistrationViewModel? model; - const RegisterConfirmationPatientPage( - {Key? key, this.operationReportViewModel, this.patient, this.model}) - : super(key: key); + const RegisterConfirmationPatientPage({Key? key, this.operationReportViewModel, this.patient, this.model}) : super(key: key); @override - _RegisterConfirmationPatientPageState createState() => - _RegisterConfirmationPatientPageState(); + _RegisterConfirmationPatientPageState createState() => _RegisterConfirmationPatientPageState(); } -class _RegisterConfirmationPatientPageState - extends State { +class _RegisterConfirmationPatientPageState extends State { bool isSubmitted = false; late ProjectViewModel projectViewModel; - TextEditingController firstNameN = TextEditingController(), - middleNameN = TextEditingController(), - lastNameN = TextEditingController(); + TextEditingController firstNameN = TextEditingController(), middleNameN = TextEditingController(), lastNameN = TextEditingController(); TextEditingController firstNameAr = TextEditingController(); TextEditingController middleNameAr = TextEditingController(); TextEditingController lastNameAr = TextEditingController(); @@ -54,17 +48,13 @@ class _RegisterConfirmationPatientPageState @override void initState() { - firstNameN = TextEditingController( - text: widget.model!.getPatientInfoResponseModel.firstNameEn); + firstNameN = TextEditingController(text: widget.model!.getPatientInfoResponseModel.firstNameEn); middleNameN = TextEditingController(text: ""); - lastNameN = TextEditingController( - text: widget.model!.getPatientInfoResponseModel.lastNameEn); + lastNameN = TextEditingController(text: widget.model!.getPatientInfoResponseModel.lastNameEn); - firstNameAr = TextEditingController( - text: widget.model!.getPatientInfoResponseModel.firstNameAr); + firstNameAr = TextEditingController(text: widget.model!.getPatientInfoResponseModel.firstNameAr); middleNameAr = TextEditingController(text: ""); - lastNameAr = TextEditingController( - text: widget.model!.getPatientInfoResponseModel.lastNameAr); + lastNameAr = TextEditingController(text: widget.model!.getPatientInfoResponseModel.lastNameAr); emailAddressController = TextEditingController(text: ""); super.initState(); } @@ -95,49 +85,27 @@ class _RegisterConfirmationPatientPageState widthFactor: 0.9, child: Column( children: [ - CustomEditableText( - controller: firstNameN, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).firstName), + CustomEditableText(controller: firstNameN, isSubmitted: isSubmitted, hint: TranslationBase.of(context).firstName), SizedBox( height: 4, ), - CustomEditableText( - controller: middleNameN, - isEditable: middleNameN.text.isEmpty, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).middleName), + CustomEditableText(controller: middleNameN, isEditable: middleNameN.text.isEmpty, isSubmitted: isSubmitted, hint: TranslationBase.of(context).middleName), SizedBox( height: 4, ), - CustomEditableText( - controller: lastNameN, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).lastName), + CustomEditableText(controller: lastNameN, isSubmitted: isSubmitted, hint: TranslationBase.of(context).lastName), SizedBox( height: 20, ), - CustomEditableText( - controller: firstNameAr, - isSubmitted: isSubmitted, - hint: - TranslationBase.of(context).firstNameInAr), + CustomEditableText(controller: firstNameAr, isSubmitted: isSubmitted, hint: TranslationBase.of(context).firstNameInAr), SizedBox( height: 4, ), - CustomEditableText( - controller: middleNameAr, - isEditable: middleNameN.text.isEmpty, - isSubmitted: isSubmitted, - hint: - TranslationBase.of(context).middleNameInAr), + CustomEditableText(controller: middleNameAr, isEditable: middleNameN.text.isEmpty, isSubmitted: isSubmitted, hint: TranslationBase.of(context).middleNameInAr), SizedBox( height: 4, ), - CustomEditableText( - controller: lastNameAr, - isSubmitted: isSubmitted, - hint: TranslationBase.of(context).lastNameInAr), + CustomEditableText(controller: lastNameAr, isSubmitted: isSubmitted, hint: TranslationBase.of(context).lastNameInAr), SizedBox( height: 20, ), @@ -147,18 +115,12 @@ class _RegisterConfirmationPatientPageState child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .healthID, - fontSize: 12, - color: Colors.black), + AppText(TranslationBase.of(context).healthID, fontSize: 12, color: Colors.black), AppText( "${widget.model!.getPatientInfoResponseModel.healthId}", fontSize: 12, @@ -167,14 +129,9 @@ class _RegisterConfirmationPatientPageState ], ), Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .identityNumber, - fontSize: 12, - color: Colors.black), + AppText(TranslationBase.of(context).identityNumber, fontSize: 12, color: Colors.black), AppText( "${widget.model!.getPatientInfoResponseModel.idNumber}", fontSize: 12, @@ -191,18 +148,12 @@ class _RegisterConfirmationPatientPageState height: 20, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .nationality, - fontSize: 12, - color: Colors.black), + AppText(TranslationBase.of(context).nationality, fontSize: 12, color: Colors.black), AppText( "${widget.model!.getPatientInfoResponseModel.nationality}", fontSize: 12, @@ -211,14 +162,9 @@ class _RegisterConfirmationPatientPageState ], ), Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .occupation, - fontSize: 12, - color: Colors.black), + AppText(TranslationBase.of(context).occupation, fontSize: 12, color: Colors.black), AppText( "${widget.model!.getPatientInfoResponseModel.occupation}", fontSize: 12, @@ -235,18 +181,12 @@ class _RegisterConfirmationPatientPageState height: 20, ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText( - TranslationBase.of(context) - .mobileNo, - fontSize: 12, - color: Colors.black), + AppText(TranslationBase.of(context).mobileNo, fontSize: 12, color: Colors.black), AppText( "${widget.model!.checkPatientForRegistrationModel!.patientMobileNumber}", fontSize: 12, @@ -272,8 +212,7 @@ class _RegisterConfirmationPatientPageState onClick: () { openMaritalStatusList(context); }, - hintText: - TranslationBase.of(context).maritalStatus, + hintText: TranslationBase.of(context).maritalStatus, maxLines: 1, minLines: 1, isTextFieldHasSuffix: true, @@ -284,6 +223,8 @@ class _RegisterConfirmationPatientPageState // ? TranslationBase.of(context) // .emptyMessage // : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 20, @@ -305,6 +246,8 @@ class _RegisterConfirmationPatientPageState // ? TranslationBase.of(context) // .emptyMessage // : null, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 20, @@ -316,11 +259,11 @@ class _RegisterConfirmationPatientPageState maxLines: 1, minLines: 1, hasBorder: true, - validationError: - emailAddressController.text.isEmpty && - isSubmitted - ? TranslationBase.of(context).emptyMessage - : "", + validationError: emailAddressController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 400, @@ -375,87 +318,59 @@ class _RegisterConfirmationPatientPageState isSubmitted = true; }); if (isFormValid()) { - print(widget - .model!.getPatientInfoResponseModel.dateOfBirth); + print(widget.model!.getPatientInfoResponseModel.dateOfBirth); - var dateFormat = DateFormat('MM/dd/yyyy').parse(widget - .model!.getPatientInfoResponseModel.dateOfBirth!); - String wellFormat = - "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}"; + var dateFormat = DateFormat('MM/dd/yyyy').parse(widget.model!.getPatientInfoResponseModel.dateOfBirth!); + String wellFormat = "${dateFormat.day}\/${dateFormat.month}\/${dateFormat.year}"; print( dateFormat.toUtc().toString(), ); JDateModel hijriDate = JDateModel( - dateTime: DateTime( - dateFormat.year, dateFormat.month, dateFormat.day), + dateTime: DateTime(dateFormat.year, dateFormat.month, dateFormat.day), ); // return ; GifLoaderDialogUtils.showMyDialog(context); - PatientRegistrationModel patientRegistrationModel = - PatientRegistrationModel( - patientobject: Patientobject( - tempValue: true, - patientIdentificationNo: widget - .model! - .checkPatientForRegistrationModel! - .patientIdentificationID - .toString(), - patientIdentificationType: 1, - firstName: firstNameAr.text, - firstNameN: firstNameN.text, - lastName: lastNameAr.text, - lastNameN: lastNameN.text, - middleName: middleNameAr.text, - middleNameN: middleNameN.text, - strDateofBirth: dateFormat.toUtc().toString(), - dateofBirth: AppDateUtils.convertToServerFormat( - widget.model!.getPatientInfoResponseModel - .dateOfBirth!, - 'MM/dd/yyyy'), - dateofBirthN: '$hijriDate', - gender: - (widget.model!.getPatientInfoResponseModel.gender == "M") - ? 1 - : 2, - sourceType: "1", - patientOutSA: 0, - nationalityID: widget - .model! - .getPatientInfoResponseModel - .nationalityCode, - //todo Elham* change static value to dynamic - preferredLanguage: selectedLang.toString(), - marital: "0", - eHealthIDField: widget.model! - .getPatientInfoResponseModel.healthId, - emailAddress: emailAddressController.text, - mobileNumber: widget - .model! - .checkPatientForRegistrationModel! - .patientMobileNumber), - isHijri: 0, - logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==", - isDentalAllowedBackend: false, + PatientRegistrationModel patientRegistrationModel = PatientRegistrationModel( + patientobject: Patientobject( + tempValue: true, + patientIdentificationNo: widget.model!.checkPatientForRegistrationModel!.patientIdentificationID.toString(), + patientIdentificationType: 1, + firstName: firstNameAr.text, + firstNameN: firstNameN.text, + lastName: lastNameAr.text, + lastNameN: lastNameN.text, + middleName: middleNameAr.text, + middleNameN: middleNameN.text, + strDateofBirth: dateFormat.toUtc().toString(), + dateofBirth: AppDateUtils.convertToServerFormat(widget.model!.getPatientInfoResponseModel.dateOfBirth!, 'MM/dd/yyyy'), + dateofBirthN: '$hijriDate', + gender: (widget.model!.getPatientInfoResponseModel.gender == "M") ? 1 : 2, + sourceType: "1", patientOutSA: 0, - sessionID: null, - patientMobileNumber: widget - .model! - .checkPatientForRegistrationModel! - .patientMobileNumber - .toString(), - healthId: widget.model!.getPatientInfoResponseModel.healthId, - generalid: GENERAL_ID, - patientIdentificationID: widget.model!.checkPatientForRegistrationModel!.patientIdentificationID.toString(), - dOB: wellFormat, - zipCode: widget.model!.checkPatientForRegistrationModel!.zipCode); - await widget.model! - .registrationPatient(patientRegistrationModel); + nationalityID: widget.model!.getPatientInfoResponseModel.nationalityCode, + //todo Elham* change static value to dynamic + preferredLanguage: selectedLang.toString(), + marital: "0", + eHealthIDField: widget.model!.getPatientInfoResponseModel.healthId, + emailAddress: emailAddressController.text, + mobileNumber: widget.model!.checkPatientForRegistrationModel!.patientMobileNumber), + isHijri: 0, + logInTokenID: "zjgvKtLC/EK+saznJ/OkiA==", + isDentalAllowedBackend: false, + patientOutSA: 0, + sessionID: null, + patientMobileNumber: widget.model!.checkPatientForRegistrationModel!.patientMobileNumber.toString(), + healthId: widget.model!.getPatientInfoResponseModel.healthId, + generalid: GENERAL_ID, + patientIdentificationID: widget.model!.checkPatientForRegistrationModel!.patientIdentificationID.toString(), + dOB: wellFormat, + zipCode: widget.model!.checkPatientForRegistrationModel!.zipCode); + await widget.model!.registrationPatient(patientRegistrationModel); if (widget.model!.state == ViewState.ErrorLocal) { Utils.showErrorToast(widget.model!.error); } else { - DrAppToastMsg.showSuccesToast( - "Patient added Successfully"); + DrAppToastMsg.showSuccesToast("Patient added Successfully"); Navigator.of(context).pop(); } @@ -500,10 +415,7 @@ class _RegisterConfirmationPatientPageState onTap: () { Navigator.of(context).pop(); }, - child: Icon(DoctorApp.close_1, - size: SizeConfig.getTextMultiplierBasedOnWidth() * - 4.5, - color: Color(0xFF2B353E))), + child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))), ), ], ), @@ -608,10 +520,7 @@ class _RegisterConfirmationPatientPageState onTap: () { Navigator.of(context).pop(); }, - child: Icon(DoctorApp.close_1, - size: SizeConfig.getTextMultiplierBasedOnWidth() * - 4.5, - color: Color(0xFF2B353E))), + child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))), ), ], ), diff --git a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart index f8f8b2c4..0c29b02a 100644 --- a/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart +++ b/lib/screens/patients/register_patient/RegisterSearchPatientPage.dart @@ -6,8 +6,8 @@ import 'package:doctor_app_flutter/core/model/PatientRegistration/CheckPatientFo import 'package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientRegistrationViewModel.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.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'; @@ -23,13 +23,10 @@ class RegisterSearchPatientPage extends StatefulWidget { final Function? changePageViewIndex; final PatientRegistrationViewModel? model; - const RegisterSearchPatientPage( - {Key? key, this.changePageViewIndex, this.model}) - : super(key: key); + const RegisterSearchPatientPage({Key? key, this.changePageViewIndex, this.model}) : super(key: key); @override - _RegisterSearchPatientPageState createState() => - _RegisterSearchPatientPageState(); + _RegisterSearchPatientPageState createState() => _RegisterSearchPatientPageState(); } class _RegisterSearchPatientPageState extends State { @@ -42,14 +39,12 @@ class _RegisterSearchPatientPageState extends State { bool isSubmitted = false; - TextEditingController _phoneController = - TextEditingController(text: "508079569"); + TextEditingController _phoneController = TextEditingController(text: "508079569"); TextEditingController _phoneCode = TextEditingController(text: "966"); String phoneError = ''; - TextEditingController _idController = - TextEditingController(text: "1062938285"); + TextEditingController _idController = TextEditingController(text: "1062938285"); String idError = ''; DateTime? _birthDateInGregorian; @@ -111,9 +106,7 @@ class _RegisterSearchPatientPageState extends State { @override Widget build(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; + final screenSize = MediaQuery.of(context).size; /// TODO Elham* add transaltion @@ -131,9 +124,7 @@ class _RegisterSearchPatientPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - TranslationBase - .of(context) - .askForIdentification, + TranslationBase.of(context).askForIdentification, fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier! * 2.2, fontWeight: FontWeight.w800, @@ -163,19 +154,17 @@ class _RegisterSearchPatientPageState extends State { Column( children: [ Container( - width: MediaQuery - .of(context) - .size - .width * 0.28, + width: MediaQuery.of(context).size.width * 0.28, child: AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: TranslationBase - .of(context) - .codeNo, + hintText: TranslationBase.of(context).codeNo, inputType: TextInputType.phone, controller: _phoneCode, validationError: phoneError, enabled: false, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), if (_phoneController.text.isEmpty && isSubmitted) @@ -192,17 +181,13 @@ class _RegisterSearchPatientPageState extends State { // width: MediaQuery.of(context).size.width*0.7, child: AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: TranslationBase - .of(context) - .phoneNumber, + hintText: TranslationBase.of(context).phoneNumber, inputType: TextInputType.phone, controller: _phoneController, - validationError: - _phoneController.text.isEmpty && isSubmitted - ? TranslationBase - .of(context) - .emptyMessage - : "", + validationError: _phoneController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), ), @@ -213,24 +198,19 @@ class _RegisterSearchPatientPageState extends State { ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: TranslationBase - .of(context) - .iDNumber, + hintText: TranslationBase.of(context).iDNumber, inputType: TextInputType.phone, controller: _idController, - validationError: _idController.text.isEmpty && isSubmitted - ? TranslationBase - .of(context) - .emptyMessage - : "", + validationError: _idController.text.isEmpty && isSubmitted ? TranslationBase.of(context).emptyMessage : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 12, ), AppText( - TranslationBase - .of(context) - .calender, + TranslationBase.of(context).calender, fontSize: SizeConfig.textMultiplier! * 1.8, fontWeight: FontWeight.w800, ), @@ -241,10 +221,7 @@ class _RegisterSearchPatientPageState extends State { children: [ Expanded( child: RadioListTile( - title: - AppText(TranslationBase - .of(context) - .gregorian), + title: AppText(TranslationBase.of(context).gregorian), value: CalenderType.Gregorian, groupValue: calenderType, onChanged: (CalenderType? value) { @@ -256,9 +233,7 @@ class _RegisterSearchPatientPageState extends State { ), Expanded( child: RadioListTile( - title: AppText(TranslationBase - .of(context) - .hijri), + title: AppText(TranslationBase.of(context).hijri), value: CalenderType.Hijri, groupValue: calenderType, onChanged: (CalenderType? value) { @@ -275,18 +250,11 @@ class _RegisterSearchPatientPageState extends State { ), AppTextFieldCustom( height: screenSize.height * 0.075, - hintText: TranslationBase - .of(context) - .birthdate, + hintText: TranslationBase.of(context).birthdate, dropDownText: getBirthdate(), enabled: false, isTextFieldHasSuffix: true, - validationError: - _birthDateInGregorian == null && isSubmitted - ? TranslationBase - .of(context) - .emptyMessage - : "", + validationError: _birthDateInGregorian == null && isSubmitted ? TranslationBase.of(context).emptyMessage : "", suffixIcon: IconButton( icon: Icon( Icons.calendar_today, @@ -298,45 +266,41 @@ class _RegisterSearchPatientPageState extends State { if (_birthDateInGregorian == null) { _birthDateInGregorian = DateTime.now(); } - _selectDate(context, _birthDateInGregorian!, - (dynamic selectedDate) { - setState(() { - if (calenderType == CalenderType.Hijri) { - birthDateInHijri = selectedDate; - // _birthDateInGregorian = HijriCalendar() - // .hijriToGregorian( - // birthDateInHijri.hYear, - // birthDateInHijri.hMonth, - // birthDateInHijri.hDay); - // + _selectDate(context, _birthDateInGregorian!, (dynamic selectedDate) { + setState(() { + if (calenderType == CalenderType.Hijri) { + birthDateInHijri = selectedDate; + // _birthDateInGregorian = HijriCalendar() + // .hijriToGregorian( + // birthDateInHijri.hYear, + // birthDateInHijri.hMonth, + // birthDateInHijri.hDay); + // - _birthDateInGregorian = DateTime.parse(JHijri( - fDay: birthDateInHijri.jhijri!.day, - fMonth: birthDateInHijri.jhijri!.month, - fYear: birthDateInHijri.jhijri!.year) - .toString()); + _birthDateInGregorian = + DateTime.parse(JHijri(fDay: birthDateInHijri.jhijri!.day, fMonth: birthDateInHijri.jhijri!.month, fYear: birthDateInHijri.jhijri!.year).toString()); + print(_birthDateInGregorian); + print(birthDateInHijri); + } else { + _birthDateInGregorian = selectedDate; + // birthDateInHijri = HijriCalendar() + // .gregorianToHijri( + // selectedDate.year, + // selectedDate.month, + // selectedDate.day) as HijriCalendar; - print(_birthDateInGregorian); - print(birthDateInHijri); - } else { - _birthDateInGregorian = selectedDate; - // birthDateInHijri = HijriCalendar() - // .gregorianToHijri( - // selectedDate.year, - // selectedDate.month, - // selectedDate.day) as HijriCalendar; + birthDateInHijri = JDateModel(dateTime: selectedDate); - birthDateInHijri = - JDateModel(dateTime: selectedDate); - - print(_birthDateInGregorian); - print(birthDateInHijri.dateTime); - print(birthDateInHijri.jhijri); - } - }); - }); + print(_birthDateInGregorian); + print(birthDateInHijri.dateTime); + print(birthDateInHijri.jhijri); + } + }); + }); }, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), SizedBox( height: 70, @@ -356,9 +320,7 @@ class _RegisterSearchPatientPageState extends State { Expanded( child: Container( child: AppButton( - title: TranslationBase - .of(context) - .cancel, + title: TranslationBase.of(context).cancel, hasBorder: true, // vPadding: 12, hPadding: 8, @@ -377,9 +339,7 @@ class _RegisterSearchPatientPageState extends State { Expanded( child: Container( child: AppButton( - title: TranslationBase - .of(context) - .next, + title: TranslationBase.of(context).next, hasBorder: true, borderColor: Color(0xFFB8382B), color: AppGlobal.appRedColor, @@ -389,21 +349,15 @@ class _RegisterSearchPatientPageState extends State { isSubmitted = true; }); if (country == null) { - countryError = TranslationBase - .of(context) - .fieldRequired; + countryError = TranslationBase.of(context).fieldRequired; } else { countryError = ""; } if (isFormValid()) { GifLoaderDialogUtils.showMyDialog(context); - CheckPatientForRegistrationModel - checkPatientForRegistrationModel = - CheckPatientForRegistrationModel( - patientIdentificationID: - int.parse(_idController.text), - patientMobileNumber: - int.parse(_phoneController.text), + CheckPatientForRegistrationModel checkPatientForRegistrationModel = CheckPatientForRegistrationModel( + patientIdentificationID: int.parse(_idController.text), + patientMobileNumber: int.parse(_phoneController.text), zipCode: _phoneCode.text, isHijri: 0, patientID: 0, @@ -411,14 +365,9 @@ class _RegisterSearchPatientPageState extends State { isDentalAllowedBackend: false, patientOutSA: 0, generalid: GENERAL_ID, - dOB: - "${AppDateUtils.convertStringToDateFormat( - _birthDateInGregorian.toString(), - "yyyy/MM/dd")}"); - await widget.model!.checkPatientForRegistration( - checkPatientForRegistrationModel); - GetPatientInfoRequestModel getPatientInfoRequestModel = - GetPatientInfoRequestModel( + dOB: "${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}"); + await widget.model!.checkPatientForRegistration(checkPatientForRegistrationModel); + GetPatientInfoRequestModel getPatientInfoRequestModel = GetPatientInfoRequestModel( //TODO Elham* this return the static to dynamic patientIdentificationID: "1062938285", // _idController.text, @@ -427,14 +376,12 @@ class _RegisterSearchPatientPageState extends State { patientOutSA: 0, generalid: GENERAL_ID, sessionID: null, - dOB: - "31/07/1988", //"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}" + dOB: "31/07/1988", //"${AppDateUtils.convertStringToDateFormat(_birthDate.toString(), "dd/MM/yyyy")}" ); if (widget.model!.state == ViewState.ErrorLocal) { Utils.showErrorToast(widget.model!.error); } else { - await widget.model! - .getPatientInfo(getPatientInfoRequestModel); + await widget.model!.getPatientInfo(getPatientInfoRequestModel); if (widget.model!.state == ViewState.ErrorLocal) { Utils.showErrorToast(widget.model!.error); } else { @@ -454,18 +401,13 @@ class _RegisterSearchPatientPageState extends State { } isFormValid() { - if (_phoneController.text != null && - _phoneController.text.isNotEmpty && - _idController.text != null && - _idController.text.isNotEmpty && - _birthDateInGregorian != null) { + if (_phoneController.text != null && _phoneController.text.isNotEmpty && _idController.text != null && _idController.text.isNotEmpty && _birthDateInGregorian != null) { return true; } return false; } - Future _selectDate(BuildContext context, DateTime dateTime, - Function(dynamic) updateDate) async { + Future _selectDate(BuildContext context, DateTime dateTime, Function(dynamic) updateDate) async { if (calenderType == CalenderType.Hijri) { JDateModel hijriDate = JDateModel(dateTime: DateTime.now()); final JPickerValue? pickedH = await showGlobalDatePicker( @@ -487,9 +429,7 @@ class _RegisterSearchPatientPageState extends State { final DateTime? picked = await showDatePicker( context: context, initialDate: dateTime ?? DateTime.now(), - firstDate: DateTime(DateTime - .now() - .year - 150), + firstDate: DateTime(DateTime.now().year - 150), lastDate: DateTime.now(), initialEntryMode: DatePickerEntryMode.calendar, ); @@ -499,16 +439,13 @@ class _RegisterSearchPatientPageState extends State { } } - void openListDialogField(String attributeName, String attributeValueId, - List list, Function(dynamic selectedValue) okFunction) { + void openListDialogField(String attributeName, String attributeValueId, List list, Function(dynamic selectedValue) okFunction) { ListSelectDialog dialog = ListSelectDialog( list: list, attributeName: attributeName, attributeValueId: attributeValueId, usingSearch: true, - okText: TranslationBase - .of(context) - .ok, + okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { okFunction(selectedValue); }, @@ -526,10 +463,7 @@ class _RegisterSearchPatientPageState extends State { if (calenderType == CalenderType.Hijri) { return birthDateInHijri != null ? "$birthDateInHijri" : null; } else { - return _birthDateInGregorian != null - ? "${AppDateUtils.convertStringToDateFormat( - _birthDateInGregorian.toString(), "yyyy/MM/dd")}" - : null; + return _birthDateInGregorian != null ? "${AppDateUtils.convertStringToDateFormat(_birthDateInGregorian.toString(), "yyyy/MM/dd")}" : null; } } } diff --git a/lib/screens/prescription/add_prescription/prescription_form_widget.dart b/lib/screens/prescription/add_prescription/prescription_form_widget.dart index 3c819577..5305032e 100644 --- a/lib/screens/prescription/add_prescription/prescription_form_widget.dart +++ b/lib/screens/prescription/add_prescription/prescription_form_widget.dart @@ -13,18 +13,18 @@ import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; +import 'package:doctor_app_flutter/utils/utils.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/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; + import '../../../widgets/transitions/slide_up_page.dart'; import 'add_drug/add_drug_widget.dart'; @@ -182,10 +182,11 @@ class _PrescriptionFormWidgetState extends State { isTextFieldHasSuffix: false, enabled: true, controller: strengthController, - onChanged: (String value) { - setState(() { - strengthChar = value.length; - }); + onChanged: (value) { + if (value != null) + setState(() { + strengthChar = value.length; + }); if (strengthChar! >= 5) { DrAppToastMsg.showErrorToast( TranslationBase.of(context).only5DigitsAllowedForStrength, @@ -195,6 +196,8 @@ class _PrescriptionFormWidgetState extends State { inputType: TextInputType.numberWithOptions( decimal: true, ), + onClick: () {}, + onFieldSubmitted: () {}, ), ), SizedBox( @@ -246,8 +249,8 @@ class _PrescriptionFormWidgetState extends State { frequency = selectedValue; frequency['isDefault'] = true; if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) { - widget.medicineViewModel - !.getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication!.itemId, strength: double.parse(strengthController.text)); + widget.medicineViewModel! + .getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication!.itemId, strength: double.parse(strengthController.text)); return; } @@ -279,6 +282,9 @@ class _PrescriptionFormWidgetState extends State { child: AppTextFieldCustom( hintText: widget.medicineViewModel!.patientAssessmentList[0].icdCode10ID.toString(), enabled: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), Container( @@ -288,6 +294,9 @@ class _PrescriptionFormWidgetState extends State { maxLines: 5, hintText: widget.medicineViewModel!.patientAssessmentList[0].asciiDesc.toString(), enabled: true, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), ], @@ -306,9 +315,13 @@ class _PrescriptionFormWidgetState extends State { icon: Icon( Icons.calendar_today, color: Colors.black, - ), onPressed: () { }, + ), + onPressed: () {}, ), dropDownText: selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : "", + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, enabled: false, ), ), @@ -339,6 +352,9 @@ class _PrescriptionFormWidgetState extends State { isTextFieldHasSuffix: false, dropDownText: uom != null ? uom : null, enabled: false, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), SizedBox(height: spaceBetweenTextFields), @@ -349,6 +365,9 @@ class _PrescriptionFormWidgetState extends State { isTextFieldHasSuffix: false, dropDownText: box != null ? widget.medicineViewModel!.boxQuintity.toString() : "", enabled: false, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), SizedBox(height: spaceBetweenTextFields), diff --git a/lib/screens/prescription/prescription_checkout_screen.dart b/lib/screens/prescription/prescription_checkout_screen.dart index acdab5b3..6537e08a 100644 --- a/lib/screens/prescription/prescription_checkout_screen.dart +++ b/lib/screens/prescription/prescription_checkout_screen.dart @@ -4,26 +4,26 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; +import 'package:doctor_app_flutter/utils/utils.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/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -341,10 +341,11 @@ class _PrescriptionCheckOutScreenState extends State isTextFieldHasSuffix: false, enabled: true, controller: strengthController, - onChanged: (String value) { - setState(() { - strengthChar = value.length; - }); + onChanged: (value) { + if (value != null) + setState(() { + strengthChar = value.length; + }); if (strengthChar! >= 5) { DrAppToastMsg.showErrorToast( TranslationBase.of(context).only5DigitsAllowedForStrength, @@ -354,6 +355,8 @@ class _PrescriptionCheckOutScreenState extends State inputType: TextInputType.numberWithOptions( decimal: true, ), + onClick: () {}, + onFieldSubmitted: () {}, ), ), SizedBox( diff --git a/lib/screens/prescription/prescription_text_filed.dart b/lib/screens/prescription/prescription_text_filed.dart index 15f969b3..1d2366e7 100644 --- a/lib/screens/prescription/prescription_text_filed.dart +++ b/lib/screens/prescription/prescription_text_filed.dart @@ -1,8 +1,7 @@ -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class PrescriptionTextFiled extends StatefulWidget { @@ -56,6 +55,9 @@ class _PrescriptionTextFiledState extends State { isTextFieldHasSuffix: true, validationError: widget.elementList!.length != 1 ? widget.elementError! : "", enabled: false, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), ); diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 83fb05eb..b5940b0d 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -21,13 +21,10 @@ class AddProcedurePage extends StatefulWidget { final PatiantInformtion? patient; final ProcedureType procedureType; - const AddProcedurePage( - {Key? key, this.model, this.patient, required this.procedureType}) - : super(key: key); + const AddProcedurePage({Key? key, this.model, this.patient, required this.procedureType}) : super(key: key); @override - _AddProcedurePageState createState() => _AddProcedurePageState( - patient: patient, model: model, procedureType: this.procedureType); + _AddProcedurePageState createState() => _AddProcedurePageState(patient: patient, model: model, procedureType: this.procedureType); } class _AddProcedurePageState extends State { @@ -56,14 +53,9 @@ class _AddProcedurePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) { - model.getProcedureCategory( - categoryName: procedureType!.getCategoryName(), - categoryID: procedureType!.getCategoryId(), - patientId: patient!.patientId); + model.getProcedureCategory(categoryName: procedureType!.getCategoryName(), categoryID: procedureType!.getCategoryId(), patientId: patient!.patientId); }, - builder: - (BuildContext context, ProcedureViewModel model, Widget? child) => - AppScaffold( + builder: (BuildContext context, ProcedureViewModel model, Widget? child) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( child: FractionallySizedBox( @@ -86,66 +78,50 @@ class _AddProcedurePageState extends State { Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, + TranslationBase.of(context).pleaseEnterProcedure, fontWeight: FontWeight.w700, fontSize: 20, ), ], ), SizedBox( - height: MediaQuery.of(context).size.height * - 0.02, + height: MediaQuery.of(context).size.height * 0.02, ), Row( children: [ Container( - width: - MediaQuery.of(context).size.width * - 0.79, + width: MediaQuery.of(context).size.width * 0.79, child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, + hintText: TranslationBase.of(context).searchProcedureHere, isTextFieldHasSuffix: false, maxLines: 1, minLines: 1, hasBorder: true, controller: procedureName, + onClick: () {}, + onChanged: (value) {}, + onFieldSubmitted: () {}, ), ), SizedBox( - width: - MediaQuery.of(context).size.width * - 0.02, + width: MediaQuery.of(context).size.width * 0.02, ), Expanded( child: InkWell( onTap: () async { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= - 3) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProcedureCategory( - patientId: patient!.patientId, - categoryName: - procedureName.text, - isLocalBusy: true); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); + if (procedureName.text.isNotEmpty && procedureName.text.length >= 3) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProcedureCategory(patientId: patient!.patientId, categoryName: procedureName.text, isLocalBusy: true); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); } - GifLoaderDialogUtils.hideDialog( - context); + GifLoaderDialogUtils.hideDialog(context); } else { DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, + TranslationBase.of(context).atLeastThreeCharacters, ); } }, @@ -159,16 +135,12 @@ class _AddProcedurePageState extends State { ), ], ), - if ((procedureType == ProcedureType.PROCEDURE - ? procedureName.text.isNotEmpty - : true) && - model.categoriesList.length != 0) + if ((procedureType == ProcedureType.PROCEDURE ? procedureName.text.isNotEmpty : true) && model.categoriesList.length != 0) NetworkBaseView( baseViewModel: model, child: EntityListCheckboxSearchWidget( model: widget.model!, - masterList: - model.categoriesList[0].entityList!, + masterList: model.categoriesList[0].entityList!, removeProcedure: (item) { setState(() { entityList.remove(item); @@ -180,9 +152,7 @@ class _AddProcedurePageState extends State { }); }, addSelectedHistories: () {}, - isEntityListSelected: (master) => - widget.model!.isEntityListSelected( - master, entityList), + isEntityListSelected: (master) => widget.model!.isEntityListSelected(master, entityList), )), SizedBox( height: 10, @@ -208,8 +178,7 @@ class _AddProcedurePageState extends State { GifLoaderDialogUtils.showMyDialog(context); if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, + TranslationBase.of(context).fillTheMandatoryProcedureDetails, ); GifLoaderDialogUtils.hideDialog(context); return; diff --git a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart index 256d9a16..70e05047 100644 --- a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart @@ -48,12 +48,10 @@ class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { : super(key: key); @override - _EntityListCheckboxSearchFavProceduresWidgetState createState() => - _EntityListCheckboxSearchFavProceduresWidgetState(); + _EntityListCheckboxSearchFavProceduresWidgetState createState() => _EntityListCheckboxSearchFavProceduresWidgetState(); } -class _EntityListCheckboxSearchFavProceduresWidgetState - extends State { +class _EntityListCheckboxSearchFavProceduresWidgetState extends State { int selectedType = 0; int typeUrgent = 0; int typeRegular = 0; @@ -87,22 +85,19 @@ class _EntityListCheckboxSearchFavProceduresWidgetState child: Center( child: Container( margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white), child: ListView( children: [ AppTextFieldCustomSearch( searchController: patientFileInfoController, onChangeFun: (value) { - widget.model!.filterProcedureSearchResults( - value, widget.masterList, items); + widget.model!.filterProcedureSearchResults(value, widget.masterList, items); }, marginTop: 5, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) - ], + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS))], inputType: TextInputType.text, hintText: TranslationBase.of(context).searchFavoriteTemplate, + onFieldSubmitted: () {}, ), SizedBox( height: 15, @@ -117,17 +112,14 @@ class _EntityListCheckboxSearchFavProceduresWidgetState addFavProcedure: widget.addFavProcedure!, selectProcedures: widget.selectProcedures!, isEntityListSelected: widget.isEntityListSelected!, - isEntityFavListSelected: - widget.isEntityFavListSelected!, + isEntityFavListSelected: widget.isEntityFavListSelected!, isProcedure: widget.isProcedure, groupProcedures: widget.groupProcedures!); }).toList(), ) : Center( child: Container( - child: AppText( - TranslationBase.of(context).sorryNoMatch, - color: AppGlobal.appRedColor), + child: AppText(TranslationBase.of(context).sorryNoMatch, color: AppGlobal.appRedColor), ), ) ], diff --git a/lib/update_page.dart b/lib/update_page.dart index 8bd28a09..38863596 100644 --- a/lib/update_page.dart +++ b/lib/update_page.dart @@ -4,7 +4,6 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 022233df..c2057ec3 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -1,9 +1,9 @@ import 'package:connectivity/connectivity.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/doctor/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/service/NavigationService.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/core/model/doctor/list_doctor_working_hours_table_model.dart'; import 'package:doctor_app_flutter/utils/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -12,21 +12,20 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:html/parser.dart'; -import '../update_page.dart'; + import '../config/size_config.dart'; import '../locator.dart'; +import '../update_page.dart'; import '../utils/dr_app_toast_msg.dart'; -import 'dr_app_shared_pref.dart'; -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); class Utils { static int cupertinoPickerIndex = 0; get currentLanguage => null; - static showConfirmationDialog( - BuildContext context, String message, Function okFunction) { + static showConfirmationDialog(BuildContext context, String message, Function okFunction) { return showDialog( context: context, barrierDismissible: false, // user must tap button! @@ -63,8 +62,7 @@ class Utils { }); } - static showCupertinoPicker(context, List items, - decKey, onSelectFun, AuthenticationViewModel model) { + static showCupertinoPicker(context, List items, decKey, onSelectFun, AuthenticationViewModel model) { showModalBottomSheet( isDismissible: false, context: context, @@ -82,8 +80,7 @@ class Utils { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: Text(TranslationBase.of(context).cancel, - style: textStyle(context)), + child: Text(TranslationBase.of(context).cancel, style: textStyle(context)), onPressed: () { Navigator.pop(context); }, @@ -101,26 +98,19 @@ class Utils { ], ), ), - Container( - height: SizeConfig.realScreenHeight! * 0.3, - color: Color(0xfff7f7f7), - child: buildPickerItems( - context, items, decKey, onSelectFun, model)) + Container(height: SizeConfig.realScreenHeight! * 0.3, color: Color(0xfff7f7f7), child: buildPickerItems(context, items, decKey, onSelectFun, model)) ], ), ); }); } - static TextStyle textStyle(context) => - TextStyle(color: Theme.of(context).primaryColor); + static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); - static buildPickerItems(context, List items, - decKey, onSelectFun, model) { + static buildPickerItems(context, List items, decKey, onSelectFun, model) { return CupertinoPicker( magnification: 1.5, - scrollController: - FixedExtentScrollController(initialItem: cupertinoPickerIndex), + scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), children: items.map((item) { return Text( '${item.facilityName}', @@ -146,10 +136,8 @@ class Utils { } static Future checkConnection() async { - ConnectivityResult connectivityResult = - await (Connectivity().checkConnectivity()); - if ((connectivityResult == ConnectivityResult.mobile) || - (connectivityResult == ConnectivityResult.wifi)) { + ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity()); + if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { return true; } else { return false; @@ -162,8 +150,7 @@ class Utils { listOfHours.forEach((element) { WorkingHours workingHours = WorkingHours(); - var from = element.substring( - element.indexOf('m ') + 2, element.indexOf('To') - 1); + var from = element.substring(element.indexOf('m ') + 2, element.indexOf('To') - 1); workingHours.from = from.trim(); var to = element.substring(element.indexOf('To') + 2); workingHours.to = to.trim(); @@ -231,9 +218,7 @@ class Utils { return parsedString; } - static InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {Icon? suffixIcon, Color? dropDownColor}) { + static InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon? suffixIcon, Color? dropDownColor}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -263,9 +248,7 @@ class Utils { ); } - static BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor, - {double borderWidth = -1}) { + static BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor, {double borderWidth = -1}) { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, @@ -325,8 +308,6 @@ class Utils { return kpi; } - - static String convertToTitleCase(String text) { if (text == null) { return ""; diff --git a/lib/widgets/shared/buttons/app_buttons_widget.dart b/lib/widgets/shared/buttons/app_buttons_widget.dart index 2b30e49c..a30f0193 100644 --- a/lib/widgets/shared/buttons/app_buttons_widget.dart +++ b/lib/widgets/shared/buttons/app_buttons_widget.dart @@ -1,7 +1,4 @@ -import 'dart:ui'; - import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -43,7 +40,7 @@ class AppButton extends StatefulWidget { this.radius = 8.0, this.hasBorder = false, this.borderColor = Colors.white, - this.height = 5, + this.height = 50, }); _AppButtonState createState() => _AppButtonState(); @@ -80,8 +77,7 @@ class _AppButtonState extends State { splashColor: widget.color, child: Padding( padding: (widget.hPadding > 0 || widget.vPadding > 0) - ? EdgeInsets.symmetric( - vertical: widget.vPadding, horizontal: widget.hPadding) + ? EdgeInsets.symmetric(vertical: widget.vPadding, horizontal: widget.hPadding) : EdgeInsets.only( top: widget.padding, bottom: widget.padding, @@ -92,8 +88,7 @@ class _AppButtonState extends State { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [ - if (widget.icon != null) - Container(width: 25, height: 25, child: widget.icon), + if (widget.icon != null) Container(width: 25, height: 25, child: widget.icon), if (widget.iconData != null) Icon( widget.iconData, diff --git a/lib/widgets/shared/loader/gif_loader_container.dart b/lib/widgets/shared/loader/gif_loader_container.dart index 1e32784c..8f315d6a 100644 --- a/lib/widgets/shared/loader/gif_loader_container.dart +++ b/lib/widgets/shared/loader/gif_loader_container.dart @@ -6,8 +6,7 @@ class GifLoaderContainer extends StatefulWidget { _GifLoaderContainerState createState() => _GifLoaderContainerState(); } -class _GifLoaderContainerState extends State - with TickerProviderStateMixin { +class _GifLoaderContainerState extends State with TickerProviderStateMixin { late GifController controller1; @override @@ -15,8 +14,8 @@ class _GifLoaderContainerState extends State controller1 = GifController(vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { - controller1.repeat( - min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); + // controller1.repeat( + // min: 0, max: 11, period: Duration(milliseconds: 750), reverse: true); }); super.initState(); } @@ -35,8 +34,7 @@ class _GifLoaderContainerState extends State // margin: EdgeInsets.only(bottom: 40), child: Gif( controller: controller1, - image: AssetImage( - "assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), ), )); } diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index f58163ee..ce1c9d50 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -1,11 +1,10 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,25 +21,14 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { final String? buttonName; final String? hintSearchText; - MasterKeyCheckboxSearchWidget( - {Key? key, - this.model, - this.addSelectedHistories, - this.removeHistory, - this.masterList, - this.addHistory, - this.isServiceSelected, - this.buttonName, - this.hintSearchText}) + MasterKeyCheckboxSearchWidget({Key? key, this.model, this.addSelectedHistories, this.removeHistory, this.masterList, this.addHistory, this.isServiceSelected, this.buttonName, this.hintSearchText}) : super(key: key); @override - _MasterKeyCheckboxSearchWidgetState createState() => - _MasterKeyCheckboxSearchWidgetState(); + _MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState(); } -class _MasterKeyCheckboxSearchWidgetState - extends State { +class _MasterKeyCheckboxSearchWidgetState extends State { List items = []; TextEditingController filteredSearchController = TextEditingController(); @@ -70,9 +58,7 @@ class _MasterKeyCheckboxSearchWidgetState height: MediaQuery.of(context).size.height * 0.60, child: Center( child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), child: ListView( children: [ AppTextFieldCustom( @@ -82,8 +68,8 @@ class _MasterKeyCheckboxSearchWidgetState isTextFieldHasSuffix: true, hasBorder: false, controller: filteredSearchController, - onChanged: (value) { - filterSearchResults(value); + onChanged: (String? value) { + filterSearchResults(value!); }, suffixIcon: IconButton( icon: Icon( @@ -92,6 +78,8 @@ class _MasterKeyCheckboxSearchWidgetState ), onPressed: () {}, ), + onClick: () {}, + onFieldSubmitted: () {}, ), // SizedBox(height: 15,), @@ -105,8 +93,7 @@ class _MasterKeyCheckboxSearchWidgetState InkWell( onTap: () { setState(() { - if (widget - .isServiceSelected!(historyInfo)) { + if (widget.isServiceSelected!(historyInfo)) { widget.removeHistory!(historyInfo); } else { widget.addHistory!(historyInfo); @@ -116,15 +103,12 @@ class _MasterKeyCheckboxSearchWidgetState child: Row( children: [ Checkbox( - value: widget - .isServiceSelected!(historyInfo), + value: widget.isServiceSelected!(historyInfo), activeColor: Colors.red[800], onChanged: (bool? newValue) { setState(() { - if (widget.isServiceSelected!( - historyInfo)) { - widget - .removeHistory!(historyInfo); + if (widget.isServiceSelected!(historyInfo)) { + widget.removeHistory!(historyInfo); } else { widget.addHistory!(historyInfo); } @@ -138,9 +122,7 @@ class _MasterKeyCheckboxSearchWidgetState : historyInfo.nameEn! : historyInfo.nameEn!, color: Color(0xFF575757), - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - (SizeConfig.isWidthLarge ? 3 : 3.8), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 3.8), letterSpacing: -0.56, ), ), @@ -172,8 +154,7 @@ class _MasterKeyCheckboxSearchWidgetState if (query.isNotEmpty) { List dummyListData = []; dummySearchList.forEach((item) { - if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || - item.nameEn!.toLowerCase().contains(query.toLowerCase())) { + if (item.nameAr!.toLowerCase().contains(query.toLowerCase()) || item.nameEn!.toLowerCase().contains(query.toLowerCase())) { dummyListData.add(item); } }); diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index d716370f..c26d1220 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -11,7 +11,7 @@ import '../app_texts_widget.dart'; class AppTextFieldCustom extends StatefulWidget { final double height; - final Function? onClick; + final Function()? onClick; final String? hintText; final TextEditingController? controller; final bool isTextFieldHasSuffix; @@ -24,8 +24,8 @@ class AppTextFieldCustom extends StatefulWidget { final int minLines; final int maxLines; final List? inputFormatters; - final Function(String)? onChanged; - final Function? onFieldSubmitted; + final Function(String? value) onChanged; + final Function onFieldSubmitted; final String? validationError; final bool isPrscription; @@ -48,13 +48,13 @@ class AppTextFieldCustom extends StatefulWidget { this.minLines = 1, this.maxLines = 1, this.inputFormatters, - this.onChanged, + required this.onChanged, this.validationError, this.isPrscription = false, this.isSecure = false, this.focus = false, this.isSearchTextField = false, - this.onFieldSubmitted, + required this.onFieldSubmitted, }); @override @@ -91,27 +91,21 @@ class _AppTextFieldCustomState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - TextInputType localKeyboardType = widget.inputType ?? - (widget.maxLines == 1 ? TextInputType.text : TextInputType.multiline); + TextInputType localKeyboardType = widget.inputType ?? (widget.maxLines == 1 ? TextInputType.text : TextInputType.multiline); return Column( children: [ Container( - height: widget.height != 0 && widget.maxLines == 1 - ? widget.height + 8 - : null, //MediaQuery.of(context).size.height * 0.098, + height: widget.height != 0 && widget.maxLines == 1 ? widget.height + 8 : null, //MediaQuery.of(context).size.height * 0.098, decoration: widget.hasBorder ? TextFieldsUtils.containerBorderDecoration( Color(0Xffffffff), - widget.validationError == null - ? Color(0xFFEFEFEF) - : Colors.red.shade700, + widget.validationError == null ? Color(0xFFEFEFEF) : Colors.red.shade700, ) : null, - padding: - EdgeInsets.only(top: 4.0, bottom: 0.0, left: 8.0, right: 8.0), + padding: EdgeInsets.only(top: 4.0, bottom: 0.0, left: 8.0, right: 8.0), child: InkWell( - onTap: widget.onClick!() ?? null, + onTap: widget.onClick ?? null, child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -136,40 +130,25 @@ class _AppTextFieldCustomState extends State { ), widget.dropDownText == null ? Container( - height: - widget.height != 0 && widget.maxLines == 1 - ? widget.height - 22 - : null, + height: widget.height != 0 && widget.maxLines == 1 ? widget.height - 22 : null, child: RawKeyboardListener( focusNode: FocusNode(), autofocus: false, onKey: (rawKeyEvent) { - final isFormSkippedEnterEvent = - rawKeyEvent is RawKeyDownEvent && - rawKeyEvent.isKeyPressed( - LogicalKeyboardKey.enter); + final isFormSkippedEnterEvent = rawKeyEvent is RawKeyDownEvent && rawKeyEvent.isKeyPressed(LogicalKeyboardKey.enter); - final needToInsertNewLine = - isFormSkippedEnterEvent && - localKeyboardType == - TextInputType.multiline; + final needToInsertNewLine = isFormSkippedEnterEvent && localKeyboardType == TextInputType.multiline; if (needToInsertNewLine) { - TextEditingControllerHelper.insertText( - widget.controller!, '\n'); + TextEditingControllerHelper.insertText(widget.controller!, '\n'); } }, child: TextFormField( - textAlign: projectViewModel.isArabic - ? TextAlign.right - : TextAlign.left, + textAlign: projectViewModel.isArabic ? TextAlign.right : TextAlign.left, focusNode: _focusNode, textAlignVertical: TextAlignVertical.top, - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - widget.hintText!, "", true), + decoration: TextFieldsUtils.textFieldSelectorDecoration(widget.hintText!, "", true), style: TextStyle( - fontSize: - SizeConfig.textMultiplier! * 1.7, + fontSize: SizeConfig.textMultiplier! * 1.7, fontFamily: 'Poppins', color: Color(0xFF575757), fontWeight: FontWeight.w400, @@ -180,18 +159,14 @@ class _AppTextFieldCustomState extends State { enabled: widget.enabled, minLines: widget.minLines, maxLines: widget.maxLines, - inputFormatters: - widget.inputFormatters != null - ? widget.inputFormatters - : [], + inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], onChanged: (value) { - setState(() {}); if (widget.onChanged != null) { - widget.onChanged!(value); + widget.onChanged(value); } + setState(() {}); }, - onFieldSubmitted: - widget.onFieldSubmitted!(), + onFieldSubmitted: widget.onFieldSubmitted(), obscureText: widget.isSecure), ), ) @@ -210,8 +185,7 @@ class _AppTextFieldCustomState extends State { ? Container( margin: EdgeInsets.only( bottom: widget.isSearchTextField - ? (widget.controller!.text.isEmpty || - widget.controller == null) + ? (widget.controller!.text.isEmpty || widget.controller == null) ? 10 : 25 : 0), @@ -219,9 +193,7 @@ class _AppTextFieldCustomState extends State { : InkWell( child: Icon( Icons.keyboard_arrow_down, - color: widget.dropDownColor != null - ? widget.dropDownColor - : Color(0xff2E303A), + color: widget.dropDownColor != null ? widget.dropDownColor : Color(0xff2E303A), size: 12.0, ), ) @@ -230,9 +202,7 @@ class _AppTextFieldCustomState extends State { ), ), ), - if (widget.validationError != null && - widget.validationError!.isNotEmpty) - TextFieldsError(error: widget.validationError!), + if (widget.validationError != null && widget.validationError!.isNotEmpty) TextFieldsError(error: widget.validationError!), ], ); } @@ -248,8 +218,7 @@ class TextEditingControllerHelper { } final text = controller.text; - final newText = - text.replaceRange(selection.start, selection.end, textToInsert); + final newText = text.replaceRange(selection.start, selection.end, textToInsert); controller.value = controller.value.copyWith( text: newText, selection: TextSelection.collapsed( diff --git a/lib/widgets/shared/text_fields/app_text_field_custom_serach.dart b/lib/widgets/shared/text_fields/app_text_field_custom_serach.dart index 6f8014a4..d2f9e696 100644 --- a/lib/widgets/shared/text_fields/app_text_field_custom_serach.dart +++ b/lib/widgets/shared/text_fields/app_text_field_custom_serach.dart @@ -9,7 +9,7 @@ import 'app-textfield-custom.dart'; class AppTextFieldCustomSearch extends StatelessWidget { const AppTextFieldCustomSearch({ Key? key, - this.onChangeFun, + required this.onChangeFun, this.positionedChild, this.marginTop, this.suffixIcon, @@ -17,15 +17,15 @@ class AppTextFieldCustomSearch extends StatelessWidget { this.inputType, this.inputFormatters, this.searchController, - this.onFieldSubmitted, + required this.onFieldSubmitted, this.hintText, this.height, }); final TextEditingController? searchController; - final Function? onChangeFun; - final Function? onFieldSubmitted; + final Function onChangeFun; + final Function onFieldSubmitted; final Widget? positionedChild; final IconButton? suffixIcon; @@ -45,28 +45,26 @@ class AppTextFieldCustomSearch extends StatelessWidget { child: Stack( children: [ AppTextFieldCustom( - height: height ?? 0, - hintText: - hintText ?? TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - isSearchTextField: true, - inputFormatters: inputFormatters, - suffixIcon: suffixIcon ?? - IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, + height: height ?? 0, + hintText: hintText ?? TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + isSearchTextField: true, + inputFormatters: inputFormatters, + suffixIcon: suffixIcon ?? + IconButton( + icon: Icon( + Icons.search, + color: Colors.black, ), - controller: searchController, - onChanged: onChangeFun!(), - onFieldSubmitted: onFieldSubmitted, - validationError: validationError), - if (positionedChild != null) - projectViewModel.isArabic - ? Positioned(left: 35, top: 5, child: positionedChild!) - : Positioned(right: 35, top: 5, child: positionedChild!) + onPressed: () {}, + ), + controller: searchController, + onChanged: onChangeFun(), + onFieldSubmitted: onFieldSubmitted(), + validationError: validationError, + onClick: () {}, + ), + if (positionedChild != null) projectViewModel.isArabic ? Positioned(left: 35, top: 5, child: positionedChild!) : Positioned(right: 35, top: 5, child: positionedChild!) ], ), ); diff --git a/lib/widgets/shared/text_fields/country_textfield_custom.dart b/lib/widgets/shared/text_fields/country_textfield_custom.dart index 878f7dfd..d2cc290c 100644 --- a/lib/widgets/shared/text_fields/country_textfield_custom.dart +++ b/lib/widgets/shared/text_fields/country_textfield_custom.dart @@ -1,8 +1,7 @@ -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class CountryTextField extends StatefulWidget { @@ -15,17 +14,7 @@ class CountryTextField extends StatefulWidget { final double? width; final Function(dynamic)? okFunction; - CountryTextField( - {Key? key, - required this.element, - required this.elementError, - this.width, - this.elementList, - this.keyName, - this.keyId, - this.hintText, - this.okFunction}) - : super(key: key); + CountryTextField({Key? key, required this.element, required this.elementError, this.width, this.elementList, this.keyName, this.keyId, this.hintText, this.okFunction}) : super(key: key); @override _CountryTextfieldState createState() => _CountryTextfieldState(); @@ -43,12 +32,9 @@ class _CountryTextfieldState extends State { ListSelectDialog dialog = ListSelectDialog( list: widget.elementList!, attributeName: '${widget.keyName}', - attributeValueId: widget.elementList!.length == 1 - ? widget.elementList![0]['${widget.keyId}'] - : '${widget.keyId}', + attributeValueId: widget.elementList!.length == 1 ? widget.elementList![0]['${widget.keyId}'] : '${widget.keyId}', okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) => - widget.okFunction!(selectedValue), + okFunction: (selectedValue) => widget.okFunction!(selectedValue), ); showDialog( barrierDismissible: false, @@ -67,9 +53,11 @@ class _CountryTextfieldState extends State { ? widget.element['${widget.keyName}'] : null, isTextFieldHasSuffix: true, - validationError: - widget.elementList!.length != 1 ? widget.elementError : null, + validationError: widget.elementList!.length != 1 ? widget.elementError : null, enabled: false, + onClick: () {}, + onChanged: (String? value) {}, + onFieldSubmitted: () {}, ), ), );