population chart issue fix

This commit is contained in:
venbaittech 2025-02-11 16:57:05 +05:30
parent 8bf645c65b
commit c0cbcf54fa
3 changed files with 60 additions and 34 deletions

View File

@ -15,12 +15,12 @@ if (localPropertiesFile.exists()) {
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "12"
flutterVersionCode = "13"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0.11"
flutterVersionName = "1.0.12"
}
def keystorePropertiesFile = rootProject.file("key.properties")

View File

@ -538,7 +538,6 @@ class ChartWidget extends StatelessWidget {
color: groupColorMap[group],
),
SizedBox(width: 6),
Text(
group,
style: TextStyle(fontSize: 14),
@ -615,17 +614,26 @@ class ChartWidget extends StatelessWidget {
textAlign: TextAlign.center,
),
SizedBox(height: 10),
// Chart
Expanded(
child: LineChart(LineChartData(
lineTouchData: lineTouchData1(),
gridData: gridData(),
titlesData: titlesData1(uniqueXValues),
borderData: borderData(),
lineBarsData: lineBars,
minX: uniqueXValues.reduce((a, b) => a < b ? a : b),
maxX: uniqueXValues.reduce((a, b) => a > b ? a : b),
))),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal, // Enable horizontal scrolling
padding: const EdgeInsets.only(right: 40),
child: SizedBox(
width: (uniqueXValues.length * 80) +
80, // Adjust width dynamically
child: LineChart(LineChartData(
lineTouchData: lineTouchData1(),
gridData: gridData(),
titlesData: titlesData1(uniqueXValues),
borderData: borderData(),
lineBarsData: lineBars,
minX: uniqueXValues.reduce((a, b) => a < b ? a : b),
maxX: uniqueXValues.reduce((a, b) => a > b ? a : b),
)),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Wrap(
@ -649,7 +657,8 @@ class ChartWidget extends StatelessWidget {
);
}).toList(),
),
),
)
// Chart
]);
case 'line_trend_2':
final List<Color> uniqueColorsLine_trend_2 = [
@ -794,22 +803,24 @@ class ChartWidget extends StatelessWidget {
getTitlesWidget: (value, meta) {
if (value.toInt() < xAxisData.length) {
String title = xAxisData[value.toInt()];
String displayTitle = title.length > 10 ? title.substring(0, 10) + '...' : title;
String displayTitle = title.length > 10
? title.substring(0, 10) + '...'
: title;
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: SizedBox(
width: 60, // Limit width to force wrapping
child: Transform.rotate(
angle: -0.5,
child:Tooltip(
message: title,
child: Text(
displayTitle,
softWrap: true,
overflow: TextOverflow.ellipsis,
)),)
));
width: 60, // Limit width to force wrapping
child: Transform.rotate(
angle: -0.5,
child: Tooltip(
message: title,
child: Text(
displayTitle,
softWrap: true,
overflow: TextOverflow.ellipsis,
)),
)));
}
return Container();
},
@ -959,6 +970,7 @@ class ChartWidget extends StatelessWidget {
crop = item['ObsKey']['SECTOR'];
cropType = item['ObsKey'][groupByKey];
} else if (chartData['dataset'] == 'general_education') {
print(chartData['dataset'] == 'general_education');
crop = item['ObsKey']['GENDER'];
cropType = item['ObsKey'][groupByKey];
} else if (chartData['dataset'] == 'higher_education') {
@ -1015,7 +1027,9 @@ class ChartWidget extends StatelessWidget {
String title =
groupByValues.elementAt(value.toInt());
String displayTitle = title.length > 10 ? title.substring(0, 10) + '...' : title;
String displayTitle = title.length > 10
? title.substring(0, 10) + '...'
: title;
return Padding(
padding: const EdgeInsets.only(top: 8.0),
@ -1023,14 +1037,14 @@ class ChartWidget extends StatelessWidget {
width: 60, // Limit width to force wrapping
child: Transform.rotate(
angle: -0.5,
child:Tooltip(
child: Tooltip(
message: title,
child: Text(
displayTitle,
softWrap: true,
overflow: TextOverflow.ellipsis,
)),)
));
)),
)));
// return Transform.rotate(
// angle:
// -0.5, // Rotation in radians (~ -30 degrees)
@ -1190,7 +1204,8 @@ class ChartWidget extends StatelessWidget {
touchTooltipData: BarTouchTooltipData(
tooltipHorizontalAlignment: FLHorizontalAlignment.center,
tooltipRoundedRadius: 8,
fitInsideHorizontally: true, // Ensure it fits within the screen
fitInsideHorizontally:
true, // Ensure it fits within the screen
fitInsideVertically: true,
tooltipPadding: EdgeInsets.all(8),
tooltipMargin: 16,
@ -1992,8 +2007,19 @@ class ChartWidget extends StatelessWidget {
double value =
double.tryParse(data['ObsValue']['Value'].toString()) ?? 0.0;
final barColor = uniqueColors[colorIndex % uniqueColors.length];
colorIndex++;
final List<Color> uniqueColorsForTwo = [
Color(0xFF648CBA),
Color(0xFF90B0D5),
];
final barColor;
if (chartData['dataset'] == 'general_education' ||
chartData['dataset'] == 'higher_education') {
barColor = uniqueColorsForTwo[colorIndex % uniqueColorsForTwo.length];
colorIndex++;
} else {
barColor = uniqueColors[colorIndex % uniqueColors.length];
colorIndex++;
}
return BarChartRodData(
toY: value, // Use the parsed value

View File

@ -1,7 +1,7 @@
name: uae_stat
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
publish_to: "none"
version: 1.0.11+12
version: 1.0.12+13
environment:
sdk: ">=3.2.3 <4.0.0"