Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into in-patient-medication
Conflicts: lib/widgets/patients/patient_card/PatientCard.dartmerge-requests/830/head
commit
696b8b89ec
@ -1,75 +0,0 @@
|
||||
import 'package:doctor_app_flutter/core/viewModel/referral_view_model.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/doctor/my_referral_patient_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../widgets/shared/app_scaffold_widget.dart';
|
||||
|
||||
class MyReferralPatient extends StatefulWidget {
|
||||
int expandedItemIndex = -1;
|
||||
|
||||
@override
|
||||
_MyReferralPatientState createState() => _MyReferralPatientState();
|
||||
}
|
||||
|
||||
class _MyReferralPatientState extends State<MyReferralPatient> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<ReferralPatientViewModel>(
|
||||
onModelReady: (model) => model.getMyReferralPatient(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).myReferralPatient,
|
||||
body: model.listMyReferralPatientModel.length == 0
|
||||
? Center(
|
||||
child: AppText(
|
||||
TranslationBase.of(context).errorNoSchedule,
|
||||
color: Theme.of(context).errorColor,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
...List.generate(
|
||||
model.listMyReferralPatientModel.length,
|
||||
(index) => MyReferralPatientWidget(
|
||||
myReferralPatientModel: model
|
||||
.listMyReferralPatientModel[index],
|
||||
model: model,
|
||||
expandClick: () {
|
||||
setState(() {
|
||||
if (widget.expandedItemIndex ==
|
||||
index) {
|
||||
widget.expandedItemIndex = -1;
|
||||
} else {
|
||||
widget.expandedItemIndex = index;
|
||||
}
|
||||
});
|
||||
},
|
||||
isExpand:
|
||||
widget.expandedItemIndex == index,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
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/patient_card/PatientCard.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.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_container.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 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../routes.dart';
|
||||
|
||||
class InPatientPage extends StatefulWidget {
|
||||
final bool isMyInPatient;
|
||||
final PatientSearchViewModel patientSearchViewModel;
|
||||
|
||||
InPatientPage(this.isMyInPatient, this.patientSearchViewModel);
|
||||
|
||||
@override
|
||||
_InPatientPageState createState() => _InPatientPageState();
|
||||
}
|
||||
|
||||
class _InPatientPageState extends State<InPatientPage> {
|
||||
|
||||
TextEditingController _searchController = TextEditingController();
|
||||
|
||||
bool isSortDes = false;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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(
|
||||
Icons.search,
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
controller: _searchController,
|
||||
onChanged: (value) {
|
||||
widget.patientSearchViewModel.filterSearchResults(value);
|
||||
}),
|
||||
|
||||
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
|
||||
? (widget.isMyInPatient && widget.patientSearchViewModel.myIinPatientList.length ==0 )?NoData():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",
|
||||
"isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index]
|
||||
.doctorId ==
|
||||
widget.patientSearchViewModel.doctorProfile.doctorID,
|
||||
});
|
||||
},
|
||||
);
|
||||
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",
|
||||
"isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index]
|
||||
.doctorId ==
|
||||
widget.patientSearchViewModel.doctorProfile.doctorID,
|
||||
});
|
||||
},
|
||||
);
|
||||
else
|
||||
return SizedBox();
|
||||
}),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: NoData(): Center(
|
||||
child: Container(
|
||||
height: 300,
|
||||
width: 300,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NoData extends StatelessWidget {
|
||||
const NoData({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: ErrorMessage(
|
||||
error:
|
||||
TranslationBase.of(context).noDataAvailable)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,370 @@
|
||||
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||
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/patient_card/PatientCard.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_loader_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/errors/error_message.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_container.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 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../routes.dart';
|
||||
|
||||
class InPatientListPage extends StatefulWidget {
|
||||
final bool isMyInPatient;
|
||||
final PatientSearchViewModel patientSearchViewModel;
|
||||
|
||||
InPatientListPage(this.isMyInPatient, this.patientSearchViewModel);
|
||||
|
||||
@override
|
||||
_InPatientListPageState createState() => _InPatientListPageState();
|
||||
}
|
||||
|
||||
class _InPatientListPageState extends State<InPatientListPage> {
|
||||
TextEditingController _searchController = TextEditingController();
|
||||
|
||||
bool isSortDes = false;
|
||||
bool isAllClinic = true;
|
||||
bool showBottomSheet = false;
|
||||
String selectedClinicName;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_searchController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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.symmetric(horizontal: 14.0, vertical: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 1,
|
||||
groupValue: isAllClinic ? 1 : 2,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
isAllClinic = true;
|
||||
showBottomSheet = false;
|
||||
});
|
||||
widget.patientSearchViewModel
|
||||
.setDefaultInPatientList();
|
||||
});
|
||||
},
|
||||
activeColor: Colors.red,
|
||||
),
|
||||
AppText("All Clinic", fontSize: 15,),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isAllClinic = true;
|
||||
showBottomSheet = false;
|
||||
});
|
||||
widget.patientSearchViewModel.setDefaultInPatientList();
|
||||
},
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isAllClinic = false;
|
||||
showBottomSheet = true;
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: 2,
|
||||
groupValue: isAllClinic ? 1 : 2,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
isAllClinic = false;
|
||||
showBottomSheet = true;
|
||||
});
|
||||
});
|
||||
},
|
||||
activeColor: Colors.red,
|
||||
),
|
||||
AppText(selectedClinicName ?? "Select Clinic", fontSize: 15,),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
child: Icon(FontAwesomeIcons.sortDown))
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
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(
|
||||
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
|
||||
? (widget.isMyInPatient &&
|
||||
widget.patientSearchViewModel.myIinPatientList
|
||||
.length ==
|
||||
0)
|
||||
? NoData()
|
||||
: Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: NotificationListener(
|
||||
child: ListView.builder(
|
||||
itemCount: widget.patientSearchViewModel
|
||||
.filteredInPatientItems.length,
|
||||
scrollDirection: Axis.vertical,
|
||||
// physics: ScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, 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",
|
||||
"isMyPatient": widget
|
||||
.patientSearchViewModel
|
||||
.filteredInPatientItems[
|
||||
index]
|
||||
.doctorId ==
|
||||
widget
|
||||
.patientSearchViewModel
|
||||
.doctorProfile
|
||||
.doctorID,
|
||||
});
|
||||
},
|
||||
);
|
||||
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",
|
||||
"isMyPatient": widget
|
||||
.patientSearchViewModel
|
||||
.filteredInPatientItems[
|
||||
index]
|
||||
.doctorId ==
|
||||
widget
|
||||
.patientSearchViewModel
|
||||
.doctorProfile
|
||||
.doctorID,
|
||||
});
|
||||
},
|
||||
);
|
||||
else
|
||||
return SizedBox();
|
||||
}),
|
||||
onNotification: (t) {
|
||||
if (isAllClinic) if (t
|
||||
is ScrollUpdateNotification &&
|
||||
t.metrics.pixels >=
|
||||
t.metrics.maxScrollExtent - 50) {
|
||||
widget.patientSearchViewModel
|
||||
.addOnFilteredList();
|
||||
}
|
||||
return;
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
: NoData()
|
||||
: Center(
|
||||
child: Container(
|
||||
height: 300,
|
||||
width: 300,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomSheet: !showBottomSheet
|
||||
? Container(
|
||||
height: 0,
|
||||
)
|
||||
: Container(
|
||||
height: 500,
|
||||
color: Colors.white,
|
||||
child: ListView.builder(
|
||||
itemCount: widget
|
||||
.patientSearchViewModel.myInpatientClinicList.length,
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: ScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isAllClinic = false;
|
||||
showBottomSheet = false;
|
||||
selectedClinicName = widget.patientSearchViewModel
|
||||
.myInpatientClinicList[index];
|
||||
});
|
||||
widget.patientSearchViewModel.filterByClinic(
|
||||
clinicName: widget.patientSearchViewModel
|
||||
.myInpatientClinicList[index]);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Radio(
|
||||
value: widget.patientSearchViewModel
|
||||
.myInpatientClinicList[index],
|
||||
groupValue: selectedClinicName,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
setState(() {
|
||||
isAllClinic = false;
|
||||
showBottomSheet = false;
|
||||
});
|
||||
widget.patientSearchViewModel
|
||||
.filterByClinic(clinicName: value);
|
||||
});
|
||||
},
|
||||
activeColor: Colors.red,
|
||||
),
|
||||
AppText(widget.patientSearchViewModel
|
||||
.myInpatientClinicList[index]),
|
||||
],
|
||||
));
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NoData extends StatelessWidget {
|
||||
const NoData({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: ErrorMessage(
|
||||
error: TranslationBase.of(context).noDataAvailable)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.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/patients/profile/UCAF/page-stepper-widget.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.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/buttons/app_buttons_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../routes.dart';
|
||||
import 'UCAF-detail-screen.dart';
|
||||
import 'UCAF-input-screen.dart';
|
||||
|
||||
class UCAFPagerScreen extends StatefulWidget {
|
||||
const UCAFPagerScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UCAFPagerScreenState createState() => _UCAFPagerScreenState();
|
||||
}
|
||||
|
||||
class _UCAFPagerScreenState extends State<UCAFPagerScreen>
|
||||
with TickerProviderStateMixin {
|
||||
PageController _controller;
|
||||
int _currentIndex = 0;
|
||||
bool _isLoading = true;
|
||||
|
||||
PatiantInformtion patient;
|
||||
String patientType;
|
||||
String arrivalType;
|
||||
|
||||
changePageViewIndex(pageIndex, {isChangeState = true}) {
|
||||
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
|
||||
_controller.jumpToPage(pageIndex);
|
||||
setState(() {
|
||||
_currentIndex = pageIndex;
|
||||
});
|
||||
}
|
||||
|
||||
void changeLoadingState(bool isLoading) {
|
||||
setState(() {
|
||||
_isLoading = isLoading;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = new PageController();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
patient = routeArgs['patient'];
|
||||
patientType = routeArgs['patientType'];
|
||||
arrivalType = routeArgs['arrivalType'];
|
||||
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<UcafViewModel>(
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
isShowAppBar: true,
|
||||
isLoading: _isLoading,
|
||||
appBar: PatientProfileAppBar(patient),
|
||||
appBarTitle: TranslationBase.of(context).ucaf,
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// PatientHeaderWidgetNoAvatar(patient),
|
||||
Container(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
"${TranslationBase.of(context).patient}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: SizeConfig.textMultiplier * 1.6,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).ucaf}",
|
||||
fontFamily: 'Poppins',
|
||||
fontSize: SizeConfig.textMultiplier * 3,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
PageStepperWidget(
|
||||
stepsCount: 2,
|
||||
currentStepIndex: _currentIndex + 1,
|
||||
screenSize: screenSize,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: PageView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
controller: _controller,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
children: <Widget>[
|
||||
UCAFInputScreen(
|
||||
patient,
|
||||
changeLoadingState: changeLoadingState,
|
||||
),
|
||||
UcafDetailScreen(
|
||||
patient,
|
||||
model,
|
||||
changeLoadingState: changeLoadingState,
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_isLoading
|
||||
? Container(
|
||||
height: 0,
|
||||
)
|
||||
: ucafButtons(model),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget ucafButtons(UcafViewModel model) {
|
||||
switch (_currentIndex) {
|
||||
case 0:
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).next,
|
||||
color: Color(0xFFD02127),
|
||||
onPressed: () {
|
||||
changePageViewIndex(1);
|
||||
// Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {
|
||||
// 'patient': patient,
|
||||
// 'patientType': patientType,
|
||||
// 'arrivalType': arrivalType
|
||||
// });
|
||||
},
|
||||
),
|
||||
);
|
||||
case 1:
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).cancel,
|
||||
hasBorder: true,
|
||||
vPadding: 8,
|
||||
hPadding: 8,
|
||||
borderColor: Colors.white,
|
||||
color: Colors.white,
|
||||
fontColor: Color(0xFFB8382B),
|
||||
fontSize: 2.2,
|
||||
onPressed: () {
|
||||
Navigator.of(context).popUntil((route) {
|
||||
return route.settings.name == PATIENTS_PROFILE;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).save,
|
||||
hasBorder: true,
|
||||
vPadding: 8,
|
||||
hPadding: 8,
|
||||
borderColor: Color(0xFFB8382B),
|
||||
color: Color(0xFFB8382B),
|
||||
fontColor: Colors.white,
|
||||
fontSize: 2.0,
|
||||
onPressed: () {
|
||||
model.saveUCAFOnTap();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue