chart improvement

main_design2.0
Sikander Saleem 2 years ago
parent 686c70e3db
commit a130780193

@ -21,73 +21,78 @@ class ProgressFragment extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const Map<String, double> statuses = {
"Completed": 12,
"In Progress": 12,
"Open": 12,
};
return Consumer<AllRequestsProvider>( return Consumer<AllRequestsProvider>(
builder: (context, snapshot, _) => Column( builder: (context, snapshot, _) {
children: [ Map<String, double> statuses = {
AspectRatio( "Completed": snapshot.completedRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
aspectRatio: 398 / 237, "In Progress": snapshot.inProgressRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
child: PieChart( "Open": snapshot.openRequests.requestsDetails?.length?.toDouble() ?? 0.0,
dataMap: statuses, };
animationDuration: const Duration(milliseconds: 500), int total = (snapshot.completedRequests?.requestsDetails?.length ?? 0) + (snapshot.inProgressRequests?.requestsDetails?.length ?? 0) + (snapshot.openRequests?.requestsDetails?.length ?? 0);
chartRadius: 190.toScreenWidth,
colorList: [AColors.statusGreen, AColors.statusBlue, AColors.statusYellowLight], return Column(
initialAngleInDegree: 270, children: [
chartType: ChartType.ring, AspectRatio(
ringStrokeWidth: 40.toScreenWidth, aspectRatio: 398 / 237,
centerText: "${context.translation.total}\n20", child: PieChart(
centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), dataMap: statuses,
legendOptions: const LegendOptions(showLegends: false), animationDuration: const Duration(milliseconds: 500),
chartValuesOptions: ChartValuesOptions( chartRadius: 190.toScreenWidth,
chartValueBackgroundColor: Colors.transparent, colorList: [AColors.statusGreen, AColors.statusBlue, AColors.statusYellowLight],
chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20), initialAngleInDegree: 270,
showChartValuesOutside: true, chartType: ChartType.ring,
), ringStrokeWidth: 40.toScreenWidth,
).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCompleteLoading, radius: 300).paddingAll(12).toShadowContainer(context), centerText: "${context.translation.total}\n$total",
).paddingOnly(start: 16, end: 16, bottom: 16), centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
DefaultTabController( legendOptions: const LegendOptions(showLegends: false),
length: 3, chartValuesOptions: ChartValuesOptions(
child: Column( chartValueBackgroundColor: Colors.white,
children: <Widget>[ showChartValuesInPercentage: true,
Container( chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20),
margin: const EdgeInsets.only(left: 16, right: 16), showChartValuesOutside: true,
decoration: BoxDecoration(color: AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
child: TabBar(
//controller: _tabController,
padding: EdgeInsets.zero,
labelColor: AppColor.neutral60,
unselectedLabelColor: AppColor.neutral20,
unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60),
indicatorPadding: const EdgeInsets.all(4),
indicator: BoxDecoration(color: context.isDark? AppColor.neutral20:Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
onTap: (index) {
// setState(() {});
},
tabs: [
Tab(text: context.translation.open, height: 57.toScreenHeight),
Tab(text: context.translation.inProgress, height: 57.toScreenHeight),
Tab(text: context.translation.completed, height: 57.toScreenHeight),
],
),
), ),
8.height, ).toShimmer(isShow: snapshot.isOpenLoading || snapshot.isInProgressLoading || snapshot.isCompleteLoading, radius: 300).paddingAll(12).toShadowContainer(context),
TabBarView( ).paddingOnly(start: 16, end: 16, bottom: 16),
children: [ DefaultTabController(
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading), length: 3,
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading), child: Column(
RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading), children: <Widget>[
], Container(
).expanded, margin: const EdgeInsets.only(left: 16, right: 16),
], decoration: BoxDecoration(color: AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
), child: TabBar(
).expanded, //controller: _tabController,
], padding: EdgeInsets.zero,
), labelColor: AppColor.neutral60,
unselectedLabelColor: AppColor.neutral20,
unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60),
indicatorPadding: const EdgeInsets.all(4),
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral20 : Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
onTap: (index) {
// setState(() {});
},
tabs: [
Tab(text: context.translation.open, height: 57.toScreenHeight),
Tab(text: context.translation.inProgress, height: 57.toScreenHeight),
Tab(text: context.translation.completed, height: 57.toScreenHeight),
],
),
),
8.height,
TabBarView(
children: [
RequestItemViewList(snapshot.openRequests?.requestsDetails ?? [], snapshot.isOpenLoading),
RequestItemViewList(snapshot.inProgressRequests?.requestsDetails ?? [], snapshot.isInProgressLoading),
RequestItemViewList(snapshot.completedRequests?.requestsDetails ?? [], snapshot.isCompleteLoading),
],
).expanded,
],
),
).expanded,
],
);
},
); );
} }
// //

Loading…
Cancel
Save