Merge branch 'in-patient_re-design' into 'development'

In patient re design

See merge request Cloud_Solution/doctor_app_flutter!595
merge-requests/597/merge
Mohammad Aljammal 5 years ago
commit 0935ee11f7

@ -121,16 +121,20 @@ class PatientSearchViewModel extends BaseViewModel{
List<PatiantInformtion> filteredInPatientItems = List(); List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel, Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async { {bool isMyInpatient = false, bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy); setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _inPatientService.getInPatientList(requestModel, isMyInpatient); await _inPatientService.getInPatientList(requestModel, isMyInpatient);
if (_inPatientService.hasError) { if (_inPatientService.hasError) {
error = _inPatientService.error; error = _inPatientService.error;
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
setState(ViewState.Idle);
filteredInPatientItems.clear(); filteredInPatientItems.clear();
if (_inPatientList.length > 0)
filteredInPatientItems.addAll(_inPatientList); filteredInPatientItems.addAll(_inPatientList);
setState(ViewState.Idle);
} }
} }
@ -153,7 +157,9 @@ class PatientSearchViewModel extends BaseViewModel{
} }
notifyListeners(); notifyListeners();
} else { } else {
filteredInPatientItems = _inPatientList; if (_inPatientList.length > 0)
filteredInPatientItems.clear();
filteredInPatientItems.addAll(_inPatientList);
notifyListeners(); notifyListeners();
} }
} }

@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.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/util/helpers.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/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/patients/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -71,15 +72,9 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
), ),
), ),
tabsBar(context, screenSize, model), tabsBar(context, screenSize, model),
model.filteredInPatientItems.length > 0 Container(
? Expanded(
child: Container(
margin: EdgeInsets.all(16.0), margin: EdgeInsets.all(16.0),
child: SingleChildScrollView( child: AppTextFieldCustom(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context)
.searchPatientName, .searchPatientName,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
@ -94,9 +89,18 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
onChanged: (value) { onChanged: (value) {
model.filterSearchResults(value); model.filterSearchResults(value);
}), }),
const SizedBox(
height: 16,
), ),
model.filteredInPatientItems.length > 0
? Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// const SizedBox(
// height: 16,
// ),
...model.filteredInPatientItems.map((item) { ...model.filteredInPatientItems.map((item) {
return PatientCard( return PatientCard(
patientInfo: item, patientInfo: item,
@ -104,6 +108,11 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
arrivalType: "1", arrivalType: "1",
isInpatient: true, isInpatient: true,
onTap: () { onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context) Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: { .pushNamed(PATIENTS_PROFILE, arguments: {
"patient": item, "patient": item,
@ -122,9 +131,13 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
), ),
), ),
) )
: Container( : Expanded(
child: SingleChildScrollView(
child: Container(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable)), error: TranslationBase.of(context).noDataAvailable)),
),
),
], ],
), ),
), ),
@ -155,10 +168,16 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
setState(() { setState(() {
_activeTab = _tabs.indexOf(item); _activeTab = _tabs.indexOf(item);
}); });
// GifLoaderDialogUtils.showMyDialog( FocusScopeNode currentFocus = FocusScope.of(context);
// context); if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
GifLoaderDialogUtils.showMyDialog(
context);
await model.getInPatientList(requestModel, await model.getInPatientList(requestModel,
isMyInpatient: _activeTab == 1); isMyInpatient: _activeTab == 1, isFirstTime: false);
GifLoaderDialogUtils.hideDialog(
context);
}, },
child: Center( child: Center(
child: Container( child: Container(

Loading…
Cancel
Save