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

View File

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