Merge branch 'soap_refactor' into 'development'
Soap refactor See merge request Cloud_Solution/doctor_app_flutter!513merge-requests/515/merge
commit
43c254de05
@ -0,0 +1,148 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/master_lookup_key.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_examination.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.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';
|
||||
import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import 'examinations_list_search_widget.dart';
|
||||
|
||||
class AddExaminationPage extends StatefulWidget {
|
||||
final List<MySelectedExamination> mySelectedExamination;
|
||||
final Function addSelectedExamination;
|
||||
final Function(MasterKeyModel) removeExamination;
|
||||
|
||||
AddExaminationPage(
|
||||
{this.mySelectedExamination,
|
||||
this.addSelectedExamination,
|
||||
this.removeExamination});
|
||||
|
||||
@override
|
||||
_AddExaminationPageState createState() => _AddExaminationPageState();
|
||||
}
|
||||
|
||||
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,
|
||||
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: Column(
|
||||
children: [
|
||||
ExaminationsListSearchWidget(
|
||||
masterList: model.physicalExaminationList,
|
||||
isServiceSelected: (master) =>
|
||||
isServiceSelected(master),
|
||||
removeHistory: (history) {
|
||||
setState(() {
|
||||
widget.removeExamination(history);
|
||||
});
|
||||
},
|
||||
addHistory: (selectedExamination) {
|
||||
setState(() {
|
||||
widget.mySelectedExamination
|
||||
.add(selectedExamination);
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
color: Colors.white,
|
||||
child: BorderedButton(
|
||||
"${TranslationBase.of(context).addExamination}",
|
||||
backgroundColor: HexColor("#359846"),
|
||||
textColor: Colors.white,
|
||||
vPadding: 12,
|
||||
radius: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: SizeConfig.textMultiplier * 2.5,
|
||||
fontFamily: 'Poppins',
|
||||
handler: () {
|
||||
widget.addSelectedExamination();
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
isServiceSelected(MasterKeyModel masterKey) {
|
||||
Iterable<MySelectedExamination> exam = widget.mySelectedExamination.where(
|
||||
(element) =>
|
||||
masterKey.id == element.selectedExamination.id &&
|
||||
masterKey.typeId == element.selectedExamination.typeId);
|
||||
if (exam.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
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/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'add_examination_widget.dart';
|
||||
|
||||
class ExaminationsListSearchWidget extends StatefulWidget {
|
||||
final Function(MasterKeyModel) removeHistory;
|
||||
final Function(MySelectedExamination) addHistory;
|
||||
final bool Function(MasterKeyModel) isServiceSelected;
|
||||
final List<MasterKeyModel> masterList;
|
||||
|
||||
ExaminationsListSearchWidget(
|
||||
{this.removeHistory,
|
||||
this.addHistory,
|
||||
this.isServiceSelected,
|
||||
this.masterList});
|
||||
|
||||
@override
|
||||
_ExaminationsListSearchWidgetState createState() =>
|
||||
_ExaminationsListSearchWidgetState();
|
||||
}
|
||||
|
||||
class _ExaminationsListSearchWidgetState
|
||||
extends State<ExaminationsListSearchWidget> {
|
||||
int expandedIndex = -1;
|
||||
List<MasterKeyModel> items = List();
|
||||
TextEditingController filteredSearchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
items.addAll(widget.masterList);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
AppTextFieldCustom(
|
||||
height: MediaQuery.of(context).size.height * 0.080,
|
||||
hintText: TranslationBase.of(context).searchExamination,
|
||||
isDropDown: true,
|
||||
hasBorder: false,
|
||||
controller: filteredSearchController,
|
||||
onChanged: (value) {
|
||||
filterSearchResults(value);
|
||||
},
|
||||
suffixIcon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
DividerWithSpacesAround(
|
||||
height: 2,
|
||||
),
|
||||
...items.mapIndexed((index, item) {
|
||||
return AddExaminationWidget(
|
||||
item: item,
|
||||
addHistory: widget.addHistory,
|
||||
removeHistory: widget.removeHistory,
|
||||
isServiceSelected: widget.isServiceSelected,
|
||||
isExpand: index == expandedIndex,
|
||||
expandClick: () {
|
||||
setState(() {
|
||||
if (expandedIndex == index) {
|
||||
expandedIndex = -1;
|
||||
} else {
|
||||
expandedIndex = index;
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void filterSearchResults(String query) {
|
||||
List<MasterKeyModel> dummySearchList = List();
|
||||
dummySearchList.addAll(widget.masterList);
|
||||
if (query.isNotEmpty) {
|
||||
List<MasterKeyModel> dummyListData = List();
|
||||
dummySearchList.forEach((item) {
|
||||
if (item.nameAr.toLowerCase().contains(query.toLowerCase()) ||
|
||||
item.nameEn.toLowerCase().contains(query.toLowerCase())) {
|
||||
dummyListData.add(item);
|
||||
}
|
||||
});
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(dummyListData);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
setState(() {
|
||||
items.clear();
|
||||
items.addAll(widget.masterList);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension FicListExtension<T> on List<T> {
|
||||
/// Maps each element of the list.
|
||||
/// The [map] function gets both the original [item] and its [index].
|
||||
Iterable<E> mapIndexed<E>(E Function(int index, T item) map) sync* {
|
||||
for (var index = 0; index < length; index++) {
|
||||
yield map(index, this[index]);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
@ -1,6 +1,5 @@
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class BottomSheetTitle extends StatelessWidget {
|
||||
const BottomSheetTitle({
|
@ -1,10 +1,10 @@
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/medication/update_medication_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../custom_validation_error.dart';
|
||||
import '../../../../../../widgets/shared/user-guid/custom_validation_error.dart';
|
||||
import '../medication/update_medication_widget.dart';
|
||||
|
||||
class UpdateChiefComplaints extends StatelessWidget {
|
||||
const UpdateChiefComplaints({
|
@ -0,0 +1,54 @@
|
||||
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../shared_soap_widgets/SOAP_open_items.dart';
|
||||
import 'add_medication.dart';
|
||||
|
||||
class UpdateMedicationWidget extends StatefulWidget {
|
||||
final TextEditingController medicationController;
|
||||
|
||||
UpdateMedicationWidget({
|
||||
Key key,
|
||||
this.medicationController,
|
||||
});
|
||||
|
||||
@override
|
||||
_UpdateMedicationWidgetState createState() => _UpdateMedicationWidgetState();
|
||||
}
|
||||
|
||||
class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
SOAPOpenItems(label: "${TranslationBase.of(context).addMedication}",onTap: () {
|
||||
openMedicationList(context);
|
||||
|
||||
},),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
openMedicationList(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
backgroundColor: Colors.white,
|
||||
isScrollControlled: true,
|
||||
isDismissible: false,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AddMedication(
|
||||
addMedicationFun: (MySelectedAllergy mySelectedAllergy) {},
|
||||
medicationController: widget.medicationController,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
||||
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
|
||||
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart';
|
||||
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../SOAP_open_items.dart';
|
||||
import '../../custom_validation_error.dart';
|
||||
import '../bottom_sheet_title.dart';
|
||||
import 'add_medication.dart';
|
||||
|
||||
class UpdateMedicationWidget extends StatefulWidget {
|
||||
final TextEditingController medicationController;
|
||||
|
||||
UpdateMedicationWidget({
|
||||
Key key,
|
||||
this.medicationController,
|
||||
});
|
||||
|
||||
@override
|
||||
_UpdateMedicationWidgetState createState() => _UpdateMedicationWidgetState();
|
||||
}
|
||||
|
||||
class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
||||
SOAPOpenItems(label: "${TranslationBase.of(context).addMedication}",onTap: () {
|
||||
openMedicationList(context);
|
||||
|
||||
},),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
openMedicationList(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
backgroundColor: Colors.white,
|
||||
isScrollControlled: true,
|
||||
isDismissible: false,
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AddMedication(
|
||||
addMedicationFun: (MySelectedAllergy mySelectedAllergy) {},
|
||||
medicationController: widget.medicationController,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue