chart improvement

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

@ -21,13 +21,16 @@ 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, _) {
Map<String, double> statuses = {
"Completed": snapshot.completedRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
"In Progress": snapshot.inProgressRequests?.requestsDetails?.length?.toDouble() ?? 0.0,
"Open": snapshot.openRequests.requestsDetails?.length?.toDouble() ?? 0.0,
};
int total = (snapshot.completedRequests?.requestsDetails?.length ?? 0) + (snapshot.inProgressRequests?.requestsDetails?.length ?? 0) + (snapshot.openRequests?.requestsDetails?.length ?? 0);
return Column(
children: [ children: [
AspectRatio( AspectRatio(
aspectRatio: 398 / 237, aspectRatio: 398 / 237,
@ -39,11 +42,12 @@ class ProgressFragment extends StatelessWidget {
initialAngleInDegree: 270, initialAngleInDegree: 270,
chartType: ChartType.ring, chartType: ChartType.ring,
ringStrokeWidth: 40.toScreenWidth, ringStrokeWidth: 40.toScreenWidth,
centerText: "${context.translation.total}\n20", centerText: "${context.translation.total}\n$total",
centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), centerTextStyle: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
legendOptions: const LegendOptions(showLegends: false), legendOptions: const LegendOptions(showLegends: false),
chartValuesOptions: ChartValuesOptions( chartValuesOptions: ChartValuesOptions(
chartValueBackgroundColor: Colors.transparent, chartValueBackgroundColor: Colors.white,
showChartValuesInPercentage: true,
chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20), chartValueStyle: AppTextStyles.heading6.copyWith(color: AppColor.neutral20),
showChartValuesOutside: true, showChartValuesOutside: true,
), ),
@ -64,7 +68,7 @@ class ProgressFragment extends StatelessWidget {
unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)), unselectedLabelStyle: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)),
labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60), labelStyle: AppTextStyles.bodyText.copyWith(color: AppColor.neutral60),
indicatorPadding: const EdgeInsets.all(4), indicatorPadding: const EdgeInsets.all(4),
indicator: BoxDecoration(color: context.isDark? AppColor.neutral20:Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)), indicator: BoxDecoration(color: context.isDark ? AppColor.neutral20 : Theme.of(context).cardColor, borderRadius: BorderRadius.circular(13)),
onTap: (index) { onTap: (index) {
// setState(() {}); // setState(() {});
}, },
@ -87,7 +91,8 @@ class ProgressFragment extends StatelessWidget {
), ),
).expanded, ).expanded,
], ],
), );
},
); );
} }
// //

Loading…
Cancel
Save