Merge branch 'home-refactoring' into 'development'
Home refactoring See merge request Cloud_Solution/doctor_app_flutter!648merge-requests/665/merge
commit
2c43cfcdde
@ -0,0 +1,37 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
|
||||
import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DashboardSliderItemWidget extends StatelessWidget {
|
||||
final DashboardModel item;
|
||||
|
||||
DashboardSliderItemWidget(this.item);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
item.kPIName,
|
||||
fontSize: SizeConfig.textMultiplier * 2.2,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
),
|
||||
new Container(
|
||||
height: 110,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
children:
|
||||
List.generate(item.summaryoptions.length, (int index) {
|
||||
return GetActivityButton(item.summaryoptions[index]);
|
||||
})))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,260 @@
|
||||
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/out_patient_stack.dart';
|
||||
import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart';
|
||||
import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.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';
|
||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||
import 'package:charts_flutter/flutter.dart' as charts;
|
||||
|
||||
class DashboardSwipeWidget extends StatefulWidget {
|
||||
final List<DashboardModel> dashboardItemList;
|
||||
final DashboardViewModel model;
|
||||
final Function(int) sliderChange;
|
||||
|
||||
DashboardSwipeWidget(this.dashboardItemList, this.model, this.sliderChange);
|
||||
|
||||
@override
|
||||
_DashboardSwipeWidgetState createState() => _DashboardSwipeWidgetState();
|
||||
}
|
||||
|
||||
class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
|
||||
int sliderActiveIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
// height: MediaQuery.of(context).size.height * 0.35,
|
||||
height: 230,
|
||||
child: Swiper(
|
||||
onIndexChanged: (index) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
sliderActiveIndex = index;
|
||||
widget.sliderChange(index);
|
||||
});
|
||||
}
|
||||
},
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return getSwipeWidget(widget.dashboardItemList, 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
|
||||
? SwiperRoundedPagination(true)
|
||||
: SwiperRoundedPagination(false),
|
||||
config.activeIndex == 1
|
||||
? SwiperRoundedPagination(true)
|
||||
: SwiperRoundedPagination(false),
|
||||
config.activeIndex == 2
|
||||
? SwiperRoundedPagination(true)
|
||||
: SwiperRoundedPagination(false),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
viewportFraction: 0.9,
|
||||
// scale: 0.9,
|
||||
// control: new SwiperControl(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getSwipeWidget(List<DashboardModel> dashboardItemList, int index) {
|
||||
if (index == 1)
|
||||
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: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: GetOutPatientStack(dashboardItemList[1])));
|
||||
if (index == 0)
|
||||
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: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: GetOutPatientStack(dashboardItemList[0])));
|
||||
if (index == 2)
|
||||
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, 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: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.patients,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontHeight: 0.5,
|
||||
),
|
||||
AppText(
|
||||
TranslationBase.of(context)
|
||||
.referral,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RowCounts(
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[0]
|
||||
.kPIParameter,
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[0]
|
||||
.value,
|
||||
Colors.black),
|
||||
),
|
||||
Expanded(
|
||||
child: RowCounts(
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[1]
|
||||
.kPIParameter,
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[1]
|
||||
.value,
|
||||
Colors.grey),
|
||||
),
|
||||
Expanded(
|
||||
child: RowCounts(
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[2]
|
||||
.kPIParameter,
|
||||
dashboardItemList[2]
|
||||
.summaryoptions[2]
|
||||
.value,
|
||||
Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
child: GaugeChart(
|
||||
_createReferralData(widget.dashboardItemList))),
|
||||
Positioned(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
AppText(
|
||||
widget.model
|
||||
.getPatientCount(dashboardItemList[2])
|
||||
.toString(),
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
],
|
||||
),
|
||||
top: MediaQuery.of(context).size.height * 0.12,
|
||||
left: 0,
|
||||
right: 0)
|
||||
]),
|
||||
),
|
||||
],
|
||||
)),
|
||||
]));
|
||||
return Container();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/screens/home/home_page_card.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomePatientCard extends StatelessWidget {
|
||||
final Color backgroundColor;
|
||||
final IconData cardIcon;
|
||||
final Color backgroundIconColor;
|
||||
final String text;
|
||||
final Color textColor;
|
||||
final Function onTap;
|
||||
|
||||
HomePatientCard({
|
||||
@required this.backgroundColor,
|
||||
@required this.backgroundIconColor,
|
||||
@required this.cardIcon,
|
||||
@required this.text,
|
||||
@required this.textColor,
|
||||
@required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return HomePageCard(
|
||||
color: backgroundColor,
|
||||
margin: EdgeInsets.all(4),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0.1,
|
||||
right: 0.5,
|
||||
width: 23.0,
|
||||
height: 25.0,
|
||||
child: Icon(
|
||||
cardIcon,
|
||||
size: 60,
|
||||
color: backgroundIconColor,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
cardIcon,
|
||||
size: 30,
|
||||
color: textColor,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: AppText(
|
||||
text,
|
||||
color: textColor,
|
||||
textAlign: TextAlign.start,
|
||||
fontSize: SizeConfig.textMultiplier * 1.6,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
hasBorder: false,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue