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/master_key_model.dart';
class SOAPService extends BaseService {
class SOAPService extends BaseService {
List<MasterKeyModel> get listOfAllergies => _listOfAllergies;
List<MasterKeyModel> get allergySeverityList => _allergySeverityList;
List<MasterKeyModel> _listOfAllergies = [];
List<MasterKeyModel> get allergySeverityList => _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 {
await baseAppClient.post(
GET_ALLERGIES,
@ -51,19 +69,38 @@ class SOAPService extends BaseService {
});
break;
case MasterKeysService.HistoryFamily:
return 36;
_historyFamilyList.clear();
entryList.forEach((v) {
_historyFamilyList
.add(MasterKeyModel.fromJson(v));
});
break;
case MasterKeysService.HistoryMedical:
return 37;
_historyMedicalList.clear();
entryList.forEach((v) {
_historyMedicalList
.add(MasterKeyModel.fromJson(v));
});
break;
case MasterKeysService.HistorySocial:
return 38;
historySocialList.clear();
entryList.forEach((v) {
historySocialList
.add(MasterKeyModel.fromJson(v));
});
break;
case MasterKeysService.HistorySports:
return 39;
break;
_historySportList.clear();
entryList.forEach((v) {
_historySportList
.add(MasterKeyModel.fromJson(v));
}); break;
case MasterKeysService.HistorySurgical:
return 66;
_historySurgicalList.clear();
entryList.forEach((v) {
_historySurgicalList
.add(MasterKeyModel.fromJson(v));
});
break;
case MasterKeysService.PhysicalExamination:
return 59;

@ -12,7 +12,22 @@ class SOAPViewModel extends BaseViewModel {
SOAPService _SOAPService = locator<SOAPService>();
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 {
setState(ViewState.Busy);

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

@ -116,7 +116,7 @@ class _AddHistoryWidgetState extends State<AddHistoryWidget>
isScrollControlled: true,
context: context,
builder: (context) {
return AddHistoryDialog();
return AddHistoryDialog(changePageViewIndex:changePageViewIndex, controller: _controller,);
});
}
}
@ -218,11 +218,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
heightFactor: 0.7,
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {
// if (model.listOfAllergies == null) {
await model.getMasterLookup(MasterKeysService.Allergies);
// }
if (model.allergySeverityList == null) {
await model.getMasterLookup(MasterKeysService.AllergySeverity);
if (model.historyFamilyList.length == 0) {
await model.getMasterLookup(MasterKeysService.HistoryFamily);
}
},
builder: (_, model, w) => AppScaffold(
@ -237,8 +234,19 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
SizedBox(
height: 10,
),
PriorityBar(onTap: (activePriority) {
PriorityBar(onTap: (activePriority) async {
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(
height: 20,
@ -254,240 +262,211 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
},
scrollDirection: Axis.horizontal,
children: <Widget>[
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: [
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(),
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),
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.historyFamilyList
.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(),
],
),
],
),
)),
DividerWithSpacesAround(),
],
);
}).toList(),
),
],
),
)),
),
),
),
SizedBox(
height: 10,
),
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
SizedBox(
height: 10,
),
],
if (model.state == ViewState.Idle)
AppButton(
title: "Add SELECTED HISTORIES".toUpperCase(),
onPressed: () {},
),
],
),
),
Container(
child: Center(
child: Texts("eee"),
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(
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(
child: Center(
child: Texts("cccc"),
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(
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