You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
268 lines
12 KiB
Dart
268 lines
12 KiB
Dart
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../../../config/size_config.dart';
|
|
import '../../../providers/patients_provider.dart';
|
|
import '../../../util/dr_app_shared_pref.dart';
|
|
import '../../../widgets/shared/app_scaffold_widget.dart';
|
|
import '../../../widgets/shared/app_texts_widget.dart';
|
|
import '../../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
/*
|
|
*@author: ibrahim albitar
|
|
*@Date:4/6/2020
|
|
*@param:
|
|
*@return:
|
|
*@desc:
|
|
*/
|
|
|
|
class ReferPatientScreen extends StatefulWidget {
|
|
@override
|
|
_ReferPatientState createState() => _ReferPatientState();
|
|
}
|
|
|
|
class _ReferPatientState extends State<ReferPatientScreen> {
|
|
PatientsProvider patientsProv;
|
|
var doctorsList;
|
|
var clinicsList;
|
|
var referralFrequancyList;
|
|
final _controller = TextEditingController();
|
|
var _isInit = true;
|
|
|
|
String _selectedClinic;
|
|
String _selectedDoctor;
|
|
String _selectedReferralFrequancy;
|
|
|
|
@override
|
|
void didChangeDependencies() {
|
|
super.didChangeDependencies();
|
|
if (_isInit) {
|
|
patientsProv = Provider.of<PatientsProvider>(context);
|
|
patientsProv.getClinicsList();
|
|
patientsProv.getReferralFrequancyList();
|
|
setState(() {
|
|
clinicsList = patientsProv.clinicsList;
|
|
referralFrequancyList = patientsProv.referalFrequancyList;
|
|
});
|
|
}
|
|
_isInit = false;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AppScaffold(
|
|
appBarTitle: "Progress Note",
|
|
body: patientsProv.isLoading
|
|
? DrAppCircularProgressIndeicator()
|
|
: patientsProv.isError
|
|
? DrAppEmbeddedError(error: patientsProv.error)
|
|
: clinicsList == null
|
|
? DrAppEmbeddedError(
|
|
error: 'You don\'t have any Progress Note')
|
|
: Column(
|
|
children: <Widget>[
|
|
RoundedContainer(
|
|
margin: 0,
|
|
showBorder: true,
|
|
raduis: 30,
|
|
borderColor: Color(0xff707070),
|
|
width: double.infinity,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Expanded(
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
child: DropdownButton(
|
|
isExpanded: true,
|
|
value: _selectedClinic,
|
|
iconSize: 40,
|
|
elevation: 16,
|
|
selectedItemBuilder:
|
|
(BuildContext context) {
|
|
return patientsProv
|
|
.getClinicNameList()
|
|
.map((item) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
AppText(
|
|
item,
|
|
fontSize:
|
|
SizeConfig.textMultiplier *
|
|
2.1,
|
|
),
|
|
],
|
|
);
|
|
}).toList();
|
|
},
|
|
onChanged: (newValue) => {
|
|
setState(() {
|
|
_selectedDoctor = null;
|
|
_selectedClinic = newValue;
|
|
var clinicInfo =
|
|
clinicsList.singleWhere((i) =>
|
|
i['ClinicDescription']
|
|
.toString()
|
|
.contains(_selectedClinic));
|
|
var clinicId =
|
|
clinicInfo['ClinicID'].toString();
|
|
patientsProv.getDoctorsList(clinicId);
|
|
})
|
|
},
|
|
items: patientsProv
|
|
.getClinicNameList()
|
|
.map((item) {
|
|
return DropdownMenuItem(
|
|
value: item.toString(),
|
|
child: Text(
|
|
item,
|
|
textAlign: TextAlign.end,
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
//--------------------------------------------------------------------//
|
|
RoundedContainer(
|
|
margin: 0,
|
|
showBorder: true,
|
|
raduis: 30,
|
|
borderColor: Color(0xff707070),
|
|
width: double.infinity,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Expanded(
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
child: DropdownButton(
|
|
isExpanded: true,
|
|
value: _selectedDoctor,
|
|
iconSize: 40,
|
|
elevation: 16,
|
|
selectedItemBuilder:
|
|
(BuildContext context) {
|
|
return patientsProv
|
|
.getDoctorNameList()
|
|
.map((item) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
AppText(
|
|
item,
|
|
fontSize:
|
|
SizeConfig.textMultiplier *
|
|
2.1,
|
|
),
|
|
],
|
|
);
|
|
}).toList();
|
|
},
|
|
onChanged: (newValue) => {
|
|
setState(() {
|
|
_selectedDoctor = newValue;
|
|
})
|
|
},
|
|
items: patientsProv
|
|
.getDoctorNameList()
|
|
.map((item) {
|
|
return DropdownMenuItem(
|
|
value: item.toString(),
|
|
child: Text(
|
|
item,
|
|
textAlign: TextAlign.end,
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
), //-----------------------------///
|
|
RoundedContainer(
|
|
margin: 0,
|
|
showBorder: true,
|
|
raduis: 30,
|
|
borderColor: Color(0xff707070),
|
|
width: double.infinity,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(
|
|
top: SizeConfig.widthMultiplier * 0.9,
|
|
bottom: SizeConfig.widthMultiplier * 0.9,
|
|
right: SizeConfig.widthMultiplier * 3,
|
|
left: SizeConfig.widthMultiplier * 3),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Expanded(
|
|
// add Expanded to have your dropdown button fill remaining space
|
|
child: DropdownButton(
|
|
isExpanded: true,
|
|
value: _selectedReferralFrequancy,
|
|
iconSize: 40,
|
|
elevation: 16,
|
|
selectedItemBuilder:
|
|
(BuildContext context) {
|
|
return patientsProv
|
|
.getReferralNamesList()
|
|
.map((item) {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
AppText(
|
|
item,
|
|
fontSize:
|
|
SizeConfig.textMultiplier *
|
|
2.1,
|
|
),
|
|
],
|
|
);
|
|
}).toList();
|
|
},
|
|
onChanged: (newValue) => {
|
|
setState(() {
|
|
_selectedReferralFrequancy = newValue;
|
|
})
|
|
},
|
|
items: patientsProv
|
|
.getReferralNamesList()
|
|
.map((item) {
|
|
return DropdownMenuItem(
|
|
value: item.toString(),
|
|
child: Text(
|
|
item,
|
|
textAlign: TextAlign.end,
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|