history list ready

pull/190/head
Elham Rababah 5 years ago
parent df68e912b5
commit 405ad731c7

@ -6,10 +6,28 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class SOAPService extends BaseService { class SOAPService extends BaseService {
List<MasterKeyModel> get listOfAllergies => _listOfAllergies; List<MasterKeyModel> get listOfAllergies => _listOfAllergies;
List<MasterKeyModel> get allergySeverityList => _allergySeverityList;
List<MasterKeyModel> _listOfAllergies = []; List<MasterKeyModel> _listOfAllergies = [];
List<MasterKeyModel> get allergySeverityList => _allergySeverityList;
List<MasterKeyModel> _allergySeverityList = []; List<MasterKeyModel> _allergySeverityList = [];
List<MasterKeyModel> get historyFamilyList => _historyFamilyList;
List<MasterKeyModel> _historyFamilyList = [];
List<MasterKeyModel> get historyMedicalList => _historyMedicalList;
List<MasterKeyModel> _historyMedicalList = [];
List<MasterKeyModel> get historySportList => _historySportList;
List<MasterKeyModel> _historySportList = [];
List<MasterKeyModel> get historySocialList => _historySocialList;
List<MasterKeyModel> _historySocialList = [];
List<MasterKeyModel> get historySurgicalList => _historySurgicalList;
List<MasterKeyModel> _historySurgicalList = [];
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
await baseAppClient.post( await baseAppClient.post(
GET_ALLERGIES, GET_ALLERGIES,
@ -51,19 +69,38 @@ class SOAPService extends BaseService {
}); });
break; break;
case MasterKeysService.HistoryFamily: case MasterKeysService.HistoryFamily:
return 36; _historyFamilyList.clear();
entryList.forEach((v) {
_historyFamilyList
.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.HistoryMedical: case MasterKeysService.HistoryMedical:
return 37; _historyMedicalList.clear();
entryList.forEach((v) {
_historyMedicalList
.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.HistorySocial: case MasterKeysService.HistorySocial:
return 38; historySocialList.clear();
entryList.forEach((v) {
historySocialList
.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.HistorySports: case MasterKeysService.HistorySports:
return 39; _historySportList.clear();
break; entryList.forEach((v) {
_historySportList
.add(MasterKeyModel.fromJson(v));
}); break;
case MasterKeysService.HistorySurgical: case MasterKeysService.HistorySurgical:
return 66; _historySurgicalList.clear();
entryList.forEach((v) {
_historySurgicalList
.add(MasterKeyModel.fromJson(v));
});
break; break;
case MasterKeysService.PhysicalExamination: case MasterKeysService.PhysicalExamination:
return 59; return 59;

@ -12,7 +12,22 @@ class SOAPViewModel extends BaseViewModel {
SOAPService _SOAPService = locator<SOAPService>(); SOAPService _SOAPService = locator<SOAPService>();
List<MasterKeyModel> get listOfAllergies => _SOAPService.listOfAllergies; List<MasterKeyModel> get listOfAllergies => _SOAPService.listOfAllergies;
List<MasterKeyModel> get allergySeverityList => _SOAPService.allergySeverityList;
List<MasterKeyModel> get allergySeverityList =>
_SOAPService.allergySeverityList;
List<MasterKeyModel> get historyFamilyList => _SOAPService.historyFamilyList;
List<MasterKeyModel> get historyMedicalList => _SOAPService.historyMedicalList;
List<MasterKeyModel> get historySportList => _SOAPService.historySportList;
List<MasterKeyModel> get historySocialList => _SOAPService.historySocialList;
List<MasterKeyModel> get historySurgicalList => _SOAPService.historySurgicalList;
List<MasterKeyModel> get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList];
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);

@ -168,10 +168,10 @@ class _AddAllergiesState extends State<AddAllergies> {
heightFactor: 0.7, heightFactor: 0.7,
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.listOfAllergies == null) { if (model.listOfAllergies.length == 0) {
await model.getMasterLookup(MasterKeysService.Allergies); await model.getMasterLookup(MasterKeysService.Allergies);
} }
if (model.allergySeverityList == null) { if (model.allergySeverityList.length == 0) {
await model.getMasterLookup(MasterKeysService.AllergySeverity); await model.getMasterLookup(MasterKeysService.AllergySeverity);
} }
}, },

@ -116,7 +116,7 @@ class _AddHistoryWidgetState extends State<AddHistoryWidget>
isScrollControlled: true, isScrollControlled: true,
context: context, context: context,
builder: (context) { builder: (context) {
return AddHistoryDialog(); return AddHistoryDialog(changePageViewIndex:changePageViewIndex, controller: _controller,);
}); });
} }
} }
@ -218,11 +218,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
heightFactor: 0.7, heightFactor: 0.7,
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
// if (model.listOfAllergies == null) { if (model.historyFamilyList.length == 0) {
await model.getMasterLookup(MasterKeysService.Allergies); await model.getMasterLookup(MasterKeysService.HistoryFamily);
// }
if (model.allergySeverityList == null) {
await model.getMasterLookup(MasterKeysService.AllergySeverity);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -237,8 +234,19 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
PriorityBar(onTap: (activePriority) { PriorityBar(onTap: (activePriority) async {
widget.changePageViewIndex(activePriority); widget.changePageViewIndex(activePriority);
if(activePriority ==1) {
if (model.historySurgicalList.length == 0) {
await model.getMasterLookup(MasterKeysService.HistorySurgical);
await model.getMasterLookup(MasterKeysService.HistorySports);
}
}
if(activePriority ==2) {
if (model.historyMedicalList.length == 0) {
await model.getMasterLookup(MasterKeysService.HistoryMedical);
}
}
}), }),
SizedBox( SizedBox(
height: 20, height: 20,
@ -254,7 +262,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Column( Container(
child: Column(
children: [ children: [
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
@ -270,6 +279,9 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
child: ListView( child: ListView(
children: [ children: [
Column( Column(
children: model.historyFamilyList
.map((historyInfo) {
return Column(
children: [ children: [
Row( Row(
children: [ children: [
@ -277,193 +289,169 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
value: true, value: true,
activeColor: activeColor:
Colors.red[800], Colors.red[800],
onChanged: (bool newValue) { onChanged:
(bool newValue) {
setState(() {}); setState(() {});
}), }),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets padding:
const EdgeInsets
.symmetric( .symmetric(
horizontal: 10, horizontal: 10,
vertical: 0), vertical: 0),
child: Texts('History', child: Texts(
historyInfo.nameEn,
variant: "bodyText", variant: "bodyText",
bold: true, bold: true,
color: Colors.black), color:
Colors.black),
), ),
), ),
], ],
), ),
DividerWithSpacesAround(), DividerWithSpacesAround(),
Row(
children: [
Checkbox(
value: true,
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts('History',
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
], ],
);
}).toList(),
), ),
DividerWithSpacesAround(), ],
Row(
children: [
Checkbox(
value: true,
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts('History',
variant: "bodyText",
bold: true,
color: Colors.black),
), ),
)),
), ),
],
), ),
DividerWithSpacesAround(), SizedBox(
Row( height: 10,
children: [
Checkbox(
value: true,
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts('History',
variant: "bodyText",
bold: true,
color: Colors.black),
), ),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
), ),
], ],
), ),
DividerWithSpacesAround(), ),
Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: model,
child: Container(
height:
MediaQuery.of(context).size.height * 0.5,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
Column(
children: model.mergeHistorySurgicalWithHistorySportList
.map((historyInfo) {
return Column(
children: [
Row( Row(
children: [ children: [
Checkbox( Checkbox(
value: true, value: true,
activeColor: activeColor:
Colors.red[800], Colors.red[800],
onChanged: (bool newValue) { onChanged:
(bool newValue) {
setState(() {}); setState(() {});
}), }),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets padding:
const EdgeInsets
.symmetric( .symmetric(
horizontal: 10, horizontal: 10,
vertical: 0), vertical: 0),
child: Texts('History', child: Texts(
historyInfo.nameEn,
variant: "bodyText", variant: "bodyText",
bold: true, bold: true,
color: Colors.black), color:
Colors.black),
), ),
), ),
], ],
), ),
DividerWithSpacesAround(), DividerWithSpacesAround(),
Row( ],
children: [ );
Checkbox( }).toList(),
value: true,
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts('History',
variant: "bodyText",
bold: true,
color: Colors.black),
),
), ),
], ],
), ),
DividerWithSpacesAround(), )),
Row(
children: [
Checkbox(
value: true,
activeColor:
Colors.red[800],
onChanged: (bool newValue) {
setState(() {});
}),
Expanded(
child: Padding(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Texts('History',
variant: "bodyText",
bold: true,
color: Colors.black),
), ),
), ),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
),
], ],
), ),
DividerWithSpacesAround(), ),
Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: model,
child: Container(
height:
MediaQuery.of(context).size.height * 0.5,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
Column(
children: model.historyMedicalList
.map((historyInfo) {
return Column(
children: [
Row( Row(
children: [ children: [
Checkbox( Checkbox(
value: true, value: true,
activeColor: activeColor:
Colors.red[800], Colors.red[800],
onChanged: (bool newValue) { onChanged:
(bool newValue) {
setState(() {}); setState(() {});
}), }),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets padding:
const EdgeInsets
.symmetric( .symmetric(
horizontal: 10, horizontal: 10,
vertical: 0), vertical: 0),
child: Texts('History', child: Texts(
historyInfo.nameEn,
variant: "bodyText", variant: "bodyText",
bold: true, bold: true,
color: Colors.black), color:
Colors.black),
), ),
), ),
], ],
), ),
DividerWithSpacesAround(), DividerWithSpacesAround(),
], ],
);
}).toList(),
), ),
], ],
), ),
@ -480,15 +468,6 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
), ),
], ],
), ),
Container(
child: Center(
child: Texts("eee"),
),
),
Container(
child: Center(
child: Texts("cccc"),
),
), ),
], ],
), ),

Loading…
Cancel
Save