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.
963 lines
44 KiB
Dart
963 lines
44 KiB
Dart
import 'package:charts_flutter/flutter.dart' as charts;
|
|
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/auth_view_model.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/dashboard_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/icons_app/doctor_app_icons.dart';
|
|
import 'package:doctor_app_flutter/models/dashboard/dashboard_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/models/patient/patient_model.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/screens/medicine/search_medicine_patient_screen.dart';
|
|
import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.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:provider/provider.dart';
|
|
|
|
import '../../routes.dart';
|
|
import '../../widgets/shared/app_texts_widget.dart';
|
|
import '../../widgets/shared/rounded_container_widget.dart';
|
|
import 'home_page_card.dart';
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
Helpers helpers = Helpers();
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
HomeScreen({Key key, this.title}) : super(key: key);
|
|
|
|
final String title;
|
|
final String iconURL = 'assets/images/dashboard_icon/';
|
|
|
|
@override
|
|
_HomeScreenState createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
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;
|
|
@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>[
|
|
SizedBox(height: 20),
|
|
Stack(children: [
|
|
IconButton(
|
|
icon: Image.asset('assets/images/menu.png',
|
|
height: 50, width: 50),
|
|
iconSize: 18,
|
|
color: Colors.black,
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
),
|
|
Column(
|
|
children: <Widget>[
|
|
ProfileWelcomeWidget(
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
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,
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.end,
|
|
children: <Widget>[
|
|
Container(
|
|
padding: EdgeInsets.all(2),
|
|
margin: EdgeInsets.all(2),
|
|
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,
|
|
),
|
|
),
|
|
AppText(item.clinicName,
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
textAlign: TextAlign.end),
|
|
],
|
|
);
|
|
}).toList();
|
|
},
|
|
onChanged: (newValue) {
|
|
clinicId = newValue;
|
|
changeClinic(
|
|
newValue, context, model);
|
|
},
|
|
items: projectsProvider
|
|
.doctorClinicsList
|
|
.map((item) {
|
|
return DropdownMenuItem(
|
|
child: AppText(
|
|
item.clinicName,
|
|
textAlign: TextAlign.right,
|
|
),
|
|
value: item.clinicID,
|
|
);
|
|
}).toList(),
|
|
)),
|
|
],
|
|
)
|
|
: AppText(TranslationBase.of(context).noClinic),
|
|
),
|
|
],
|
|
),
|
|
isClilic: true,
|
|
),
|
|
Container(
|
|
height: MediaQuery.of(context).size.height * 0.24,
|
|
),
|
|
],
|
|
),
|
|
Positioned(
|
|
right: 9.0,
|
|
left: 9,
|
|
top: MediaQuery.of(context).size.height * .08,
|
|
child: Container(
|
|
height: MediaQuery.of(context).size.height * 0.35,
|
|
child: model.dashboardItemsList.length > 0
|
|
? new Swiper(
|
|
onIndexChanged: (index) {
|
|
if (mounted) {
|
|
setState(() {
|
|
sliderActiveIndex = index;
|
|
});
|
|
}
|
|
},
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return getSwipeWidget(model)[index];
|
|
},
|
|
itemCount: 3,
|
|
itemHeight: 300,
|
|
pagination: new SwiperCustomPagination(builder:
|
|
(BuildContext context,
|
|
SwiperPluginConfig config) {
|
|
return new Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
Positioned(
|
|
bottom: 0,
|
|
child: Center(
|
|
child: InkWell(
|
|
onTap: () {},
|
|
child: Container(
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment
|
|
.spaceBetween,
|
|
children: [
|
|
config.activeIndex == 0
|
|
? getSwiperPagiantion(
|
|
true)
|
|
: getSwiperPagiantion(
|
|
false),
|
|
config.activeIndex == 1
|
|
? getSwiperPagiantion(
|
|
true)
|
|
: getSwiperPagiantion(
|
|
false),
|
|
config.activeIndex == 2
|
|
? getSwiperPagiantion(
|
|
true)
|
|
: getSwiperPagiantion(
|
|
false),
|
|
],
|
|
)))))
|
|
]);
|
|
}),
|
|
viewportFraction: 0.9,
|
|
// scale: 0.9,
|
|
// control: new SwiperControl(),
|
|
)
|
|
: SizedBox()),
|
|
)
|
|
]),
|
|
model.dashboardItemsList.length > 0
|
|
? FractionallySizedBox(
|
|
widthFactor: 0.90,
|
|
child: Container(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
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[6]
|
|
.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[6]
|
|
.summaryoptions
|
|
.length, (int index) {
|
|
return getActivityButton(model
|
|
.dashboardItemsList[6]
|
|
.summaryoptions[index]);
|
|
})))
|
|
],
|
|
)
|
|
: 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]);
|
|
})))
|
|
],
|
|
),
|
|
])))
|
|
: SizedBox(),
|
|
FractionallySizedBox(
|
|
// widthFactor: 0.90,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topRight: Radius.circular(50),
|
|
)),
|
|
padding: EdgeInsets.only(left: 20, top: 10, right: 20),
|
|
margin: EdgeInsets.only(top: 10),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 150,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
TranslationBase.of(context).patients,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
height: .5,
|
|
fontWeight: FontWeight.bold,
|
|
fontFamily: 'Poppins'),
|
|
),
|
|
Text(
|
|
TranslationBase.of(context).services,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.bold,
|
|
fontFamily: 'Poppins'),
|
|
),
|
|
],
|
|
)),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
HomePageCard(
|
|
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,
|
|
fontSize: 15,
|
|
))
|
|
],
|
|
),
|
|
hasBorder: false,
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => PatientReferralScreen(),
|
|
// MyReferredPatient(),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
HomePageCard(
|
|
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,
|
|
fontSize: 15,
|
|
))
|
|
],
|
|
),
|
|
hasBorder: false,
|
|
onTap: () {
|
|
Navigator.of(context)
|
|
.pushNamed(PATIENTS, arguments: {
|
|
"patientSearchForm": _patientSearchFormValues,
|
|
"selectedType": "7",
|
|
"arrivalType": "1"
|
|
});
|
|
},
|
|
),
|
|
HomePageCard(
|
|
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: 32,
|
|
color: Colors.white,
|
|
)),
|
|
Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: AppText(
|
|
TranslationBase.of(context)
|
|
.searchmedicinepatient,
|
|
color: Colors.white,
|
|
textAlign: TextAlign.start,
|
|
fontSize: 13,
|
|
))
|
|
],
|
|
),
|
|
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: 40,
|
|
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: 40,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10),
|
|
color: Colors.red[300]))),
|
|
Container(
|
|
height: 150,
|
|
margin: EdgeInsets.only(left: 5, top: 5),
|
|
padding: EdgeInsets.all(10),
|
|
child: RotatedBox(
|
|
quarterTurns: 1,
|
|
child: Center(
|
|
child: Align(
|
|
child: AppText(
|
|
value.kPIParameter + ' (' + value.value.toString() + ') ',
|
|
fontSize: 10,
|
|
textAlign: TextAlign.center,
|
|
fontWeight: FontWeight.bold,
|
|
)),
|
|
),
|
|
))
|
|
]);
|
|
}
|
|
|
|
List<Widget> getSwipeWidget(model) {
|
|
return [
|
|
RoundedContainer(
|
|
height: MediaQuery.of(context).size.height * 0.35,
|
|
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: getOutPatientStack(model.dashboardItemsList[1]))),
|
|
RoundedContainer(
|
|
height: MediaQuery.of(context).size.height * 0.35,
|
|
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5.0),
|
|
child: getOutPatientStack(model.dashboardItemsList[0]))),
|
|
RoundedContainer(
|
|
height: MediaQuery.of(context).size.height * 0.35,
|
|
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
|
|
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(
|
|
padding: EdgeInsets.all(8),
|
|
child: Column(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.center,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
TranslationBase.of(context)
|
|
.patients,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
height: .5,
|
|
fontWeight: FontWeight.bold,
|
|
fontFamily: 'Poppins'),
|
|
),
|
|
Text(
|
|
TranslationBase.of(context)
|
|
.referral,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.bold,
|
|
fontFamily: 'Poppins'),
|
|
),
|
|
],
|
|
))),
|
|
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)
|
|
]),
|
|
),
|
|
],
|
|
)),
|
|
])),
|
|
];
|
|
}
|
|
|
|
getSwiperPagiantion(active) {
|
|
return active == true
|
|
? Container(
|
|
height: 5,
|
|
width: 30,
|
|
// margin: EdgeInsets.only(10),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(5), color: Colors.black),
|
|
)
|
|
: Container(
|
|
height: 5,
|
|
width: 8,
|
|
margin: EdgeInsets.all(2),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10), color: Colors.grey));
|
|
}
|
|
}
|