filter and charts bug fix
This commit is contained in:
parent
a1263877e0
commit
1c8515709a
@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
|
||||
|
||||
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
|
||||
if (flutterVersionCode == null) {
|
||||
flutterVersionCode = "41"
|
||||
flutterVersionCode = "42"
|
||||
}
|
||||
|
||||
def flutterVersionName = localProperties.getProperty("flutter.versionName")
|
||||
if (flutterVersionName == null) {
|
||||
flutterVersionName = "1.0.40"
|
||||
flutterVersionName = "1.0.41"
|
||||
}
|
||||
|
||||
def keystorePropertiesFile = rootProject.file("key.properties")
|
||||
|
||||
@ -451,7 +451,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
///Calculate card Width
|
||||
Future<double?> _getWidget() async {
|
||||
await Future.delayed(Duration(milliseconds: 50)); // Ensures widget is built
|
||||
final RenderBox? box = cardKey.currentContext?.findRenderObject() as RenderBox?;
|
||||
final RenderBox? box =
|
||||
cardKey.currentContext?.findRenderObject() as RenderBox?;
|
||||
|
||||
if (box != null) {
|
||||
final Offset position = box.localToGlobal(Offset.zero);
|
||||
@ -537,7 +538,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
final double screenHeight = MediaQuery.of(context).size.height;
|
||||
// print('remaintarget $remainHeight');
|
||||
// print ('at intint target : ${screenHeight-remainHeight}');
|
||||
final double arrowPosition= screenHeight-tourCard;
|
||||
final double arrowPosition = screenHeight - tourCard;
|
||||
marriageTargets = [
|
||||
TargetFocus(
|
||||
enableTargetTab: false,
|
||||
@ -561,7 +562,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: arrowPosition*0.41,
|
||||
bottom: arrowPosition * 0.41,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: Column(
|
||||
@ -871,7 +872,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
final double screenHeight = MediaQuery.of(context).size.height;
|
||||
// print('remaintarget $remainHeight');
|
||||
// print ('at intint target : ${screenHeight-remainHeight}');
|
||||
final double arrowPosition= screenHeight-tourCard;
|
||||
final double arrowPosition = screenHeight - tourCard;
|
||||
previousMarriageTargets = [
|
||||
TargetFocus(
|
||||
enableTargetTab: false,
|
||||
@ -1055,7 +1056,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: arrowPosition*0.41,
|
||||
bottom: arrowPosition * 0.41,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: Column(
|
||||
@ -1794,6 +1795,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
});
|
||||
selectedFilters.forEach((filter) {
|
||||
filter["filter_data"].clear();
|
||||
});
|
||||
@ -1849,6 +1853,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
"Selected Filters before applying: $selectedFilters");
|
||||
|
||||
setState(() {
|
||||
isLoading = true;
|
||||
chartsData = originalTabChartsData;
|
||||
cardData = originalTabCardData;
|
||||
});
|
||||
|
||||
@ -335,7 +335,70 @@ class ChartWidget extends StatelessWidget {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
List<Widget> generateIndicators(dynamic chartData) {
|
||||
// List<Widget> generateIndicators(dynamic chartData) {
|
||||
// var groupByKeyValue;
|
||||
// if (chartData['chart_type_json']['chart_type'] == 'bar_chart_horizontal' ||
|
||||
// chartData['chart_type_json']['chart_type'] == 'horizontal_rotate') {
|
||||
// groupByKeyValue = chartData['chart_type_json']['y_group'] ?? '';
|
||||
// } else {
|
||||
// groupByKeyValue = chartData['chart_type_json']['x_group'] ?? '';
|
||||
// }
|
||||
//
|
||||
// return [
|
||||
// Center(
|
||||
// child: Wrap(
|
||||
// alignment: WrapAlignment.center, // Center-align all items
|
||||
// spacing: 10, // Adjust horizontal spacing
|
||||
// runSpacing: 5, // Adjust vertical spacing for wrapping
|
||||
// children: chartData['response'].asMap().entries.map<Widget>((entry) {
|
||||
// int index = entry.key;
|
||||
// var data = entry.value;
|
||||
// Color color = Colors.primaries[index % Colors.primaries.length];
|
||||
// String title = data['ObsKey'][groupByKeyValue] ?? '';
|
||||
//
|
||||
// return Container(
|
||||
// padding: EdgeInsets.symmetric(vertical: 4), // Add spacing
|
||||
// child: Row(
|
||||
// mainAxisSize:
|
||||
// MainAxisSize.min, // Wrap content without extra space
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.center, // Align items center
|
||||
// crossAxisAlignment:
|
||||
// CrossAxisAlignment.center, // Align vertically
|
||||
// children: [
|
||||
// Container(
|
||||
// width: 10,
|
||||
// height: 10,
|
||||
// decoration: BoxDecoration(
|
||||
// color: uniqueColors[index % uniqueColors.length],
|
||||
// shape: BoxShape.circle,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(width: 5),
|
||||
// ConstrainedBox(
|
||||
// constraints: BoxConstraints(
|
||||
// maxWidth: 200, // Ensures text wraps within a limit
|
||||
// ),
|
||||
// child: Text(
|
||||
// title,
|
||||
// style: TextStyle(fontSize: 12),
|
||||
// softWrap: true, // Allow text to wrap naturally
|
||||
// textAlign: TextAlign.center, // Center text alignment
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
// ),
|
||||
// ];
|
||||
// }
|
||||
|
||||
List<Widget> generateIndicators(
|
||||
dynamic chartData,
|
||||
double totalValue,
|
||||
) {
|
||||
var groupByKeyValue;
|
||||
if (chartData['chart_type_json']['chart_type'] == 'bar_chart_horizontal' ||
|
||||
chartData['chart_type_json']['chart_type'] == 'horizontal_rotate') {
|
||||
@ -348,9 +411,30 @@ class ChartWidget extends StatelessWidget {
|
||||
var data = entry.value;
|
||||
Color color = Colors.primaries[index % Colors.primaries.length];
|
||||
String title = data['ObsKey'][groupByKeyValue] ?? '';
|
||||
// String value = data['ObsValue']['Value'].toString();
|
||||
String shortTitle =
|
||||
title.length > 10 ? '${title.substring(0, 10)}…' : title;
|
||||
|
||||
// Handle different types: int, double, and String
|
||||
double value = 0.0;
|
||||
var rawValue = data['ObsValue']['Value'];
|
||||
|
||||
if (rawValue is String) {
|
||||
value = double.tryParse(rawValue) ?? 0.0;
|
||||
} else if (rawValue is num) {
|
||||
value = rawValue.toDouble();
|
||||
} else if (rawValue is double) {
|
||||
value = rawValue;
|
||||
} else {
|
||||
print('Unexpected Type for ObsValue[Value]: ${rawValue.runtimeType}');
|
||||
}
|
||||
|
||||
// double percentage = (value / totalValue) * 100;
|
||||
String percentage = (totalValue > 0)
|
||||
? ((value / totalValue) * 100).toStringAsFixed(1)
|
||||
: "0.0";
|
||||
// bool isTouched = index == touchedIndex;
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@ -376,9 +460,9 @@ class ChartWidget extends StatelessWidget {
|
||||
message: title, // Full text on hover
|
||||
child: ConstrainedBox(
|
||||
// Constrain width to allow wrapping
|
||||
constraints: BoxConstraints(maxWidth: 200),
|
||||
constraints: BoxConstraints(maxWidth: 250),
|
||||
child: Text(
|
||||
title,
|
||||
'$title -- $percentage%',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
),
|
||||
@ -630,7 +714,7 @@ class ChartWidget extends StatelessWidget {
|
||||
child: Column(
|
||||
// Change Row to Column
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: generateIndicators(chartData),
|
||||
children: generateIndicators(chartData, totalValue),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -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.40+41
|
||||
version: 1.0.41+40
|
||||
|
||||
environment:
|
||||
sdk: ">=3.2.3 <4.0.0"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user