Merge branch 'sultan' into 'development'

Sultan

See merge request Cloud_Solution/doctor_app_flutter!562
merge-requests/564/merge
Mohammad Aljammal 5 years ago
commit d14659d2b7

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

@ -859,5 +859,6 @@ const Map<String, Map<String, String>> localizedValues = {
"noOfDays": {"en": "No of days", "ar": "عدد الأيام"}, "noOfDays": {"en": "No of days", "ar": "عدد الأيام"},
"numOfDays": {"en": "Number of Days", "ar": "عدد الأيام"}, "numOfDays": {"en": "Number of Days", "ar": "عدد الأيام"},
"replayBefore": {"en": "Replay Before", "ar": "رد قبل"}, "replayBefore": {"en": "Replay Before", "ar": "رد قبل"},
"try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'},
"refClinic": {"en": "Ref Clinic", "ar": "Ref Clinic"}, "refClinic": {"en": "Ref Clinic", "ar": "Ref Clinic"},
}; };

@ -0,0 +1,25 @@
import 'dart:async';
class RobotProvider {
static final RobotProvider _singleton = RobotProvider._internal();
var value;
StreamController<Map> controller = StreamController<Map>.broadcast();
getData() {
// return data;
}
intStream() {
controller.add({});
}
setValue(Map data) {
value = data;
controller.add(value);
}
factory RobotProvider() {
return _singleton;
}
RobotProvider._internal();
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/livecare_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/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -42,6 +43,10 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider<LiveCareViewModel>( ChangeNotifierProvider<LiveCareViewModel>(
create: (context) => LiveCareViewModel(), create: (context) => LiveCareViewModel(),
), ),
StreamProvider.value(
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),
)
], ],
child: Consumer<ProjectViewModel>( child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp( builder: (context, projectProvider, child) => MaterialApp(

@ -205,10 +205,11 @@ class _AdmissionRequestSecondScreenState
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: expectedDatesError, validationError: expectedDatesError,
suffixIcon: Icon( suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
), )),
onClick: () { onClick: () {
if (_expectedAdmissionDate == null) { if (_expectedAdmissionDate == null) {
_expectedAdmissionDate = DateTime.now(); _expectedAdmissionDate = DateTime.now();
@ -559,72 +560,85 @@ class _AdmissionRequestSecondScreenState
setState(() { setState(() {
if (_estimatedCostController.text == "") { if (_estimatedCostController.text == "") {
costError = TranslationBase.of(context).fieldRequired; costError =
TranslationBase.of(context).fieldRequired;
} else { } else {
costError = null; costError = null;
} }
if (_postPlansEstimatedCostController.text == "") { if (_postPlansEstimatedCostController.text ==
plansError = TranslationBase.of(context).fieldRequired; "") {
plansError =
TranslationBase.of(context).fieldRequired;
} else { } else {
plansError = null; plansError = null;
} }
if (_expectedDaysController.text == "") { if (_expectedDaysController.text == "") {
expectedDaysError = TranslationBase.of(context).fieldRequired; expectedDaysError =
TranslationBase.of(context).fieldRequired;
} else { } else {
expectedDaysError = null; expectedDaysError = null;
} }
if (_expectedAdmissionDate == null) { if (_expectedAdmissionDate == null) {
expectedDatesError = TranslationBase.of(context).fieldRequired; expectedDatesError =
TranslationBase.of(context).fieldRequired;
} else { } else {
expectedDatesError = null; expectedDatesError = null;
} }
if (_otherDepartmentsInterventionsController.text == "") { if (_otherDepartmentsInterventionsController
otherInterventionsError = TranslationBase.of(context).fieldRequired; .text ==
"") {
otherInterventionsError =
TranslationBase.of(context).fieldRequired;
} else { } else {
otherInterventionsError = null; otherInterventionsError = null;
} }
if (_selectedFloor == null) { if (_selectedFloor == null) {
floorError = TranslationBase.of(context).fieldRequired; floorError =
TranslationBase.of(context).fieldRequired;
} else { } else {
floorError = null; floorError = null;
} }
if (_selectedRoomCategory == null) { if (_selectedRoomCategory == null) {
roomError = TranslationBase.of(context).fieldRequired; roomError =
TranslationBase.of(context).fieldRequired;
} else { } else {
roomError = null; roomError = null;
} }
if (_treatmentLineController.text == "") { if (_treatmentLineController.text == "") {
treatmentsError = TranslationBase.of(context).fieldRequired; treatmentsError =
TranslationBase.of(context).fieldRequired;
} else { } else {
treatmentsError = null; treatmentsError = null;
} }
if (_complicationsController.text == "") { if (_complicationsController.text == "") {
complicationsError = TranslationBase.of(context).fieldRequired; complicationsError =
TranslationBase.of(context).fieldRequired;
} else { } else {
complicationsError = null; complicationsError = null;
} }
if (_otherProceduresController.text == "") { if (_otherProceduresController.text == "") {
proceduresError = TranslationBase.of(context).fieldRequired; proceduresError =
TranslationBase.of(context).fieldRequired;
} else { } else {
proceduresError = null; proceduresError = null;
} }
if (_selectedAdmissionType == null) { if (_selectedAdmissionType == null) {
admissionTypeError = TranslationBase.of(context).fieldRequired; admissionTypeError =
TranslationBase.of(context).fieldRequired;
} else { } else {
admissionTypeError = null; admissionTypeError = null;
} }
}); });
} }
}, },
), ),

@ -1,9 +1,11 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.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/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart';
import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart';
import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -15,8 +17,11 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_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/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
class UpdateNoteOrder extends StatefulWidget { class UpdateNoteOrder extends StatefulWidget {
final NoteModel note; final NoteModel note;
@ -26,18 +31,24 @@ class UpdateNoteOrder extends StatefulWidget {
final bool isUpdate; final bool isUpdate;
const UpdateNoteOrder( const UpdateNoteOrder(
{Key key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate}) {Key key,
this.note,
this.patientModel,
this.patient,
this.visitType,
this.isUpdate})
: super(key: key); : super(key: key);
@override @override
_UpdateNoteOrderState createState() => _UpdateNoteOrderState createState() => _UpdateNoteOrderState();
_UpdateNoteOrderState();
} }
class _UpdateNoteOrderState extends State<UpdateNoteOrder> { class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
int selectedType; int selectedType;
bool isSubmitted = false; bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
TextEditingController progressNoteController = TextEditingController(); TextEditingController progressNoteController = TextEditingController();
setSelectedType(int val) { setSelectedType(int val) {
@ -54,27 +65,23 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
return AppScaffold( return AppScaffold(
isShowAppBar: false, isShowAppBar: false,
backgroundColor: Theme backgroundColor: Theme.of(context).scaffoldBackgroundColor,
.of(context)
.scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery height: MediaQuery.of(context).size.height * 1.0,
.of(context)
.size
.height * 1.0,
child: Padding( child: Padding(
padding: EdgeInsets.all(0.0), padding: EdgeInsets.all(0.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
BottomSheetTitle(title: widget.visitType == 3 BottomSheetTitle(
? (widget.isUpdate?'Update':'Add')+' Order Sheet' title: widget.visitType == 3
: (widget.isUpdate?'Update':'Add')+' Progress Note',), ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet'
: (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note',
),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Center( Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
@ -82,21 +89,35 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
hintText: widget.visitType == 3 hintText: widget.visitType == 3
? (widget.isUpdate?'Update':'Add')+' Order Sheet' ? (widget.isUpdate ? 'Update' : 'Add') +
: (widget.isUpdate?'Update':'Add')+' Progress Note', ' Order Sheet'
: (widget.isUpdate ? 'Update' : 'Add') +
' Progress Note',
//TranslationBase.of(context).addProgressNote, //TranslationBase.of(context).addProgressNote,
controller: progressNoteController, controller: progressNoteController,
maxLines: 35, maxLines: 35,
minLines: 25, minLines: 25,
hasBorder: true, hasBorder: true,
validationError:progressNoteController.text.isEmpty&&isSubmitted?TranslationBase.of(context).emptyMessage:null , suffixIcon: IconButton(
icon: Icon(
Icons.mic,
color: Colors.black,
),
onPressed: () {
onVoiceText();
},
),
isTextFieldHasSuffix: true,
validationError:
progressNoteController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
), ),
], ],
), ),
), ),
), ),
], ],
), ),
), ),
@ -109,8 +130,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
title: widget.visitType == 3 title: widget.visitType == 3
? (widget.isUpdate?'Update':'Add')+' Order Sheet' ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet'
: (widget.isUpdate?'Update':'Add')+' Progress Note', : (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note',
color: Color(0xff359846), color: Color(0xff359846),
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -122,60 +143,55 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel DoctorProfileModel doctorProfile =
.fromJson(profile); DoctorProfileModel.fromJson(profile);
if (widget.isUpdate) { if (widget.isUpdate) {
UpdateNoteReqModel reqModel = UpdateNoteReqModel( UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(widget.patient admissionNo: int.parse(widget.patient.admissionNo),
.admissionNo),
cancelledNote: false, cancelledNote: false,
lineItemNo: widget.note.lineItemNo, lineItemNo: widget.note.lineItemNo,
createdBy: widget.note.createdBy, createdBy: widget.note.createdBy,
notes: progressNoteController.text, notes: progressNoteController.text,
verifiedNote: false, verifiedNote: false,
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient.patientType,
patientOutSA: false, patientOutSA: false,
); );
await widget.patientModel.updatePatientProgressNote(reqModel); await widget.patientModel
.updatePatientProgressNote(reqModel);
} else { } else {
CreateNoteModel reqModel = CreateNoteModel( CreateNoteModel reqModel = CreateNoteModel(
admissionNo: int.parse(widget.patient admissionNo: int.parse(widget.patient.admissionNo),
.admissionNo),
createdBy: doctorProfile.doctorID, createdBy: doctorProfile.doctorID,
visitType: widget.visitType, visitType: widget.visitType,
patientID: widget.patient.patientId, patientID: widget.patient.patientId,
nursingRemarks: ' ', nursingRemarks: ' ',
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient.patientType,
patientOutSA: false, patientOutSA: false,
notes: progressNoteController.text);
notes: progressNoteController.text await widget.patientModel
); .createPatientProgressNote(reqModel);
await widget.patientModel.createPatientProgressNote(reqModel);
} }
if (widget.patientModel.state == ViewState.ErrorLocal) { if (widget.patientModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast( Helpers.showErrorToast(widget.patientModel.error);
widget.patientModel.error );
} else { } else {
ProgressNoteRequest progressNoteRequest = ProgressNoteRequest progressNoteRequest =
ProgressNoteRequest( ProgressNoteRequest(
visitType: widget.visitType, visitType: widget.visitType,
// if equal 5 then this will return progress note // if equal 5 then this will return progress note
admissionNo: int.parse(widget.patient admissionNo:
.admissionNo), int.parse(widget.patient.admissionNo),
projectID: widget.patient.projectId, projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient.patientType,
languageID: 2); languageID: 2);
await widget.patientModel.getPatientProgressNote( await widget.patientModel
progressNoteRequest.toJson()); .getPatientProgressNote(progressNoteRequest.toJson());
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast("Your Order added Successfully"); DrAppToastMsg.showSuccesToast(
"Your Order added Successfully");
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Helpers.showErrorToast("You cant add only spaces"); Helpers.showErrorToast("You cant add only spaces");
@ -187,5 +203,37 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
); );
} }
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);
if (available) {
speech.listen(
onResult: resultListener,
// listenMode: ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
progressNoteController.text = reconizedWord;
});
}
}
} }

@ -438,10 +438,11 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
: null, : null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: Icon( suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
), )),
onClick: () { onClick: () {
_selectDate(context, model); _selectDate(context, model);
}, },

@ -33,16 +33,16 @@ class AddAssessmentDetails extends StatefulWidget {
final MySelectedAssessment mySelectedAssessment; final MySelectedAssessment mySelectedAssessment;
final List<MySelectedAssessment> mySelectedAssessmentList; final List<MySelectedAssessment> mySelectedAssessmentList;
final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate)
addSelectedAssessment; addSelectedAssessment;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final bool isUpdate; final bool isUpdate;
AddAssessmentDetails( AddAssessmentDetails(
{Key key, {Key key,
this.mySelectedAssessment, this.mySelectedAssessment,
this.addSelectedAssessment, this.addSelectedAssessment,
this.patientInfo, this.patientInfo,
this.isUpdate = false, this.isUpdate = false,
this.mySelectedAssessmentList}); this.mySelectedAssessmentList});
@override @override
_AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState();
@ -78,29 +78,33 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
icdNameController.text = widget.mySelectedAssessment.selectedICD.code; icdNameController.text = widget.mySelectedAssessment.selectedICD.code;
} }
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown , String hintText, String selectedText, bool isDropDown,
{IconData icon, String validationError}) {
{IconData icon, String validationError}) {
return new InputDecoration( return new InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: (validationError != null borderSide: BorderSide(
color: (validationError != null
? Colors.red.shade700 ? Colors.red.shade700
:Color(0xFFEFEFEF)) , width: 2.5), : Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: (validationError != null borderSide: BorderSide(
? Colors.red.shade700 color: (validationError != null
: Color(0xFFEFEFEF)), width: 2.5), ? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: (validationError != null borderSide: BorderSide(
? Colors.red.shade700 color: (validationError != null
: Color(0xFFEFEFEF)), width: 2.5), ? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
@ -143,213 +147,224 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 16, height: 16,
), ),
Container( Container(
margin: EdgeInsets.only(left: 0, right: 0, top: 15), margin: EdgeInsets.only(left: 0, right: 0, top: 15),
child: AppTextFieldCustom( child: AppTextFieldCustom(
// height: 55.0, // height: 55.0,
hintText: hintText:
TranslationBase.of(context).appointmentNumber, TranslationBase.of(context).appointmentNumber,
isTextFieldHasSuffix: false, isTextFieldHasSuffix: false,
enabled: false, enabled: false,
controller: appointmentIdController, controller: appointmentIdController,
), ),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( Container(
child: InkWell( child: InkWell(
onTap: model.listOfICD10 != null onTap: model.listOfICD10 != null
? () { ? () {
setState(() {
widget.mySelectedAssessment
.selectedICD = null;
icdNameController.text = null;
});
}
: null,
child: widget
.mySelectedAssessment.selectedICD ==
null
? CustomAutoCompleteTextField(
isShowError: isFormSubmitted &&
widget.mySelectedAssessment.selectedICD == null,
child:AutoCompleteTextField<MasterKeyModel>(
decoration: TextFieldsUtils.textFieldSelectorDecoration(
TranslationBase.of(context)
.nameOrICD, null, true, suffixIcon: Icons.search),
itemSubmitted: (item) => setState(() {
widget.mySelectedAssessment
.selectedICD = item;
icdNameController.text = '${item.code.trim()}/${item.description}';
}),
key: key,
suggestions: model.listOfICD10,
itemBuilder: (context, suggestion) =>
new Padding(
child: AppText(suggestion
.description +
" / " +
suggestion.code.toString()),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.code
.toLowerCase()
.startsWith(
input.toLowerCase()),
),
)
: AppTextFieldCustom(
onClick: model.listOfICD10 != null
? () {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment
.selectedICD = null; .selectedICD = null;
icdNameController.text = null; icdNameController.text = null;
}); });
} }
: null,
hintText: TranslationBase.of(context)
.nameOrICD,
maxLines: 2,
minLines: 1,
controller: icdNameController,
enabled: true,
isTextFieldHasSuffix: true,
suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,),
)
),
),
SizedBox(
height: 7,
),
AppTextFieldCustom(
onClick: model.listOfDiagnosisCondition != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment
.selectedDiagnosisCondition =
selectedValue;
conditionController
.text = projectViewModel
.isArabic
? widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameAr
: widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null, : null,
hintText: TranslationBase.of(context).condition, child: widget
maxLines: 2, .mySelectedAssessment.selectedICD ==
minLines: 1, null
controller: conditionController, ? CustomAutoCompleteTextField(
isTextFieldHasSuffix: true, isShowError: isFormSubmitted &&
enabled: false, widget.mySelectedAssessment
hasBorder: true, .selectedICD ==
validationError: isFormSubmitted && null,
child: AutoCompleteTextField<
MasterKeyModel>(
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
TranslationBase.of(context)
.nameOrICD,
null,
true,
suffixIcon: Icons.search),
itemSubmitted: (item) => setState(() {
widget.mySelectedAssessment
.selectedICD = item;
icdNameController.text =
'${item.code.trim()}/${item.description}';
}),
key: key,
suggestions: model.listOfICD10,
itemBuilder: (context, suggestion) =>
new Padding(
child: AppText(
suggestion.description +
" / " +
suggestion.code
.toString()),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.code
.toLowerCase()
.startsWith(
input.toLowerCase()),
),
)
: AppTextFieldCustom(
onClick: model.listOfICD10 != null
? () {
setState(() {
widget.mySelectedAssessment
.selectedICD = null;
icdNameController.text = null;
});
}
: null,
hintText: TranslationBase.of(context)
.nameOrICD,
maxLines: 2,
minLines: 1,
controller: icdNameController,
enabled: true,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
)),
)),
),
SizedBox(
height: 7,
),
AppTextFieldCustom(
onClick: model.listOfDiagnosisCondition != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
widget.mySelectedAssessment
.selectedDiagnosisCondition =
selectedValue;
conditionController
.text = projectViewModel
.isArabic
? widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameAr
: widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).condition,
maxLines: 2,
minLines: 1,
controller: conditionController,
isTextFieldHasSuffix: true,
enabled: false,
hasBorder: true,
validationError: isFormSubmitted &&
widget.mySelectedAssessment widget.mySelectedAssessment
.selectedDiagnosisCondition == null?TranslationBase .selectedDiagnosisCondition ==
.of(context) null
.emptyMessage:null, ? TranslationBase.of(context).emptyMessage
), : null,
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppTextFieldCustom( AppTextFieldCustom(
onClick: model.listOfDiagnosisType != null onClick: model.listOfDiagnosisType != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType, list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: okFunction:
(MasterKeyModel selectedValue) { (MasterKeyModel selectedValue) {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment
.selectedDiagnosisType = .selectedDiagnosisType =
selectedValue; selectedValue;
typeController.text = typeController.text =
projectViewModel.isArabic projectViewModel.isArabic
? selectedValue.nameAr ? selectedValue.nameAr
: selectedValue.nameEn; : selectedValue.nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: TranslationBase.of(context).dType, hintText: TranslationBase.of(context).dType,
maxLines: 2, maxLines: 2,
minLines: 1, minLines: 1,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
controller: typeController, controller: typeController,
hasBorder: true, hasBorder: true,
validationError: isFormSubmitted && validationError: isFormSubmitted &&
widget.mySelectedAssessment widget.mySelectedAssessment
.selectedDiagnosisType == null?TranslationBase .selectedDiagnosisType ==
.of(context) null
.emptyMessage:null, ? TranslationBase.of(context).emptyMessage
), : null,
SizedBox( ),
height: 10, SizedBox(
), height: 10,
Container( ),
margin: EdgeInsets.only(left: 0, right: 0, top: 15), Container(
child: AppTextFieldCustom( margin: EdgeInsets.only(left: 0, right: 0, top: 15),
hintText: TranslationBase.of(context).remarks, child: AppTextFieldCustom(
maxLines: 18, hintText: TranslationBase.of(context).remarks,
minLines: 5, maxLines: 18,
controller: remarkController, minLines: 5,
onChanged: (value) { controller: remarkController,
widget.mySelectedAssessment.remark = onChanged: (value) {
remarkController.text; widget.mySelectedAssessment.remark =
}, remarkController.text;
), },
), ),
SizedBox( ),
height: 10, SizedBox(
), height: 10,
])), ),
])),
), ),
], ],
), ),
@ -390,17 +405,17 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
widget.mySelectedAssessment.appointmentId = widget.mySelectedAssessment.appointmentId =
int.parse(appointmentIdController.text); int.parse(appointmentIdController.text);
if (widget.mySelectedAssessment if (widget.mySelectedAssessment
.selectedDiagnosisCondition != .selectedDiagnosisCondition !=
null && null &&
widget.mySelectedAssessment widget.mySelectedAssessment
.selectedDiagnosisType != .selectedDiagnosisType !=
null && null &&
widget.mySelectedAssessment.selectedICD != null) { widget.mySelectedAssessment.selectedICD != null) {
await submitAssessment( await submitAssessment(
isUpdate: widget.isUpdate, isUpdate: widget.isUpdate,
model: model, model: model,
mySelectedAssessment: mySelectedAssessment:
widget.mySelectedAssessment); widget.mySelectedAssessment);
} }
}, },
), ),
@ -420,8 +435,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
submitAssessment( submitAssessment(
{SOAPViewModel model, {SOAPViewModel model,
MySelectedAssessment mySelectedAssessment, MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async { bool isUpdate = false}) async {
if (isUpdate) { if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -437,11 +452,11 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.patchAssessment(patchAssessmentReqModel); await model.patchAssessment(patchAssessmentReqModel);
} else { } else {
PostAssessmentRequestModel postAssessmentRequestModel = PostAssessmentRequestModel postAssessmentRequestModel =
new PostAssessmentRequestModel( new PostAssessmentRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
icdCodeDetails: [ icdCodeDetails: [
new IcdCodeDetails( new IcdCodeDetails(
remarks: mySelectedAssessment.remark, remarks: mySelectedAssessment.remark,
complexDiagnosis: true, complexDiagnosis: true,
@ -468,4 +483,4 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} }
} }

@ -49,10 +49,11 @@ class _ExaminationsListSearchWidgetState
onChanged: (value) { onChanged: (value) {
filterSearchResults(value); filterSearchResults(value);
}, },
suffixIcon: Icon( suffixIcon: IconButton(
icon: Icon(
Icons.search, Icons.search,
color: Colors.black, color: Colors.black,
), )),
), ),
DividerWithSpacesAround( DividerWithSpacesAround(
height: 2, height: 2,

@ -58,7 +58,9 @@ class _AddMedicationState extends State<AddMedication> {
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.medicationStrengthList.length == 0) { if (model.medicationStrengthList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationStrength,); await model.getMasterLookup(
MasterKeysService.MedicationStrength,
);
} }
if (model.medicationFrequencyList.length == 0) { if (model.medicationFrequencyList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationFrequency); await model.getMasterLookup(MasterKeysService.MedicationFrequency);
@ -72,372 +74,366 @@ class _AddMedicationState extends State<AddMedication> {
if (model.allMedicationList.length == 0) if (model.allMedicationList.length == 0)
await model.getMedicationList(); await model.getMedicationList();
}, },
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold( baseViewModel: model,
baseViewModel: model, isShowAppBar: false,
isShowAppBar: false, body: Center(
body: Center( child: Container(
child: Container( child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
BottomSheetTitle( ),
title: TranslationBase.of(context).addMedication, SizedBox(
), height: 10,
SizedBox( ),
height: 10, SizedBox(
), height: 16,
SizedBox( ),
height: 16, Expanded(
), child: Center(
Expanded( child: FractionallySizedBox(
child: Center( widthFactor: 0.9,
child: FractionallySizedBox( child: Column(
widthFactor: 0.9, children: [
child: Column( SizedBox(
children: [ height: 16,
SizedBox( ),
height: 16, SizedBox(
), height: 16,
SizedBox( ),
height: 16, Container(
), // height: screenSize.height * 0.070,
Container( child: InkWell(
// height: screenSize.height * 0.070, onTap: model.allMedicationList != null
child: InkWell( ? () {
onTap: model.allMedicationList != null
? () {
setState(() {
_selectedMedication = null;
});
}
: null,
child: _selectedMedication == null
?
CustomAutoCompleteTextField(
isShowError: isFormSubmitted &&
_selectedMedication ==null,
child: AutoCompleteTextField<
GetMedicationResponseModel>(
decoration:
TextFieldsUtils.textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicineNameHere, null, true, suffixIcon: Icons.search),
itemSubmitted: (item) =>
setState(
() =>
_selectedMedication =
item),
key: key,
suggestions:
model.allMedicationList,
itemBuilder: (context,
suggestion) =>
new Padding(
child: AppText(suggestion
.description +
'/' +
suggestion
.genericName),
padding:
EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion,
input) =>
suggestion.genericName
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input
.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(
input.toLowerCase()),
),
)
: AppTextFieldCustom(
hintText: _selectedMedication != null
? _selectedMedication
.description +
(' (${_selectedMedication.genericName} )')
: TranslationBase.of(context)
.searchMedicineNameHere,
minLines: 2,
maxLines: 2,
isTextFieldHasSuffix: true,
suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,),
enabled: false,
),
),
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
onClick: model.medicationDoseTimeList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationDoseTimeList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationDose = _selectedMedication = null;
selectedValue;
doseController
.text = projectViewModel
.isArabic
? _selectedMedicationDose
.nameAr
: _selectedMedicationDose
.nameEn;
}); });
}, }
: null,
child: _selectedMedication == null
? CustomAutoCompleteTextField(
isShowError: isFormSubmitted &&
_selectedMedication == null,
child: AutoCompleteTextField<
GetMedicationResponseModel>(
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
TranslationBase.of(
context)
.searchMedicineNameHere,
null,
true,
suffixIcon: Icons.search),
itemSubmitted: (item) => setState(
() => _selectedMedication =
item),
key: key,
suggestions:
model.allMedicationList,
itemBuilder: (context,
suggestion) =>
new Padding(
child: AppText(suggestion
.description +
'/' +
suggestion
.genericName),
padding:
EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.genericName.toLowerCase().startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(input
.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(
input.toLowerCase()),
),
)
: AppTextFieldCustom(
hintText: _selectedMedication !=
null
? _selectedMedication
.description +
(' (${_selectedMedication.genericName} )')
: TranslationBase.of(context)
.searchMedicineNameHere,
minLines: 2,
maxLines: 2,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.grey.shade600,
)),
enabled: false,
),
),
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
onClick: model.medicationDoseTimeList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationDoseTimeList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationDose =
selectedValue;
); doseController
showDialog( .text = projectViewModel
barrierDismissible: false, .isArabic
context: context, ? _selectedMedicationDose
builder: (BuildContext context) { .nameAr
return dialog; : _selectedMedicationDose
}, .nameEn;
); });
} },
: null, );
hintText: showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).doseTime, TranslationBase.of(context).doseTime,
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
controller: doseController, controller: doseController,
validationError:isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationDose == null?TranslationBase _selectedMedicationDose == null
.of(context) ? TranslationBase.of(context).emptyMessage
.emptyMessage:null, : null,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
AppTextFieldCustom( AppTextFieldCustom(
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList != null onClick: model.medicationStrengthList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog dialog =
MasterKeyDailog( MasterKeyDailog(
list: model.medicationStrengthList, list: model.medicationStrengthList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationStrength = _selectedMedicationStrength =
selectedValue; selectedValue;
strengthController strengthController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationStrength ? _selectedMedicationStrength
.nameAr .nameAr
: _selectedMedicationStrength : _selectedMedicationStrength
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).strength, TranslationBase.of(context).strength,
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,
controller: strengthController, controller: strengthController,
validationError:isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationStrength == null?TranslationBase _selectedMedicationStrength == null
.of(context) ? TranslationBase.of(context).emptyMessage
.emptyMessage:null, : null,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
AppTextFieldCustom( AppTextFieldCustom(
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null onClick: model.medicationRouteList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog dialog =
MasterKeyDailog( MasterKeyDailog(
list: model.medicationRouteList, list: model.medicationRouteList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationRoute = _selectedMedicationRoute =
selectedValue; selectedValue;
routeController routeController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationRoute ? _selectedMedicationRoute
.nameAr .nameAr
: _selectedMedicationRoute : _selectedMedicationRoute
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: TranslationBase.of(context).route, hintText: TranslationBase.of(context).route,
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,
controller: routeController, controller: routeController,
validationError:isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationRoute == null?TranslationBase _selectedMedicationRoute == null
.of(context) ? TranslationBase.of(context).emptyMessage
.emptyMessage:null, : null,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
AppTextFieldCustom( AppTextFieldCustom(
onClick: model.medicationFrequencyList != null onClick: model.medicationFrequencyList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog dialog =
MasterKeyDailog( MasterKeyDailog(
list: model.medicationFrequencyList, list: model.medicationFrequencyList,
okText: okText:
TranslationBase.of(context).ok, TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
_selectedMedicationFrequency = _selectedMedicationFrequency =
selectedValue; selectedValue;
frequencyController frequencyController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationFrequency ? _selectedMedicationFrequency
.nameAr .nameAr
: _selectedMedicationFrequency : _selectedMedicationFrequency
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).frequency, TranslationBase.of(context).frequency,
enabled: false, enabled: false,
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
controller: frequencyController, controller: frequencyController,
validationError:isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationFrequency == null?TranslationBase _selectedMedicationFrequency == null
.of(context) ? TranslationBase.of(context).emptyMessage
.emptyMessage:null, : null,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
SizedBox( SizedBox(
height: 30, height: 30,
), ),
], ],
)), )),
), ),
), ),
]), ]),
), ),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
), ),
bottomSheet: Container( border: Border.all(color: HexColor('#707070'), width: 0.30),
decoration: BoxDecoration( ),
color: Colors.white, height: MediaQuery.of(context).size.height * 0.1,
borderRadius: BorderRadius.all( width: double.infinity,
Radius.circular(10.0), child: Column(
), children: [
border: Border.all(color: HexColor('#707070'), width: 0.30), SizedBox(
height: 10,
), ),
height: MediaQuery.of(context).size.height * 0.1, Container(
width: double.infinity, child: FractionallySizedBox(
child: Column( widthFactor: .80,
children: [ child: Center(
SizedBox( child: AppButton(
height: 10, title: TranslationBase.of(context)
), .addMedication
Container( .toUpperCase(),
child: FractionallySizedBox( color: Color(0xFF359846),
widthFactor: .80, onPressed: () {
child: Center( setState(() {
child: AppButton( isFormSubmitted = true;
title: TranslationBase.of(context).addMedication.toUpperCase(), });
color: Color(0xFF359846), if (_selectedMedication != null &&
onPressed: () { _selectedMedicationDose != null &&
setState(() { _selectedMedicationStrength != null &&
isFormSubmitted = true; _selectedMedicationRoute != null &&
}); _selectedMedicationFrequency != null) {
if (_selectedMedication != null && widget.medicationController.text = widget
_selectedMedicationDose != null &&
_selectedMedicationStrength != null &&
_selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) {
widget.medicationController.text = widget
.medicationController.text + .medicationController.text +
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
}, },
),
),
), ),
), ),
SizedBox( ),
height: 5,
),
],
), ),
), SizedBox(
height: 5,
),
],
), ),
),
),
), ),
); );
} }
} }

@ -1236,7 +1236,9 @@ class TranslationBase {
localizedValues['admission-date'][locale.languageCode]; localizedValues['admission-date'][locale.languageCode];
String get noOfDays => localizedValues['noOfDays'][locale.languageCode]; String get noOfDays => localizedValues['noOfDays'][locale.languageCode];
String get numOfDays => localizedValues['numOfDays'][locale.languageCode]; String get numOfDays => localizedValues['numOfDays'][locale.languageCode];
String get replayBefore => localizedValues['replayBefore'][locale.languageCode]; String get replayBefore =>
localizedValues['replayBefore'][locale.languageCode];
String get trySaying => localizedValues["try-saying"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -267,6 +267,19 @@ class PatientCard extends StatelessWidget {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 15)), fontSize: 15)),
]))), ]))),
Row(
children: [
AppText(
"${TranslationBase.of(context).numOfDays}: ",
fontSize: 15,
),
AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
],
),
// Container( // Container(
// child: Row( // child: Row(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,

@ -185,7 +185,7 @@ class PatientProfileHeaderNewDesignInPatient extends StatelessWidget {
fontSize: 1.2 * SizeConfig.textMultiplier, fontSize: 1.2 * SizeConfig.textMultiplier,
), ),
AppText( AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays}", "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 1.4 * SizeConfig.textMultiplier, fontSize: 1.4 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
], ],

@ -19,7 +19,7 @@ import 'expandable-widget-header-body.dart';
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model; final SOAPViewModel model;
final Function () addSelectedAllergy; final Function() addSelectedAllergy;
final Function(MasterKeyModel) removeAllergy; final Function(MasterKeyModel) removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy; final Function(MySelectedAllergy mySelectedAllergy) addAllergy;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
@ -77,18 +77,21 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
child: Column( child: Column(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
height: MediaQuery.of(context).size.height * 0.070, height:
hintText: TranslationBase.of(context).selectAllergy, MediaQuery.of(context).size.height * 0.070,
hintText:
TranslationBase.of(context).selectAllergy,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
hasBorder: false, hasBorder: false,
// controller: filteredSearchController, // controller: filteredSearchController,
onChanged: (value) { onChanged: (value) {
filterSearchResults(value); filterSearchResults(value);
}, },
suffixIcon: Icon( suffixIcon: IconButton(
icon: Icon(
Icons.search, Icons.search,
color: Colors.black, color: Colors.black,
), )),
), ),
DividerWithSpacesAround(), DividerWithSpacesAround(),
SizedBox( SizedBox(
@ -98,12 +101,13 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.60, height:
MediaQuery.of(context).size.height * 0.60,
child: ListView.builder( child: ListView.builder(
itemCount: items.length, itemCount: items.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
bool isSelected = bool isSelected = widget
widget.isServiceSelected(items[index]); .isServiceSelected(items[index]);
MySelectedAllergy mySelectedAllergy; MySelectedAllergy mySelectedAllergy;
if (isSelected) { if (isSelected) {
mySelectedAllergy = mySelectedAllergy =
@ -121,7 +125,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
? mySelectedAllergy ? mySelectedAllergy
.selectedAllergySeverity != .selectedAllergySeverity !=
null null
? projectViewModel.isArabic ? projectViewModel
.isArabic
? mySelectedAllergy ? mySelectedAllergy
.selectedAllergySeverity .selectedAllergySeverity
.nameAr .nameAr
@ -138,28 +143,32 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
Row( Row(
children: [ children: [
Checkbox( Checkbox(
value: value: widget
widget.isServiceSelected( .isServiceSelected(
items[index]), items[index]),
activeColor: Colors.red[800], activeColor:
Colors.red[800],
onChanged: (bool newValue) { onChanged: (bool newValue) {
setState(() { setState(() {
if (widget if (widget
.isServiceSelected( .isServiceSelected(
items[index])) { items[index])) {
widget.removeAllergy( widget.removeAllergy(
items[index]); items[index]);
} else { } else {
MySelectedAllergy MySelectedAllergy
mySelectedAllergy = mySelectedAllergy =
new MySelectedAllergy( new MySelectedAllergy(
selectedAllergy: selectedAllergy:
items[index], items[
selectedAllergySeverity: index],
_selectedAllergySeverity, selectedAllergySeverity:
remark: null, _selectedAllergySeverity,
isChecked: true, remark: null,
isExpanded: true); isChecked:
true,
isExpanded:
true);
widget.addAllergy( widget.addAllergy(
mySelectedAllergy); mySelectedAllergy);
} }
@ -176,16 +185,17 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
} else { } else {
// TODO add Allergy // TODO add Allergy
MySelectedAllergy MySelectedAllergy mySelectedAllergy =
mySelectedAllergy =
new MySelectedAllergy( new MySelectedAllergy(
selectedAllergy: selectedAllergy:
items[index], items[
index],
selectedAllergySeverity: selectedAllergySeverity:
_selectedAllergySeverity, _selectedAllergySeverity,
remark: null, remark: null,
isChecked: true, isChecked: true,
isExpanded: true); isExpanded:
true);
widget.addAllergy( widget.addAllergy(
mySelectedAllergy); mySelectedAllergy);
} }
@ -197,9 +207,9 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
horizontal: 10, horizontal: 10,
vertical: 0), vertical: 0),
child: Container( child: Container(
child: AppText( child: AppText(
projectViewModel.isArabic projectViewModel
.isArabic
? items[index] ? items[index]
.nameAr != .nameAr !=
"" ""
@ -207,13 +217,19 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
.nameAr .nameAr
: items[index] : items[index]
.nameEn .nameEn
: items[index].nameEn, : items[index]
color: Color(0xFF575757), .nameEn,
color:
Color(0xFF575757),
fontSize: 16, fontSize: 16,
fontWeight: fontWeight:
FontWeight.w600, FontWeight.w600,
), ),
width: MediaQuery.of(context).size.width * 0.55, width:
MediaQuery.of(context)
.size
.width *
0.55,
), ),
), ),
), ),
@ -221,7 +237,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
), ),
InkWell( InkWell(
onTap: () { onTap: () {
if (mySelectedAllergy != null) { if (mySelectedAllergy !=
null) {
setState(() { setState(() {
mySelectedAllergy mySelectedAllergy
.isExpanded = .isExpanded =
@ -250,103 +267,113 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
child: Column( child: Column(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
onClick: widget.model onClick: widget.model
.allergySeverityList != .allergySeverityList !=
null null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog
MasterKeyDailog( dialog =
list: widget.model MasterKeyDailog(
.allergySeverityList, list: widget.model
okText: .allergySeverityList,
TranslationBase.of( okText:
context) TranslationBase.of(
.ok, context)
okFunction: .ok,
(selectedValue) { okFunction:
setState(() { (selectedValue) {
mySelectedAllergy setState(() {
.selectedAllergySeverity = mySelectedAllergy
selectedValue; .selectedAllergySeverity =
}); selectedValue;
}, });
); },
showDialog( );
barrierDismissible: showDialog(
false, barrierDismissible:
context: context, false,
builder: (BuildContext context: context,
context) { builder:
return dialog; (BuildContext
}, context) {
); return dialog;
} },
);
}
: null, : null,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
hintText: hintText:
TranslationBase TranslationBase.of(
.of(context) context)
.selectSeverity, .selectSeverity,
enabled: false, enabled: false,
maxLines: 2, maxLines: 2,
minLines: 2, minLines: 2,
controller: severityController,), controller:
SizedBox( severityController,
height: 5,
),
if(isSubmitted && mySelectedAllergy !=null &&
mySelectedAllergy
.selectedAllergySeverity == null)
Row(
children: [
CustomValidationError(),
],
mainAxisAlignment: MainAxisAlignment.start,
), ),
SizedBox(
height: 5,
),
if (isSubmitted &&
mySelectedAllergy !=
null &&
mySelectedAllergy
.selectedAllergySeverity ==
null)
Row(
children: [
CustomValidationError(),
],
mainAxisAlignment:
MainAxisAlignment
.start,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(
left: 0,
right: 0,
top: 15),
child: NewTextFields(
hintText:
TranslationBase.of(
context)
.remarks,
fontSize: 13.5,
// hintColor: Colors.black,
fontWeight:
FontWeight.w600,
maxLines: 25,
minLines: 3,
initialValue: isSelected
? mySelectedAllergy
.remark
: '',
// controller: remarkControlle
SizedBox( onChanged: (value) {
height: 10, if (isSelected) {
), mySelectedAllergy
Container( .remark = value;
margin: EdgeInsets.only( }
left: 0, right: 0, top: 15), },
child: NewTextFields( validator: (value) {
hintText: TranslationBase if (value == null)
.of( return TranslationBase
context) .of(context)
.remarks, .emptyMessage;
fontSize: 13.5, else
// hintColor: Colors.black, return null;
fontWeight: FontWeight.w600, }),
maxLines: 25, ),
minLines: 3, SizedBox(
initialValue: isSelected height: 10,
? mySelectedAllergy ),
.remark : '', ],
// controller: remarkControlle ),
onChanged: (value) {
if (isSelected) {
mySelectedAllergy
.remark = value;
}
},
validator: (value) {
if (value == null)
return TranslationBase
.of(
context)
.emptyMessage;
else
return null;
}),
),
SizedBox(
height: 10,
),
],),
), ),
), ),
), ),
@ -360,8 +387,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
), ),
), ),
], ],
) ))),
)),
), ),
), ),
SizedBox( SizedBox(

@ -31,14 +31,18 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget {
this.removeHistory, this.removeHistory,
this.masterList, this.masterList,
this.addHistory, this.addHistory,
this.isServiceSelected, this.buttonName, this.hintSearchText}) this.isServiceSelected,
this.buttonName,
this.hintSearchText})
: super(key: key); : super(key: key);
@override @override
_MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState(); _MasterKeyCheckboxSearchWidgetState createState() =>
_MasterKeyCheckboxSearchWidgetState();
} }
class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchWidget> { class _MasterKeyCheckboxSearchWidgetState
extends State<MasterKeyCheckboxSearchWidget> {
List<MasterKeyModel> items = List(); List<MasterKeyModel> items = List();
@override @override
@ -67,88 +71,89 @@ class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchW
height: MediaQuery.of(context).size.height * 0.60, height: MediaQuery.of(context).size.height * 0.60,
child: Center( child: Center(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white), color: Colors.white),
child: ListView( child: ListView(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
height: MediaQuery.of(context).size.height * 0.070, height: MediaQuery.of(context).size.height * 0.070,
hintText: TranslationBase.of(context).searchHistory, hintText: TranslationBase.of(context).searchHistory,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
hasBorder: false, hasBorder: false,
// controller: filteredSearchController, // controller: filteredSearchController,
onChanged: (value) { onChanged: (value) {
filterSearchResults(value); filterSearchResults(value);
}, },
suffixIcon: Icon( suffixIcon: IconButton(
Icons.search, icon: Icon(
color: Colors.black, Icons.search,
), color: Colors.black,
), )),
),
// SizedBox(height: 15,),
DividerWithSpacesAround(),
Container(
// padding:EdgeInsets.all(20),
child: Column(
children: items.map((historyInfo) {
return Column(
children: [
InkWell(
onTap:(){
setState(() {
if (widget
.isServiceSelected(historyInfo)) {
widget.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
},
child: Row( // SizedBox(height: 15,),
children: [ DividerWithSpacesAround(),
Checkbox( Container(
value: // padding:EdgeInsets.all(20),
widget.isServiceSelected(historyInfo), child: Column(
activeColor: Colors.red[800], children: items.map((historyInfo) {
onChanged: (bool newValue) { return Column(
setState(() { children: [
if (widget InkWell(
.isServiceSelected(historyInfo)) { onTap: () {
widget.removeHistory(historyInfo); setState(() {
} else { if (widget.isServiceSelected(historyInfo)) {
widget.addHistory(historyInfo); widget.removeHistory(historyInfo);
} } else {
}); widget.addHistory(historyInfo);
}), }
Expanded( });
child: Padding( },
padding: const EdgeInsets.symmetric( child: Row(
horizontal: 10, vertical: 0), children: [
child: AppText(projectViewModel.isArabic Checkbox(
? historyInfo.nameAr!=""?historyInfo.nameAr:historyInfo.nameEn value: widget
: historyInfo.nameEn, .isServiceSelected(historyInfo),
color: Color(0xFF575757), activeColor: Colors.red[800],
fontSize: 16, onChanged: (bool newValue) {
fontWeight:FontWeight.w600, setState(() {
), if (widget.isServiceSelected(
), historyInfo)) {
widget.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: AppText(
projectViewModel.isArabic
? historyInfo.nameAr != ""
? historyInfo.nameAr
: historyInfo.nameEn
: historyInfo.nameEn,
color: Color(0xFF575757),
fontSize: 16,
fontWeight: FontWeight.w600,
), ),
], ),
), ),
), ],
// DividerWithSpacesAround(), ),
], ),
); // DividerWithSpacesAround(),
}).toList(), ],
), );
), }).toList(),
], ),
), ),
)), ],
),
)),
), ),
), ),
SizedBox( SizedBox(

@ -0,0 +1,145 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:async';
class SpeechToText {
final BuildContext context;
static var dialog;
SpeechToText({
@required this.context,
});
showAlertDialog(BuildContext context) {
//AlertDialog alert = AlertDialog
// AlertDialog alert = AlertDialog(content: MyStatefulBuilder(dispose: () {
// print('dispose!!!!!!!!!!!!');
// })
// isClosed = true;
// streamSubscription.cancel();
// }, builder: (BuildContext context, StateSetter setState) {
// //print(streamSubscription);
// }),
// );
// show the dialog
showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
dialog = context;
return MyStatefulBuilder(
dispose: () {},
);
},
);
print(dialog);
}
static closeAlertDialog(BuildContext context) {
Navigator.of(dialog).pop();
}
}
typedef Disposer = void Function();
class MyStatefulBuilder extends StatefulWidget {
const MyStatefulBuilder({
// @required this.builder,
@required this.dispose,
});
//final StatefulWidgetBuilder builder;
final Disposer dispose;
@override
_MyStatefulBuilderState createState() => _MyStatefulBuilderState();
}
class _MyStatefulBuilderState extends State<MyStatefulBuilder> {
var event = RobotProvider();
var searchText;
static StreamSubscription<dynamic> streamSubscription;
static var isClosed = false;
@override
void initState() {
streamSubscription = event.controller.stream.listen((p) {
if ((p['searchText'] != 'null' &&
p['searchText'] != null &&
p['searchText'] != "" &&
isClosed == false) &&
mounted) {
setState(() {
searchText = p['searchText'];
});
}
});
super.initState();
}
@override
Widget build(BuildContext context) => AlertDialog(
content: Container(
color: Colors.white,
height: SizeConfig.realScreenHeight * 0.5,
width: SizeConfig.realScreenWidth * 0.8,
child: Container(
child: Column(children: [
Expanded(
flex: 1,
child: Center(
child: Image.asset(
'assets/images/habib-logo.png',
height: 75,
width: 75,
))),
Expanded(
flex: 3,
child: Center(
child: Container(
margin: EdgeInsets.all(20),
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(width: 2, color: Colors.red)),
child: Icon(
Icons.mic,
color: Colors.blue,
size: 48,
),
))),
Expanded(
flex: 1,
child: Center(
child: Image.asset(
'assets/images/soundWaveAnimation.gif',
height: 75,
))),
Expanded(
flex: 1,
child: Center(
child: AppText(searchText != null && searchText != 'null'
? searchText
: TranslationBase.of(context).trySaying))),
searchText == 'null'
? Center(
child: RaisedButton(
child: AppText('Retry'),
onPressed: () {
SpeechToText.closeAlertDialog(context);
event.setValue({'startPopUp': 'true'});
},
))
: SizedBox()
]),
)));
@override
void dispose() {
super.dispose();
widget.dispose();
}
}

@ -14,7 +14,7 @@ class AppTextFieldCustom extends StatefulWidget {
final bool isTextFieldHasSuffix; final bool isTextFieldHasSuffix;
final bool hasBorder; final bool hasBorder;
final String dropDownText; final String dropDownText;
final Icon suffixIcon; final IconButton suffixIcon;
final Color dropDownColor; final Color dropDownColor;
final bool enabled; final bool enabled;
final TextInputType inputType; final TextInputType inputType;
@ -89,8 +89,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.dropDownText == null widget.dropDownText == null
? TextField( ? TextField(
textAlign: TextAlign.left, textAlign: TextAlign.left,
decoration: TextFieldsUtils.textFieldSelectorDecoration( decoration:
widget.hintText, null, true), TextFieldsUtils.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle( style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7, fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins', fontFamily: 'Poppins',
@ -124,11 +125,13 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.isTextFieldHasSuffix widget.isTextFieldHasSuffix
? widget.suffixIcon != null ? widget.suffixIcon != null
? widget.suffixIcon ? widget.suffixIcon
: Icon( : InkWell(
Icons.keyboard_arrow_down, child: Icon(
color: widget.dropDownColor != null Icons.keyboard_arrow_down,
? widget.dropDownColor color: widget.dropDownColor != null
: Colors.black, ? widget.dropDownColor
: Colors.black,
),
) )
: Container(), : Container(),
], ],
@ -141,4 +144,3 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
); );
} }
} }

@ -80,7 +80,6 @@ dependencies:
flutter_html: 1.0.2 flutter_html: 1.0.2
sticky_headers: "^0.1.8" sticky_headers: "^0.1.8"
#speech to text #speech to text
speech_to_text: speech_to_text:
path: speech_to_text path: speech_to_text

Loading…
Cancel
Save