Merge branch 'development' into 'master'
Development See merge request Cloud_Solution/doctor_app_flutter!632merge-requests/644/merge
commit
368d94168b
@ -0,0 +1,164 @@
|
|||||||
|
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/base/base_view.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';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../routes.dart';
|
||||||
|
|
||||||
|
class InPatientPage extends StatefulWidget {
|
||||||
|
final bool isMyInPatient;
|
||||||
|
|
||||||
|
InPatientPage(this.isMyInPatient);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InPatientPageState createState() => _InPatientPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InPatientPageState extends State<InPatientPage> {
|
||||||
|
TextEditingController _searchController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_searchController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<PatientSearchViewModel>(
|
||||||
|
onModelReady: (model) async {
|
||||||
|
await model.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: 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.symmetric(horizontal: 16.0),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
...List.generate(
|
||||||
|
model.filteredInPatientItems.length, (index) {
|
||||||
|
if (!widget.isMyInPatient)
|
||||||
|
return PatientCard(
|
||||||
|
patientInfo:
|
||||||
|
model.filteredInPatientItems[index],
|
||||||
|
patientType: "1",
|
||||||
|
arrivalType: "1",
|
||||||
|
isInpatient: true,
|
||||||
|
isMyPatient: model
|
||||||
|
.filteredInPatientItems[index]
|
||||||
|
.doctorId ==
|
||||||
|
model.doctorProfile.doctorID,
|
||||||
|
onTap: () {
|
||||||
|
FocusScopeNode currentFocus =
|
||||||
|
FocusScope.of(context);
|
||||||
|
if (!currentFocus.hasPrimaryFocus) {
|
||||||
|
currentFocus.unfocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
PATIENTS_PROFILE,
|
||||||
|
arguments: {
|
||||||
|
"patient": model
|
||||||
|
.filteredInPatientItems[index],
|
||||||
|
"patientType": "1",
|
||||||
|
"from": "0",
|
||||||
|
"to": "0",
|
||||||
|
"isSearch": false,
|
||||||
|
"isInpatient": true,
|
||||||
|
"arrivalType": "1",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
else if (model.filteredInPatientItems[index]
|
||||||
|
.doctorId ==
|
||||||
|
model.doctorProfile.doctorID &&
|
||||||
|
widget.isMyInPatient)
|
||||||
|
return PatientCard(
|
||||||
|
patientInfo:
|
||||||
|
model.filteredInPatientItems[index],
|
||||||
|
patientType: "1",
|
||||||
|
arrivalType: "1",
|
||||||
|
isInpatient: true,
|
||||||
|
isMyPatient: model
|
||||||
|
.filteredInPatientItems[index]
|
||||||
|
.doctorId ==
|
||||||
|
model.doctorProfile.doctorID,
|
||||||
|
onTap: () {
|
||||||
|
FocusScopeNode currentFocus =
|
||||||
|
FocusScope.of(context);
|
||||||
|
if (!currentFocus.hasPrimaryFocus) {
|
||||||
|
currentFocus.unfocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
PATIENTS_PROFILE,
|
||||||
|
arguments: {
|
||||||
|
"patient": model
|
||||||
|
.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)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
class PatientProfileCardModel {
|
||||||
|
final String nameLine1;
|
||||||
|
final String nameLine2;
|
||||||
|
final dynamic route;
|
||||||
|
final String icon;
|
||||||
|
final bool isInPatient;
|
||||||
|
final bool isDisable;
|
||||||
|
final bool isLoading;
|
||||||
|
final Function onTap;
|
||||||
|
final bool isDischargedPatient;
|
||||||
|
final bool isSelectInpatient;
|
||||||
|
|
||||||
|
PatientProfileCardModel(
|
||||||
|
this.nameLine1,
|
||||||
|
this.nameLine2,
|
||||||
|
this.route,
|
||||||
|
this.icon, {
|
||||||
|
this.isInPatient = false,
|
||||||
|
this.isDisable = false,
|
||||||
|
this.isLoading = false,
|
||||||
|
this.onTap,
|
||||||
|
this.isDischargedPatient = false,
|
||||||
|
this.isSelectInpatient = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue