keep show header in bottom sheet while it loading

merge-requests/773/head
Elham Rababh 5 years ago
parent c69f122713
commit ac6a6e7855

@ -32,6 +32,7 @@ class AddAssessmentDetails extends StatefulWidget {
addSelectedAssessment; addSelectedAssessment;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final bool isUpdate; final bool isUpdate;
AddAssessmentDetails( AddAssessmentDetails(
{Key key, {Key key,
this.mySelectedAssessment, this.mySelectedAssessment,
@ -129,14 +130,14 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
child: Column( child: Column(
children: [ children: [
BottomSheetTitle(
title: TranslationBase.of(context).addAssessmentDetails),
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: Container(

@ -4,6 +4,7 @@ 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/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.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/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
@ -38,39 +39,14 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: "${TranslationBase.of(context).addExamination}",
),
backgroundColor: Color.fromRGBO(248, 248, 248, 1), backgroundColor: Color.fromRGBO(248, 248, 248, 1),
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ 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( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
@ -100,7 +76,7 @@ class _AddExaminationPageState extends State<AddExaminationPage> {
widget.removeExamination(history); widget.removeExamination(history);
}); });
}, },
addExamination: (selectedExamination) { addHistory: (selectedExamination) {
widget.mySelectedExamination widget.mySelectedExamination
.add(selectedExamination); .add(selectedExamination);
// setState(() {}); // setState(() {});

@ -82,7 +82,7 @@ class _AddExaminationWidgetState extends State<AddExaminationWidget> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
if (widget.isServiceSelected(widget.item)) { if (widget.isServiceSelected(widget.item)) {
if (!examination.isLocal) if (examination.isLocal)
widget.removeExamination(widget.item); widget.removeExamination(widget.item);
widget.expandClick(); widget.expandClick();
} else { } else {

@ -60,7 +60,7 @@ class ExaminationItemCard extends StatelessWidget {
SizedBox( SizedBox(
height: 4, height: 4,
), ),
if(examination.remark.isEmpty) if(examination.remark.isNotEmpty)
AppText( AppText(
examination.remark, examination.remark,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,

@ -9,14 +9,14 @@ import 'add_examination_widget.dart';
class ExaminationsListSearchWidget extends StatefulWidget { class ExaminationsListSearchWidget extends StatefulWidget {
final Function(MasterKeyModel) removeExamination; final Function(MasterKeyModel) removeExamination;
final Function(MySelectedExamination) addExamination; final Function(MySelectedExamination) addHistory;
final bool Function(MasterKeyModel) isServiceSelected; final bool Function(MasterKeyModel) isServiceSelected;
final List<MasterKeyModel> masterList; final List<MasterKeyModel> masterList;
final List<MySelectedExamination> mySelectedExamination; final List<MySelectedExamination> mySelectedExamination;
ExaminationsListSearchWidget( ExaminationsListSearchWidget(
{this.removeExamination, {this.removeExamination,
this.addExamination, this.addHistory,
this.isServiceSelected, this.isServiceSelected,
this.masterList, this.mySelectedExamination}); this.masterList, this.mySelectedExamination});
@ -62,7 +62,7 @@ class _ExaminationsListSearchWidgetState
...items.mapIndexed((index, item) { ...items.mapIndexed((index, item) {
return AddExaminationWidget( return AddExaminationWidget(
item: item, item: item,
addExamination: widget.addExamination, addExamination: widget.addHistory,
removeExamination: widget.removeExamination, removeExamination: widget.removeExamination,
mySelectedExamination: widget.mySelectedExamination, mySelectedExamination: widget.mySelectedExamination,
isServiceSelected: widget.isServiceSelected, isServiceSelected: widget.isServiceSelected,

@ -260,11 +260,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
widget.changeLoadingState(false); widget.changeLoadingState(false);
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
widget.changeLoadingState(false); widget.changeLoadingState(true);
// TODO Elham* return this widget.changePageViewIndex(2);
// widget.changeLoadingState(true);
//widget.changePageViewIndex(2);
} }
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg);

@ -1,7 +1,7 @@
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BottomSheetTitle extends StatelessWidget { class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget {
const BottomSheetTitle({ const BottomSheetTitle({
Key key, this.title, Key key, this.title,
}) : super(key: key); }) : super(key: key);
@ -57,4 +57,7 @@ class BottomSheetTitle extends StatelessWidget {
), ),
); );
} }
@override
Size get preferredSize => Size(double.maxFinite,115);
} }

@ -1,5 +1,6 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.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/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
@ -83,95 +84,100 @@ class _AddAllergiesState extends State<AddAllergies> {
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
body: Center( appBar: BottomSheetTitle(
child: Container( title: TranslationBase.of(context).addAllergies,
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.start, body: Center(
children: [ child: Container(
BottomSheetTitle( child: Column(
title: TranslationBase.of(context).addAllergies, crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: NetworkBaseView(
baseViewModel: model,
child: MasterKeyCheckboxSearchAllergiesWidget(
model: model,
masterList: model.allergiesList,
removeAllergy: (master) {
setState(() {
removeAllergyFromLocalList(master);
});
},
addAllergy:
(MySelectedAllergy mySelectedAllergy) {
addAllergyLocally(mySelectedAllergy);
},
addSelectedAllergy: () => widget
.addAllergiesFun(myAllergiesListLocal),
isServiceSelected: (master) =>
isServiceSelected(master),
getServiceSelectedAllergy: (master) =>
getSelectedAllergy(master),
),
),
),
),
), ),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
),
]),
),
),
bottomSheet: model.state == ViewState.Busy
? Container(
height: 0,
)
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox( SizedBox(
height: 10, height: 10,
), ),
SizedBox( Container(
height: 16, child: FractionallySizedBox(
), widthFactor: .80,
Expanded( child: Center(
child: Center( child: AppButton(
child: FractionallySizedBox( title: TranslationBase.of(context).addAllergies,
widthFactor: 0.9, padding: 10,
child: Center( color: Color(0xFF359846),
child: NetworkBaseView( onPressed: () {
baseViewModel: model, widget.addAllergiesFun(myAllergiesListLocal);
child: MasterKeyCheckboxSearchAllergiesWidget( },
model: model,
masterList: model.allergiesList,
removeAllergy: (master) {
setState(() {
removeAllergyFromLocalList(master);
});
},
addAllergy:
(MySelectedAllergy mySelectedAllergy) {
addAllergyLocally(mySelectedAllergy);
},
addSelectedAllergy: () => widget
.addAllergiesFun(myAllergiesListLocal),
isServiceSelected: (master) =>
isServiceSelected(master),
getServiceSelectedAllergy: (master) =>
getSelectedAllergy(master),
),
),
), ),
), ),
), ),
), ),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * 0.11, height: 5,
), ),
]), ],
),
),bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title:
TranslationBase.of(context).addAllergies,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addAllergiesFun(myAllergiesListLocal);
},
),
), ),
), ),
), ),
SizedBox(
height: 5,
),
],
),
),),
), ),
); );
} }
@ -207,17 +213,15 @@ class _AddAllergiesState extends State<AddAllergies> {
addAllergyLocally(MySelectedAllergy mySelectedAllergy) { addAllergyLocally(MySelectedAllergy mySelectedAllergy) {
if (mySelectedAllergy.selectedAllergy == null) { if (mySelectedAllergy.selectedAllergy == null) {
Helpers.showErrorToast(TranslationBase Helpers.showErrorToast(TranslationBase.of(context).requiredMsg);
.of(context)
.requiredMsg);
} else { } else {
setState(() { setState(() {
List<MySelectedAllergy> allergy = List<MySelectedAllergy> allergy =
// ignore: missing_return // ignore: missing_return
myAllergiesListLocal myAllergiesListLocal
.where((element) => .where((element) =>
mySelectedAllergy.selectedAllergy.id == mySelectedAllergy.selectedAllergy.id ==
element.selectedAllergy.id) element.selectedAllergy.id)
.toList(); .toList();
if (allergy.isEmpty) { if (allergy.isEmpty) {

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.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/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart';
@ -19,10 +20,15 @@ class AddHistoryDialog extends StatefulWidget {
final PageController controller; final PageController controller;
final List<MySelectedHistory> myHistoryList; final List<MySelectedHistory> myHistoryList;
final Function addSelectedHistories; final Function addSelectedHistories;
final Function (MasterKeyModel) removeHistory; final Function(MasterKeyModel) removeHistory;
const AddHistoryDialog( const AddHistoryDialog(
{Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) {Key key,
this.changePageViewIndex,
this.controller,
this.myHistoryList,
this.addSelectedHistories,
this.removeHistory})
: super(key: key); : super(key: key);
@override @override
@ -51,96 +57,96 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addHistory),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(
children: [ children: [
BottomSheetTitle(title:TranslationBase.of(context).addHistory), SizedBox(
SizedBox( height: 10,
height: 10, ),
), PriorityBar(onTap: (activePriority) async {
PriorityBar(onTap: (activePriority) async { widget.changePageViewIndex(activePriority);
widget.changePageViewIndex(activePriority); }),
}), SizedBox(
SizedBox( height: 20,
height: 20, ),
), Expanded(
Expanded( child: FractionallySizedBox(
child: FractionallySizedBox( widthFactor: 0.9,
widthFactor: 0.9, child: PageView(
child: PageView( physics: NeverScrollableScrollPhysics(),
physics: NeverScrollableScrollPhysics(), controller: widget.controller,
controller: widget.controller, onPageChanged: (index) {
onPageChanged: (index) { setState(() {});
setState(() { },
}); scrollDirection: Axis.horizontal,
}, children: <Widget>[
scrollDirection: Axis.horizontal, NetworkBaseView(
children: <Widget>[ baseViewModel: model,
NetworkBaseView( child: MasterKeyCheckboxSearchWidget(
baseViewModel: model, model: model,
child: MasterKeyCheckboxSearchWidget( masterList: model.historyFamilyList,
model: model, removeHistory: (history) {
masterList: model.historyFamilyList, setState(() {
removeHistory: (history){ widget.removeHistory(history);
setState(() { });
widget.removeHistory(history); },
}); addHistory: (history) {
}, setState(() {
addHistory: (history){ createAndAddHistory(history);
setState(() { });
createAndAddHistory( },
history); addSelectedHistories: () {
}); widget.addSelectedHistories();
}, },
addSelectedHistories: (){ isServiceSelected: (master) =>
widget.addSelectedHistories(); isServiceSelected(master),
}, ),
isServiceSelected: (master) =>isServiceSelected(master), ),
), NetworkBaseView(
), baseViewModel: model,
NetworkBaseView( child: MasterKeyCheckboxSearchWidget(
baseViewModel: model, model: model,
child: MasterKeyCheckboxSearchWidget( masterList: model
model: model, .mergeHistorySurgicalWithHistorySportList,
masterList: model.mergeHistorySurgicalWithHistorySportList, removeHistory: (history) {
removeHistory: (history){ setState(() {
setState(() { widget.removeHistory(history);
widget.removeHistory(history); });
}); },
}, addHistory: (history) {
addHistory: (history){ setState(() {
setState(() { createAndAddHistory(history);
createAndAddHistory( });
history); },
}); addSelectedHistories: () {
}, widget.addSelectedHistories();
addSelectedHistories: (){ },
widget.addSelectedHistories(); isServiceSelected: (master) =>
}, isServiceSelected(master),
isServiceSelected: (master) =>isServiceSelected(master), ),
), ),
), NetworkBaseView(
NetworkBaseView( baseViewModel: model,
baseViewModel: model, child: MasterKeyCheckboxSearchWidget(
child: MasterKeyCheckboxSearchWidget( model: model,
model: model, masterList: model.historyMedicalList,
masterList: model.historyMedicalList, removeHistory: (history) {
removeHistory: (history){ setState(() {
setState(() { widget.removeHistory(history);
widget.removeHistory(history); });
}); },
}, addHistory: (history) {
addHistory: (history){ setState(() {
setState(() { createAndAddHistory(history);
createAndAddHistory( });
history); },
}); addSelectedHistories: () {
}, widget.addSelectedHistories();
addSelectedHistories: (){ },
widget.addSelectedHistories();
},
isServiceSelected: (master) => isServiceSelected: (master) =>
isServiceSelected(master), isServiceSelected(master),
), ),
@ -149,59 +155,63 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
), ),
), ),
), ),
SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,) SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
)
], ],
) )),
),
), ),
bottomSheet: Container( bottomSheet: model.state == ViewState.Busy
decoration: BoxDecoration( ? Container(
color: Colors.white, height: 0,
borderRadius: BorderRadius.all( )
Radius.circular(0.0), : Container(
), decoration: BoxDecoration(
border: Border.all(color: HexColor('#707070'), width: 0), color: Colors.white,
), borderRadius: BorderRadius.all(
height: MediaQuery.of(context).size.height * 0.1, Radius.circular(0.0),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title:
TranslationBase.of(context).addSelectedHistories,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addSelectedHistories();
},
),
), ),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: MediaQuery.of(context).size.height * 0.1,
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context)
.addSelectedHistories,
padding: 10,
color: Color(0xFF359846),
onPressed: () {
widget.addSelectedHistories();
},
),
),
),
),
SizedBox(
height: 5,
),
],
), ),
), ),
SizedBox(
height: 5,
),
],
),
),
), ),
)); ));
} }
createAndAddHistory(MasterKeyModel history) { createAndAddHistory(MasterKeyModel history) {
List<MySelectedHistory> myhistory = widget.myHistoryList.where((element) => List<MySelectedHistory> myhistory = widget.myHistoryList
history.id == .where((element) =>
element.selectedHistory.id && history.id == element.selectedHistory.id &&
history.typeId == history.typeId == element.selectedHistory.typeId)
element.selectedHistory.typeId .toList();
).toList();
if (myhistory.isEmpty) { if (myhistory.isEmpty) {
setState(() { setState(() {
@ -217,18 +227,14 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedHistory> history = Iterable<MySelectedHistory> history = widget.myHistoryList.where(
widget (element) =>
.myHistoryList masterKey.id == element.selectedHistory.id &&
.where((element) => masterKey.typeId == element.selectedHistory.typeId &&
masterKey.id == element.selectedHistory.id && element.isChecked);
masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
return false; return false;
} }
} }

@ -1,6 +1,7 @@
// ignore: must_be_immutable // ignore: must_be_immutable
import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_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/core/viewModel/project_view_model.dart';
@ -74,15 +75,15 @@ class _AddMedicationState extends State<AddMedication> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
body: Center( body: Center(
child: Container( child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
BottomSheetTitle(
title: TranslationBase.of(context).addMedication,
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -381,7 +382,7 @@ class _AddMedicationState extends State<AddMedication> {
]), ]),
), ),
), ),
bottomSheet: Container( bottomSheet:model.state == ViewState.Busy?Container(height: 0,): Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(

Loading…
Cancel
Save