in-patient re-design

merge-requests/595/head
mosazaid 5 years ago
parent 40c0f9f4a0
commit 286d883c9b

@ -14,16 +14,20 @@ class PatientSearchViewModel extends BaseViewModel {
List<PatiantInformtion> filteredInPatientItems = List();
Future getInPatientList(PatientSearchRequestModel requestModel,
{bool isMyInpatient = false}) async {
setState(ViewState.Busy);
{bool isMyInpatient = false, bool isFirstTime = true}) async {
if (isFirstTime)
setState(ViewState.Busy);
else
setState(ViewState.BusyLocal);
await _inPatientService.getInPatientList(requestModel, isMyInpatient);
if (_inPatientService.hasError) {
error = _inPatientService.error;
setState(ViewState.Error);
} else {
setState(ViewState.Idle);
filteredInPatientItems.clear();
filteredInPatientItems.addAll(_inPatientList);
if (_inPatientList.length > 0)
filteredInPatientItems.addAll(_inPatientList);
setState(ViewState.Idle);
}
}
@ -46,9 +50,10 @@ class PatientSearchViewModel extends BaseViewModel {
}
notifyListeners();
} else {
filteredInPatientItems = _inPatientList;
if (_inPatientList.length > 0)
filteredInPatientItems.clear();
filteredInPatientItems.addAll(_inPatientList);
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/models/patient/patiant_info_model.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/widgets/patients/PatientCard.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -71,32 +72,35 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
),
),
tabsBar(context, screenSize, model),
Container(
margin: EdgeInsets.all(16.0),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context)
.searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
model.filterSearchResults(value);
}),
),
model.filteredInPatientItems.length > 0
? Expanded(
child: Container(
margin: EdgeInsets.all(16.0),
margin: EdgeInsets.symmetric(horizontal: 16.0),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context)
.searchPatientName,
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Colors.black,
),
onPressed: () {},
),
controller: _searchController,
onChanged: (value) {
model.filterSearchResults(value);
}),
const SizedBox(
height: 16,
),
// const SizedBox(
// height: 16,
// ),
...model.filteredInPatientItems.map((item) {
return PatientCard(
patientInfo: item,
@ -104,6 +108,11 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
arrivalType: "1",
isInpatient: true,
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Navigator.of(context)
.pushNamed(PATIENTS_PROFILE, arguments: {
"patient": item,
@ -122,9 +131,13 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
),
),
)
: Container(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable)),
: Expanded(
child: SingleChildScrollView(
child: Container(
child: ErrorMessage(
error: TranslationBase.of(context).noDataAvailable)),
),
),
],
),
),
@ -155,10 +168,16 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen> {
setState(() {
_activeTab = _tabs.indexOf(item);
});
// GifLoaderDialogUtils.showMyDialog(
// context);
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
GifLoaderDialogUtils.showMyDialog(
context);
await model.getInPatientList(requestModel,
isMyInpatient: _activeTab == 1);
isMyInpatient: _activeTab == 1, isFirstTime: false);
GifLoaderDialogUtils.hideDialog(
context);
},
child: Center(
child: Container(

Loading…
Cancel
Save