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": "عدد الأيام"},
"numOfDays": {"en": "Number of Days", "ar": "عدد الأيام"},
"replayBefore": {"en": "Replay Before", "ar": "رد قبل"},
"try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'},
"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/project_view_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -42,6 +43,10 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider<LiveCareViewModel>(
create: (context) => LiveCareViewModel(),
),
StreamProvider.value(
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),
)
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(

@ -205,10 +205,11 @@ class _AdmissionRequestSecondScreenState
enabled: false,
isTextFieldHasSuffix: true,
validationError: expectedDatesError,
suffixIcon: Icon(
suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today,
color: Colors.black,
),
)),
onClick: () {
if (_expectedAdmissionDate == null) {
_expectedAdmissionDate = DateTime.now();
@ -559,72 +560,85 @@ class _AdmissionRequestSecondScreenState
setState(() {
if (_estimatedCostController.text == "") {
costError = TranslationBase.of(context).fieldRequired;
costError =
TranslationBase.of(context).fieldRequired;
} else {
costError = null;
}
if (_postPlansEstimatedCostController.text == "") {
plansError = TranslationBase.of(context).fieldRequired;
if (_postPlansEstimatedCostController.text ==
"") {
plansError =
TranslationBase.of(context).fieldRequired;
} else {
plansError = null;
}
if (_expectedDaysController.text == "") {
expectedDaysError = TranslationBase.of(context).fieldRequired;
expectedDaysError =
TranslationBase.of(context).fieldRequired;
} else {
expectedDaysError = null;
}
if (_expectedAdmissionDate == null) {
expectedDatesError = TranslationBase.of(context).fieldRequired;
expectedDatesError =
TranslationBase.of(context).fieldRequired;
} else {
expectedDatesError = null;
}
if (_otherDepartmentsInterventionsController.text == "") {
otherInterventionsError = TranslationBase.of(context).fieldRequired;
if (_otherDepartmentsInterventionsController
.text ==
"") {
otherInterventionsError =
TranslationBase.of(context).fieldRequired;
} else {
otherInterventionsError = null;
}
if (_selectedFloor == null) {
floorError = TranslationBase.of(context).fieldRequired;
floorError =
TranslationBase.of(context).fieldRequired;
} else {
floorError = null;
}
if (_selectedRoomCategory == null) {
roomError = TranslationBase.of(context).fieldRequired;
roomError =
TranslationBase.of(context).fieldRequired;
} else {
roomError = null;
}
if (_treatmentLineController.text == "") {
treatmentsError = TranslationBase.of(context).fieldRequired;
treatmentsError =
TranslationBase.of(context).fieldRequired;
} else {
treatmentsError = null;
}
if (_complicationsController.text == "") {
complicationsError = TranslationBase.of(context).fieldRequired;
complicationsError =
TranslationBase.of(context).fieldRequired;
} else {
complicationsError = null;
}
if (_otherProceduresController.text == "") {
proceduresError = TranslationBase.of(context).fieldRequired;
proceduresError =
TranslationBase.of(context).fieldRequired;
} else {
proceduresError = null;
}
if (_selectedAdmissionType == null) {
admissionTypeError = TranslationBase.of(context).fieldRequired;
admissionTypeError =
TranslationBase.of(context).fieldRequired;
} else {
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/size_config.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/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/models/doctor/doctor_profile_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/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package: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 {
final NoteModel note;
@ -26,18 +31,24 @@ class UpdateNoteOrder extends StatefulWidget {
final bool isUpdate;
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);
@override
_UpdateNoteOrderState createState() =>
_UpdateNoteOrderState();
_UpdateNoteOrderState createState() => _UpdateNoteOrderState();
}
class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
int selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
TextEditingController progressNoteController = TextEditingController();
setSelectedType(int val) {
@ -54,27 +65,23 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
return AppScaffold(
isShowAppBar: false,
backgroundColor: Theme
.of(context)
.scaffoldBackgroundColor,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView(
child: Container(
height: MediaQuery
.of(context)
.size
.height * 1.0,
height: MediaQuery.of(context).size.height * 1.0,
child: Padding(
padding: EdgeInsets.all(0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(title: widget.visitType == 3
? (widget.isUpdate?'Update':'Add')+' Order Sheet'
: (widget.isUpdate?'Update':'Add')+' Progress Note',),
BottomSheetTitle(
title: widget.visitType == 3
? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet'
: (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note',
),
SizedBox(
height: 10.0,
),
Center(
child: FractionallySizedBox(
widthFactor: 0.9,
@ -82,21 +89,35 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [
AppTextFieldCustom(
hintText: widget.visitType == 3
? (widget.isUpdate?'Update':'Add')+' Order Sheet'
: (widget.isUpdate?'Update':'Add')+' Progress Note',
? (widget.isUpdate ? 'Update' : 'Add') +
' Order Sheet'
: (widget.isUpdate ? 'Update' : 'Add') +
' Progress Note',
//TranslationBase.of(context).addProgressNote,
controller: progressNoteController,
maxLines: 35,
minLines: 25,
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>[
AppButton(
title: widget.visitType == 3
? (widget.isUpdate?'Update':'Add')+' Order Sheet'
: (widget.isUpdate?'Update':'Add')+' Progress Note',
? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet'
: (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note',
color: Color(0xff359846),
// disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700,
@ -122,60 +143,55 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
GifLoaderDialogUtils.showMyDialog(context);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel
.fromJson(profile);
DoctorProfileModel doctorProfile =
DoctorProfileModel.fromJson(profile);
if (widget.isUpdate) {
UpdateNoteReqModel reqModel = UpdateNoteReqModel(
admissionNo: int.parse(widget.patient
.admissionNo),
admissionNo: int.parse(widget.patient.admissionNo),
cancelledNote: false,
lineItemNo: widget.note.lineItemNo,
createdBy: widget.note.createdBy,
notes: progressNoteController.text,
verifiedNote: false,
patientTypeID: widget.patient.patientType,
patientOutSA: false,
);
await widget.patientModel.updatePatientProgressNote(reqModel);
await widget.patientModel
.updatePatientProgressNote(reqModel);
} else {
CreateNoteModel reqModel = CreateNoteModel(
admissionNo: int.parse(widget.patient
.admissionNo),
admissionNo: int.parse(widget.patient.admissionNo),
createdBy: doctorProfile.doctorID,
visitType: widget.visitType,
patientID: widget.patient.patientId,
nursingRemarks: ' ',
patientTypeID: widget.patient.patientType,
patientOutSA: false,
notes: progressNoteController.text);
notes: progressNoteController.text
);
await widget.patientModel.createPatientProgressNote(reqModel);
await widget.patientModel
.createPatientProgressNote(reqModel);
}
if (widget.patientModel.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.patientModel.error );
Helpers.showErrorToast(widget.patientModel.error);
} else {
ProgressNoteRequest progressNoteRequest =
ProgressNoteRequest(
visitType: widget.visitType,
// if equal 5 then this will return progress note
admissionNo: int.parse(widget.patient
.admissionNo),
projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType,
languageID: 2);
await widget.patientModel.getPatientProgressNote(
progressNoteRequest.toJson());
ProgressNoteRequest(
visitType: widget.visitType,
// if equal 5 then this will return progress note
admissionNo:
int.parse(widget.patient.admissionNo),
projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType,
languageID: 2);
await widget.patientModel
.getPatientProgressNote(progressNoteRequest.toJson());
}
GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast("Your Order added Successfully");
DrAppToastMsg.showSuccesToast(
"Your Order added Successfully");
Navigator.of(context).pop();
} else {
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,
enabled: false,
isTextFieldHasSuffix: true,
suffixIcon: Icon(
suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today,
color: Colors.black,
),
)),
onClick: () {
_selectDate(context, model);
},

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

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

@ -58,7 +58,9 @@ class _AddMedicationState extends State<AddMedication> {
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
if (model.medicationStrengthList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationStrength,);
await model.getMasterLookup(
MasterKeysService.MedicationStrength,
);
}
if (model.medicationFrequencyList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationFrequency);
@ -72,372 +74,366 @@ class _AddMedicationState extends State<AddMedication> {
if (model.allMedicationList.length == 0)
await model.getMedicationList();
},
builder: (_, model, w) =>
AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Center(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: [
SizedBox(
height: 16,
),
SizedBox(
height: 16,
),
Container(
// height: screenSize.height * 0.070,
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) {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Center(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
children: [
SizedBox(
height: 16,
),
SizedBox(
height: 16,
),
Container(
// height: screenSize.height * 0.070,
child: InkWell(
onTap: model.allMedicationList != null
? () {
setState(() {
_selectedMedicationDose =
selectedValue;
doseController
.text = projectViewModel
.isArabic
? _selectedMedicationDose
.nameAr
: _selectedMedicationDose
.nameEn;
_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: 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;
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
doseController
.text = projectViewModel
.isArabic
? _selectedMedicationDose
.nameAr
: _selectedMedicationDose
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).doseTime,
maxLines: 2,
minLines: 2,
isTextFieldHasSuffix: true,
controller: doseController,
validationError:isFormSubmitted &&
_selectedMedicationDose == null?TranslationBase
.of(context)
.emptyMessage:null,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationStrengthList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
maxLines: 2,
minLines: 2,
isTextFieldHasSuffix: true,
controller: doseController,
validationError: isFormSubmitted &&
_selectedMedicationDose == null
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationStrengthList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationStrengthList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
strengthController
.text = projectViewModel
.isArabic
? _selectedMedicationStrength
.nameAr
: _selectedMedicationStrength
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
strengthController
.text = projectViewModel
.isArabic
? _selectedMedicationStrength
.nameAr
: _selectedMedicationStrength
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).strength,
maxLines: 2,
minLines: 2,
controller: strengthController,
validationError:isFormSubmitted &&
_selectedMedicationStrength == null?TranslationBase
.of(context)
.emptyMessage:null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationRouteList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
maxLines: 2,
minLines: 2,
controller: strengthController,
validationError: isFormSubmitted &&
_selectedMedicationStrength == null
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
enabled: false,
isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationRouteList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
routeController
.text = projectViewModel
.isArabic
? _selectedMedicationRoute
.nameAr
: _selectedMedicationRoute
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).route,
maxLines: 2,
minLines: 2,
controller: routeController,
validationError:isFormSubmitted &&
_selectedMedicationRoute == null?TranslationBase
.of(context)
.emptyMessage:null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
onClick: model.medicationFrequencyList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationFrequencyList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
routeController
.text = projectViewModel
.isArabic
? _selectedMedicationRoute
.nameAr
: _selectedMedicationRoute
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText: TranslationBase.of(context).route,
maxLines: 2,
minLines: 2,
controller: routeController,
validationError: isFormSubmitted &&
_selectedMedicationRoute == null
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 5,
),
AppTextFieldCustom(
onClick: model.medicationFrequencyList != null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationFrequencyList,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
selectedValue;
frequencyController
.text = projectViewModel
.isArabic
? _selectedMedicationFrequency
.nameAr
: _selectedMedicationFrequency
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
frequencyController
.text = projectViewModel
.isArabic
? _selectedMedicationFrequency
.nameAr
: _selectedMedicationFrequency
.nameEn;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
hintText:
TranslationBase.of(context).frequency,
enabled: false,
maxLines: 2,
minLines: 2,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError:isFormSubmitted &&
_selectedMedicationFrequency == null?TranslationBase
.of(context)
.emptyMessage:null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 30,
),
],
)),
),
),
]),
),
enabled: false,
maxLines: 2,
minLines: 2,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError: isFormSubmitted &&
_selectedMedicationFrequency == null
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 5,
),
SizedBox(
height: 30,
),
],
)),
),
),
]),
),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: HexColor('#707070'), width: 0.30),
border: Border.all(color: HexColor('#707070'), width: 0.30),
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context).addMedication.toUpperCase(),
color: Color(0xFF359846),
onPressed: () {
setState(() {
isFormSubmitted = true;
});
if (_selectedMedication != null &&
_selectedMedicationDose != null &&
_selectedMedicationStrength != null &&
_selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) {
widget.medicationController.text = widget
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context)
.addMedication
.toUpperCase(),
color: Color(0xFF359846),
onPressed: () {
setState(() {
isFormSubmitted = true;
});
if (_selectedMedication != null &&
_selectedMedicationDose != null &&
_selectedMedicationStrength != null &&
_selectedMedicationRoute != null &&
_selectedMedicationFrequency != null) {
widget.medicationController.text = widget
.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';
Navigator.of(context).pop();
}
},
),
),
'${_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();
}
},
),
),
SizedBox(
height: 5,
),
],
),
),
),
SizedBox(
height: 5,
),
],
),
),
),
),
);
}
}

@ -1236,7 +1236,9 @@ class TranslationBase {
localizedValues['admission-date'][locale.languageCode];
String get noOfDays => localizedValues['noOfDays'][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> {

@ -267,6 +267,19 @@ class PatientCard extends StatelessWidget {
fontWeight: FontWeight.w700,
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(
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,

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

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

@ -31,14 +31,18 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget {
this.removeHistory,
this.masterList,
this.addHistory,
this.isServiceSelected, this.buttonName, this.hintSearchText})
this.isServiceSelected,
this.buttonName,
this.hintSearchText})
: super(key: key);
@override
_MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState();
_MasterKeyCheckboxSearchWidgetState createState() =>
_MasterKeyCheckboxSearchWidgetState();
}
class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchWidget> {
class _MasterKeyCheckboxSearchWidgetState
extends State<MasterKeyCheckboxSearchWidget> {
List<MasterKeyModel> items = List();
@override
@ -67,88 +71,89 @@ class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchW
height: MediaQuery.of(context).size.height * 0.60,
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
AppTextFieldCustom(
height: MediaQuery.of(context).size.height * 0.070,
hintText: TranslationBase.of(context).searchHistory,
isTextFieldHasSuffix: true,
hasBorder: false,
// controller: filteredSearchController,
onChanged: (value) {
filterSearchResults(value);
},
suffixIcon: Icon(
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);
}
});
},
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
AppTextFieldCustom(
height: MediaQuery.of(context).size.height * 0.070,
hintText: TranslationBase.of(context).searchHistory,
isTextFieldHasSuffix: true,
hasBorder: false,
// controller: filteredSearchController,
onChanged: (value) {
filterSearchResults(value);
},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
)),
),
child: Row(
children: [
Checkbox(
value:
widget.isServiceSelected(historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
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,
),
),
// 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(
children: [
Checkbox(
value: widget
.isServiceSelected(historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
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(),
],
);
}).toList(),
),
),
],
],
),
),
// DividerWithSpacesAround(),
],
);
}).toList(),
),
),
)),
],
),
)),
),
),
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 hasBorder;
final String dropDownText;
final Icon suffixIcon;
final IconButton suffixIcon;
final Color dropDownColor;
final bool enabled;
final TextInputType inputType;
@ -89,8 +89,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.dropDownText == null
? TextField(
textAlign: TextAlign.left,
decoration: TextFieldsUtils.textFieldSelectorDecoration(
widget.hintText, null, true),
decoration:
TextFieldsUtils.textFieldSelectorDecoration(
widget.hintText, null, true),
style: TextStyle(
fontSize: SizeConfig.textMultiplier * 1.7,
fontFamily: 'Poppins',
@ -124,11 +125,13 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.isTextFieldHasSuffix
? widget.suffixIcon != null
? widget.suffixIcon
: Icon(
Icons.keyboard_arrow_down,
color: widget.dropDownColor != null
? widget.dropDownColor
: Colors.black,
: InkWell(
child: Icon(
Icons.keyboard_arrow_down,
color: widget.dropDownColor != null
? widget.dropDownColor
: Colors.black,
),
)
: Container(),
],
@ -141,4 +144,3 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
);
}
}

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

Loading…
Cancel
Save