From 72ee88d567b893ab60da8c3584d3fa08825f1b0b Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 9 May 2021 13:54:03 +0300 Subject: [PATCH] working on dashboard --- lib/screens/home/dashboard_swipe_widget.dart | 208 ++++++++++--------- lib/screens/home/home_screen.dart | 24 +-- lib/widgets/dashboard/out_patient_stack.dart | 10 +- lib/widgets/dashboard/row_count.dart | 4 +- 4 files changed, 128 insertions(+), 118 deletions(-) diff --git a/lib/screens/home/dashboard_swipe_widget.dart b/lib/screens/home/dashboard_swipe_widget.dart index faca68f8..de582dc2 100644 --- a/lib/screens/home/dashboard_swipe_widget.dart +++ b/lib/screens/home/dashboard_swipe_widget.dart @@ -27,55 +27,59 @@ class _DashboardSwipeWidgetState extends State { @override Widget build(BuildContext context) { - return 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), - ], + 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(), + ) + ], + ); + }), + viewportFraction: 0.9, + // scale: 0.9, + // control: new SwiperControl(), + ), ); } @@ -83,21 +87,21 @@ class _DashboardSwipeWidgetState extends State { if (index == 1) return RoundedContainer( raduis: 16, - margin: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + 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, - margin: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + 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, - margin: EdgeInsets.only(top: 20, bottom: 20, left: 10, right: 10), + margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( @@ -112,61 +116,65 @@ class _DashboardSwipeWidgetState extends State { 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: 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: 2, + flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - RowCounts( - dashboardItemList[2] - .summaryoptions[0] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[0] - .value, - Colors.black), - RowCounts( - dashboardItemList[2] - .summaryoptions[1] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[1] - .value, - Colors.grey), - RowCounts( - dashboardItemList[2] - .summaryoptions[2] - .kPIParameter, - dashboardItemList[2] - .summaryoptions[2] - .value, - Colors.red), + 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), + ), ], ), ) @@ -187,7 +195,7 @@ class _DashboardSwipeWidgetState extends State { widget.model .getPatientCount(dashboardItemList[2]) .toString(), - fontSize: 30, + fontSize: 28, fontWeight: FontWeight.bold, ) ], diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index d3fe217c..4a375d6d 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -202,19 +202,17 @@ class _HomeScreenState extends State { ])), content: Column( children: [ - Container( - height: MediaQuery.of(context).size.height * 0.35, - child: model.dashboardItemsList.length > 0 - ? DashboardSwipeWidget( - model.dashboardItemsList, - model, - (sliderIndex) { - setState(() { - sliderActiveIndex = sliderIndex; - }); - }, - ) - : SizedBox()), + model.dashboardItemsList.length > 0 + ? DashboardSwipeWidget( + model.dashboardItemsList, + model, + (sliderIndex) { + setState(() { + sliderActiveIndex = sliderIndex; + }); + }, + ) + : SizedBox(), model.dashboardItemsList.length > 0 ? FractionallySizedBox( widthFactor: 0.90, diff --git a/lib/widgets/dashboard/out_patient_stack.dart b/lib/widgets/dashboard/out_patient_stack.dart index b3b7ed8c..2a9109c3 100644 --- a/lib/widgets/dashboard/out_patient_stack.dart +++ b/lib/widgets/dashboard/out_patient_stack.dart @@ -19,9 +19,13 @@ class GetOutPatientStack extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - AppText( - value.kPIName, - medium: true, + Container( + height: 30, + child: AppText( + value.kPIName, + medium: true, + fontSize: 14, + ), ), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) ], diff --git a/lib/widgets/dashboard/row_count.dart b/lib/widgets/dashboard/row_count.dart index a42cccdf..a22932f4 100644 --- a/lib/widgets/dashboard/row_count.dart +++ b/lib/widgets/dashboard/row_count.dart @@ -24,7 +24,7 @@ class RowCounts extends StatelessWidget { name, color: Colors.black, textAlign: TextAlign.start, // from TextAlign.center - fontSize: 12, + fontSize: 11, textOverflow: TextOverflow.ellipsis, ), ), @@ -32,7 +32,7 @@ class RowCounts extends StatelessWidget { ' (' + count.toString() + ')', color: Colors.black, textAlign: TextAlign.center, - fontSize: 13, + fontSize: 12, fontWeight: FontWeight.bold, ) ],