|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
|
|
|
|
import 'package:charts_flutter/flutter.dart' as charts;
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patient_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/doctor/patient_arrival_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/patients_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/date-utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.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/dashboard/guage_chart.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:percent_indicator/circular_percent_indicator.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
|
|
|
|
import '../routes.dart';
|
|
|
|
import '../widgets/shared/app_texts_widget.dart';
|
|
|
|
import 'doctor/doctor_reply_screen.dart';
|
|
|
|
import 'doctor/my_referral_patient_screen.dart';
|
|
|
|
import 'doctor/my_referred_patient_screen.dart';
|
|
|
|
import 'medicine/medicine_search_screen.dart';
|
|
|
|
import 'patients/profile/referral/referred-patient-screen.dart';
|
|
|
|
import '../widgets/shared/rounded_container_widget.dart';
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
class DashboardScreen extends StatefulWidget {
|
|
|
|
DashboardScreen({Key key, this.title}) : super(key: key);
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
final String iconURL = 'assets/images/dashboard_icon/';
|
|
|
|
|
|
|
|
@override
|
|
|
|
_DashboardScreenState createState() => _DashboardScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
|
|
|
|
HospitalViewModel hospitalProvider;
|
|
|
|
AuthViewModel authProvider;
|
|
|
|
bool isLoading = false;
|
|
|
|
ProjectViewModel projectsProvider;
|
|
|
|
var _isInit = true;
|
|
|
|
DoctorProfileModel profile;
|
|
|
|
bool isExpanded = false;
|
|
|
|
String isInpatient = "";
|
|
|
|
var clinicName = [];
|
|
|
|
int sliderActiveIndex = 0;
|
|
|
|
var clinicId;
|
|
|
|
var _patientSearchFormValues = PatientModel(
|
|
|
|
FirstName: "0",
|
|
|
|
MiddleName: "0",
|
|
|
|
LastName: "0",
|
|
|
|
PatientMobileNumber: "0",
|
|
|
|
PatientIdentificationID: "0",
|
|
|
|
PatientID: 0,
|
|
|
|
From: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
|
|
|
|
.toString(),
|
|
|
|
To: DateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
|
|
|
|
.toString(),
|
|
|
|
LanguageID: 2,
|
|
|
|
stamp: "2020-03-02T13:56:39.170Z",
|
|
|
|
IPAdress: "11.11.11.11",
|
|
|
|
VersionID: 1.2,
|
|
|
|
Channel: 9,
|
|
|
|
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
|
|
|
|
SessionID: "5G0yXn0Jnq",
|
|
|
|
IsLoginForDoctorApp: true,
|
|
|
|
PatientOutSA: false);
|
|
|
|
void didChangeDependencies() async {
|
|
|
|
super.didChangeDependencies();
|
|
|
|
if (_isInit) {
|
|
|
|
projectsProvider = Provider.of<ProjectViewModel>(context);
|
|
|
|
projectsProvider.getDoctorClinicsList();
|
|
|
|
|
|
|
|
// _firebaseMessaging.setAutoInitEnabled(true);
|
|
|
|
_firebaseMessaging.requestNotificationPermissions(
|
|
|
|
const IosNotificationSettings(
|
|
|
|
sound: true, badge: true, alert: true, provisional: true));
|
|
|
|
_firebaseMessaging.onIosSettingsRegistered
|
|
|
|
.listen((IosNotificationSettings settings) {
|
|
|
|
print("Settings registered: $settings");
|
|
|
|
});
|
|
|
|
clinicName = await sharedPref.getObj(CLINIC_NAME);
|
|
|
|
print(clinicName);
|
|
|
|
_firebaseMessaging.getToken().then((String token) async {
|
|
|
|
if (token != '') {
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
var request = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
authProvider.insertDeviceImei(request).then((value) {
|
|
|
|
// print(value);
|
|
|
|
changeIsLoading(false);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
_isInit = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildContext myContext;
|
|
|
|
|
|
|
|
GlobalKey _one = GlobalKey();
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
myContext = context;
|
|
|
|
hospitalProvider = Provider.of(context);
|
|
|
|
authProvider = Provider.of(context);
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
FocusScopeNode currentFocus = FocusScope.of(context);
|
|
|
|
|
|
|
|
if (!currentFocus.hasPrimaryFocus) {
|
|
|
|
currentFocus.unfocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
return BaseView<DashboardViewModel>(
|
|
|
|
onModelReady: (model) => model.getDashboard(),
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
baseViewModel: model,
|
|
|
|
isShowAppBar: false,
|
|
|
|
body: ListView(children: [
|
|
|
|
Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Stack(children: [
|
|
|
|
Column(
|
|
|
|
children: <Widget>[
|
|
|
|
ProfileWelcomeWidget(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
margin: 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,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: MediaQuery.of(context).size.width * .6,
|
|
|
|
// // height: 100,
|
|
|
|
child: projectsProvider.doctorClinicsList.length > 0
|
|
|
|
? Stack(
|
|
|
|
children: [
|
|
|
|
DropdownButtonHideUnderline(
|
|
|
|
child: DropdownButton(
|
|
|
|
dropdownColor: Colors.white,
|
|
|
|
iconEnabledColor: Colors.black,
|
|
|
|
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.black,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}).toList();
|
|
|
|
},
|
|
|
|
onChanged: (newValue) {
|
|
|
|
clinicId = newValue;
|
|
|
|
changeClinic(
|
|
|
|
newValue, context, model);
|
|
|
|
},
|
|
|
|
items: projectsProvider
|
|
|
|
.doctorClinicsList
|
|
|
|
.map((item) {
|
|
|
|
return DropdownMenuItem(
|
|
|
|
child: Text(
|
|
|
|
item.clinicName,
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
),
|
|
|
|
value: item.clinicID,
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: AppText(TranslationBase.of(context).noClinic),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
isClilic: true,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.20,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: 9.0,
|
|
|
|
left: 9,
|
|
|
|
top: MediaQuery.of(context).size.height * .05,
|
|
|
|
child: Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.30,
|
|
|
|
child: model.dashboardItemsList.length > 0
|
|
|
|
? new Swiper(
|
|
|
|
onIndexChanged: (index) {
|
|
|
|
if (mounted) {
|
|
|
|
setState(() {
|
|
|
|
sliderActiveIndex = index;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return getSwiperWidget(model)[index];
|
|
|
|
},
|
|
|
|
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(),
|
|
|
|
)
|
|
|
|
: SizedBox()),
|
|
|
|
|
|
|
|
//ExpandableCardContainer(
|
|
|
|
// expandedChild: Container(
|
|
|
|
// margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
// height: MediaQuery.of(context).orientation ==
|
|
|
|
// Orientation.portrait
|
|
|
|
// ? MediaQuery.of(context).size.height * 0.22
|
|
|
|
// : MediaQuery.of(context).size.height * 0.25,
|
|
|
|
// width: double.infinity,
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// children: <Widget>[
|
|
|
|
// DashboardItem(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// this.isExpanded = false;
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// Row(
|
|
|
|
// children: [
|
|
|
|
// Expanded(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[0]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[0]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 24,
|
|
|
|
// ),
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[0]
|
|
|
|
// .kPIParameter
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[0]
|
|
|
|
// .kPIParameter
|
|
|
|
// : "",
|
|
|
|
// //'My Admitted Patient',
|
|
|
|
// color: Colors.white,
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
// fontSize: 12,
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// Expanded(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[1]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[1]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 28,
|
|
|
|
// ),
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[1]
|
|
|
|
// .kPIParameter
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[1]
|
|
|
|
// .kPIParameter
|
|
|
|
// : "",
|
|
|
|
// color: Colors.white,
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
// fontSize: 12,
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// Expanded(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[2]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[2]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 28),
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[2]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[2]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 12,
|
|
|
|
// textAlign: TextAlign.center)
|
|
|
|
// ],
|
|
|
|
// ))
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// Row(
|
|
|
|
// children: [
|
|
|
|
// Expanded(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[3]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[3]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 28),
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[3]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[3]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 12,
|
|
|
|
// textAlign: TextAlign.center)
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// Expanded(
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[
|
|
|
|
// 4]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[
|
|
|
|
// 4]
|
|
|
|
// .value
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 28),
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList
|
|
|
|
// .length >
|
|
|
|
// 0
|
|
|
|
// ? isInpatient == 'in'
|
|
|
|
// ? model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 0]
|
|
|
|
// .summaryoptions[
|
|
|
|
// 4]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : model
|
|
|
|
// .dashboardItemsList[
|
|
|
|
// 1]
|
|
|
|
// .summaryoptions[
|
|
|
|
// 4]
|
|
|
|
// .kPIParameter
|
|
|
|
// .toString()
|
|
|
|
// : "",
|
|
|
|
// color: Colors.white,
|
|
|
|
// fontSize: 12,
|
|
|
|
// textAlign: TextAlign.center)
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// Expanded(
|
|
|
|
// child: Container(),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// imageName: '5.png',
|
|
|
|
// color: HexColor('#B8382C'),
|
|
|
|
// hasBorder: false,
|
|
|
|
// width: MediaQuery.of(context).size.width * 0.9,
|
|
|
|
// height: MediaQuery.of(context).orientation ==
|
|
|
|
// Orientation.portrait
|
|
|
|
// ? MediaQuery.of(context).size.height * 0.22
|
|
|
|
// : MediaQuery.of(context).size.height * 0.25,
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// collapsedChild: Container(
|
|
|
|
// margin: EdgeInsets.only(left: 10, right: 10),
|
|
|
|
// height: MediaQuery.of(context).orientation ==
|
|
|
|
// Orientation.portrait
|
|
|
|
// ? MediaQuery.of(context).size.height * 0.15
|
|
|
|
// : MediaQuery.of(context).size.height * 0.25,
|
|
|
|
// width: double.infinity,
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
// children: <Widget>[
|
|
|
|
// DashboardItem(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// this.isExpanded = true;
|
|
|
|
// this.isInpatient = 'in';
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.spaceBetween,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.start,
|
|
|
|
// children: <Widget>[
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList.length > 0
|
|
|
|
// ? getPatientCount(
|
|
|
|
// model.dashboardItemsList[0])
|
|
|
|
// : "",
|
|
|
|
// fontSize:
|
|
|
|
// SizeConfig.textMultiplier * 6,
|
|
|
|
// color: Colors.white,
|
|
|
|
// ),
|
|
|
|
// Flexible(
|
|
|
|
// child: AppText(
|
|
|
|
// TranslationBase.of(context).inPatient,
|
|
|
|
// color: Colors.white,
|
|
|
|
// textOverflow: TextOverflow.ellipsis,
|
|
|
|
// )),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// Padding(
|
|
|
|
// padding: EdgeInsets.all(5),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.end,
|
|
|
|
// children: [
|
|
|
|
// Icon(
|
|
|
|
// DoctorApp.in_patient_white,
|
|
|
|
// size: 35,
|
|
|
|
// color: Colors.white,
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ))
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// imageName: '4.png',
|
|
|
|
// color: HexColor('#B8382C'),
|
|
|
|
// hasBorder: false,
|
|
|
|
// width: MediaQuery.of(context).size.width * 0.44,
|
|
|
|
// height: MediaQuery.of(context).orientation ==
|
|
|
|
// Orientation.portrait
|
|
|
|
// ? MediaQuery.of(context).size.height * 0.15
|
|
|
|
// : MediaQuery.of(context).size.height * 0.25,
|
|
|
|
// ),
|
|
|
|
// DashboardItem(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// isExpanded = true;
|
|
|
|
// this.isInpatient = 'out';
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.spaceBetween,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.start,
|
|
|
|
// children: <Widget>[
|
|
|
|
// AppText(
|
|
|
|
// model.dashboardItemsList.length > 0
|
|
|
|
// ? getPatientCount(
|
|
|
|
// model.dashboardItemsList[1])
|
|
|
|
// : "",
|
|
|
|
// fontSize:
|
|
|
|
// SizeConfig.textMultiplier * 6,
|
|
|
|
// color: Colors.white,
|
|
|
|
// ),
|
|
|
|
// Flexible(
|
|
|
|
// child: AppText(
|
|
|
|
// TranslationBase.of(context)
|
|
|
|
// .outPatients,
|
|
|
|
// color: Colors.white,
|
|
|
|
// textOverflow: TextOverflow.ellipsis,
|
|
|
|
// )),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// Padding(
|
|
|
|
// padding: EdgeInsets.all(5),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.end,
|
|
|
|
// children: [
|
|
|
|
// Icon(
|
|
|
|
// DoctorApp.out_patient,
|
|
|
|
// size: 35,
|
|
|
|
// color: Colors.white,
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ))
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// imageName: '5.png',
|
|
|
|
// color: HexColor('#B8382C'),
|
|
|
|
// hasBorder: false,
|
|
|
|
// width: MediaQuery.of(context).size.width * 0.44,
|
|
|
|
// height: MediaQuery.of(context).orientation ==
|
|
|
|
// Orientation.portrait
|
|
|
|
// ? MediaQuery.of(context).size.height * 0.15
|
|
|
|
// : MediaQuery.of(context).size.height * 0.25,
|
|
|
|
// ),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// isExpanded: isExpanded,
|
|
|
|
// ))
|
|
|
|
)
|
|
|
|
]),
|
|
|
|
model.dashboardItemsList.length > 0
|
|
|
|
? FractionallySizedBox(
|
|
|
|
widthFactor: 0.90,
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
sliderActiveIndex == 1
|
|
|
|
? Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
AppText(
|
|
|
|
model.dashboardItemsList[3].kPIName,
|
|
|
|
fontSize:
|
|
|
|
SizeConfig.textMultiplier * 2.2,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
new Container(
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
.orientation ==
|
|
|
|
Orientation.portrait
|
|
|
|
? MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.15
|
|
|
|
: MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.20,
|
|
|
|
child: new ListView(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
children: new List.generate(
|
|
|
|
model
|
|
|
|
.dashboardItemsList[3]
|
|
|
|
.summaryoptions
|
|
|
|
.length, (int index) {
|
|
|
|
return getActivityButton(model
|
|
|
|
.dashboardItemsList[3]
|
|
|
|
.summaryoptions[index]);
|
|
|
|
})))
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: sliderActiveIndex == 0
|
|
|
|
? Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
AppText(
|
|
|
|
model.dashboardItemsList[4]
|
|
|
|
.kPIName,
|
|
|
|
fontSize:
|
|
|
|
SizeConfig.textMultiplier *
|
|
|
|
2.2,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
new Container(
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
.orientation ==
|
|
|
|
Orientation.portrait
|
|
|
|
? MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.15
|
|
|
|
: MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.20,
|
|
|
|
child: new ListView(
|
|
|
|
scrollDirection:
|
|
|
|
Axis.horizontal,
|
|
|
|
children: new List.generate(
|
|
|
|
model
|
|
|
|
.dashboardItemsList[4]
|
|
|
|
.summaryoptions
|
|
|
|
.length, (int index) {
|
|
|
|
return getActivityButton(model
|
|
|
|
.dashboardItemsList[4]
|
|
|
|
.summaryoptions[index]);
|
|
|
|
})))
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
AppText(
|
|
|
|
model.dashboardItemsList[5]
|
|
|
|
.kPIName,
|
|
|
|
fontSize:
|
|
|
|
SizeConfig.textMultiplier *
|
|
|
|
2.2,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
new Container(
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
.orientation ==
|
|
|
|
Orientation.portrait
|
|
|
|
? MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.15
|
|
|
|
: MediaQuery.of(context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.20,
|
|
|
|
child: new ListView(
|
|
|
|
scrollDirection:
|
|
|
|
Axis.horizontal,
|
|
|
|
children: new List.generate(
|
|
|
|
model
|
|
|
|
.dashboardItemsList[5]
|
|
|
|
.summaryoptions
|
|
|
|
.length, (int index) {
|
|
|
|
return getActivityButton(model
|
|
|
|
.dashboardItemsList[5]
|
|
|
|
.summaryoptions[index]);
|
|
|
|
})))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
])))
|
|
|
|
: SizedBox(),
|
|
|
|
FractionallySizedBox(
|
|
|
|
// widthFactor: 0.90,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topRight: Radius.circular(50),
|
|
|
|
)),
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
margin: EdgeInsets.only(top: 15),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
|
|
height: 15,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
width: 150,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).patient,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.5,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).services,
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
DashboardItem(
|
|
|
|
color: Colors.red[800],
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 10, left: 10, right: 0),
|
|
|
|
child: Icon(
|
|
|
|
DoctorApp.referral_1,
|
|
|
|
size: 35,
|
|
|
|
color: Colors.white,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.patientsreferral,
|
|
|
|
color: Colors.white,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
hasBorder: false,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => PatientReferralScreen(),
|
|
|
|
// MyReferredPatient(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
DashboardItem(
|
|
|
|
color: Colors.grey[300],
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 10, left: 10, right: 0),
|
|
|
|
child: Icon(
|
|
|
|
DoctorApp.arrival_patients,
|
|
|
|
size: 35,
|
|
|
|
color: Colors.black,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.arrivalpatient,
|
|
|
|
color: Colors.black,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
hasBorder: false,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed(PATIENTS, arguments: {
|
|
|
|
"patientSearchForm": _patientSearchFormValues,
|
|
|
|
"selectedType": "7",
|
|
|
|
"arrivalType": "1"
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
DashboardItem(
|
|
|
|
color: Colors.black,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 10, left: 10, right: 0),
|
|
|
|
child: Icon(
|
|
|
|
DoctorApp.search,
|
|
|
|
size: 35,
|
|
|
|
color: Colors.white,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.searchmedicinepatient,
|
|
|
|
color: Colors.white,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
hasBorder: false,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) =>
|
|
|
|
SearchMedicinePatientScreen(),
|
|
|
|
));
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: 8,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static List<charts.Series<GaugeSegment, String>> _createReferralData(model) {
|
|
|
|
final data = [
|
|
|
|
new GaugeSegment(
|
|
|
|
model.dashboardItemsList[2].summaryoptions[0].kPIParameter,
|
|
|
|
getValue(model.dashboardItemsList[1].summaryoptions[0].value),
|
|
|
|
charts.MaterialPalette.black),
|
|
|
|
new GaugeSegment(
|
|
|
|
model.dashboardItemsList[2].summaryoptions[1].kPIParameter,
|
|
|
|
getValue(model.dashboardItemsList[1].summaryoptions[1].value),
|
|
|
|
charts.MaterialPalette.gray.shadeDefault),
|
|
|
|
new GaugeSegment(
|
|
|
|
model.dashboardItemsList[2].summaryoptions[2].kPIParameter,
|
|
|
|
getValue(model.dashboardItemsList[1].summaryoptions[2].value),
|
|
|
|
charts.MaterialPalette.red.shadeDefault),
|
|
|
|
];
|
|
|
|
|
|
|
|
return [
|
|
|
|
new charts.Series<GaugeSegment, String>(
|
|
|
|
id: 'Segments',
|
|
|
|
domainFn: (GaugeSegment segment, _) => segment.segment,
|
|
|
|
measureFn: (GaugeSegment segment, _) => segment.size,
|
|
|
|
data: data,
|
|
|
|
colorFn: (GaugeSegment segment, _) => segment.color,
|
|
|
|
)
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
static int getValue(value) {
|
|
|
|
return value == 0 ? 1 : value;
|
|
|
|
}
|
|
|
|
|
|
|
|
changeClinic(clinicId, BuildContext context, model) async {
|
|
|
|
// Navigator.pop(context);
|
|
|
|
changeIsLoading(true);
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
|
|
|
|
ProfileReqModel docInfo = new ProfileReqModel(
|
|
|
|
doctorID: doctorProfile.doctorID,
|
|
|
|
clinicID: clinicId,
|
|
|
|
license: true,
|
|
|
|
projectID: doctorProfile.projectID,
|
|
|
|
tokenID: '',
|
|
|
|
languageID: 2);
|
|
|
|
|
|
|
|
// authProvider.getDocProfiles(docInfo)
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
changeIsLoading(bool val) {
|
|
|
|
setState(() {
|
|
|
|
this.isLoading = val;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
getPatientCount(DashboardModel inPatientCount) {
|
|
|
|
int value = 0;
|
|
|
|
inPatientCount.summaryoptions.forEach((result) => {value += result.value});
|
|
|
|
|
|
|
|
return value.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget getActivityButton(value) {
|
|
|
|
return Container(
|
|
|
|
width: MediaQuery.of(context).size.width * 0.24,
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
height: MediaQuery.of(context).orientation == Orientation.portrait
|
|
|
|
? MediaQuery.of(context).size.height * 0.15
|
|
|
|
: MediaQuery.of(context).size.height * 0.20,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: AppText(value.value.toString(),
|
|
|
|
fontSize: 28, fontWeight: FontWeight.bold)),
|
|
|
|
Expanded(
|
|
|
|
child: AppText(
|
|
|
|
value.kPIParameter,
|
|
|
|
textOverflow: TextOverflow.clip,
|
|
|
|
fontSize: 12,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget dot(Color c) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.all(5.0),
|
|
|
|
margin: EdgeInsets.all(5.0),
|
|
|
|
decoration: BoxDecoration(color: c, shape: BoxShape.circle));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget rowCount(name, int count, Color c) {
|
|
|
|
return Row(
|
|
|
|
children: [
|
|
|
|
dot(c),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 5, bottom: 5),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
name,
|
|
|
|
color: Colors.black,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
fontSize: 12,
|
|
|
|
textOverflow: TextOverflow.ellipsis,
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
' (' + count.toString() + ')',
|
|
|
|
color: Colors.black,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget getOutPatientStack(value) {
|
|
|
|
value.summaryoptions
|
|
|
|
.sort((Summaryoptions a, Summaryoptions b) => b.value - a.value);
|
|
|
|
|
|
|
|
var list = new List<Widget>();
|
|
|
|
value.summaryoptions.forEach((result) =>
|
|
|
|
{list.add(getStack(result, value.summaryoptions.first.value))});
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
Texts(
|
|
|
|
value.kPIName,
|
|
|
|
medium: true,
|
|
|
|
),
|
|
|
|
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
getStack(Summaryoptions value, max) {
|
|
|
|
return Stack(children: [
|
|
|
|
Container(
|
|
|
|
height: 150,
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
width: ((SizeConfig.screenWidth * .55) / 5),
|
|
|
|
child: SizedBox(),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(10), color: Colors.red[50]),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
bottom: 0,
|
|
|
|
child: Container(
|
|
|
|
child: SizedBox(),
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
height: max != 0 ? (150 * value.value) / max : 0,
|
|
|
|
width: ((SizeConfig.screenWidth * .55) / 5),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
color: Colors.red[300]))),
|
|
|
|
Container(
|
|
|
|
height: 150,
|
|
|
|
margin: EdgeInsets.only(left: 10, top: 5),
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
child: RotatedBox(
|
|
|
|
quarterTurns: 1,
|
|
|
|
child: Center(
|
|
|
|
child: Align(
|
|
|
|
child: AppText(
|
|
|
|
value.kPIParameter + ' (' + value.value.toString() + ') ',
|
|
|
|
fontSize: 11,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> getSwiperWidget(model) {
|
|
|
|
return [
|
|
|
|
RoundedContainer(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.32,
|
|
|
|
margin: 5,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(5.0),
|
|
|
|
child: getOutPatientStack(model.dashboardItemsList[1]))),
|
|
|
|
RoundedContainer(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.32,
|
|
|
|
margin: 5,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(5.0),
|
|
|
|
child: getOutPatientStack(model.dashboardItemsList[0]))),
|
|
|
|
RoundedContainer(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.24,
|
|
|
|
margin: 5,
|
|
|
|
child:
|
|
|
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 4,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(5.0),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Padding(
|
|
|
|
child: AppText(
|
|
|
|
TranslationBase.of(context).referral,
|
|
|
|
fontSize: 20,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.all(10))),
|
|
|
|
Expanded(
|
|
|
|
flex: 2,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
rowCount(
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[0].kPIParameter,
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[0].value,
|
|
|
|
Colors.black),
|
|
|
|
rowCount(
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[1].kPIParameter,
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[1].value,
|
|
|
|
Colors.grey),
|
|
|
|
rowCount(
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[2].kPIParameter,
|
|
|
|
model.dashboardItemsList[2]
|
|
|
|
.summaryoptions[2].value,
|
|
|
|
Colors.red),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
Expanded(
|
|
|
|
flex: 3,
|
|
|
|
child: Stack(children: [
|
|
|
|
Container(
|
|
|
|
child: GaugeChart(_createReferralData(model))),
|
|
|
|
Positioned(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
getPatientCount(model.dashboardItemsList[2])
|
|
|
|
.toString(),
|
|
|
|
fontSize: 30,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
top: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
left: 0,
|
|
|
|
right: 0)
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
])),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO Move to it file
|
|
|
|
class DashboardItem extends StatelessWidget {
|
|
|
|
const DashboardItem(
|
|
|
|
{this.hasBorder = false,
|
|
|
|
this.imageName,
|
|
|
|
@required this.child,
|
|
|
|
this.onTap,
|
|
|
|
Key key,
|
|
|
|
this.width,
|
|
|
|
this.height,
|
|
|
|
this.color,
|
|
|
|
this.opacity = 0.4})
|
|
|
|
: super(key: key);
|
|
|
|
final bool hasBorder;
|
|
|
|
final String imageName;
|
|
|
|
final Widget child;
|
|
|
|
final Function onTap;
|
|
|
|
final double width;
|
|
|
|
final double height;
|
|
|
|
final Color color;
|
|
|
|
final double opacity;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
|
|
|
|
height: height != null
|
|
|
|
? height
|
|
|
|
: MediaQuery.of(context).orientation == Orientation.portrait
|
|
|
|
? MediaQuery.of(context).size.height * 0.16
|
|
|
|
: MediaQuery.of(context).size.height * 0.36,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: !hasBorder
|
|
|
|
? color != null
|
|
|
|
? color
|
|
|
|
: HexColor('#050705').withOpacity(opacity)
|
|
|
|
: Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
border: hasBorder
|
|
|
|
? Border.all(width: 1.0, color: const Color(0xffcccccc))
|
|
|
|
: Border.all(width: 0.0, color: Colors.transparent),
|
|
|
|
image: imageName != null
|
|
|
|
? DecorationImage(
|
|
|
|
image: AssetImage('assets/images/dashboard/${imageName}'),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
colorFilter: new ColorFilter.mode(
|
|
|
|
Colors.black.withOpacity(0.2), BlendMode.dstIn),
|
|
|
|
)
|
|
|
|
: null,
|
|
|
|
),
|
|
|
|
child: Center(
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
getDashboardWidget() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ExpandableCardContainer extends StatefulWidget {
|
|
|
|
final bool isExpanded;
|
|
|
|
final Widget collapsedChild;
|
|
|
|
final Widget expandedChild;
|
|
|
|
|
|
|
|
const ExpandableCardContainer(
|
|
|
|
{Key key, this.isExpanded, this.collapsedChild, this.expandedChild})
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_ExpandableCardContainerState createState() =>
|
|
|
|
_ExpandableCardContainerState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ExpandableCardContainerState extends State<ExpandableCardContainer> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return new AnimatedContainer(
|
|
|
|
duration: new Duration(milliseconds: 1000),
|
|
|
|
curve: Curves.easeInOut,
|
|
|
|
child: widget.isExpanded ? widget.expandedChild : widget.collapsedChild,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|