Merge branch 'episode_fixes' into 'development'

Episode fixes

See merge request Cloud_Solution/doctor_app_flutter!773
merge-requests/774/merge
Mohammad Aljammal 3 years ago
commit 4553570547

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -703,4 +703,5 @@ const Map<String, Map<String, String>> localizedValues = {
"addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"},
"edit": {"en": "Edit", "ar": "تعديل"},
"summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"},
"finish": {"en": "Finish", "ar": "انهاء"},
};

@ -6,15 +6,19 @@ class MySelectedAllergy {
String remark;
bool isChecked;
bool isExpanded;
bool isLocal;
int createdBy;
bool hasValidationError;
MySelectedAllergy(
{this.selectedAllergySeverity,
this.selectedAllergy,
this.remark,
this.isChecked,
this.isExpanded = true,
this.createdBy});
this.isExpanded = true,
this.isLocal = true,
this.createdBy,
this.hasValidationError = false});
MySelectedAllergy.fromJson(Map<String, dynamic> json) {
selectedAllergySeverity = json['selectedAllergySeverity'] != null
@ -26,7 +30,9 @@ class MySelectedAllergy {
remark = json['remark'];
isChecked = json['isChecked'];
isExpanded = json['isExpanded'];
isLocal = json['isLocal'];
createdBy = json['createdBy'];
hasValidationError = json['hasValidationError'];
}
Map<String, dynamic> toJson() {
@ -41,6 +47,8 @@ class MySelectedAllergy {
data['isChecked'] = this.isChecked;
data['isExpanded'] = this.isExpanded;
data['createdBy'] = this.createdBy;
data['isLocal'] = this.isLocal;
data['hasValidationError'] = this.hasValidationError;
return data;
}
}

@ -1,22 +1,29 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination {
MasterKeyModel selectedExamination;
MasterKeyModel selectedExamination;
String remark;
bool isNormal;
bool isAbnormal;
bool notExamined;
bool isNew;
bool isLocal;
int createdBy;
String createdOn;
String editedOn;
MySelectedExamination(
{this.selectedExamination,
this.remark,
this.isNormal = false,
this.isAbnormal = false,
this.notExamined = true,
this.isNew = true,
this.createdBy});
MySelectedExamination({
this.selectedExamination,
this.remark,
this.isNormal = false,
this.isAbnormal = false,
this.notExamined = true,
this.isNew = true,
this.isLocal = true,
this.createdBy,
this.createdOn,
this.editedOn,
});
MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null
@ -28,6 +35,9 @@ class MySelectedExamination {
notExamined = json['notExamined'];
isNew = json['isNew'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedOn = json['editedOn'];
isLocal = json['isLocal'];
}
Map<String, dynamic> toJson() {
@ -42,6 +52,10 @@ class MySelectedExamination {
data['notExamined'] = this.notExamined;
data['isNew'] = this.isNew;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedOn'] = this.editedOn;
data['isLocal'] = this.isLocal;
return data;
}
}

@ -4,9 +4,10 @@ class MySelectedHistory {
MasterKeyModel selectedHistory;
String remark;
bool isChecked;
bool isLocal;
MySelectedHistory(
{ this.selectedHistory, this.remark, this.isChecked});
{ this.selectedHistory, this.remark, this.isChecked, this.isLocal = true});
MySelectedHistory.fromJson(Map<String, dynamic> json) {
@ -15,6 +16,7 @@ class MySelectedHistory {
: null;
remark = json['remark'];
remark = json['isChecked'];
isLocal = json['isLocal'];
}
Map<String, dynamic> toJson() {
@ -25,6 +27,7 @@ class MySelectedHistory {
}
data['remark'] = this.remark;
data['isChecked'] = this.remark;
data['isLocal'] = this.isLocal;
return data;
}
}

@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
@ -32,6 +33,7 @@ class AddAssessmentDetails extends StatefulWidget {
addSelectedAssessment;
final PatiantInformtion patientInfo;
final bool isUpdate;
AddAssessmentDetails(
{Key key,
this.mySelectedAssessment,
@ -129,14 +131,14 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView(
child: Center(
child: Column(
children: [
BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
FractionallySizedBox(
widthFactor: 0.9,
child: Container(
@ -253,6 +255,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
@ -305,6 +309,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisType,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
@ -367,7 +372,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
),
),
),
bottomSheet: Container(
bottomSheet: model.state == ViewState.Busy?Container(height: 0,):Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
@ -434,6 +439,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
{SOAPViewModel model,
MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN,
@ -464,8 +470,9 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.postAssessment(postAssessmentRequestModel);
}
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -473,10 +480,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code;
mySelectedAssessment.doctorName = doctorProfile.doctorName;
if (!isUpdate) {
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
}
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
Navigator.of(context).pop();
}
}

@ -26,14 +26,12 @@ import 'add_assessment_details.dart';
// ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget {
final Function changePageViewIndex;
List<MySelectedAssessment> mySelectedAssessmentList;
final PatiantInformtion patientInfo;
final Function changeLoadingState;
final int currentIndex;
UpdateAssessmentPage(
{Key key,
this.changePageViewIndex,
this.mySelectedAssessmentList,
this.patientInfo,
this.changeLoadingState, this.currentIndex});
@ -43,19 +41,20 @@ class UpdateAssessmentPage extends StatefulWidget {
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List();
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
widget.mySelectedAssessmentList.clear();
mySelectedAssessmentList.clear();
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: int.parse(widget.patientInfo.appointmentNo));
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientAssessment(getAssessmentReqModel);
if (model.patientAssessmentList.isNotEmpty) {
if (model.listOfDiagnosisCondition.length == 0) {
@ -96,7 +95,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
createdOn: element.createdOn,
icdCode10ID: element.icdCode10ID);
widget.mySelectedAssessmentList.add(temMySelectedAssessment);
mySelectedAssessmentList.add(temMySelectedAssessment);
}
});
}
@ -147,7 +146,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 20,
),
Column(
children: widget.mySelectedAssessmentList
children: mySelectedAssessmentList
.map((assessment) {
return Container(
margin: EdgeInsets.only(
@ -348,7 +347,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 6,
),
AppText(
(assessment.remark != null ||
(assessment.remark != null &&
assessment.remark !=
'')
? TranslationBase.of(
@ -501,14 +500,15 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
color: Colors.red[700],
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
if (widget.mySelectedAssessmentList.isEmpty) {
if (mySelectedAssessmentList.isEmpty) {
Helpers.showErrorToast(
TranslationBase
.of(context)
.assessmentErrorMsg);
} else {
widget.changePageViewIndex(3);
widget.changeLoadingState(true);
widget.changePageViewIndex(3);
}
},
),
@ -542,11 +542,12 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
mySelectedAssessment: assessment,
patientInfo: widget.patientInfo,
isUpdate: isUpdate,
mySelectedAssessmentList: widget.mySelectedAssessmentList,
mySelectedAssessmentList: mySelectedAssessmentList,
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment,
bool isUpdate) async {
setState(() {
widget.mySelectedAssessmentList.add(mySelectedAssessment);
if(!isUpdate)
mySelectedAssessmentList.add(mySelectedAssessment);
});
});
});

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
@ -31,79 +32,55 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
@override
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination);
}
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
backgroundColor: Color.fromRGBO(248, 248, 248, 1),
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
padding:
EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination);
}
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: "${TranslationBase.of(context).addExamination}",
),
backgroundColor: Color.fromRGBO(248, 248, 248, 1),
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: AppText(
"${TranslationBase.of(context).addExamination}",
fontSize: SizeConfig.textMultiplier * 3.3,
color: Colors.black,
fontWeight: FontWeight.w700,
),
),
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Icon(
Icons.clear,
size: 40,
),
)
],
),
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.all(16.0),
padding: EdgeInsets.all(0.0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.fromBorderSide(BorderSide(
color: Colors.grey.shade400,
width: 0.4,
)),
),
child: SingleChildScrollView(
child: Column(
children: [
ExaminationsListSearchWidget(
masterList: model.physicalExaminationList,
isServiceSelected: (master) =>
isServiceSelected(master),
removeHistory: (history) {
setState(() {
widget.removeExamination(history);
});
},
addHistory: (selectedExamination) {
setState(() {
widget.mySelectedExamination
.add(selectedExamination);
Container(
margin: EdgeInsets.all(16.0),
padding: EdgeInsets.all(0.0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.fromBorderSide(BorderSide(
color: Colors.grey.shade400,
width: 0.4,
)),
),
child: Column(
children: [
ExaminationsListSearchWidget(
mySelectedExamination:
widget.mySelectedExamination,
masterList: model.physicalExaminationList,
isServiceSelected: (master) =>
isServiceSelected(master),
removeExamination: (history) {
setState(() {
widget.removeExamination(history);
});
},
addHistory: (selectedExamination) {
widget.mySelectedExamination
.add(selectedExamination);
// setState(() {});
},
),
],
),

@ -14,19 +14,21 @@ import 'package:provider/provider.dart';
// ignore: must_be_immutable
class AddExaminationWidget extends StatefulWidget {
MasterKeyModel item;
final Function(MasterKeyModel) removeHistory;
final Function(MySelectedExamination) addHistory;
final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addExamination;
final bool Function(MasterKeyModel) isServiceSelected;
bool isExpand;
final Function expandClick;
final List<MySelectedExamination> mySelectedExamination;
AddExaminationWidget({
this.item,
this.removeHistory,
this.addHistory,
this.removeExamination,
this.addExamination,
this.isServiceSelected,
this.isExpand,
this.expandClick,
this.mySelectedExamination,
});
@override
@ -40,7 +42,17 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
@override
void initState() {
examination.selectedExamination = widget.item;
if (getSelectedExam(widget.item) != null) {
examination = getSelectedExam(widget.item);
status = examination.isNormal
? 1
: examination.isAbnormal
? 2
: 3;
remarksController.text = examination.remark;
} else {
examination.selectedExamination = widget.item;
}
super.initState();
}
@ -70,14 +82,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onChanged: (newValue) {
setState(() {
if (widget.isServiceSelected(widget.item)) {
widget.removeHistory(widget.item);
if (examination.isLocal)
widget.removeExamination(widget.item);
widget.expandClick();
} else {
examination.isNormal = status == 1;
examination.isAbnormal = status == 2;
examination.notExamined = status == 3;
examination.remark = remarksController.text;
widget.addHistory(examination);
widget.addExamination(examination);
widget.expandClick();
}
});
@ -113,18 +126,18 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
Row(
children: [
Expanded(
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
status = 1;
});
examination.isNormal = true;
examination.isAbnormal = false;
examination.notExamined = false;
},
child: Container(
child: InkWell(
onTap: () {
setState(() {
status = 1;
});
examination.isNormal = true;
examination.isAbnormal = false;
examination.notExamined = false;
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
@ -143,28 +156,28 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
),
),
),
),
AppText(
TranslationBase.of(context).normal,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
],
AppText(
TranslationBase.of(context).normal,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
],
),
)),
Expanded(
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
status = 2;
});
examination.isNormal = false;
examination.isAbnormal = true;
examination.notExamined = false;
},
child: Container(
child: InkWell(
onTap: () {
setState(() {
status = 2;
});
examination.isNormal = false;
examination.isAbnormal = true;
examination.notExamined = false;
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
@ -183,57 +196,58 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
),
),
),
),
AppText(
TranslationBase.of(context).abnormal,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
],
AppText(
TranslationBase.of(context).abnormal,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
],
),
)),
Expanded(
if (!examination.isLocal)
Expanded(
child: InkWell(
onTap: () {
setState(() {
status = 3;
});
examination.isNormal = false;
examination.isAbnormal = false;
examination.notExamined = true;
},
child: Row(
children: [
InkWell(
onTap: () {
setState(() {
status = 3;
});
examination.isNormal = false;
examination.isAbnormal = false;
examination.notExamined = true;
},
child: Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.grey, width: 1),
),
child: Container(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: status == 3
? HexColor("#D02127")
: Colors.white,
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status == 3
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
),
),
),
),
Expanded(
child: AppText(
TranslationBase.of(context).notExamined,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
Expanded(
child: AppText(
TranslationBase.of(context).notExamined,
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
),
),
],
),
],
)),
)),
],
),
Container(
@ -256,4 +270,15 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
),
);
}
MySelectedExamination getSelectedExam(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> exam = widget.mySelectedExamination.where(
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) {
return exam.first;
}
return null;
}
}

@ -40,25 +40,6 @@ class ExaminationItemCard extends StatelessWidget {
fontSize: SizeConfig.textMultiplier * 1.8,
),
)),
Row(
children: [
AppText(
TranslationBase.of(context).remove,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
color: Colors.red.shade800,
fontSize: SizeConfig.textMultiplier * 1.8,
),
InkWell(
onTap: removeExamination,
child: Icon(
Icons.clear,
size: 20,
color: Colors.red.shade800,
),
)
],
),
],
),
AppText(
@ -79,6 +60,7 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox(
height: 4,
),
if(examination.remark.isNotEmpty)
AppText(
examination.remark,
fontWeight: FontWeight.normal,

@ -8,16 +8,17 @@ import 'package:flutter/material.dart';
import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MasterKeyModel) removeHistory;
final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addHistory;
final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel> masterList;
final List<MySelectedExamination> mySelectedExamination;
ExaminationsListSearchWidget(
{this.removeHistory,
{this.removeExamination,
this.addHistory,
this.isServiceSelected,
this.masterList});
this.masterList, this.mySelectedExamination});
@override
_ExaminationsListSearchWidgetState createState() =>
@ -61,8 +62,9 @@ class _ExaminationsListSearchWidgetState
...items.mapIndexed((index, item) {
return AddExaminationWidget(
item: item,
addHistory: widget.addHistory,
removeHistory: widget.removeHistory,
addExamination: widget.addHistory,
removeExamination: widget.removeExamination,
mySelectedExamination: widget.mySelectedExamination,
isServiceSelected: widget.isServiceSelected,
isExpand: index == expandedIndex,
expandClick: () {

@ -28,13 +28,11 @@ class UpdateObjectivePage extends StatefulWidget {
final Function changePageViewIndex;
final Function changeLoadingState;
final int currentIndex;
final List<MySelectedExamination> mySelectedExamination;
final PatiantInformtion patientInfo;
UpdateObjectivePage(
{Key key,
this.changePageViewIndex,
this.mySelectedExamination,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@ -45,8 +43,10 @@ class UpdateObjectivePage extends StatefulWidget {
class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List();
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
@ -62,11 +62,13 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
widget.mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()));
mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) {
@ -79,14 +81,18 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
id: element.examId,
);
MySelectedExamination tempEam = MySelectedExamination(
selectedExamination: examMaster,
remark: element.remarks,
isNormal: element.isNormal,
createdBy: element.createdBy,
notExamined: element.notExamined,
isNew: element.isNew,
isAbnormal: element.isAbnormal);
widget.mySelectedExamination.add(tempEam);
selectedExamination: examMaster,
remark: element.remarks,
isNormal: element.isNormal,
createdBy: element.createdBy,
createdOn: element.createdOn,
editedOn: element.editedOn,
notExamined: element.notExamined,
isNew: element.isNew,
isLocal: false,
isAbnormal: element.isAbnormal,
);
mySelectedExamination.add(tempEam);
});
}
@ -102,9 +108,12 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).physicalSystemExamination,
headerTitle:
TranslationBase.of(context).physicalSystemExamination,
onTap: () {
setState(() {
isSysExaminationExpand = !isSysExaminationExpand;
@ -113,15 +122,17 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
child: Column(
children: [
SOAPOpenItems(
label: "${TranslationBase.of(context).addExamination}",
label:
"${TranslationBase.of(context).addExamination}",
onTap: () {
openExaminationList(context);
},
),
Column(
children: widget.mySelectedExamination.map((examination) {
children: mySelectedExamination.map((examination) {
return ExaminationItemCard(examination, () {
removeExamination(examination.selectedExamination);
removeExamination(
examination.selectedExamination);
});
}).toList(),
)
@ -198,40 +209,45 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
}
submitUpdateObjectivePage(SOAPViewModel model) async {
if (widget.mySelectedExamination.isNotEmpty) {
if (mySelectedExamination.isNotEmpty) {
widget.changeLoadingState(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
widget.mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = [];
PostPhysicalExamRequestModel postPhysicalExamRequestModel =
new PostPhysicalExamRequestModel();
mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM =
[];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(ListHisProgNotePhysicalExaminationVM(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal,
notExamined: exam.notExamined,
examinationType: exam.isNormal
? 1
: exam.isAbnormal
? 2
: 3,
examinationTypeName: exam.isNormal
? "Normal"
: exam.isAbnormal
? 'AbNormal'
: "Not Examined",
isNew: exam.isNew));
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM
.add(ListHisProgNotePhysicalExaminationVM(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: exam.createdOn ?? DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal,
notExamined: exam.notExamined,
examinationType: exam.isNormal
? 1
: exam.isAbnormal
? 2
: 3,
examinationTypeName: exam.isNormal
? "Normal"
: exam.isAbnormal
? 'AbNormal'
: "Not Examined",
isNew: exam.isNew));
});
if (model.patientPhysicalExamList.isEmpty) {
@ -241,10 +257,10 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
}
if (model.state == ViewState.ErrorLocal) {
widget.changeLoadingState(false);
Helpers.showErrorToast(model.error);
} else {
widget.changeLoadingState(true);
widget.changePageViewIndex(2);
}
} else {
@ -253,12 +269,14 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
}
removeExamination(MasterKeyModel masterKey) {
Iterable<MySelectedExamination> history = widget.mySelectedExamination.where((element) =>
masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId);
Iterable<MySelectedExamination> history = mySelectedExamination.where(
(element) =>
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0)
setState(() {
widget.mySelectedExamination.remove(history.first);
mySelectedExamination.remove(history.first);
});
}
@ -267,7 +285,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
context,
FadePage(
page: AddExaminationPage(
mySelectedExamination: widget.mySelectedExamination,
mySelectedExamination: mySelectedExamination,
addSelectedExamination: () {
setState(() {
Navigator.of(context).pop();
@ -276,21 +294,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
removeExamination: (masterKey) => removeExamination(masterKey)),
),
);
/*showModalBottomSheet(
backgroundColor: Colors.white,
isScrollControlled: true,
context: context,
builder: (context) {
return AddExaminationDailog(
mySelectedExamination: widget.mySelectedExamination,
addSelectedExamination: () {
setState(() {
Navigator.of(context).pop();
});
},
removeExamination: (masterKey) => removeExamination(masterKey),
);
});*/
}
}
@ -299,7 +302,11 @@ class AddExaminationDailog extends StatefulWidget {
final Function addSelectedExamination;
final Function(MasterKeyModel) removeExamination;
const AddExaminationDailog({Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination})
const AddExaminationDailog(
{Key key,
this.mySelectedExamination,
this.addSelectedExamination,
this.removeExamination})
: super(key: key);
@override
@ -314,7 +321,8 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
if (model.physicalExaminationList.length == 0) {
await model.getMasterLookup(MasterKeysService.PhysicalExamination);
await model
.getMasterLookup(MasterKeysService.PhysicalExamination);
}
},
builder: (_, model, w) => AppScaffold(
@ -324,19 +332,21 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
child: Container(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 16,
),
AppText(
TranslationBase.of(context).physicalSystemExamination,
fontWeight: FontWeight.bold,
fontSize: 16,
),
SizedBox(
height: 16,
),
]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 16,
),
AppText(
TranslationBase.of(context).physicalSystemExamination,
fontWeight: FontWeight.bold,
fontSize: 16,
),
SizedBox(
height: 16,
),
]),
))),
)),
);

@ -27,14 +27,12 @@ class UpdatePlanPage extends StatefulWidget {
final Function changeLoadingState;
final int currentIndex;
GetPatientProgressNoteResModel patientProgressNote;
UpdatePlanPage(
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.patientProgressNote,
this.currentIndex});
@override
@ -44,10 +42,14 @@ class UpdatePlanPage extends StatefulWidget {
class _UpdatePlanPageState extends State<UpdatePlanPage> {
bool isAddProgress = true;
bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote =
GetPatientProgressNoteResModel();
TextEditingController progressNoteController = TextEditingController(text: null);
TextEditingController progressNoteController =
TextEditingController(text: null);
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
@ -62,32 +64,74 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
@override
void initState() {
super.initState();
if (widget.patientProgressNote.planNote != null) {
if (patientProgressNote.planNote != null) {
setState(() {
isAddProgress = false;
});
}
}
getPatientProgressNote(model, {bool isAddProgress = false}) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel(
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo;
setState(() {
isAddProgress = isAddProgress;
});
}
}
@override
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel(
appointmentNo: int.parse(widget.patientInfo.appointmentNo),
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '');
GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel(
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote);
widget.patientProgressNote.planNote = progressNoteController.text;
widget.patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName;
widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn;
widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn;
widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName;
progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo;
setState(() {
isAddProgress = false;
});
@ -104,7 +148,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
widthFactor: 0.90,
child: Column(
children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex),
SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
SizedBox(
height: 10,
),
@ -123,33 +169,41 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
children: [
if (isAddProgress)
Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
margin: EdgeInsets.only(
left: 10, right: 10, top: 15),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).progressNote,
hintText: TranslationBase.of(context)
.progressNote,
controller: progressNoteController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {
widget.patientProgressNote.planNote = value;
setState(() {
patientProgressNote.planNote = value;
});
},
),
),
SizedBox(
height: 9,
),
if (widget.patientProgressNote.planNote != null && !isAddProgress)
if (patientProgressNote.planNote != null &&
!isAddProgress)
Container(
margin: EdgeInsets.only(
left: 5,
right: 5,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
@ -158,40 +212,61 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
fontSize: 12,
),
AppText(
widget.patientProgressNote.appointmentNo ?? '',
patientProgressNote
.appointmentNo !=
null
? patientProgressNote
.appointmentNo
.toString()
: '',
fontWeight: FontWeight.w600,
fontSize: 14,
),
],
),
AppText(
widget.patientProgressNote.createdOn != null
? AppDateUtils.getDayMonthYearDateFormatted(
DateTime.parse(widget.patientProgressNote.createdOn))
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
patientProgressNote.createdOn !=
null
? AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.parse(
patientProgressNote
.createdOn))
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
AppText(
'Condition: ',
fontSize: 12,
),
AppText(widget.patientProgressNote.mName ?? '',
fontWeight: FontWeight.w600),
],
),
// Row(
// children: [
// AppText(
// 'Condition: ',
// fontSize: 12,
// ),
// AppText(
// patientProgressNote.mName ??
// '',
// fontWeight: FontWeight.w600),
// ],
// ),
AppText(
widget.patientProgressNote.createdOn != null
patientProgressNote.createdOn !=
null
? AppDateUtils.getHour(
DateTime.parse(widget.patientProgressNote.createdOn))
: AppDateUtils.getHour(DateTime.now()),
DateTime.parse(
patientProgressNote
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600,
fontSize: 14,
)
@ -201,7 +276,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Expanded(
child: AppText(
@ -213,7 +289,6 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
onTap: () {
setState(() {
isAddProgress = true;
widget.changePageViewIndex(3, isChangeState: false);
});
},
child: Icon(
@ -274,30 +349,23 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
title: isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700],
loading: model.state == ViewState.BusyLocal,
disabled: progressNoteController.text.isEmpty,
onPressed: () async {
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
setState(() {
widget.patientProgressNote.createdByName =
widget.patientProgressNote.createdByName ?? doctorProfile.doctorName;
widget.patientProgressNote.editedByName = doctorProfile.doctorName;
widget.patientProgressNote.createdOn = DateTime.now().toString();
widget.patientProgressNote.planNote = progressNoteController.text;
isAddProgress = !isAddProgress;
});
submitPlan(model);
} else {
Navigator.of(context).pop();
}
} else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
}
},
),
@ -318,19 +386,20 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
submitPlan(SOAPViewModel model) async {
if (progressNoteController.text.isNotEmpty) {
PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
planNote: widget.patientProgressNote.planNote,
doctorID: '',
editedBy: '');
widget.changeLoadingState(true);
PostProgressNoteRequestModel postProgressNoteRequestModel =
new PostProgressNoteRequestModel(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
planNote: patientProgressNote.planNote,
doctorID: '',
editedBy: '');
if (model.patientProgressNoteList.isEmpty) {
await model.postProgressNote(postProgressNoteRequestModel);
} else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
postProgressNoteRequestModel.editedBy = doctorProfile.doctorID;
await model.patchProgressNote(postProgressNoteRequestModel);
@ -339,8 +408,37 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else {
widget.changePageViewIndex(4, isChangeState: false);
GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel(
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn =
model.patientProgressNoteList[0].createdOn;
patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo;
setState(() {
isAddProgress = false;
});
}
}
widget.changeLoadingState(false);
} else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
}

@ -1,7 +1,7 @@
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart';
class BottomSheetTitle extends StatelessWidget {
class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget {
const BottomSheetTitle({
Key key, this.title,
}) : super(key: key);
@ -57,4 +57,7 @@ class BottomSheetTitle extends StatelessWidget {
),
);
}
@override
Size get preferredSize => Size(double.maxFinite,115);
}

@ -247,6 +247,8 @@ class StepsWidget extends StatelessWidget {
"Plan",
fontWeight: FontWeight.bold,
fontSize: 12,
textAlign: TextAlign.end,
marginLeft: 25,
),
StatusLabel(
selectedStepId: index,
@ -530,20 +532,22 @@ class StatusLabel extends StatelessWidget {
),
border: Border.all(color: HexColor('#707070'), width: 0.30),
),
child: AppText(
stepId == selectedStepId
? "inProgress"
: stepId < selectedStepId
? "Completed"
: " Locked ",
fontWeight: FontWeight.bold,
textAlign: TextAlign.center,
fontSize: 10,
color: stepId == selectedStepId
? Color(0xFFCC9B14)
: stepId < selectedStepId
? Color(0xFF359846)
: Color(0xFF969696),
child: Center(
child: AppText(
stepId == selectedStepId
? "inProgress"
: stepId < selectedStepId
? "Completed"
: "Locked",
fontWeight: FontWeight.bold,
textAlign: TextAlign.center,
fontSize: 10,
color: stepId == selectedStepId
? Color(0xFFCC9B14)
: stepId < selectedStepId
? Color(0xFF359846)
: Color(0xFF969696),
),
),
);
}

@ -1,5 +1,6 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
@ -8,12 +9,12 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_allergies_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../shared_soap_widgets/bottom_sheet_title.dart';
import 'master_key_checkbox_search_allergies_widget.dart';
class AddAllergies extends StatefulWidget {
final Function addAllergiesFun;
@ -83,95 +84,107 @@ class _AddAllergiesState extends State<AddAllergies> {
}
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Center(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(
title: TranslationBase.of(context).addAllergies,
baseViewModel: model,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAllergies,
),
body: Center(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchAllergiesWidget(
model: model,
masterList: model.allergiesList,
removeAllergy: (master) {
setState(() {
removeAllergyFromLocalList(master);
});
},
addAllergy:
(MySelectedAllergy mySelectedAllergy) {
addAllergyLocally(mySelectedAllergy);
},
addSelectedAllergy: () {
setState(() {
widget
.addAllergiesFun(myAllergiesListLocal);
});
},
isServiceSelected: (master) =>
isServiceSelected(master),
getServiceSelectedAllergy: (master) =>
getSelectedAllergy(master),
),
),
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
),
]),
),
),
bottomSheet: model.state == ViewState.Busy
? Container(
height: 0,
)
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchAllergiesWidget(
model: model,
masterList: model.allergiesList,
removeAllergy: (master) {
setState(() {
removeAllergyFromLocalList(master);
});
},
addAllergy:
(MySelectedAllergy mySelectedAllergy) {
addAllergyLocally(mySelectedAllergy);
},
addSelectedAllergy: () => widget
.addAllergiesFun(myAllergiesListLocal),
isServiceSelected: (master) =>
isServiceSelected(master),
getServiceSelectedAllergy: (master) =>
getSelectedAllergy(master),
),
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context).addAllergies,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
setState(() {
widget.addAllergiesFun(myAllergiesListLocal);
});
},
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
height: 5,
),
]),
),
),bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
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).addAllergies,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addAllergiesFun(myAllergiesListLocal);
},
),
],
),
),
),
SizedBox(
height: 5,
),
],
),
),),
),
),
);
}
@ -207,17 +220,15 @@ class _AddAllergiesState extends State<AddAllergies> {
addAllergyLocally(MySelectedAllergy mySelectedAllergy) {
if (mySelectedAllergy.selectedAllergy == null) {
Helpers.showErrorToast(TranslationBase
.of(context)
.requiredMsg);
Helpers.showErrorToast(TranslationBase.of(context).requiredMsg);
} else {
setState(() {
List<MySelectedAllergy> allergy =
// ignore: missing_return
myAllergiesListLocal
.where((element) =>
mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id)
// ignore: missing_return
myAllergiesListLocal
.where((element) =>
mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id)
.toList();
if (allergy.isEmpty) {

@ -0,0 +1,197 @@
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart';
import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AddAllergiesItem extends StatefulWidget {
final SOAPViewModel model;
final Function(MasterKeyModel) removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy;
final bool Function(MasterKeyModel) isServiceSelected;
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy;
final MasterKeyModel item;
const AddAllergiesItem(
{Key key,
this.model,
this.removeAllergy,
this.addAllergy,
this.isServiceSelected,
this.getServiceSelectedAllergy,
this.item})
: super(key: key);
@override
_AddAllergiesItemState createState() => _AddAllergiesItemState();
}
class _AddAllergiesItemState extends State<AddAllergiesItem> {
MasterKeyModel _selectedAllergySeverity;
bool isSubmitted = false;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
bool isSelected = widget.isServiceSelected(widget.item);
MySelectedAllergy mySelectedAllergy;
if (isSelected) {
mySelectedAllergy = widget.getServiceSelectedAllergy(widget.item);
}
TextEditingController remarkController = TextEditingController(
text: isSelected ? mySelectedAllergy.remark : null);
TextEditingController severityController = TextEditingController(
text: isSelected
? mySelectedAllergy.selectedAllergySeverity != null
? projectViewModel.isArabic
? mySelectedAllergy.selectedAllergySeverity.nameAr
: mySelectedAllergy.selectedAllergySeverity.nameEn
: null
: null);
return HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox(
value: widget.isServiceSelected(widget.item),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
onTapItem();
}),
InkWell(
onTap:onTapItem,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: Container(
child: AppText(
projectViewModel.isArabic
? widget.item.nameAr != ""
? widget.item.nameAr
: widget.item.nameEn
: widget.item.nameEn,
color: Color(0xFF575757),
fontSize: 16,
fontWeight: FontWeight.w600,
),
width: MediaQuery.of(context).size.width * 0.55,
),
),
),
],
),
InkWell(
onTap: () {
if (mySelectedAllergy != null) {
setState(() {
mySelectedAllergy.isExpanded =
mySelectedAllergy.isExpanded ? false : true;
});
}
},
child: Icon((mySelectedAllergy != null
? mySelectedAllergy.isExpanded
: false)
? EvaIcons.arrowIosUpwardOutline
: EvaIcons.arrowIosDownwardOutline))
],
),
bodyWidget: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: Column(
children: [
AppTextFieldCustom(
onClick: widget.model.allergySeverityList != null
? () {
MasterKeyDailog dialog = MasterKeyDailog(
list: widget.model.allergySeverityList,
selectedValue:
mySelectedAllergy.selectedAllergySeverity,
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,
enabled: false,
maxLines: 2,
minLines: 2,
validationError: mySelectedAllergy != null &&
mySelectedAllergy.selectedAllergySeverity == null &&
mySelectedAllergy.hasValidationError
? TranslationBase.of(context).emptyMessage
: null,
controller: severityController,
),
SizedBox(
height: 10,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarkController,
maxLines: 25,
minLines: 3,
hasBorder: true,
onChanged: (value){
mySelectedAllergy.remark = value;
},
inputType: TextInputType.multiline,
),
SizedBox(
height: 10,
),
],
),
),
),
),
isExpand:
mySelectedAllergy != null ? mySelectedAllergy.isExpanded : false,
);
}
onTapItem(){
setState(() {
if (widget.isServiceSelected(widget.item)) {
widget.removeAllergy(widget.item);
} else {
MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy(
selectedAllergy: widget.item,
selectedAllergySeverity: _selectedAllergySeverity,
remark: null,
isChecked: true,
isExpanded: true);
widget.addAllergy(mySelectedAllergy);
}
});
}
}

@ -0,0 +1,148 @@
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'allergies_item.dart';
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model;
final Function() addSelectedAllergy;
final Function(MasterKeyModel) removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy;
final bool Function(MasterKeyModel) isServiceSelected;
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy;
final List<MasterKeyModel> masterList;
final String buttonName;
final String hintSearchText;
MasterKeyCheckboxSearchAllergiesWidget(
{Key key,
this.model,
this.addSelectedAllergy,
this.removeAllergy,
this.masterList,
this.addAllergy,
this.isServiceSelected,
this.buttonName,
this.hintSearchText,
this.getServiceSelectedAllergy})
: super(key: key);
@override
_MasterKeyCheckboxSearchAllergiesWidgetState createState() =>
_MasterKeyCheckboxSearchAllergiesWidgetState();
}
class _MasterKeyCheckboxSearchAllergiesWidgetState
extends State<MasterKeyCheckboxSearchAllergiesWidget> {
List<MasterKeyModel> items = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context).size.height * 0.70,
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Column(
children: [
AppTextFieldCustom(
// height:
// MediaQuery.of(context).size.height * 0.070,
hintText:
TranslationBase.of(context).selectAllergy,
isTextFieldHasSuffix: true,
hasBorder: false,
// controller: filteredSearchController,
onChanged: (value) {
filterSearchResults(value);
},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
)),
),
DividerWithSpacesAround(),
SizedBox(
height: 10,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Container(
height:
MediaQuery.of(context).size.height * 0.60,
child: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return AddAllergiesItem(
item:items[index],
model: widget.model,
removeAllergy: widget.removeAllergy,
addAllergy:widget.addAllergy,
isServiceSelected: widget.isServiceSelected,
getServiceSelectedAllergy: widget.getServiceSelectedAllergy,
);
},
),
),
),
),
],
))),
),
),
SizedBox(
height: 10,
),
],
),
);
}
void filterSearchResults(String query) {
List<MasterKeyModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<MasterKeyModel> dummyListData = List();
dummySearchList.forEach((items) {
if (items.nameAr.toLowerCase().contains(query.toLowerCase()) ||
items.nameEn.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(items);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}

@ -34,10 +34,8 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
return Column(
children: [
SOAPOpenItems(label: "${TranslationBase.of(context).addAllergies}",onTap: () {
openAllergiesList(context, changeAllState);
openAllergiesList(context, changeAllState, removeAllergy);
},),
SizedBox(
height: 20,
@ -153,16 +151,18 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
).toList();
if (allergy.length > 0) {
if(allergy.first.isLocal) {
setState(() {
widget.myAllergiesList.remove(allergy.first);
});
}
setState(() {
allergy[0].isChecked = false;
});
}
print(allergy);
}
openAllergiesList(BuildContext context, Function changeParentState) {
openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) {
showModalBottomSheet(
backgroundColor: Colors.white,
isScrollControlled: true,
@ -175,15 +175,29 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
bool isAllDataFilled = true;
mySelectedAllergy.forEach((element) {
if (element.selectedAllergySeverity == null) {
element.hasValidationError = true;
isAllDataFilled = false;
}
});
if (isAllDataFilled) {
mySelectedAllergy.forEach((element) {
if (!widget.myAllergiesList.contains(element.selectedAllergySeverity.id)) {
if ((widget.myAllergiesList.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id,
orElse: () => null)) == null) {
widget.myAllergiesList.add(element);
}
});
/// remove items.
List<MySelectedAllergy> removedList= [];
widget.myAllergiesList.forEach((element) {
if ((mySelectedAllergy.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id,
orElse: () => null)) == null) {
removedList.add(element);
}});
removedList.forEach((element) {
removeAllergy(element);
});
changeParentState();
Navigator.of(context).pop();
} else {

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart';
@ -19,10 +20,15 @@ class AddHistoryDialog extends StatefulWidget {
final PageController controller;
final List<MySelectedHistory> myHistoryList;
final Function addSelectedHistories;
final Function (MasterKeyModel) removeHistory;
final Function(MasterKeyModel) removeHistory;
const AddHistoryDialog(
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory})
{Key key,
this.changePageViewIndex,
this.controller,
this.myHistoryList,
this.addSelectedHistories,
this.removeHistory})
: super(key: key);
@override
@ -51,96 +57,96 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addHistory),
body: Center(
child: Container(
child: Column(
children: [
BottomSheetTitle(title:TranslationBase.of(context).addHistory),
SizedBox(
height: 10,
),
PriorityBar(onTap: (activePriority) async {
widget.changePageViewIndex(activePriority);
}),
SizedBox(
height: 20,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: widget.controller,
onPageChanged: (index) {
setState(() {
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model.historyFamilyList,
removeHistory: (history){
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history){
setState(() {
createAndAddHistory(
history);
});
},
addSelectedHistories: (){
widget.addSelectedHistories();
},
isServiceSelected: (master) =>isServiceSelected(master),
),
),
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model.mergeHistorySurgicalWithHistorySportList,
removeHistory: (history){
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history){
setState(() {
createAndAddHistory(
history);
});
},
addSelectedHistories: (){
widget.addSelectedHistories();
},
isServiceSelected: (master) =>isServiceSelected(master),
),
),
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model.historyMedicalList,
removeHistory: (history){
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history){
setState(() {
createAndAddHistory(
history);
});
},
addSelectedHistories: (){
widget.addSelectedHistories();
},
children: [
SizedBox(
height: 10,
),
PriorityBar(onTap: (activePriority) async {
widget.changePageViewIndex(activePriority);
}),
SizedBox(
height: 20,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: widget.controller,
onPageChanged: (index) {
setState(() {});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model.historyFamilyList,
removeHistory: (history) {
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history) {
setState(() {
createAndAddHistory(history);
});
},
addSelectedHistories: () {
widget.addSelectedHistories();
},
isServiceSelected: (master) =>
isServiceSelected(master),
),
),
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model
.mergeHistorySurgicalWithHistorySportList,
removeHistory: (history) {
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history) {
setState(() {
createAndAddHistory(history);
});
},
addSelectedHistories: () {
widget.addSelectedHistories();
},
isServiceSelected: (master) =>
isServiceSelected(master),
),
),
NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchWidget(
model: model,
masterList: model.historyMedicalList,
removeHistory: (history) {
setState(() {
widget.removeHistory(history);
});
},
addHistory: (history) {
setState(() {
createAndAddHistory(history);
});
},
addSelectedHistories: () {
widget.addSelectedHistories();
},
isServiceSelected: (master) =>
isServiceSelected(master),
),
@ -149,59 +155,63 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
),
),
),
SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,)
SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
)
],
)
),
)),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
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).addSelectedHistories,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addSelectedHistories();
},
),
bottomSheet: model.state == ViewState.Busy
? Container(
height: 0,
)
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
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)
.addSelectedHistories,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addSelectedHistories();
},
),
),
),
),
SizedBox(
height: 5,
),
],
),
),
SizedBox(
height: 5,
),
],
),
),
),
));
}
createAndAddHistory(MasterKeyModel history) {
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) =>
history.id ==
element.selectedHistory.id &&
history.typeId ==
element.selectedHistory.typeId
).toList();
List<MySelectedHistory> myhistory = widget.myHistoryList
.where((element) =>
history.id == element.selectedHistory.id &&
history.typeId == element.selectedHistory.typeId)
.toList();
if (myhistory.isEmpty) {
setState(() {
@ -217,18 +227,14 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}
isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedHistory> history =
widget
.myHistoryList
.where((element) =>
masterKey.id == element.selectedHistory.id &&
masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked);
Iterable<MySelectedHistory> history = widget.myHistoryList.where(
(element) =>
masterKey.id == element.selectedHistory.id &&
masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked);
if (history.length > 0) {
return true;
}
return false;
}
}

@ -123,10 +123,19 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
).toList();
if (history.length > 0)
setState(() {
history[0].isChecked = false;
});
if (history.length > 0) {
if(history.first.isLocal) {
setState(() {
widget.myHistoryList.remove(history.first);
});
} else {
setState(() {
history[0].isChecked = false;
});
}
}
}
openHistoryList(BuildContext context) {

@ -1,6 +1,7 @@
// ignore: must_be_immutable
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -74,15 +75,15 @@ class _AddMedicationState extends State<AddMedication> {
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
body: Center(
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
SizedBox(
height: 10,
),
@ -187,6 +188,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationDoseTimeList,
okText:
TranslationBase.of(context).ok,
selectedValue: _selectedMedicationDose,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationDose =
@ -235,6 +237,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationStrengthList,
okText:
TranslationBase.of(context).ok,
selectedValue: _selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
@ -283,6 +286,7 @@ class _AddMedicationState extends State<AddMedication> {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model.medicationRouteList,
selectedValue: _selectedMedicationRoute,
okText:
TranslationBase.of(context).ok,
okFunction: (selectedValue) {
@ -332,6 +336,7 @@ class _AddMedicationState extends State<AddMedication> {
list: model.medicationFrequencyList,
okText:
TranslationBase.of(context).ok,
selectedValue: _selectedMedicationFrequency,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationFrequency =
@ -381,7 +386,7 @@ class _AddMedicationState extends State<AddMedication> {
]),
),
),
bottomSheet: Container(
bottomSheet:model.state == ViewState.Busy?Container(height: 0,): Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(

@ -30,16 +30,12 @@ import 'history/update_history_widget.dart';
class UpdateSubjectivePage extends StatefulWidget {
final Function changePageViewIndex;
final Function changeLoadingState;
final List<MySelectedAllergy> myAllergiesList;
final List<MySelectedHistory> myHistoryList;
final PatiantInformtion patientInfo;
final int currentIndex;
UpdateSubjectivePage(
{Key key,
this.changePageViewIndex,
this.myAllergiesList,
this.myHistoryList,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@ -59,6 +55,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
String medicationControllerError = '';
String illnessControllerError = '';
final formKey = GlobalKey<FormState>();
List<MySelectedAllergy> myAllergiesList=List();
List<MySelectedHistory> myHistoryList=List();
getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true);
@ -93,9 +91,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
);
if (history != null) {
MySelectedHistory mySelectedHistory =
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks);
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
widget.myHistoryList.add(mySelectedHistory);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
@ -105,9 +103,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
);
if (history != null) {
MySelectedHistory mySelectedHistory =
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks);
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
widget.myHistoryList.add(mySelectedHistory);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
@ -117,9 +115,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
);
if (history != null) {
MySelectedHistory mySelectedHistory =
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks);
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
widget.myHistoryList.add(mySelectedHistory);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
@ -129,9 +127,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
);
if (history != null) {
MySelectedHistory mySelectedHistory =
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks);
MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false);
widget.myHistoryList.add(mySelectedHistory);
myHistoryList.add(mySelectedHistory);
}
}
});
@ -169,8 +167,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
isChecked: element.isChecked,
createdBy: element.createdBy,
remark: element.remarks,
isLocal : false,
selectedAllergySeverity: selectedAllergySeverity);
if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy);
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
});
}
}
@ -179,8 +178,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
widget.myAllergiesList.clear();
widget.myHistoryList.clear();
myAllergiesList.clear();
myHistoryList.clear();
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel(
patientMRN: widget.patientInfo.patientMRN,
@ -246,7 +245,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
});
},
child: Column(
children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)],
children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
),
isExpanded: isHistoryExpand,
),
@ -264,7 +263,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
child: Column(
children: [
UpdateAllergiesWidget(
myAllergiesList: widget.myAllergiesList,
myAllergiesList: myAllergiesList,
),
SizedBox(
height: 30,
@ -304,10 +303,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
loading: model.state == ViewState.BusyLocal,
// loading: model.state == ViewState.BusyLocal,
onPressed: () async {
addSubjectiveInfo(
model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList);
model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
},
),
),
@ -325,6 +324,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
addSubjectiveInfo(
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
if(FocusScope.of(context).hasFocus)
FocusScope.of(context).unfocus();
widget.changeLoadingState(true);
formKey.currentState.save();
formKey.currentState.validate();
@ -338,7 +340,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) {
@ -370,6 +371,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
medicationControllerError = TranslationBase.of(context).emptyMessage;
}
});
widget.changeLoadingState(false);
Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
}
}
@ -380,7 +383,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
widget.myAllergiesList.forEach((allergy) {
myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM(
@ -404,6 +407,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
await model.patchAllergy(postAllergyRequestModel);
}
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
@ -419,7 +425,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async {
PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: '');
widget.myHistoryList.forEach((history) {
myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: widget.patientInfo.patientMRN,

@ -31,11 +31,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List();
List<MySelectedExamination> mySelectedExamination = List();
List<MySelectedAssessment> mySelectedAssessment = List();
GetPatientProgressNoteResModel patientProgressNote =
GetPatientProgressNoteResModel();
changePageViewIndex(pageIndex,{isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState)
@ -65,12 +61,11 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
return BaseView<DoctorReplayViewModel>(
builder: (_, model, w) => AppScaffold(
isLoading: _isLoading,
isShowAppBar: false,
body: SingleChildScrollView(
child: SingleChildScrollView(
return AppScaffold(
isLoading: _isLoading,
isShowAppBar: false,
body: SingleChildScrollView(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -105,27 +100,22 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
UpdateSubjectivePage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateObjectivePage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
mySelectedExamination: mySelectedExamination,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
mySelectedAssessmentList: mySelectedAssessment,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdatePlanPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
patientProgressNote: patientProgressNote,
changeLoadingState: changeLoadingState)
],
),
@ -137,6 +127,6 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
),
),
),
));
);
}
}

@ -562,6 +562,7 @@ class TranslationBase {
localizedValues['no-priscription-listed'][locale.languageCode];
String get next => localizedValues['next'][locale.languageCode];
String get finish => localizedValues['finish'][locale.languageCode];
String get previous => localizedValues['previous'][locale.languageCode];

@ -1,421 +0,0 @@
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/new_text_Field.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/custom_validation_error.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'app_texts_widget.dart';
import 'dialogs/master_key_dailog.dart';
import 'divider_with_spaces_around.dart';
import 'expandable-widget-header-body.dart';
import 'text_fields/app-textfield-custom.dart';
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model;
final Function() addSelectedAllergy;
final Function(MasterKeyModel) removeAllergy;
final Function(MySelectedAllergy mySelectedAllergy) addAllergy;
final bool Function(MasterKeyModel) isServiceSelected;
final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy;
final List<MasterKeyModel> masterList;
final String buttonName;
final String hintSearchText;
MasterKeyCheckboxSearchAllergiesWidget(
{Key key,
this.model,
this.addSelectedAllergy,
this.removeAllergy,
this.masterList,
this.addAllergy,
this.isServiceSelected,
this.buttonName,
this.hintSearchText,
this.getServiceSelectedAllergy})
: super(key: key);
@override
_MasterKeyCheckboxSearchAllergiesWidgetState createState() =>
_MasterKeyCheckboxSearchAllergiesWidgetState();
}
class _MasterKeyCheckboxSearchAllergiesWidgetState
extends State<MasterKeyCheckboxSearchAllergiesWidget> {
List<MasterKeyModel> items = List();
MasterKeyModel _selectedAllergySeverity;
bool isSubmitted = false;
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
child: Column(
children: [
Expanded(
child: Container(
height: MediaQuery.of(context).size.height * 0.70,
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: Column(
children: [
AppTextFieldCustom(
// height:
// MediaQuery.of(context).size.height * 0.070,
hintText:
TranslationBase.of(context).selectAllergy,
isTextFieldHasSuffix: true,
hasBorder: false,
// controller: filteredSearchController,
onChanged: (value) {
filterSearchResults(value);
},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
)),
),
DividerWithSpacesAround(),
SizedBox(
height: 10,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Container(
height:
MediaQuery.of(context).size.height * 0.60,
child: ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
bool isSelected = widget
.isServiceSelected(items[index]);
MySelectedAllergy mySelectedAllergy;
if (isSelected) {
mySelectedAllergy =
widget.getServiceSelectedAllergy(
items[index]);
}
TextEditingController remarkController =
TextEditingController(
text: isSelected
? mySelectedAllergy.remark
: null);
TextEditingController severityController =
TextEditingController(
text: isSelected
? mySelectedAllergy
.selectedAllergySeverity !=
null
? projectViewModel
.isArabic
? mySelectedAllergy
.selectedAllergySeverity
.nameAr
: mySelectedAllergy
.selectedAllergySeverity
.nameEn
: null
: null);
return HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Checkbox(
value: widget
.isServiceSelected(
items[index]),
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {
if (widget
.isServiceSelected(
items[index])) {
widget.removeAllergy(
items[index]);
} else {
MySelectedAllergy
mySelectedAllergy =
new MySelectedAllergy(
selectedAllergy:
items[
index],
selectedAllergySeverity:
_selectedAllergySeverity,
remark: null,
isChecked:
true,
isExpanded:
true);
widget.addAllergy(
mySelectedAllergy);
}
});
}),
InkWell(
onTap: () {
setState(() {
if (widget
.isServiceSelected(
items[index])) {
widget.removeAllergy(
items[index]);
} else {
MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy(
selectedAllergy:
items[
index],
selectedAllergySeverity:
_selectedAllergySeverity,
remark: null,
isChecked: true,
isExpanded:
true);
widget.addAllergy(
mySelectedAllergy);
}
});
},
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Container(
child: AppText(
projectViewModel
.isArabic
? items[index]
.nameAr !=
""
? items[index]
.nameAr
: items[index]
.nameEn
: items[index]
.nameEn,
color:
Color(0xFF575757),
fontSize: 16,
fontWeight:
FontWeight.w600,
),
width:
MediaQuery.of(context)
.size
.width *
0.55,
),
),
),
],
),
InkWell(
onTap: () {
if (mySelectedAllergy !=
null) {
setState(() {
mySelectedAllergy
.isExpanded =
mySelectedAllergy
.isExpanded
? false
: true;
});
}
},
child: Icon((mySelectedAllergy !=
null
? mySelectedAllergy
.isExpanded
: false)
? EvaIcons
.arrowIosUpwardOutline
: EvaIcons
.arrowIosDownwardOutline))
],
),
bodyWidget: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
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;
},
);
}
: null,
isTextFieldHasSuffix: true,
hintText:
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,
),
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,
),
],
),
),
),
),
isExpand: mySelectedAllergy != null
? mySelectedAllergy.isExpanded
: false,
);
},
),
),
),
),
],
))),
),
),
SizedBox(
height: 10,
),
],
),
);
}
void filterSearchResults(String query) {
List<MasterKeyModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<MasterKeyModel> dummyListData = List();
dummySearchList.forEach((items) {
if (items.nameAr.toLowerCase().contains(query.toLowerCase()) ||
items.nameEn.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(items);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}

@ -27,6 +27,7 @@ class AppTextFieldCustom extends StatefulWidget {
final String validationError;
final bool isPrscription;
final bool isSecure;
final bool focus;
AppTextFieldCustom({
this.height = 0,
@ -47,6 +48,7 @@ class AppTextFieldCustom extends StatefulWidget {
this.validationError,
this.isPrscription = false,
this.isSecure = false,
this.focus = false,
});
@override
@ -54,6 +56,32 @@ class AppTextFieldCustom extends StatefulWidget {
}
class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
final FocusNode _focusNode = FocusNode();
bool focus = false;
bool view = false;
@override
void initState() {
super.initState();
_focusNode.addListener(() {
setState(() {
focus = _focusNode.hasFocus;
});
});
}
@override
void didUpdateWidget(AppTextFieldCustom oldWidget) {
if (widget.focus) _focusNode.requestFocus();
super.didUpdateWidget(oldWidget);
}
@override
void dispose() {
_focusNode.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -104,10 +132,11 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
widget.height != 0 && widget.maxLines == 1
? widget.height - 22
: null,
child: TextField(
child: TextFormField(
textAlign: projectViewModel.isArabic
? TextAlign.right
: TextAlign.left,
focusNode: _focusNode,
decoration: TextFieldsUtils
.textFieldSelectorDecoration(
widget.hintText, null, true),
@ -129,7 +158,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
? widget.inputFormatters
: [],
onChanged: (value) {
setState(() {});
// setState(() {});
if (widget.onChanged != null) {
widget.onChanged(value);
}
@ -162,9 +191,10 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
),
),
),
if (widget.validationError != null)
if (widget.validationError != null && widget.validationError.isNotEmpty)
TextFieldsError(error: widget.validationError),
],
);
}
}

@ -13,9 +13,9 @@ class CustomValidationError extends StatelessWidget {
@override
Widget build(BuildContext context) {
if(error == null )
error = TranslationBase
.of(context)
.emptyMessage;
error = TranslationBase
.of(context)
.emptyMessage;
return Column(
children: [
SizedBox(

Loading…
Cancel
Save