bug fix chart

This commit is contained in:
Juki-shiba 2025-04-16 18:04:56 +05:30
parent 1a0ae636f7
commit a3671b5fd6
2 changed files with 193 additions and 45 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart'; import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
import 'package:uae_stat/domain/use_cases/language.dart';
import 'package:uae_stat/presentation/components/constant/constant.dart'; import 'package:uae_stat/presentation/components/constant/constant.dart';
import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart'; import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
@ -153,9 +154,13 @@ class _MarriagesState extends ConsumerState<Marriages> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', 'Skip',
style: TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -165,7 +170,11 @@ class _MarriagesState extends ConsumerState<Marriages> {
children: [ children: [
Text( Text(
'3/7', '3/7',
style: const TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -273,9 +282,13 @@ class _MarriagesState extends ConsumerState<Marriages> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', 'Skip',
style: TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -285,7 +298,11 @@ class _MarriagesState extends ConsumerState<Marriages> {
children: [ children: [
Text( Text(
'4/7', '4/7',
style: const TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -406,9 +423,13 @@ class _MarriagesState extends ConsumerState<Marriages> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', 'Skip',
style: TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -418,7 +439,11 @@ class _MarriagesState extends ConsumerState<Marriages> {
children: [ children: [
Text( Text(
'4/7', '4/7',
style: const TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -532,9 +557,13 @@ class _MarriagesState extends ConsumerState<Marriages> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0, elevation: 0,
), ),
child: const Text( child: Text(
'Skip', 'Skip',
style: TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),
@ -544,7 +573,11 @@ class _MarriagesState extends ConsumerState<Marriages> {
children: [ children: [
Text( Text(
'3/7', '3/7',
style: const TextStyle( style: TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: 14,
), ),

View File

@ -484,7 +484,10 @@ class ChartWidget extends StatelessWidget {
color: Colors.blueGrey[800], // Change background color color: Colors.blueGrey[800], // Change background color
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
textStyle: TextStyle(color: Colors.white), textStyle: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),color: Colors.white),
), ),
child: Tooltip( child: Tooltip(
message: title, // Full text on hover message: title, // Full text on hover
@ -493,7 +496,10 @@ class ChartWidget extends StatelessWidget {
'$title -- $percentage%', '$title -- $percentage%',
'$title -- %$percentage', '$title -- %$percentage',
), ),
style: TextStyle(fontSize: 12), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 12),
softWrap: true, softWrap: true,
maxLines: 2, maxLines: 2,
), ),
@ -679,13 +685,19 @@ class ChartWidget extends StatelessWidget {
Text( Text(
chartData['chart_heading'] ?? chartData['chart_heading'] ??
'Pie Chart', // Chart title from data 'Pie Chart', // Chart title from data
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 15), SizedBox(height: 15),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 70), SizedBox(height: 70),
@ -774,13 +786,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 15), SizedBox(height: 15),
@ -849,14 +867,20 @@ class ChartWidget extends StatelessWidget {
tooltipTextSpans.addAll([ tooltipTextSpans.addAll([
TextSpan( TextSpan(
text: '', text: '',
style: TextStyle( style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: groupColor, color: groupColor,
fontSize: 14, fontSize: 14,
), // Circle color ), // Circle color
), ),
TextSpan( TextSpan(
text: '$groupName - $formattedValue\n', text: '$groupName - $formattedValue\n',
style: TextStyle( style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
), ),
@ -866,7 +890,10 @@ class ChartWidget extends StatelessWidget {
return BarTooltipItem( return BarTooltipItem(
'', '',
TextStyle(color: Colors.white, fontSize: 12), TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),color: Colors.white, fontSize: 12),
children: tooltipTextSpans, children: tooltipTextSpans,
textAlign: TextAlign.left, textAlign: TextAlign.left,
); );
@ -938,14 +965,20 @@ class ChartWidget extends StatelessWidget {
// color: Colors.blueGrey[900], // color: Colors.blueGrey[900],
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
textStyle: TextStyle(color: Colors.white), textStyle: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),color: Colors.white),
child: Text( child: Text(
group, group,
// group.length > 10 // group.length > 10
// ? '${group.substring(0, 10)}...' // ? '${group.substring(0, 10)}...'
// : group, // : group,
// overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 11), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 11),
), ),
), ),
], ],
@ -1144,13 +1177,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -1312,13 +1351,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -1359,7 +1404,10 @@ class ChartWidget extends StatelessWidget {
color: groupColorMap[group], color: groupColorMap[group],
), ),
SizedBox(width: 6), SizedBox(width: 6),
Text(group, style: TextStyle(fontSize: 14)), Text(group, style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14)),
], ],
); );
}).toList(), }).toList(),
@ -1467,13 +1515,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
'', '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -1602,13 +1656,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', // Chart title from data chartData['chart_heading'] ?? '', // Chart title from data
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -1709,7 +1769,10 @@ class ChartWidget extends StatelessWidget {
return BarTooltipItem( return BarTooltipItem(
displayValue, displayValue,
const TextStyle( TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.black, color: Colors.black,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -1776,7 +1839,10 @@ class ChartWidget extends StatelessWidget {
8, 8,
), // Optional: rounded corners ), // Optional: rounded corners
), ),
textStyle: TextStyle( textStyle: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
), // Change text color ), // Change text color
), ),
@ -1788,7 +1854,10 @@ class ChartWidget extends StatelessWidget {
softWrap: true, softWrap: true,
textAlign: textAlign:
TextAlign.right, TextAlign.right,
style: TextStyle( style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
fontSize: 10, fontSize: 10,
), ),
overflow: overflow:
@ -1937,7 +2006,10 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
// SizedBox(height: 5), // SizedBox(height: 5),
@ -1984,6 +2056,10 @@ class ChartWidget extends StatelessWidget {
) )
: formatNumber(rod.toY), : formatNumber(rod.toY),
TextStyle( TextStyle(
fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.black, color: Colors.black,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -2026,7 +2102,10 @@ class ChartWidget extends StatelessWidget {
child: Text( child: Text(
xAxisData[value.toInt()], xAxisData[value.toInt()],
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: const TextStyle(fontSize: 10), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 10),
softWrap: true, softWrap: true,
maxLines: 2, maxLines: 2,
), ),
@ -2172,13 +2251,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
'', '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -2251,7 +2336,10 @@ class ChartWidget extends StatelessWidget {
8, 8,
), // Optional: rounded corners ), // Optional: rounded corners
), ),
textStyle: TextStyle( textStyle: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
), // Change text color ), // Change text color
), ),
@ -2262,7 +2350,10 @@ class ChartWidget extends StatelessWidget {
softWrap: true, softWrap: true,
maxLines: 2, maxLines: 2,
textAlign: TextAlign.right, textAlign: TextAlign.right,
style: TextStyle(fontSize: 10), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 10),
// overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
), ),
), ),
@ -2350,7 +2441,10 @@ class ChartWidget extends StatelessWidget {
return BarTooltipItem( return BarTooltipItem(
'$groupLabel\n$crop', '$groupLabel\n$crop',
const TextStyle( TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -2358,7 +2452,10 @@ class ChartWidget extends StatelessWidget {
TextSpan( TextSpan(
text: text:
'- ${(chartConversion != null && chartConversion.isNotEmpty && number_format != null) ? formatNumberConversion(rod.toY, chartConversion, number_format) : formatNumber(rod.toY)}', '- ${(chartConversion != null && chartConversion.isNotEmpty && number_format != null) ? formatNumberConversion(rod.toY, chartConversion, number_format) : formatNumber(rod.toY)}',
style: const TextStyle( style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
@ -2470,13 +2567,19 @@ class ChartWidget extends StatelessWidget {
children: [ children: [
Text( Text(
chartData['chart_heading'] ?? '', chartData['chart_heading'] ?? '',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 14, fontWeight: FontWeight.w400),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
Text( Text(
chartData['chart_sub_heading'] ?? '', chartData['chart_sub_heading'] ?? '',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w300), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 13, fontWeight: FontWeight.w300),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox(height: 5), SizedBox(height: 5),
@ -2643,7 +2746,10 @@ class ChartWidget extends StatelessWidget {
return BarTooltipItem( return BarTooltipItem(
'0', // Display "0" instead of hiding '0', // Display "0" instead of hiding
textAlign: TextAlign.right, textAlign: TextAlign.right,
const TextStyle( TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.black, color: Colors.black,
fontSize: 12, fontSize: 12,
), ),
@ -2672,7 +2778,10 @@ class ChartWidget extends StatelessWidget {
return BarTooltipItem( return BarTooltipItem(
formattedValue, formattedValue,
textAlign: TextAlign.right, textAlign: TextAlign.right,
const TextStyle( TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),
color: Colors.black, color: Colors.black,
fontSize: 12, fontSize: 12,
), ),
@ -2693,7 +2802,10 @@ class ChartWidget extends StatelessWidget {
child: Text( child: Text(
value.toInt().toString(), value.toInt().toString(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: const TextStyle(fontSize: 12), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 12),
), ),
); );
}, },
@ -2731,7 +2843,10 @@ class ChartWidget extends StatelessWidget {
0) 0)
? TextAlign.right ? TextAlign.right
: TextAlign.center, : TextAlign.center,
style: const TextStyle(fontSize: 12), style: TextStyle(fontFamily: context.translate(
'Roboto',
'NotoKufi',
),fontSize: 12),
softWrap: true, softWrap: true,
maxLines: 2, maxLines: 2,
), ),