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';
@ -84,15 +85,15 @@ class _AddAllergiesState extends State<AddAllergies> {
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAllergies,
),
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).addAllergies,
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -135,7 +136,12 @@ class _AddAllergiesState extends State<AddAllergies> {
), ),
]), ]),
), ),
),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(
@ -155,8 +161,7 @@ class _AddAllergiesState extends State<AddAllergies> {
widthFactor: .80, widthFactor: .80,
child: Center( child: Center(
child: AppButton( child: AppButton(
title: title: TranslationBase.of(context).addAllergies,
TranslationBase.of(context).addAllergies,
padding: 10, padding: 10,
color: Color(0xFF359846), color: Color(0xFF359846),
onPressed: () { onPressed: () {
@ -171,7 +176,8 @@ class _AddAllergiesState extends State<AddAllergies> {
), ),
], ],
), ),
),), ),
),
), ),
); );
} }
@ -207,9 +213,7 @@ 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 =

@ -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,12 +57,13 @@ 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,
), ),
@ -73,8 +80,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
controller: widget.controller, controller: widget.controller,
onPageChanged: (index) { onPageChanged: (index) {
setState(() { setState(() {});
});
}, },
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
@ -83,43 +89,44 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
child: MasterKeyCheckboxSearchWidget( child: MasterKeyCheckboxSearchWidget(
model: model, model: model,
masterList: model.historyFamilyList, masterList: model.historyFamilyList,
removeHistory: (history){ removeHistory: (history) {
setState(() { setState(() {
widget.removeHistory(history); widget.removeHistory(history);
}); });
}, },
addHistory: (history){ addHistory: (history) {
setState(() { setState(() {
createAndAddHistory( createAndAddHistory(history);
history);
}); });
}, },
addSelectedHistories: (){ addSelectedHistories: () {
widget.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.mergeHistorySurgicalWithHistorySportList, masterList: model
removeHistory: (history){ .mergeHistorySurgicalWithHistorySportList,
removeHistory: (history) {
setState(() { setState(() {
widget.removeHistory(history); widget.removeHistory(history);
}); });
}, },
addHistory: (history){ addHistory: (history) {
setState(() { setState(() {
createAndAddHistory( createAndAddHistory(history);
history);
}); });
}, },
addSelectedHistories: (){ addSelectedHistories: () {
widget.addSelectedHistories(); widget.addSelectedHistories();
}, },
isServiceSelected: (master) =>isServiceSelected(master), isServiceSelected: (master) =>
isServiceSelected(master),
), ),
), ),
NetworkBaseView( NetworkBaseView(
@ -127,18 +134,17 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
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( createAndAddHistory(history);
history);
}); });
}, },
addSelectedHistories: (){ addSelectedHistories: () {
widget.addSelectedHistories(); widget.addSelectedHistories();
}, },
isServiceSelected: (master) => isServiceSelected: (master) =>
@ -149,12 +155,17 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
), ),
), ),
), ),
SizedBox(height:MediaQuery.of(context).size.height * 0.11 ,) SizedBox(
], height: MediaQuery.of(context).size.height * 0.11,
) )
],
)),
), ),
), bottomSheet: model.state == ViewState.Busy
bottomSheet: Container( ? Container(
height: 0,
)
: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
@ -174,8 +185,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
widthFactor: .80, widthFactor: .80,
child: Center( child: Center(
child: AppButton( child: AppButton(
title: title: TranslationBase.of(context)
TranslationBase.of(context).addSelectedHistories, .addSelectedHistories,
padding: 10, padding: 10,
color: Color(0xFF359846), color: Color(0xFF359846),
onPressed: () { onPressed: () {
@ -196,12 +207,11 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
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,10 +227,8 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
isServiceSelected(MasterKeyModel masterKey) { isServiceSelected(MasterKeyModel masterKey) {
Iterable<MySelectedHistory> history = Iterable<MySelectedHistory> history = widget.myHistoryList.where(
widget (element) =>
.myHistoryList
.where((element) =>
masterKey.id == element.selectedHistory.id && masterKey.id == element.selectedHistory.id &&
masterKey.typeId == element.selectedHistory.typeId && masterKey.typeId == element.selectedHistory.typeId &&
element.isChecked); element.isChecked);
@ -229,6 +237,4 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
} }
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