From 7b65f1bade340fc3862ede71fa02343ae57b873e Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 9 Aug 2021 11:41:56 +0300 Subject: [PATCH] small fix on in patient --- lib/screens/patients/InPatientPage.dart | 297 ++++++++++++------------ 1 file changed, 146 insertions(+), 151 deletions(-) diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index f06aabac..2a41414a 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -38,164 +38,159 @@ class _InPatientPageState extends State { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) async { - await widget.patientSearchViewModel.setDefaultInPatientList(); - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Container( - margin: EdgeInsets.all(16.0), - child: Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context).searchPatientName, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.black, - ), - onPressed: () {}, - ), - controller: _searchController, - onChanged: (value) { - widget.patientSearchViewModel.filterSearchResults(value); - }), - - Positioned( - right: 35, - top:5, - child: IconButton( + return AppScaffold( + baseViewModel: widget.patientSearchViewModel, + isShowAppBar: false, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + Container( + margin: EdgeInsets.all(16.0), + child: Stack( + children: [ + AppTextFieldCustom( + hintText: TranslationBase.of(context).searchPatientName, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( icon: Icon( - isSortDes - ? FontAwesomeIcons.sortAmountDown - : FontAwesomeIcons.sortAmountUp, + Icons.search, color: Colors.black, ), - iconSize: 20, - // padding: EdgeInsets.only(bottom: 30), - onPressed: () { - GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); - isSortDes = !isSortDes; - GifLoaderDialogUtils.hideDialog(context); - }, + onPressed: () {}, ), - ) - ], - ), - ), - widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate( - widget.patientSearchViewModel.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel. - filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else if (widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + controller: _searchController, + onChanged: (value) { + widget.patientSearchViewModel.filterSearchResults(value); + }), - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], - ), - ), - ), - ) - : Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: - TranslationBase.of(context).noDataAvailable)), - ), - ): Center( - child: Container( - height: 300, - width: 300, - child: Image.asset( - "assets/images/progress-loading-red.gif"), + Positioned( + right: 35, + top:5, + child: IconButton( + icon: Icon( + isSortDes + ? FontAwesomeIcons.sortAmountDown + : FontAwesomeIcons.sortAmountUp, + color: Colors.black, ), + iconSize: 20, + // padding: EdgeInsets.only(bottom: 30), + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); + isSortDes = !isSortDes; + GifLoaderDialogUtils.hideDialog(context); + }, ), - ], - ), + ) + ], + ), + ), + widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 + ? Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...List.generate( + widget.patientSearchViewModel.filteredInPatientItems.length, (index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: + widget.patientSearchViewModel.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget.patientSearchViewModel. + filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else if (widget.patientSearchViewModel.filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: + widget.patientSearchViewModel.filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget.patientSearchViewModel + .filteredInPatientItems[index] + .doctorId == + widget.patientSearchViewModel.doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget.patientSearchViewModel.filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + }); + }, + ); + else + return SizedBox(); + }), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ) + : Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: + TranslationBase.of(context).noDataAvailable)), + ), + ): Center( + child: Container( + height: 300, + width: 300, + child: Image.asset( + "assets/images/progress-loading-red.gif"), + ), + ), + ], ), ); }