move referral patient
parent
4a9748739e
commit
01abd02d19
@ -0,0 +1,174 @@
|
|||||||
|
|
||||||
|
import 'package:charts_flutter/flutter.dart' as charts;
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.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/dashboard/row_count.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class DashboardReferralPatient extends StatelessWidget {
|
||||||
|
final List<DashboardModel> dashboardItemList;
|
||||||
|
final double height;
|
||||||
|
final DashboardViewModel model;
|
||||||
|
|
||||||
|
const DashboardReferralPatient({Key key, this.dashboardItemList, this.height, this.model}) : super(key: key);
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return RoundedContainer(
|
||||||
|
raduis: 16,
|
||||||
|
showBorder: true,
|
||||||
|
borderColor: Colors.white,
|
||||||
|
shadowWidth: 0.2,
|
||||||
|
shadowSpreadRadius: 3,
|
||||||
|
shadowDy: 1,
|
||||||
|
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
|
||||||
|
child:
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 4,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(5.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.patients,
|
||||||
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontHeight: 0.5,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.referral,
|
||||||
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: SizeConfig.getHeightMultiplier(height: height) * (SizeConfig.isHeightShort?14: 20)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
RowCounts(
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[0]
|
||||||
|
.kPIParameter,
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[0]
|
||||||
|
.value,
|
||||||
|
Colors.black, height: height,),
|
||||||
|
RowCounts(
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[1]
|
||||||
|
.kPIParameter,
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[1]
|
||||||
|
.value,
|
||||||
|
Colors.grey, height: height,),
|
||||||
|
RowCounts(
|
||||||
|
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[2]
|
||||||
|
.kPIParameter,
|
||||||
|
dashboardItemList[2]
|
||||||
|
.summaryoptions[2]
|
||||||
|
.value,
|
||||||
|
Colors.red, height: height,),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: Stack(children: [
|
||||||
|
Container(
|
||||||
|
padding:EdgeInsets.all(0),
|
||||||
|
|
||||||
|
child: GaugeChart(
|
||||||
|
_createReferralData(dashboardItemList))),
|
||||||
|
Positioned(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
model
|
||||||
|
.getPatientCount(dashboardItemList[2])
|
||||||
|
.toString(),
|
||||||
|
fontSize: SizeConfig.textMultiplier * 3.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
top: height * .35,
|
||||||
|
left: 0,
|
||||||
|
right: 0)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
static List<charts.Series<GaugeSegment, String>> _createReferralData(List<DashboardModel> dashboardItemList) {
|
||||||
|
final data = [
|
||||||
|
new GaugeSegment(
|
||||||
|
dashboardItemList[2].summaryoptions[0].kPIParameter,
|
||||||
|
getValue(dashboardItemList[1].summaryoptions[0].value),
|
||||||
|
charts.MaterialPalette.black),
|
||||||
|
new GaugeSegment(
|
||||||
|
dashboardItemList[2].summaryoptions[1].kPIParameter,
|
||||||
|
getValue(dashboardItemList[1].summaryoptions[1].value),
|
||||||
|
charts.MaterialPalette.gray.shadeDefault),
|
||||||
|
new GaugeSegment(
|
||||||
|
dashboardItemList[2].summaryoptions[2].kPIParameter,
|
||||||
|
getValue(dashboardItemList[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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue