dashboard page updated

merge-requests/340/head
Sultan Khan 5 years ago
parent c00d4107b9
commit 05ef7a4b25

@ -738,5 +738,6 @@ const Map<String, Map<String, String>> localizedValues = {
'en': "A Sick leave is on Hold status for this patient",
'ar': "الإجازة المرضية في حالة الانتظار لهذا المريض"
},
'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"}
'no-clinic': {'en': "No Clinic", 'ar': "لا عيادة"},
'otherStatistic': {'en': "Other Statistics", 'ar': "دیگر شماریات"},
};

@ -63,6 +63,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
bool isExpanded = false;
String isInpatient = "";
var clinicName = [];
var clinicId;
void didChangeDependencies() async {
super.didChangeDependencies();
@ -146,48 +147,81 @@ class _DashboardScreenState extends State<DashboardScreen> {
width: MediaQuery.of(context).size.width * .6,
// height: 100,
child: projectsProvider.doctorClinicsList.length > 0
? DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.white,
isExpanded: true,
value: clinicId == null
? projectsProvider
.doctorClinicsList[0].clinicID
: clinicId,
iconSize: 25,
elevation: 16,
selectedItemBuilder: (BuildContext context) {
return projectsProvider.doctorClinicsList
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
? Stack(
children: [
DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.white,
isExpanded: true,
value: clinicId == null
? projectsProvider
.doctorClinicsList[0].clinicID
: clinicId,
iconSize: 25,
elevation: 16,
selectedItemBuilder:
(BuildContext context) {
return projectsProvider.doctorClinicsList
.map((item) {
return Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
AppText(
item.clinicName,
fontSize:
SizeConfig.textMultiplier *
2.1,
color: Colors.white,
),
],
);
}).toList();
},
onChanged: (newValue) {
clinicId = newValue;
changeClinic(newValue, context, model);
},
items: projectsProvider.doctorClinicsList
.map((item) {
return DropdownMenuItem(
child: Text(
item.clinicName,
fontSize:
SizeConfig.textMultiplier * 2.1,
textAlign: TextAlign.end,
),
value: item.clinicID,
);
}).toList(),
)),
Positioned(
right: projectsProvider.isArabic ? 35 : 0,
top: 0,
child: new Container(
padding: EdgeInsets.all(4),
decoration: new BoxDecoration(
color: Colors.red[800],
borderRadius: BorderRadius.circular(20),
),
constraints: BoxConstraints(
minWidth: 20,
minHeight: 20,
),
child: new Text(
projectsProvider
.doctorClinicsList.length
.toString(),
style: new TextStyle(
color: Colors.white,
fontSize: projectsProvider.isArabic
? 10
: 11,
),
],
);
}).toList();
},
onChanged: (newValue) {
clinicId = newValue;
changeClinic(newValue, context);
},
items: projectsProvider.doctorClinicsList
.map((item) {
return DropdownMenuItem(
child: Text(
item.clinicName,
textAlign: TextAlign.end,
textAlign: TextAlign.center,
),
),
value: item.clinicID,
);
}).toList(),
))
)
],
)
: AppText(TranslationBase.of(context).noClinic),
),
),
@ -284,7 +318,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
// ),
Container(
color: Colors.white,
height: MediaQuery.of(context).size.height * 0.22,
height: MediaQuery.of(context).size.height * 0.23,
),
],
),
@ -293,14 +327,68 @@ class _DashboardScreenState extends State<DashboardScreen> {
left: 9,
top: MediaQuery.of(context).size.height * .1,
child: Container(
height: MediaQuery.of(context).size.height * 0.30,
height: MediaQuery.of(context).size.height * 0.28,
child: model.dashboardItemsList.length > 0
? new Swiper(
itemBuilder: (BuildContext context, int index) {
return getSwiperWidget(model)[index];
},
itemCount: 2,
// pagination: new SwiperPagination(),
itemCount: 3,
pagination: new SwiperCustomPagination(builder:
(BuildContext context,
SwiperPluginConfig config) {
return new Stack(
alignment: Alignment.bottomCenter,
children: [
Positioned(
bottom: -5,
child: Center(
child: InkWell(
onTap: () {},
child: Container(
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Container(
height: 10,
width: 50,
margin:
EdgeInsets.all(
2),
color: config
.activeIndex ==
0
? Colors.black
: Colors.grey),
Container(
height: 10,
width: 50,
margin:
EdgeInsets.all(
2),
color: config
.activeIndex ==
1
? Colors.black
: Colors.grey),
Container(
height: 10,
width: 50,
margin:
EdgeInsets.all(
2),
color: config
.activeIndex ==
2
? Colors.black
: Colors.grey),
],
)))))
]);
}),
viewportFraction: 0.9,
// scale: 0.9,
// control: new SwiperControl(),
@ -738,119 +826,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
DashboardItem(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 10),
child: Icon(
DoctorApp.lab_results,
size: 40,
color: Colors.white,
),
),
Container(
// margin: EdgeInsets.only(bottom: 10),
child: Column(
children: <Widget>[
AppText(
model.dashboardItemsList.length > 0
? getPatientCount(
model.dashboardItemsList[5])
: "",
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.white,
),
AppText(
TranslationBase.of(context)
.targetPatient,
textAlign: TextAlign.center,
color: Colors.white,
)
],
),
),
],
),
imageName: '1.png',
opacity: 0.82,
),
DashboardItem(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 10),
child: Icon(
DoctorApp.radiology,
size: 40,
color: Colors.white,
),
),
Container(
margin: EdgeInsets.only(bottom: 10),
child: Column(
children: <Widget>[
AppText(
clinicName.length.toString(),
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.white,
),
AppText(
TranslationBase.of(context).clinic,
color: Colors.white,
)
],
),
),
],
),
imageName: '2.png',
opacity: 0.9,
),
DashboardItem(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 10),
child: Icon(
DoctorApp.referral,
size: 40,
color: Colors.white,
),
),
Container(
margin: EdgeInsets.only(bottom: 10),
child: Column(
children: <Widget>[
AppText(
model.dashboardItemsList.length > 0
? getPatientCount(
model.dashboardItemsList[2])
: "",
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.white,
),
AppText(
TranslationBase.of(context).referral,
color: Colors.white,
)
],
),
),
],
),
imageName: '3.png',
opacity: 0.9,
),
],
),
SizedBox(
height: 15,
),
@ -873,32 +848,27 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Center(
child: Icon(
DoctorApp.search_patient_1,
size: 50,
color: Colors.black,
),
Icon(
DoctorApp.referred,
size: 50,
color: Colors.black,
),
Column(
children: [
AppText(
TranslationBase.of(context).searchAbout,
color: Colors.black,
textAlign: TextAlign.center,
),
AppText(
TranslationBase.of(context).patient,
color: Colors.black,
textAlign: TextAlign.center,
)
],
AppText(
TranslationBase.of(context).myReferredPatient,
color: Colors.black,
textAlign: TextAlign.center,
)
],
),
hasBorder: true,
onTap: () {
Navigator.of(context).pushNamed(PATIENT_SEARCH);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ReferredPatientScreen(),
// MyReferredPatient(),
),
);
},
),
DashboardItem(
@ -906,23 +876,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.mail,
DoctorApp.referral,
size: 50,
color: Colors.black,
),
Column(
children: [
AppText(
TranslationBase.of(context).theDoctor,
textAlign: TextAlign.center,
color: Colors.black,
),
AppText(
TranslationBase.of(context).reply,
textAlign: TextAlign.center,
color: Colors.black,
),
],
AppText(
TranslationBase.of(context).myReferralPatient,
textAlign: TextAlign.center,
color: Colors.black,
)
],
),
@ -931,7 +892,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DoctorReplyScreen(),
builder: (context) =>
MyReferralPatientScreen(),
),
);
},
@ -941,12 +903,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.medicine_search,
DoctorApp.patient,
size: 50,
color: Colors.black,
),
AppText(
TranslationBase.of(context).searchMedicine,
TranslationBase.of(context).arrived,
color: Colors.black,
textAlign: TextAlign.center,
)
@ -954,14 +915,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
hasBorder: true,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MedicineSearchScreen(),
),
);
Navigator.of(context)
.pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,
"selectedType": "7"
});
},
),
)
],
),
SizedBox(
@ -975,35 +935,32 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.qr_code,
size: 50,
color: Colors.black,
Center(
child: Icon(
DoctorApp.search_patient_1,
size: 50,
color: Colors.black,
),
),
Column(
children: [
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).reader
: TranslationBase.of(context).qr,
TranslationBase.of(context).searchAbout,
color: Colors.black,
textAlign: TextAlign.center,
),
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).qr
: TranslationBase.of(context).reader,
TranslationBase.of(context).patient,
color: Colors.black,
textAlign: TextAlign.center,
),
)
],
)
],
),
// imageName: '1.png',
hasBorder: true,
onTap: () {
Navigator.of(context).pushNamed(QR_READER);
Navigator.of(context).pushNamed(PATIENT_SEARCH);
},
),
DashboardItem(
@ -1011,14 +968,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.referral,
DoctorApp.medicine_search,
size: 50,
color: Colors.black,
),
AppText(
TranslationBase.of(context).myReferralPatient,
textAlign: TextAlign.center,
TranslationBase.of(context).searchMedicine,
color: Colors.black,
textAlign: TextAlign.center,
)
],
),
@ -1027,8 +984,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
MyReferralPatientScreen(),
builder: (context) => MedicineSearchScreen(),
),
);
},
@ -1038,26 +994,34 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.referred,
DoctorApp.qr_code,
size: 50,
color: Colors.black,
),
AppText(
TranslationBase.of(context).myReferredPatient,
color: Colors.black,
textAlign: TextAlign.center,
Column(
children: [
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).reader
: TranslationBase.of(context).qr,
color: Colors.black,
textAlign: TextAlign.center,
),
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).qr
: TranslationBase.of(context).reader,
color: Colors.black,
textAlign: TextAlign.center,
),
],
)
],
),
// imageName: '1.png',
hasBorder: true,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ReferredPatientScreen(),
// MyReferredPatient(),
),
);
Navigator.of(context).pushNamed(QR_READER);
},
),
],
@ -1104,23 +1068,34 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.patient,
DoctorApp.mail,
size: 50,
),
AppText(
TranslationBase.of(context).arrived,
color: Colors.black,
textAlign: TextAlign.center,
),
Column(
children: [
AppText(
TranslationBase.of(context).theDoctor,
textAlign: TextAlign.center,
color: Colors.black,
),
AppText(
TranslationBase.of(context).reply,
textAlign: TextAlign.center,
color: Colors.black,
),
],
)
],
),
hasBorder: true,
onTap: () {
Navigator.of(context)
.pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,
"selectedType": "7"
});
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DoctorReplyScreen(),
),
);
},
)
],
@ -1218,72 +1193,72 @@ class _DashboardScreenState extends State<DashboardScreen> {
return value == 0 ? 1 : value;
}
showCupertinoPicker(
{context, List<ClinicModel> actionList, decKey, onSelectFun}) {
showModalBottomSheet(
isDismissible: false,
isScrollControlled: true,
context: context,
builder: (BuildContext builder) {
return Container(
// height: 500,
height: SizeConfig.realScreenHeight * 0.4,
color: Color(0xfff7f7f7),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
color: Color(0xfff7f7f7),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
CupertinoButton(
child: AppText(TranslationBase.of(context).cancel
// style: TextStyle(context)
),
onPressed: () {
Navigator.pop(context);
},
),
CupertinoButton(
child: AppText(TranslationBase.of(context).done
// style: textStyle(context),
),
onPressed: () {
Navigator.pop(context);
// onSelectFun(cupertinoPickerIndex);
},
)
],
),
),
Container(
height: SizeConfig.realScreenHeight * 0.3,
color: Color(0xfff7f7f7),
child: Column(
children: actionList
.map((e) => Flexible(
child: Container(
height: 50,
child: InkWell(
onTap: () =>
changeClinic(e.clinicID, context),
child: AppText(
e.clinicName,
fontSize:
SizeConfig.textMultiplier * 1.9,
)),
),
))
.toList(),
))
],
),
);
});
}
// showCupertinoPicker(
// {context, List<ClinicModel> actionList, decKey, onSelectFun}) {
// showModalBottomSheet(
// isDismissible: false,
// isScrollControlled: true,
// context: context,
// builder: (BuildContext builder) {
// return Container(
// // height: 500,
// height: SizeConfig.realScreenHeight * 0.4,
// color: Color(0xfff7f7f7),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Container(
// color: Color(0xfff7f7f7),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// CupertinoButton(
// child: AppText(TranslationBase.of(context).cancel
// // style: TextStyle(context)
// ),
// onPressed: () {
// Navigator.pop(context);
// },
// ),
// CupertinoButton(
// child: AppText(TranslationBase.of(context).done
// // style: textStyle(context),
// ),
// onPressed: () {
// Navigator.pop(context);
// // onSelectFun(cupertinoPickerIndex);
// },
// )
// ],
// ),
// ),
// Container(
// height: SizeConfig.realScreenHeight * 0.3,
// color: Color(0xfff7f7f7),
// child: Column(
// children: actionList
// .map((e) => Flexible(
// child: Container(
// height: 50,
// child: InkWell(
// onTap: () => changeClinic(
// e.clinicID, context, model),
// child: AppText(
// e.clinicName,
// fontSize:
// SizeConfig.textMultiplier * 1.9,
// )),
// ),
// ))
// .toList(),
// ))
// ],
// ),
// );
// });
// }
changeClinic(clinicId, BuildContext context) async {
changeClinic(clinicId, BuildContext context, model) async {
// Navigator.pop(context);
changeIsLoading(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -1300,6 +1275,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
authProvider.getDocProfiles(docInfo.toJson()).then((res) async {
changeIsLoading(false);
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
model.getDashboard();
}).catchError((err) {
changeIsLoading(false);
helpers.showErrorToast(err);
@ -1420,7 +1396,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
AppText(
getPatientCount(model.dashboardItemsList[0])
.toString(),
fontSize: 11,
fontSize: 18,
fontWeight: FontWeight.bold,
)
],
@ -1502,18 +1478,166 @@ class _DashboardScreenState extends State<DashboardScreen> {
AppText(
getPatientCount(model.dashboardItemsList[1])
.toString(),
fontSize: 11,
fontSize: 18,
fontWeight: FontWeight.bold,
)
],
),
top: MediaQuery.of(context).size.height * 0.12,
left: MediaQuery.of(context).size.width * 0.11)
left: MediaQuery.of(context).size.width * 0.10)
]),
),
],
)),
]))
])),
RoundedContainer(
height: MediaQuery.of(context).size.height * 0.24,
margin: 5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(10),
child: AppText(TranslationBase.of(context).otherStatistic)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
DashboardItem(
width: MediaQuery.of(context).size.width * 0.25,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.18
: MediaQuery.of(context).size.height * 0.36,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 5),
child: Icon(
DoctorApp.lab_results,
size: 40,
color: Colors.black,
),
),
Container(
// margin: EdgeInsets.only(bottom: 10),
child: Column(
children: <Widget>[
AppText(
model.dashboardItemsList.length > 0
? getPatientCount(
model.dashboardItemsList[5])
: "",
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.black,
),
AppText(
TranslationBase.of(context).targetPatient,
textAlign: TextAlign.center,
color: Colors.black,
)
],
),
),
],
),
//imageName: '1.png',
opacity: 0,
),
Container(
color: Colors.black12,
height: MediaQuery.of(context).size.height * 0.18,
width: 1,
),
DashboardItem(
width: MediaQuery.of(context).size.width * 0.25,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.18
: MediaQuery.of(context).size.height * 0.36,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 5),
child: Icon(
DoctorApp.radiology,
size: 40,
color: Colors.black,
),
),
Container(
margin: EdgeInsets.only(bottom: 5),
child: Column(
children: <Widget>[
AppText(
clinicName.length.toString(),
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.black,
),
AppText(
TranslationBase.of(context).clinic,
color: Colors.black,
)
],
),
),
],
),
//imageName: '2.png',
opacity: 0,
),
Container(
color: Colors.black12,
height: MediaQuery.of(context).size.height * 0.18,
width: 1,
),
DashboardItem(
width: MediaQuery.of(context).size.width * 0.25,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.18
: MediaQuery.of(context).size.height * 0.36,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 5),
child: Icon(
DoctorApp.referral,
size: 40,
color: Colors.black,
),
),
Container(
margin: EdgeInsets.only(bottom: 5),
child: Column(
children: <Widget>[
AppText(
model.dashboardItemsList.length > 0
? getPatientCount(
model.dashboardItemsList[2])
: "",
fontSize: SizeConfig.textMultiplier * 6,
color: Colors.black,
),
AppText(
TranslationBase.of(context).referral,
color: Colors.black,
)
],
),
),
],
),
//imageName: '3.png',
opacity: 0,
),
],
)
],
))
];
}
}

@ -1123,6 +1123,9 @@ class TranslationBase {
String get sickleaveonhold =>
localizedValues['sickleaveonhold'][locale.languageCode];
String get noClinic => localizedValues['no-clinic'][locale.languageCode];
String get otherStatistic =>
localizedValues['otherStatistic'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save