From 4e4e6a3600f5340430feae5ce5f650a6cc10190a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 21 Jan 2021 16:32:59 +0200 Subject: [PATCH] fix DA-151 --- lib/core/viewModel/SOAP_view_model.dart | 5 ++- .../subjective/update_history_widget.dart | 35 ++++++++----------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index d4f50ce6..2c312ade 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -92,7 +92,10 @@ class SOAPViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getMasterLookup(MasterKeysService masterKeys) async { + Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async { + if(isBusyLocal){ + setState(ViewState.Busy); + }else setState(ViewState.Busy); await _SOAPService.getMasterLookup(masterKeys); if (_SOAPService.hasError) { diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart index 28f9f466..81217025 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -272,36 +272,31 @@ class _AddHistoryDialogState extends State { onModelReady: (model) async { if (model.historyFamilyList.length == 0) { await model.getMasterLookup(MasterKeysService.HistoryFamily); - setState(() { + } - }); + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + await model.getMasterLookup(MasterKeysService.HistorySports); + } + + if (model.historyMedicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); } }, builder: (_, model, w) => AppScaffold( - // baseViewModel: model, + baseViewModel: model, isShowAppBar: false, body: Center( child: Container( child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 10, - ), + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 10, + ), 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,