history list ready

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

@ -4,12 +4,30 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; 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,240 +262,211 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Column( Container(
children: [ child: Column(
NetworkBaseView( children: [
baseViewModel: model, NetworkBaseView(
child: Container( baseViewModel: model,
height: child: Container(
MediaQuery.of(context).size.height * 0.5, height:
child: Center( MediaQuery.of(context).size.height * 0.5,
child: Container( child: Center(
margin: EdgeInsets.only(top: 15), child: Container(
decoration: BoxDecoration( margin: EdgeInsets.only(top: 15),
borderRadius: BorderRadius.circular(12), decoration: BoxDecoration(
color: Colors.white), borderRadius: BorderRadius.circular(12),
child: ListView( color: Colors.white),
children: [ child: ListView(
Column( children: [
children: [ Column(
Row( children: model.historyFamilyList
children: [ .map((historyInfo) {
Checkbox( return Column(
value: true, children: [
activeColor: Row(
Colors.red[800], children: [
onChanged: (bool newValue) { Checkbox(
setState(() {}); value: true,
}), activeColor:
Expanded( Colors.red[800],
child: Padding( onChanged:
padding: const EdgeInsets (bool newValue) {
.symmetric( setState(() {});
horizontal: 10, }),
vertical: 0), Expanded(
child: Texts('History', child: Padding(
variant: "bodyText", padding:
bold: true, const EdgeInsets
color: Colors.black), .symmetric(
), horizontal: 10,
), vertical: 0),
], child: Texts(
), historyInfo.nameEn,
DividerWithSpacesAround(), variant: "bodyText",
Row( bold: true,
children: [ color:
Checkbox( Colors.black),
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),
),
),
],
),
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(),
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(),
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(),
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(),
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(),
], ],
), );
DividerWithSpacesAround(), }).toList(),
], ),
), ],
], ),
), )),
)), ),
), ),
), SizedBox(
SizedBox( height: 10,
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
), ),
], if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
),
],
),
), ),
Container( Container(
child: Center( child: Column(
child: Texts("eee"), 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(
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(
historyInfo.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
),
],
), ),
), ),
Container( Container(
child: Center( child: Column(
child: Texts("cccc"), 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(
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(
historyInfo.nameEn,
variant: "bodyText",
bold: true,
color:
Colors.black),
),
),
],
),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
),
],
), ),
), ),
], ],

Loading…
Cancel
Save