move bottom sheet to index page

episode_fixes
Elham Rababh 5 years ago
parent b341bd5f47
commit e58ce34aa4

@ -27,6 +27,10 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart
import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objectiveCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -86,6 +90,9 @@ class SOAPViewModel extends BaseViewModel {
_SOAPService.patientAssessmentList; _SOAPService.patientAssessmentList;
int get episodeID => _SOAPService.episodeID; int get episodeID => _SOAPService.episodeID;
bool isAddProgress = true;
String progressNoteText ="";
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
get medicationRouteList => _SOAPService.medicationRouteListWithModel; get medicationRouteList => _SOAPService.medicationRouteListWithModel;
@ -93,6 +100,43 @@ class SOAPViewModel extends BaseViewModel {
List<GetMedicationResponseModel> get allMedicationList => List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList; _prescriptionService.allMedicationList;
SubjectiveCallBack subjectiveCallBack;
setSubjectiveCallBack(SubjectiveCallBack callBack)
{
this.subjectiveCallBack = callBack;
}
nextOnSubjectPage(model){
subjectiveCallBack.nextFunction(model);
}
ObjectiveCallBack objectiveCallBack;
setObjectiveCallBack(ObjectiveCallBack callBack)
{
this.objectiveCallBack = callBack;
}
nextOnObjectivePage(model){
objectiveCallBack.nextFunction(model);
}
AssessmentCallBack assessmentCallBack;
setAssessmentCallBack(AssessmentCallBack callBack)
{
this.assessmentCallBack = callBack;
}
nextOnAssessmentPage(model){
assessmentCallBack.nextFunction(model);
}
PlanCallBack planCallBack;
setPlanCallBack(PlanCallBack callBack)
{
this.planCallBack = callBack;
}
nextOnPlanPage(model){
planCallBack.nextFunction(model);
}
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getAllergies(getAllergiesRequestModel); await _SOAPService.getAllergies(getAllergiesRequestModel);

@ -109,7 +109,7 @@ void setupLocator() {
locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => DashboardViewModel());
locator.registerFactory(() => SickLeaveViewModel()); locator.registerFactory(() => SickLeaveViewModel());
locator.registerFactory(() => SOAPViewModel()); locator.registerLazySingleton(() => SOAPViewModel());
locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PatientReferralViewModel());
locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => PrescriptionViewModel());
locator.registerFactory(() => ProcedureViewModel()); locator.registerFactory(() => ProcedureViewModel());

@ -251,6 +251,32 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
)), )),
)), )),
), ),
if(widget.mySelectedAssessment
.selectedICD != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery
.of(context)
.size
.width * 0.7,
child: AppText(
widget.mySelectedAssessment
.selectedICD.description +
(' (${widget.mySelectedAssessment
.selectedICD.code} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
),
],
),
SizedBox( SizedBox(
height: 7, height: 7,
), ),

@ -0,0 +1,3 @@
abstract class AssessmentCallBack{
nextFunction(model);
}

@ -25,6 +25,7 @@ import '../shared_soap_widgets/SOAP_open_items.dart';
import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/SOAP_step_header.dart';
import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart';
import 'add_assessment_details.dart'; import 'add_assessment_details.dart';
import 'assessmentCallBack.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget { class UpdateAssessmentPage extends StatefulWidget {
@ -44,7 +45,7 @@ class UpdateAssessmentPage extends StatefulWidget {
_UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState();
} }
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> { class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> implements AssessmentCallBack{
bool isAssessmentExpand = false; bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List(); List<MySelectedAssessment> mySelectedAssessmentList = List();
@ -54,6 +55,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setAssessmentCallBack(this);
mySelectedAssessmentList.clear(); mySelectedAssessmentList.clear();
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -525,16 +527,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// TODO Elham*
widget.changePageViewIndex(3);
// if (mySelectedAssessmentList.isEmpty) {
// Helpers.showErrorToast(
// TranslationBase.of(context)
// .assessmentErrorMsg);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(3);
// }
}, },
), ),
), ),
@ -577,4 +570,18 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
}); });
}); });
} }
@override
nextFunction(model) {
// TODO Elham*
widget.changePageViewIndex(3);
// if (mySelectedAssessmentList.isEmpty) {
// Helpers.showErrorToast(
// TranslationBase.of(context)
// .assessmentErrorMsg);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(3);
// }
}
} }

@ -0,0 +1,3 @@
abstract class ObjectiveCallBack{
nextFunction(model);
}

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objectiveCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -43,7 +44,7 @@ class UpdateObjectivePage extends StatefulWidget {
_UpdateObjectivePageState createState() => _UpdateObjectivePageState(); _UpdateObjectivePageState createState() => _UpdateObjectivePageState();
} }
class _UpdateObjectivePageState extends State<UpdateObjectivePage> { class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements ObjectiveCallBack {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List(); List<MySelectedExamination> mySelectedExamination = List();
@ -64,6 +65,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setObjectiveCallBack(this);
mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel( GetPhysicalExamReqModel(
@ -71,7 +73,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo: appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString())); int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
@ -204,70 +205,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
), ),
), ),
), ),
bottomSheet: Container( ),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
widget.changePageViewIndex(0);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
await submitUpdateObjectivePage(model);
},
),
),
],
),
),
),
),
SizedBox(
height: 5,
),
],
),
)),
); );
} }
@ -397,4 +335,9 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
), ),
); );
} }
@override
nextFunction(model) async {
await submitUpdateObjectivePage(model);
}
} }

@ -0,0 +1,3 @@
abstract class PlanCallBack{
nextFunction(model);
}

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
@ -9,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -40,7 +42,7 @@ class UpdatePlanPage extends StatefulWidget {
_UpdatePlanPageState createState() => _UpdatePlanPageState(); _UpdatePlanPageState createState() => _UpdatePlanPageState();
} }
class _UpdatePlanPageState extends State<UpdatePlanPage> { class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = true; bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel patientProgressNote =
@ -73,7 +75,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
} }
getPatientProgressNote(model, {bool isAddProgress = false}) async { getPatientProgressNote(SOAPViewModel model, {bool isAddProgress = false}) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel( GetGetProgressNoteReqModel(
appointmentNo: appointmentNo:
@ -83,11 +85,12 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await model.getPatientProgressNote(getGetProgressNoteReqModel);
///TODO set progressNote in model;
if (model.patientProgressNoteList.isNotEmpty) { if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString( progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote); model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName; model.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
@ -100,6 +103,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
model.patientProgressNoteList[0].appointmentNo; model.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = isAddProgress; isAddProgress = isAddProgress;
model.isAddProgress = isAddProgress;
}); });
} }
} }
@ -108,6 +112,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setPlanCallBack(this);
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel( GetGetProgressNoteReqModel(
appointmentNo: appointmentNo:
@ -135,6 +140,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false;
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState(false);
@ -320,84 +326,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
), ),
), ),
), ),)
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: Row(
children: [
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
widget.changePageViewIndex(2);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700],
disabled: progressNoteController.text.isEmpty,
onPressed: () async {
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
submitPlan(model);
} else {
Navigator.of(context).pop();
}
} else {
Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
}
},
),
),
],
),
),
),
),
SizedBox(
height: 5,
),
],
),
)),
); );
} }
@ -452,6 +381,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false;
}); });
} }
} }
@ -460,4 +390,20 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
} }
} }
@override
nextFunction(model) {
print("dfdfdf");
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
submitPlan(model);
} else {
Navigator.of(context).pop();
}
} else {
Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
}
}
} }

@ -49,7 +49,7 @@ class _AddMedicationState extends State<AddMedication> {
GetMedicationResponseModel _selectedMedication; GetMedicationResponseModel _selectedMedication;
GlobalKey key = GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>(); new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@override @override
@ -57,387 +57,440 @@ class _AddMedicationState extends State<AddMedication> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return FractionallySizedBox( return FractionallySizedBox(
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.medicationStrengthList.length == 0) { if (model.medicationStrengthList.length == 0) {
await model.getMasterLookup( await model.getMasterLookup(
MasterKeysService.MedicationStrength, MasterKeysService.MedicationStrength,
); );
} }
if (model.medicationFrequencyList.length == 0) { if (model.medicationFrequencyList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationFrequency); await model.getMasterLookup(
} MasterKeysService.MedicationFrequency);
if (model.medicationDoseTimeList.length == 0) { }
await model.getMasterLookup(MasterKeysService.MedicationDoseTime); if (model.medicationDoseTimeList.length == 0) {
} await model.getMasterLookup(MasterKeysService.MedicationDoseTime);
if (model.medicationRouteList.length == 0) { }
await model.getMasterLookup(MasterKeysService.MedicationRoute); if (model.medicationRouteList.length == 0) {
} await model.getMasterLookup(MasterKeysService.MedicationRoute);
if (model.allMedicationList.length == 0) }
await model.getMedicationList(); if (model.allMedicationList.length == 0)
}, await model.getMedicationList();
builder: (_, model, w) => AppScaffold( },
baseViewModel: model, builder: (_, model, w) =>
isShowAppBar: true, AppScaffold(
appBar: BottomSheetTitle( baseViewModel: model,
title: TranslationBase.of(context).addMedication, isShowAppBar: true,
), appBar: BottomSheetTitle(
body: Center( title: TranslationBase
child: Container( .of(context)
child: Column( .addMedication,
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ body: Center(
SizedBox( child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10, height: 10,
), ),
Expanded( Expanded(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?2:2), height: SizeConfig.heightMultiplier * (
), SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?
Container( 2:2),
// height: screenSize.height * 0.070, ),
child: InkWell( Container(
onTap: model.allMedicationList != null // height: screenSize.height * 0.070,
? () { child: InkWell(
setState(() { onTap: model.allMedicationList != null
_selectedMedication = null; ? () {
}); setState(() {
} _selectedMedication = null;
: null, });
child: _selectedMedication == null }
? CustomAutoCompleteTextField( : null,
isShowError: isFormSubmitted && child: _selectedMedication == null
_selectedMedication == null, ? CustomAutoCompleteTextField(
child: AutoCompleteTextField< isShowError: isFormSubmitted &&
GetMedicationResponseModel>( _selectedMedication == null,
decoration: TextFieldsUtils child: AutoCompleteTextField<
.textFieldSelectorDecoration( GetMedicationResponseModel>(
TranslationBase.of( decoration: TextFieldsUtils
context) .textFieldSelectorDecoration(
.searchMedicineNameHere, TranslationBase
null, .of(
true, context)
suffixIcon: .searchMedicineNameHere,
Icons.search), null,
itemSubmitted: (item) => true,
setState(() => suffixIcon:
_selectedMedication = Icons.search),
item), itemSubmitted: (item) =>
key: key, setState(() =>
suggestions: _selectedMedication =
model.allMedicationList, item),
itemBuilder: (context, key: key,
suggestion) => suggestions:
new Padding( model.allMedicationList,
child: AppText(suggestion itemBuilder: (context,
.description + suggestion) =>
'/' + new Padding(
suggestion child: AppText(suggestion
.genericName), .description +
padding: '/' +
EdgeInsets.all( suggestion
8.0)), .genericName),
itemSorter: (a, b) => 1, padding:
itemFilter: (suggestion, EdgeInsets.all(
input) => 8.0)),
suggestion.genericName.toLowerCase().startsWith(input.toLowerCase()) || itemSorter: (a, b) => 1,
suggestion.description itemFilter: (suggestion,
.toLowerCase() input) =>
.startsWith(input suggestion.genericName.toLowerCase()
.toLowerCase()) || .startsWith(input.toLowerCase()) ||
suggestion.keywords suggestion.description
.toLowerCase() .toLowerCase()
.startsWith(input .startsWith(input
.toLowerCase()), .toLowerCase()) ||
), suggestion.keywords
) .toLowerCase()
: AppTextFieldCustom( .startsWith(input
height: Helpers.getTextFieldHeight(), .toLowerCase()),
hintText: _selectedMedication != ),
null )
? _selectedMedication : AppTextFieldCustom(
.description + height: Helpers.getTextFieldHeight(),
(' (${_selectedMedication.genericName} )') hintText: _selectedMedication !=
: TranslationBase.of( null
context) ? _selectedMedication
.searchMedicineNameHere, .description +
minLines: 1, (' (${_selectedMedication.genericName} )')
maxLines: 1, : TranslationBase
isTextFieldHasSuffix: true, .of(
suffixIcon: IconButton( context)
icon: Icon( .searchMedicineNameHere,
Icons.search, minLines: 1,
color: Colors.grey.shade600, maxLines: 1,
)), isTextFieldHasSuffix: true,
enabled: false, suffixIcon: IconButton(
), icon: Icon(
), Icons.search,
), color: Colors.grey.shade600,
SizedBox( )),
height: 5, enabled: false,
), ),
AppTextFieldCustom( ),
height: Helpers.getTextFieldHeight(), ),
enabled: false,
onClick: model.medicationDoseTimeList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model
.medicationDoseTimeList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationDose,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationDose =
selectedValue;
doseController if(_selectedMedication != null)
.text = projectViewModel Column(
.isArabic children: [
? _selectedMedicationDose SizedBox(
.nameAr height: 3,
: _selectedMedicationDose ),
.nameEn; Container(
}); width: MediaQuery
}, .of(context)
); .size
showDialog( .width * 0.7,
barrierDismissible: false, child: AppText(
context: context, _selectedMedication.description +
builder: (' (${_selectedMedication.genericName} )'),
(BuildContext context) { color: Color(0xFF575757),
return dialog; fontSize: 10,
}, fontWeight: FontWeight.w700,
); letterSpacing: -0.4,
} ),
: null, ),
hintText: ],
TranslationBase.of(context).doseTime, ),
maxLines: 1, SizedBox(
minLines: 1, height: 5,
isTextFieldHasSuffix: true, ),
controller: doseController, AppTextFieldCustom(
validationError: isFormSubmitted && height: Helpers.getTextFieldHeight(),
_selectedMedicationDose == null enabled: false,
? TranslationBase.of(context) onClick: model.medicationDoseTimeList !=
.emptyMessage null
: null, ? () {
), MasterKeyDailog dialog =
SizedBox( MasterKeyDailog(
height: 5, list: model
), .medicationDoseTimeList,
AppTextFieldCustom( okText:
height: Helpers.getTextFieldHeight(), TranslationBase
enabled: false, .of(context)
isTextFieldHasSuffix: true, .ok,
onClick: model.medicationStrengthList != selectedValue:
null _selectedMedicationDose,
? () { okFunction: (selectedValue) {
MasterKeyDailog dialog = setState(() {
MasterKeyDailog( _selectedMedicationDose =
list: model selectedValue;
.medicationStrengthList,
okText:
TranslationBase.of(context)
.ok,
selectedValue:
_selectedMedicationStrength,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
strengthController doseController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationStrength ? _selectedMedicationDose
.nameAr .nameAr
: _selectedMedicationStrength : _selectedMedicationDose
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder:
(BuildContext context) { (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).strength, TranslationBase
maxLines: 1, .of(context)
minLines: 1, .doseTime,
controller: strengthController, maxLines: 1,
validationError: isFormSubmitted && minLines: 1,
_selectedMedicationStrength == isTextFieldHasSuffix: true,
null controller: doseController,
? TranslationBase.of(context) validationError: isFormSubmitted &&
.emptyMessage _selectedMedicationDose == null
: null, ? TranslationBase
), .of(context)
SizedBox( .emptyMessage
height: 5, : null,
), ),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: Helpers.getTextFieldHeight(), height: Helpers.getTextFieldHeight(),
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
onClick: model.medicationRouteList != null onClick: model.medicationStrengthList !=
? () { null
MasterKeyDailog dialog = ? () {
MasterKeyDailog( MasterKeyDailog dialog =
list: model.medicationRouteList, MasterKeyDailog(
selectedValue: list: model
_selectedMedicationRoute, .medicationStrengthList,
okText: okText:
TranslationBase.of(context) TranslationBase
.ok, .of(context)
okFunction: (selectedValue) { .ok,
setState(() { selectedValue:
_selectedMedicationRoute = _selectedMedicationStrength,
selectedValue; okFunction: (selectedValue) {
setState(() {
_selectedMedicationStrength =
selectedValue;
routeController strengthController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationRoute ? _selectedMedicationStrength
.nameAr .nameAr
: _selectedMedicationRoute : _selectedMedicationStrength
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder:
(BuildContext context) { (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).route, TranslationBase
maxLines: 1, .of(context)
minLines: 1, .strength,
controller: routeController, maxLines: 1,
validationError: isFormSubmitted && minLines: 1,
_selectedMedicationRoute == null controller: strengthController,
? TranslationBase.of(context) validationError: isFormSubmitted &&
.emptyMessage _selectedMedicationStrength ==
: null, null
), ? TranslationBase
SizedBox( .of(context)
height: 5, .emptyMessage
), : null,
SizedBox( ),
height: 5, SizedBox(
), height: 5,
AppTextFieldCustom( ),
height: Helpers.getTextFieldHeight(), SizedBox(
onClick: model.medicationFrequencyList != height: 5,
null ),
? () { AppTextFieldCustom(
MasterKeyDailog dialog = height: Helpers.getTextFieldHeight(),
MasterKeyDailog( enabled: false,
list: model isTextFieldHasSuffix: true,
.medicationFrequencyList, onClick: model.medicationRouteList != null
okText: ? () {
TranslationBase.of(context) MasterKeyDailog dialog =
.ok, MasterKeyDailog(
selectedValue: list: model.medicationRouteList,
_selectedMedicationFrequency, selectedValue:
okFunction: (selectedValue) { _selectedMedicationRoute,
setState(() { okText:
_selectedMedicationFrequency = TranslationBase
selectedValue; .of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
_selectedMedicationRoute =
selectedValue;
frequencyController routeController
.text = projectViewModel .text = projectViewModel
.isArabic .isArabic
? _selectedMedicationFrequency ? _selectedMedicationRoute
.nameAr .nameAr
: _selectedMedicationFrequency : _selectedMedicationRoute
.nameEn; .nameEn;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder:
(BuildContext context) { (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).frequency, TranslationBase
enabled: false, .of(context)
maxLines: 1, .route,
minLines: 1, maxLines: 1,
isTextFieldHasSuffix: true, minLines: 1,
controller: frequencyController, controller: routeController,
validationError: isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationFrequency == _selectedMedicationRoute == null
null ? TranslationBase
? TranslationBase.of(context) .of(context)
.emptyMessage .emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?20:SizeConfig.isHeightShort?15:10), height: 5,
), ),
SizedBox(
height: 5,
),
AppTextFieldCustom(
height: Helpers.getTextFieldHeight(),
onClick: model.medicationFrequencyList !=
null
? () {
MasterKeyDailog dialog =
MasterKeyDailog(
list: model
.medicationFrequencyList,
okText:
TranslationBase
.of(context)
.ok,
selectedValue:
_selectedMedicationFrequency,
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:
TranslationBase
.of(context)
.frequency,
enabled: false,
maxLines: 1,
minLines: 1,
isTextFieldHasSuffix: true,
controller: frequencyController,
validationError: isFormSubmitted &&
_selectedMedicationFrequency ==
null
? TranslationBase
.of(context)
.emptyMessage
: null,
),
SizedBox(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 20 : SizeConfig
.isHeightShort ? 15 : 10),
),
],
), ),
]), )),
), ),
), ]),
bottomSheet: model.state != ViewState.Idle ),
? Container( ),
height: 0, bottomSheet: model.state != ViewState.Idle
) ? Container(
: BottomSheetDialogButton( height: 0,
label: )
TranslationBase.of(context).addMedication, : BottomSheetDialogButton(
onTap: () { label:
setState(() { TranslationBase.of(context).addMedication,
isFormSubmitted = true; onTap: () {
}); setState(() {
if (_selectedMedication != null && isFormSubmitted = true;
_selectedMedicationDose != null && });
_selectedMedicationStrength != null && if (_selectedMedication != null &&
_selectedMedicationRoute != null && _selectedMedicationDose != null &&
_selectedMedicationFrequency != null) { _selectedMedicationStrength != null &&
widget.medicationController.text = widget _selectedMedicationRoute != null &&
.medicationController.text + _selectedMedicationFrequency != null) {
'${_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'; widget.medicationController.text = widget
Navigator.of(context).pop(); .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();
)), }
), },
)
)
,
)
,
); );
} }
} }

@ -0,0 +1,3 @@
abstract class SubjectiveCallBack{
Function nextFunction(model);
}

@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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_scaffold_widget.dart';
@ -46,7 +47,8 @@ class UpdateSubjectivePage extends StatefulWidget {
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
} }
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> { class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
implements SubjectiveCallBack {
bool isChiefExpand = false; bool isChiefExpand = false;
bool isHistoryExpand = false; bool isHistoryExpand = false;
bool isAllergiesExpand = false; bool isAllergiesExpand = false;
@ -208,7 +210,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
onModelReady: (model) async { onModelReady: (model) async {
myAllergiesList.clear(); myAllergiesList.clear();
myHistoryList.clear(); myHistoryList.clear();
model.setSubjectiveCallBack(this);
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel( GetChiefComplaintReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -270,7 +272,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 4 : 2), (SizeConfig.isHeightVeryShort ? 4 : 2),
), ),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).histories, headerTitle: TranslationBase.of(context).histories,
@ -312,57 +314,14 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
isExpanded: isAllergiesExpand, isExpanded: isAllergiesExpand,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 20 : 10), (SizeConfig.isHeightVeryShort ? 20 : 10),
), ),
], ],
), ),
), ),
), ),
), ),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
color: Colors.red[700],
onPressed: () async {
addSubjectiveInfo(
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
},
),
),
),
),
SizedBox(
height: 5,
),
],
),
),
), ),
); );
} }
@ -371,7 +330,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
{SOAPViewModel model, {SOAPViewModel model,
List<MySelectedAllergy> myAllergiesList, List<MySelectedAllergy> myAllergiesList,
List<MySelectedHistory> myHistoryList}) async { List<MySelectedHistory> myHistoryList}) async {
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
widget.changeLoadingState(true); widget.changeLoadingState(true);
formKey.currentState.save(); formKey.currentState.save();
@ -380,50 +338,54 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
complaintsControllerError = ''; complaintsControllerError = '';
medicationControllerError = ''; medicationControllerError = '';
illnessControllerError = ''; illnessControllerError = '';
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) {
await postChiefComplaint(model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
if (myAllergiesList.length != 0) {
await postAllergy(myAllergiesList: myAllergiesList, model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
widget.changeLoadingState(true);
widget.changePageViewIndex(1);
} else {
setState(() {
if (complaintsController.text.isEmpty) {
complaintsControllerError = TranslationBase.of(context).emptyMessage;
} else if (complaintsController.text.length < 25) {
complaintsControllerError =
TranslationBase.of(context).chiefComplaintLength;
}
if (illnessController.text.isEmpty) {
illnessControllerError = TranslationBase.of(context).emptyMessage;
}
if (medicationController.text.isEmpty) { ///TODO Elham*
medicationControllerError = TranslationBase.of(context).emptyMessage; ///
} widget.changePageViewIndex(1);
}); // if (complaintsController.text.isNotEmpty &&
// illnessController.text.isNotEmpty &&
widget.changeLoadingState(false); // complaintsController.text.length > 25) {
Helpers.showErrorToast( // await postChiefComplaint(model: model);
TranslationBase.of(context).chiefComplaintErrorMsg); // if (model.state == ViewState.ErrorLocal) {
} // Helpers.showErrorToast(model.error);
// }
// if (myHistoryList.length != 0) {
// await postHistories(model: model, myHistoryList: myHistoryList);
// if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error);
// }
// }
// if (myAllergiesList.length != 0) {
// await postAllergy(myAllergiesList: myAllergiesList, model: model);
// if (model.state == ViewState.ErrorLocal) {
// Helpers.showErrorToast(model.error);
// }
// }
// widget.changeLoadingState(true);
//
// widget.changePageViewIndex(1);
// } else {
// setState(() {
// if (complaintsController.text.isEmpty) {
// complaintsControllerError = TranslationBase.of(context).emptyMessage;
// } else if (complaintsController.text.length < 25) {
// complaintsControllerError =
// TranslationBase.of(context).chiefComplaintLength;
// }
//
// if (illnessController.text.isEmpty) {
// illnessControllerError = TranslationBase.of(context).emptyMessage;
// }
//
// if (medicationController.text.isEmpty) {
// medicationControllerError = TranslationBase.of(context).emptyMessage;
// }
// });
//
// widget.changeLoadingState(false);
// Helpers.showErrorToast(
// TranslationBase.of(context).chiefComplaintErrorMsg);
// }
} }
postAllergy( postAllergy(
@ -528,4 +490,12 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
} }
} }
} }
@override
Function nextFunction(model) {
addSubjectiveInfo(
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
}
} }

@ -1,3 +1,6 @@
import 'package:doctor_app_flutter/config/size_config.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/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart';
@ -6,10 +9,13 @@ import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_histor
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'assessment/update_assessment_page.dart'; import 'assessment/update_assessment_page.dart';
import 'objective/update_objective_page.dart'; import 'objective/update_objective_page.dart';
@ -31,10 +37,8 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
List<MySelectedAllergy> myAllergiesList = List(); List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List(); List<MySelectedHistory> myHistoryList = List();
changePageViewIndex(pageIndex, {isChangeState = true}) {
changePageViewIndex(pageIndex,{isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
if (pageIndex != _currentIndex && isChangeState)
changeLoadingState(true);
_controller.jumpToPage(pageIndex); _controller.jumpToPage(pageIndex);
setState(() { setState(() {
_currentIndex = pageIndex; _currentIndex = pageIndex;
@ -60,65 +64,244 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
return AppScaffold( return BaseView<SOAPViewModel>(
isLoading: _isLoading, builder: (_,model,w)=>AppScaffold(
isShowAppBar: true, isLoading: _isLoading,
appBar: PatientProfileAppBar(patient), isShowAppBar: true,
body: SingleChildScrollView( appBar: PatientProfileAppBar(patient),
child: Column( body: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: [
decoration: BoxDecoration( Container(
boxShadow: <BoxShadow>[], decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor), boxShadow: <BoxShadow>[],
child: Column( color: Theme.of(context).scaffoldBackgroundColor),
mainAxisAlignment: MainAxisAlignment.start, child: Column(
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container( Container(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).scaffoldBackgroundColor,
height: MediaQuery.of(context).size.height * 0.73, height: MediaQuery.of(context).size.height * 0.73,
child: PageView( child: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
controller: _controller, controller: _controller,
onPageChanged: (index) { onPageChanged: (index) {
setState(() { setState(() {
_currentIndex = index; _currentIndex = index;
}); });
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
UpdateSubjectivePage( UpdateSubjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateObjectivePage( UpdateObjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateAssessmentPage( UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdatePlanPage( UpdatePlanPage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState) changeLoadingState: changeLoadingState)
], ],
), ),
) )
], ],
),
), ),
],
),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
), ),
], border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: getBottomSheet(model)
),
),
SizedBox(
height: 5,
),
],
),
), ),
), ),
); );
} }
Widget getBottomSheet(SOAPViewModel model) {
switch (_currentIndex) {
case 0:
{
return Center(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
color: Colors.red[700],
onPressed: () async {
model.nextOnSubjectPage(model);
},
),
);
}
break;
case 1:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
changePageViewIndex(0);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
await model.nextOnObjectivePage(model);
},
),
),
],
),
);
}
break;
case 2:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(1);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
model.nextOnAssessmentPage(model);
},
),
),
],
),
);
}
break;
case 3:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(2);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: model.isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700],
disabled: model.progressNoteText.isEmpty,
onPressed: () async {
model.nextOnPlanPage(model);
},
),
),
],
),
);
}
break;
}
}
} }

@ -552,6 +552,6 @@ class PatientProfileAppBar extends StatelessWidget
@override @override
Size get preferredSize => Size get preferredSize =>
Size(double.maxFinite, height == 0 Size(double.maxFinite, height == 0
? isInpatient ? (isFromLabResult?200:170) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?180: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) ? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20)
: height); : height);
} }

Loading…
Cancel
Save