merge commit

This commit is contained in:
Kalonkarthik 2025-02-20 18:09:42 +05:30
commit 349c815f63
4 changed files with 904 additions and 456 deletions

View File

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

View File

@ -80,7 +80,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
print(' bgColor $bgColor');
// fetchChartData(widget.dataSets);
checkIfBookmarked();
locale = ref.read(localeProvider)?? const Locale('en');
locale = ref.read(localeProvider) ?? const Locale('en');
fetchChartData(widget.dataSets, locale?.languageCode ?? 'en').then((_) {
if (_tabsData.isNotEmpty) {
// Call onTabSelected for the first tab
@ -310,6 +310,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
),
);
}
//when the popup need for bookmark
// void showAddBookmarkDialog() {
// double myheight = MediaQuery.of(context).size.height;
@ -398,15 +399,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// }
void showAddBookmarkDialog() {
addBookmark();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'The bookmark is added successfully',
),
backgroundColor: Colors.green,
duration: Duration(seconds: 2),
),
);
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// 'The bookmark is added successfully',
// ),
// backgroundColor: Colors.green,
// duration: Duration(seconds: 2),
// ),
// );
}
void handleSkip() {
@ -539,9 +540,14 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: null,
border: Border.all(
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: Colors.white,
width: 2.0),
),
child: IconButton(
iconSize: 20,
@ -551,8 +557,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(previousHomeTourProvider
.notifier)
.state = false;
tutorialCoachMark.finish();
}
},
@ -562,9 +573,14 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
color: locale.languageCode == 'ar'
? null
: Color(0xFF7DAFBC),
border: Border.all(
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
color: locale.languageCode == 'ar'
? Colors.white
: Color(0xFF7DAFBC),
width: 1),
),
child: IconButton(
iconSize: 20,
@ -572,8 +588,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: Colors.white),
onPressed: () {
if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(previousHomeTourProvider
.notifier)
.state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.next();
@ -627,7 +648,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
text: AppLocalizations.of(context)!.bookMark,
alignment: ContentAlign.bottom,
gap: 53,
space: screenWidth*0.22,
space: screenWidth * 0.22,
),
TargetContent(
align: ContentAlign.bottom,
@ -682,18 +703,29 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: null,
border: Border.all(
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0),
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: Colors.white,
width: 2.0),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white,),
icon: const Icon(
Icons.arrow_back,
color: Colors.white,
),
onPressed: () {
if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.previous();
@ -705,23 +737,33 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
color: locale.languageCode == 'ar'
? null
: Color(0xFF7DAFBC),
border: Border.all(
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
color: locale.languageCode == 'ar'
? Colors.white
: Color(0xFF7DAFBC),
width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white,),
icon: const Icon(
Icons.arrow_forward,
color: Colors.white,
),
onPressed: () {
if (locale.languageCode == 'ar') {
tutorialCoachMark.previous();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -741,7 +783,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.right,
child: Container(
width: screenWidth / 4,
height: screenHeight*0.2,
height: screenHeight * 0.2,
child: Stack(
children: [
Image.asset(
@ -770,7 +812,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
contents: [
createTargetContent(
text: AppLocalizations.of(context)!.bookMark,
space:screenWidth*0.22,
space: screenWidth * 0.22,
alignment: ContentAlign.bottom,
gap: 53,
),
@ -827,18 +869,30 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: null,
border: Border.all(
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: Colors.white,
width: 2.0,
),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white,),
icon: const Icon(
Icons.arrow_back,
color: Colors.white,
),
onPressed: () {
if (locale.languageCode == 'ar') {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.next();
@ -850,9 +904,15 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
color: locale.languageCode == 'ar'
? null
: Color(0xFF7DAFBC),
border: Border.all(
color:locale.languageCode=='ar' ? Colors.white : Color(0xFF7DAFBC), width: 2.0,),
color: locale.languageCode == 'ar'
? Colors.white
: Color(0xFF7DAFBC),
width: 2.0,
),
),
child: IconButton(
iconSize: 20,
@ -862,8 +922,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
if (locale.languageCode == 'ar') {
tutorialCoachMark.next();
} else {
ref.read(chartsTourProvider.notifier).state = true;
ref.read(scaffoldTourProvider.notifier).state = false;
ref
.read(chartsTourProvider.notifier)
.state = true;
ref
.read(scaffoldTourProvider.notifier)
.state = false;
tutorialCoachMark.finish();
}
},
@ -885,7 +949,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
align: ContentAlign.right,
child: SizedBox(
width: screenWidth / 4,
height:screenHeight*0.2,
height: screenHeight * 0.2,
child: Stack(
children: [
Image.asset(
@ -964,23 +1028,36 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? Color(0xFF7DAFBC):null,
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: null,
border: Border.all(
color:locale.languageCode=='ar' ? Color(0xFF7DAFBC): Colors.white, width: 2.0,),
color: locale.languageCode == 'ar'
? Color(0xFF7DAFBC)
: Colors.white,
width: 2.0,
),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_back,
color: Colors.white,),
icon: const Icon(
Icons.arrow_back,
color: Colors.white,
),
onPressed: () {
if (locale.languageCode == 'ar') {
tutorialCoachMark.previous();
} else {
ref.read(previousChartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
ref
.read(previousChartsTourProvider
.notifier)
.state = true;
ref
.read(previousHomeTourProvider
.notifier)
.state = false;
tutorialCoachMark.finish();
}
},
),
),
@ -988,18 +1065,31 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: locale.languageCode=='ar' ? null:Color(0xFF7DAFBC),
color: locale.languageCode == 'ar'
? null
: Color(0xFF7DAFBC),
border: Border.all(
color:locale.languageCode=='ar' ? Colors.white: Color(0xFF7DAFBC), width: 1),
color: locale.languageCode == 'ar'
? Colors.white
: Color(0xFF7DAFBC),
width: 1),
),
child: IconButton(
iconSize: 20,
icon: const Icon(Icons.arrow_forward,
color: Colors.white,),
icon: const Icon(
Icons.arrow_forward,
color: Colors.white,
),
onPressed: () {
if (locale.languageCode == 'ar') {
ref.read(previousChartsTourProvider.notifier).state = true;
ref.read(previousHomeTourProvider.notifier).state = false;
ref
.read(previousChartsTourProvider
.notifier)
.state = true;
ref
.read(previousHomeTourProvider
.notifier)
.state = false;
tutorialCoachMark.finish();
} else {
tutorialCoachMark.previous();
@ -1217,6 +1307,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
for (var chart in data) {
final groupBy = chart['group_by'];
List response = chart['response'] ?? [];
final chartHeading = chart['chart_heading'];
// Filter the response based on selected filters
var chartFilteredData = response.where((responseItem) {
@ -1243,6 +1334,26 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
});
}).toList();
print('chartFilteredData- $chartFilteredData');
// If chartFilteredData is empty, print the message
if (chartFilteredData.isEmpty) {
if (kDebugMode) {
print(
"Selected year: ${selectedFilters.firstWhere((f) => f['filter_key'] == 'TIME_PERIOD', orElse: () => {
'filter_data': ['Unknown']
})['filter_data']} - No data for chart: : $chartHeading");
}
// Add the complete chart data to the filteredData list
filteredData.add({
...chart,
'response': response, // Return full unfiltered response
});
continue;
}
// If any data matches the filter, add the whole chart data object
// Add filtered chart only once
if (chartFilteredData.isNotEmpty &&
@ -1996,6 +2107,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: isBookmarked
? Colors.black
: Colors.white,
size: 23,
),
],
),
@ -2015,7 +2127,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: Colors.white,
),
),
SizedBox(width: 5),
SizedBox(width: 6),
Stack(
children: [
// Image.asset(
@ -2031,7 +2143,6 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// height: 24,
// ),
SvgPicture.asset(
UaeNumbersAssetPath.share,
semanticsLabel: 'share',
@ -2056,6 +2167,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: Colors.white,
),
),
SizedBox(width: 10),
GestureDetector(
onTap: () {
showRightSideModal(
@ -2233,6 +2346,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
right: 16.0,
bottom: 1.0,
top: 1.0),
decoration: BoxDecoration(
color: Colors
.white, // Move color inside BoxDecoration
borderRadius: BorderRadius.circular(
12), // Ensure border radius is applied
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
@ -2276,15 +2395,20 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
const SizedBox(height: 5),
Flexible(
fit: FlexFit.loose,
child: FittedBox(
child: Text(
'(${response[0]['display_value'] ?? 'NA'})',
// '(${data['firstYear'] ??
// 'NA'} - ${data['lastYear'] ??
// 'NA'})',
style: const TextStyle(
fontSize: 10,
color: Colors.grey),
child: SizedBox(
height: 20.0,
child: FittedBox(
child: Text(
'(${response[0]['display_value'] ?? 'NA'})',
// '(${data['firstYear'] ??
// 'NA'} - ${data['lastYear'] ??
// 'NA'})',
style:
const TextStyle(
fontSize: 10,
color: Colors
.grey),
),
),
),
),
@ -2295,20 +2419,60 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
height: 50.0,
child: FittedBox(
fit: BoxFit.contain,
child: Text(
response[0]
['value'] ??
'NA',
// '${data['roundedAverage'] ??
// 'NA'}',
style:
const TextStyle(
fontSize: 20,
fontWeight:
FontWeight.w900,
color: Color(
0xFF90B0D5),
),
child: Row(
children: [
Text(
response[0][
'value'] ??
'NA',
// '${data['roundedAverage'] ??
// 'NA'}',
style: TextStyle(
fontSize: 20,
fontWeight:
FontWeight
.w900,
color: response[0]
[
'calculation'] ==
'different'
? _getColorFromHex(
response[0]
[
'font_color'])
: const Color(
0xFF90B0D5),
// color: Color(
// 0xFF90B0D5),
),
),
const SizedBox(
width:
1), // Space between text and icon
if (response[0][
'calculation'] ==
'different') ...[
if (response[0][
'font_color'] ==
'#D83731')
const Icon(
Icons
.arrow_downward,
color: Colors
.red,
size: 22)
else if (response[
0][
'font_color'] ==
'#11AF22')
const Icon(
Icons
.arrow_upward,
color: Colors
.green,
size: 22),
],
],
),
),
),
@ -2344,6 +2508,12 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
child: Container(
height: cardHeight,
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors
.white, // Move color inside BoxDecoration
borderRadius: BorderRadius.circular(
12), // Ensure border radius is applied
),
child: Column(
mainAxisSize: MainAxisSize
.min, // Adjust card height based on content
@ -2413,12 +2583,18 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// data['lastYearValue']),
// apiService.formatAmount(
// data['lastYearValue']),
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight:
FontWeight.w900,
color:
Color(0xFF90B0D5),
color: response[0][
'calculation'] ==
'different'
? _getColorFromHex(
response[0][
'font_color'])
: const Color(
0xFF90B0D5),
),
),
),
@ -2441,12 +2617,18 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'NA',
// apiService.formatAmount(
// data['secondLastYearValue']),
style: const TextStyle(
style: TextStyle(
fontSize: 14,
fontWeight:
FontWeight.w600,
color:
Color(0xFFD83731),
color: response[1][
'calculation'] ==
'different'
? _getColorFromHex(
response[0][
'font_color'])
: const Color(
0xFFD83731),
),
),
),
@ -2476,29 +2658,48 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return Card(
margin: const EdgeInsets.all(10),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const SizedBox(height: 10),
ConstrainedBox(
constraints: const BoxConstraints(
minHeight:
200, // Minimum height
maxHeight:
400, // Maximum height
margin: const EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Color(
int.parse(
(chartScreenData[
'border_color'] ??
'#898C81')
.replaceFirst('#', '0xff'),
),
// child: buildChart(chartsData[index]),
child: ChartWidget(
chartData:
chartsData[index])),
],
),
),
);
), // Border color
width: 1, // Border width
),
color: Colors.white,
borderRadius: BorderRadius.circular(
8), // Optional: Rounded corners
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// ConstrainedBox
Container(
// constraints: const BoxConstraints(
// minHeight:
// 200, // Minimum height
// maxHeight:
// 400, // Maximum height
// ),
height: 350,
// child: buildChart(chartsData[index]),
child: ChartWidget(
chartData:
chartsData[index]))
],
),
),
));
},
),
],
@ -2545,7 +2746,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
onTap: () {
setState(() {
_activeTabIndex = _tabsData.indexOf(tab);
});
});
_scrollToIndex(_activeTabIndex);
onTabSelected(tab['id']!);
},
@ -2567,4 +2768,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
),
);
}
}
}
// Function to convert hex color string to Color
Color _getColorFromHex(String hexColor) {
hexColor = hexColor.replaceFirst('#', '');
if (hexColor.length == 6) {
hexColor = 'FF$hexColor'; // Add alpha if not provided
}
return Color(int.parse(hexColor, radix: 16));
}

File diff suppressed because it is too large Load Diff

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.19+20
version: 1.0.23+24
environment:
sdk: ">=3.2.3 <4.0.0"