charts changes

This commit is contained in:
venbaittech 2025-03-10 09:35:03 +05:30
parent e9074e4c93
commit 3b64a5e970
4 changed files with 476 additions and 343 deletions

View File

@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) {
def flutterVersionCode = localProperties.getProperty("flutter.versionCode") def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = "32" flutterVersionCode = "33"
} }
def flutterVersionName = localProperties.getProperty("flutter.versionName") def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = "1.0.31" flutterVersionName = "1.0.32"
} }
def keystorePropertiesFile = rootProject.file("key.properties") def keystorePropertiesFile = rootProject.file("key.properties")

View File

@ -571,7 +571,7 @@ class ChartWidget extends StatelessWidget {
}, },
), ),
), ),
SizedBox(height: 45), SizedBox(height: 55),
Expanded( Expanded(
// child: SingleChildScrollView( // child: SingleChildScrollView(
// scrollDirection: Axis.horizontal, // scrollDirection: Axis.horizontal,
@ -1037,19 +1037,14 @@ class ChartWidget extends StatelessWidget {
final List<Color> uniqueColorsLine_trend_2 = [ final List<Color> uniqueColorsLine_trend_2 = [
Color(0xFF6097CD), Color(0xFF6097CD),
Color(0xFFD086A7), Color(0xFFD086A7),
Color(0xFF98BCE5),
Color(0xFFA7B5C5),
Color(0xFFBED3EC),
Color(0xFFD4E3F4),
]; ];
Set<int> selectedYears = {1970, 1980, 1990, 2000, 2010, 2020}; Set<int> selectedYears = {1970, 1980, 1990, 2000, 2010, 2020};
Map<String, Color> groupColorMap = {}; Map<String, Color> groupColorMap = {};
int colorIndex = 0; int colorIndex = 0;
// for (String group in groupByValues) { // for (String group in groupByValues) {
// // groupColorMap[group] = adjustColorlineTrend(bodyColor, colorIndex); // // groupColorMap[group] = uniqueColors[colorIndex % uniqueColors.length];
// groupColorMap[group] = uniqueColors[colorIndex % uniqueColors.length]; // groupColorMap[group] = uniqueColorsLine_trend_2[
// // groupColorMap[group] = uniqueColorsLine_trend_2[ // colorIndex % uniqueColorsLine_trend_2.length];
// // colorIndex % uniqueColorsLine_trend_2.length];
// colorIndex++; // colorIndex++;
// } // }
@ -1089,22 +1084,35 @@ class ChartWidget extends StatelessWidget {
var chartBarColors = chartData['chart_bar_color'] ?? {}; var chartBarColors = chartData['chart_bar_color'] ?? {};
Map<String, String> barColorsMap = {}; Map<String, String> barColorsMap = {};
chartBarColors.forEach((key, value) { chartBarColors.forEach((key, value) {
barColorsMap[key] = value.toString(); // Ensure values are strings barColorsMap[key] = value.toString(); // Ensure values are strings
}); });
bool hasBarColors = barColorsMap.isNotEmpty; bool hasBarColors = barColorsMap.isNotEmpty;
// var chartBarColorsRaw = chartData['chart_bar_color'] ?? {};
// // Convert LinkedMap<dynamic, dynamic> to Map<String, String>
// Map<String, String> chartBarColrs =
// Map<String, String>.from(chartBarColorsRaw);
// // Now map to Color
// Map<String, Color> parsedChartBarColors =
// chartBarColrs.map((key, value) {
// return MapEntry(key, _hexToColor(value));
// });
//
var chartBarColorsRaw = chartData['chart_bar_color'] ?? {}; List<dynamic> keys = chartBarColors['key'] ?? [];
List<dynamic> colors = chartBarColors['color'] ?? [];
// Convert LinkedMap<dynamic, dynamic> to Map<String, String> print('RT1keys - $keys');
Map<String, String> chartBarColrs = print('RT1colors - $colors');
Map<String, String>.from(chartBarColorsRaw);
// Now map to Color // Convert to a map for easy lookup
Map<String, Color> parsedChartBarColors = Map<String, Color> parsedChartBarColors = {};
chartBarColrs.map((key, value) { for (int i = 0; i < keys.length; i++) {
return MapEntry(key, _hexToColor(value)); parsedChartBarColors[keys[i].toString()] =
}); _hexToColor(colors[i].toString());
}
print('RTLinr1 - $parsedChartBarColors');
for (String group in groupByValues) { for (String group in groupByValues) {
if (parsedChartBarColors.containsKey(group)) { if (parsedChartBarColors.containsKey(group)) {
@ -1718,7 +1726,7 @@ class ChartWidget extends StatelessWidget {
fitInsideHorizontally: true, fitInsideHorizontally: true,
fitInsideVertically: true, fitInsideVertically: true,
tooltipPadding: const EdgeInsets.all(5), tooltipPadding: const EdgeInsets.all(5),
tooltipMargin: 5, tooltipMargin: 12,
getTooltipColor: (group) => Colors.transparent, getTooltipColor: (group) => Colors.transparent,
getTooltipItem: (group, groupIndex, rod, rodIndex) { getTooltipItem: (group, groupIndex, rod, rodIndex) {
if (rod.toY == 0) return null; if (rod.toY == 0) return null;
@ -2150,29 +2158,45 @@ class ChartWidget extends StatelessWidget {
double minHeight = 300.0; // Minimum chart height double minHeight = 300.0; // Minimum chart height
double maxHeight = 500.0; // Maximum chart height double maxHeight = 500.0; // Maximum chart height
// Calculate total height dynamically // Calculate total height dynamically
double chartHeight = // double chartHeight =
((numberOfBars * barHeight) + ((numberOfBars - 1) * barSpacing)) // ((numberOfBars * barHeight) + ((numberOfBars - 1) * barSpacing))
.clamp(minHeight, maxHeight); // .clamp(minHeight, maxHeight);
var chartBarColors = chartData['chart_bar_color'] ?? {}; var chartBarColors = chartData['chart_bar_color'] ?? {};
Map<String, String> barColorsMap = {}; Map<String, String> barColorsMap = {};
chartBarColors.forEach((key, value) { // chartBarColors.forEach((key, value) {
barColorsMap[key] = value.toString(); // Ensure values are strings // barColorsMap[key] = value.toString(); // Ensure values are strings
}); // });
bool hasBarColors = barColorsMap.isNotEmpty; // bool hasBarColors = barColorsMap.isNotEmpty;
var chartBarColorsRaw = chartData['chart_bar_color'] ?? {}; var chartBarColorsRaw = chartData['chart_bar_color'] ?? {};
// Convert LinkedMap<dynamic, dynamic> to Map<String, String> // // Convert LinkedMap<dynamic, dynamic> to Map<String, String>
Map<String, String> chartBarColrs = // Map<String, String> chartBarColrs =
Map<String, String>.from(chartBarColorsRaw); // Map<String, String>.from(chartBarColorsRaw);
//
// // Now map to Color
// Map<String, Color> parsedChartBarColors =
// chartBarColrs.map((key, value) {
// print('HorizontalLegends1 -$key');
// return MapEntry(key, _hexToColor(value));
// });
// Now map to Color List<dynamic> keys = chartBarColors['key'] ?? [];
Map<String, Color> parsedChartBarColors = List<dynamic> colors = chartBarColors['color'] ?? [];
chartBarColrs.map((key, value) {
return MapEntry(key, _hexToColor(value)); print('RT1keys - $keys');
}); print('RT1colors - $colors');
// Convert to a map for easy lookup
Map<String, Color> parsedChartBarColors = {};
for (int i = 0; i < keys.length; i++) {
parsedChartBarColors[keys[i].toString()] =
_hexToColor(colors[i].toString());
}
print('RT1 - $parsedChartBarColors');
bool hasBarColors = parsedChartBarColors.isNotEmpty;
return Column(children: [ return Column(children: [
Text( Text(
@ -2203,221 +2227,220 @@ class ChartWidget extends StatelessWidget {
child: SizedBox( child: SizedBox(
// width: 500, // width: 500,
// width: 1000, // width: 1000,
height: chartHeight, // height: chartHeight,
child: Stack(children: [ child: Stack(children: [
BarChart( BarChart(
BarChartData( BarChartData(
// maxY: 400000, // maxY: 400000,
maxY: _calculateMaxY(chartData), maxY: _calculateMaxY(chartData),
rotationQuarterTurns: rotationTurns, rotationQuarterTurns: rotationTurns,
barTouchData: BarTouchData( barTouchData: BarTouchData(
// enabled: true, // enabled: true,
enabled: false, enabled: false,
touchTooltipData: BarTouchTooltipData( touchTooltipData: BarTouchTooltipData(
// getTooltipColor: (group) => Colors.black12, // getTooltipColor: (group) => Colors.black12,
getTooltipColor: (group) => Colors.transparent, getTooltipColor: (group) => Colors.transparent,
tooltipHorizontalAlignment: tooltipHorizontalAlignment: FLHorizontalAlignment.center,
FLHorizontalAlignment.center,
tooltipRoundedRadius: 8,
fitInsideHorizontally:
true, // Ensure it fits within the screen
fitInsideVertically: true,
tooltipPadding: EdgeInsets.only(
left: 3, right: 3, top: 0.5, bottom: 1),
tooltipMargin: 16,
// Only show tooltip when touched
getTooltipItem: (group, groupIndex, rod, rodIndex) {
// if (rod.toY == 0 || touchedGroupIndex == -1) {
// return null; // Don't show the tooltip if the value is 0 or there's no touch
// }
// Hide tooltips for 0 values
if (rod.toY == 0)
return null; // Hide for zero values
// if (groupIndex == touchedGroupIndex) { tooltipRoundedRadius: 8,
// print('Group Index: $groupIndex, Group : $group'); fitInsideHorizontally:
true, // Ensure it fits within the screen
fitInsideVertically: true,
tooltipPadding: EdgeInsets.only(
left: 5, right: 3, top: 0.5, bottom: 1),
// Get the group label dynamically tooltipMargin: 20,
String groupLabel =
groupByValues.elementAt(groupIndex);
// Fetch the crop for the current group from groupedCrops // Only show tooltip when touched
String cropType = getTooltipItem: (group, groupIndex, rod, rodIndex) {
groupByValues.elementAt(groupIndex); // if (rod.toY == 0 || touchedGroupIndex == -1) {
String crop = groupedCrops[cropType]![rodIndex]; // return null; // Don't show the tooltip if the value is 0 or there's no touch
double value = rod.toY; // }
// Hide tooltips for 0 values
if (rod.toY == 0) return null; // Hide for zero values
String formattedValue; // if (groupIndex == touchedGroupIndex) {
if (value >= 1000000) { // print('Group Index: $groupIndex, Group : $group');
formattedValue =
(value / 1000000).toStringAsFixed(1) + 'M';
} else if (value >= 1000) {
formattedValue =
(value / 1000).toStringAsFixed(1) + 'K';
} else {
formattedValue = value.toStringAsFixed(
0); // for values smaller than 1000
}
// return BarTooltipItem( // Get the group label dynamically
// // '$groupLabel\n$crop', String groupLabel = groupByValues.elementAt(groupIndex);
// '$formattedValue',
// const TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.w400,
// fontSize: 12,
// ),
// );
return BarTooltipItem( // Fetch the crop for the current group from groupedCrops
'$formattedValue', // This is your main tooltip text String cropType = groupByValues.elementAt(groupIndex);
String crop = groupedCrops[cropType]![rodIndex];
double value = rod.toY;
const TextStyle( String formattedValue;
color: Colors.black, if (value >= 1000000) {
fontWeight: FontWeight.w400, formattedValue =
(value / 1000000).toStringAsFixed(1) + 'M';
} else if (value >= 1000) {
formattedValue =
(value / 1000).toStringAsFixed(1) + 'K';
} else {
formattedValue = value.toStringAsFixed(
0); // for values smaller than 1000
}
// return BarTooltipItem(
// // '$groupLabel\n$crop',
// '$formattedValue',
// const TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.w400,
// fontSize: 12,
// ),
// );
return BarTooltipItem(
'$formattedValue', // This is your main tooltip text
const TextStyle(
color: Colors.black,
fontWeight: FontWeight.w400,
fontSize: 12,
),
children: [
TextSpan(
text: '', // Add extra information here
// text: '\n$crop', // Add extra information here
style: TextStyle(
color: Colors.grey[
700], // Optional: Different color for extra text
fontSize: 8,
),
),
],
);
// return BarTooltipItem(
// '$groupLabel\n$crop',
// const TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// ),
// children: [
// TextSpan(
// text: ' Value: $formattedValue',
// style: const TextStyle(
// color: Colors.yellow,
// fontWeight: FontWeight.w500,
// ),
// ),
// ],
// );
// }
// return null;
},
),
// touchCallback: (event, response) {
// if (event.isInterestedForInteractions &&
// response != null &&
// response.spot != null) {
// // setState(() {
// touchedGroupIndex =
// response.spot!.touchedBarGroupIndex;
// // });
// } else {
// // setState(() {
// touchedGroupIndex = -1; // Reset if no interaction
// // });
// }
// },
),
titlesData: FlTitlesData(
leftTitles: AxisTitles(
sideTitles: SideTitles(
// showTitles: false,
reservedSize: 40,
interval: 100000,
getTitlesWidget: (value, meta) {
return SizedBox(
width: 50,
child: Text(
value.toInt().toString(),
textAlign: TextAlign.justify,
style: const TextStyle(
fontSize: 12, fontSize: 12,
), ),
children: [ ),
TextSpan( );
text: '', // Add extra information here },
// text: '\n$crop', // Add extra information here ),
style: TextStyle( ),
color: Colors.grey[ bottomTitles: AxisTitles(
700], // Optional: Different color for extra text sideTitles: SideTitles(
fontSize: 8, showTitles: true,
reservedSize: 150, // Added space for rotated titles
getTitlesWidget: (value, meta) {
if (value < groupByValues.length) {
String title =
groupByValues.elementAt(value.toInt());
return Transform.rotate(
angle:
-1.58, // Rotation in radians (~ -30 degrees)
child: Center(
child: SizedBox(
width: 120,
child: Text(
title,
textAlign: TextAlign.end,
style: const TextStyle(fontSize: 12),
softWrap: true,
maxLines: 2,
), ),
), ),
], ),
); );
}
// return BarTooltipItem( return const SizedBox.shrink();
// '$groupLabel\n$crop',
// const TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// ),
// children: [
// TextSpan(
// text: ' Value: $formattedValue',
// style: const TextStyle(
// color: Colors.yellow,
// fontWeight: FontWeight.w500,
// ),
// ),
// ],
// );
// }
// return null;
},
),
// touchCallback: (event, response) {
// if (event.isInterestedForInteractions &&
// response != null &&
// response.spot != null) {
// // setState(() {
// touchedGroupIndex =
// response.spot!.touchedBarGroupIndex;
// // });
// } else {
// // setState(() {
// touchedGroupIndex = -1; // Reset if no interaction
// // });
// }
// },
),
titlesData: FlTitlesData(
leftTitles: AxisTitles(
sideTitles: SideTitles(
// showTitles: false,
reservedSize: 40,
interval: 100000,
getTitlesWidget: (value, meta) {
return SizedBox(
width: 50,
child: Text(
value.toInt().toString(),
textAlign: TextAlign.justify,
style: const TextStyle(
fontSize: 12,
),
),
);
},
),
),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 150, // Added space for rotated titles
getTitlesWidget: (value, meta) {
if (value < groupByValues.length) {
String title =
groupByValues.elementAt(value.toInt());
return Transform.rotate(
angle:
-1.58, // Rotation in radians (~ -30 degrees)
child: Center(
child: SizedBox(
width: 120,
child: Text(
title,
textAlign: TextAlign.end,
style: const TextStyle(fontSize: 12),
softWrap: true,
maxLines: 2,
),
),
),
);
}
return const SizedBox.shrink();
},
),
),
rightTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false)),
topTitles: AxisTitles(
sideTitles: SideTitles(showTitles: false)),
),
borderData: FlBorderData(
show: true,
border: const Border(
// left: BorderSide(color: Colors.grey),
bottom: BorderSide(color: Colors.white),
),
),
gridData: FlGridData(
show: false,
drawVerticalLine: true,
verticalInterval: 1,
horizontalInterval: 100000,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1,
);
}, },
), ),
// barGroups: _buildHorizontalRotateBarGroups( ),
// chartData, groupByValues), rightTitles:
AxisTitles(sideTitles: SideTitles(showTitles: false)),
barGroups: hasBarColors topTitles:
? _buildHorizontalRotateBarGroupsBarColors( AxisTitles(sideTitles: SideTitles(showTitles: false)),
chartData, groupByValues, parsedChartBarColors) ),
: _buildHorizontalRotateBarGroups( borderData: FlBorderData(
chartData, groupByValues), show: true,
border: const Border(
alignment: BarChartAlignment.spaceAround, // left: BorderSide(color: Colors.grey),
bottom: BorderSide(color: Colors.white),
), ),
), ),
])), gridData: FlGridData(
show: false,
drawVerticalLine: true,
verticalInterval: 1,
horizontalInterval: 100000,
getDrawingHorizontalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1,
);
},
getDrawingVerticalLine: (value) {
return FlLine(
color: Colors.grey.withOpacity(0.5),
strokeWidth: 1,
);
},
),
// barGroups: _buildHorizontalRotateBarGroups(
// chartData, groupByValues),
barGroups: hasBarColors
? _buildHorizontalRotateBarGroupsBarColors(
chartData, groupByValues, parsedChartBarColors)
: _buildHorizontalRotateBarGroups(
chartData, groupByValues),
alignment: BarChartAlignment.spaceAround,
),
),
])),
), ),
// ), // ),
@ -2592,6 +2615,7 @@ class ChartWidget extends StatelessWidget {
// // groupColorMap[group] = adjustColorlineTrend(bodyColor, colorIndex); // // groupColorMap[group] = adjustColorlineTrend(bodyColor, colorIndex);
// colorIndex++; // colorIndex++;
// } // }
for (String group in groupByValues) { for (String group in groupByValues) {
if (chartBarColors.isNotEmpty && chartBarColors.containsKey(group)) { if (chartBarColors.isNotEmpty && chartBarColors.containsKey(group)) {
// Use predefined color from chartBarColors // Use predefined color from chartBarColors
@ -3225,8 +3249,8 @@ class ChartWidget extends StatelessWidget {
} }
// Apply different buffers based on maxY value // Apply different buffers based on maxY value
return maxY < 500 ? maxY * 3.5 : maxY * 1.5; // return maxY < 500 ? maxY * 3.5 : maxY * 1.5;
// return maxY * 1.5; // Add 10% buffer for better visualization return maxY * 1.5; // Add 10% buffer for better visualization
} }
List<BarChartGroupData> _buildHorizontalRotateBarGroups( List<BarChartGroupData> _buildHorizontalRotateBarGroups(
@ -3313,6 +3337,9 @@ class ChartWidget extends StatelessWidget {
Map<String, Color> chartBarColors) { Map<String, Color> chartBarColors) {
List<dynamic> responseData = chartData['response']; List<dynamic> responseData = chartData['response'];
List<BarChartGroupData> barGroups = []; List<BarChartGroupData> barGroups = [];
print('chartBarColorsRota- $chartBarColors');
// Define two shades for alternating colors // Define two shades for alternating colors
List<Color> uniqueColorsForTwo = [ List<Color> uniqueColorsForTwo = [
chartBarColors['default'] ?? Colors.blue, // Original color chartBarColors['default'] ?? Colors.blue, // Original color
@ -3330,6 +3357,21 @@ class ChartWidget extends StatelessWidget {
return entry['ObsKey'][chartData['group_by']] == groupValue; return entry['ObsKey'][chartData['group_by']] == groupValue;
}).toList(); }).toList();
Map<String, String> genderMapping = {
'ذكر': 'Male', // Arabic for Male
'أنثى': 'Female' // Arabic for Female
};
// Sort data so "Male" appears first, "Female" second
groupData.sort((a, b) {
String genderA =
genderMapping[a['ObsKey']['GENDER']] ?? a['ObsKey']['GENDER'] ?? "";
String genderB =
genderMapping[b['ObsKey']['GENDER']] ?? b['ObsKey']['GENDER'] ?? "";
return (genderA == 'Male' ? 0 : 1).compareTo(genderB == 'Male' ? 0 : 1);
});
// Create BarChartRodData for each bar in the group // Create BarChartRodData for each bar in the group
List<BarChartRodData> barRods = groupData.map((data) { List<BarChartRodData> barRods = groupData.map((data) {
double value = double value =
@ -3337,8 +3379,11 @@ class ChartWidget extends StatelessWidget {
// Get gender-based color // Get gender-based color
String gender = data['ObsKey']['GENDER'] ?? ""; String gender = data['ObsKey']['GENDER'] ?? "";
// Convert Arabic gender to English if necessary
String normalizedGender = genderMapping[gender] ?? gender;
List<BarChartGroupData> barGroups = []; print('horizontalRotateGender - $gender');
// Map Arabic gender values to English equivalents
// Determine color dynamically // Determine color dynamically
Color barColor; Color barColor;
@ -3347,8 +3392,8 @@ class ChartWidget extends StatelessWidget {
colorIndex % 2]; // Alternate between two colors colorIndex % 2]; // Alternate between two colors
colorIndex++; // Update index for next bar colorIndex++; // Update index for next bar
} else { } else {
barColor = chartBarColors[gender] ?? // barColor = chartBarColors[gender] ?? Colors.grey; // Default gender-based color
Colors.grey; // Default gender-based color barColor = chartBarColors[normalizedGender] ?? Colors.grey;
} }
print('GEG- $gender'); print('GEG- $gender');
@ -3391,6 +3436,9 @@ Widget _buildChartLegend(
Set<String> uniqueCropTypes = Set<String> uniqueCropTypes =
groupedCrops.values.expand((list) => list).toSet(); groupedCrops.values.expand((list) => list).toSet();
print('HorizontalLegends2 -$uniqueCropTypes');
print('HorizontalLegends -$parsedChartBarColors');
return Wrap( return Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
spacing: 12, spacing: 12,

View File

@ -1,8 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:uae_stat/domain/use_cases/language.dart'; import 'package:uae_stat/domain/use_cases/language.dart';
import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/enquiry_asset_icon_path.dart'; import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/enquiry_asset_icon_path.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:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
class Contact extends StatefulWidget { class Contact extends StatefulWidget {
const Contact({super.key}); const Contact({super.key});
@ -13,133 +18,213 @@ class Contact extends StatefulWidget {
class _ContactState extends State<Contact> { class _ContactState extends State<Contact> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double screenWidth= MediaQuery.of(context).size.width; final double screenWidth = MediaQuery.of(context).size.width;
final double screenHeight= MediaQuery.of(context).size.height;
// final double screenHeight = MediaQuery.of(context).size.height;
return BaseScaffold( return BaseScaffold(
body: Container( body: Container(
color: Colors.grey[200], color: Colors.grey[200],
width: screenWidth, width: screenWidth,
padding: EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
Container( buildContactCard(
decoration: BoxDecoration( context,
color: Colors.white, title: 'DUBAI - EMIRATES TOWER -32ND FLOOR',
borderRadius: BorderRadius.circular(4.0), // Slight curve titleAr: 'دبي - أبراج الإمارات - الطابق 32',
), details: [
padding: EdgeInsets.all(7.0), {
height: screenHeight*0.35, 'icon': EnquiryAssetIconPath.building,
child: Column( 'text': 'Office : Dubai - Emirates Tower -32nd Floor',
crossAxisAlignment: CrossAxisAlignment.start, 'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32'
children: [ },
Text(context.translate('DUBAI - EMIRATES TOWER -32ND FLOOR','دبي - أبراج الإمارات - الطابق 32'), {
style: TextStyle( 'icon': EnquiryAssetIconPath.phone,
color: Color(0xFF265E84), 'text': 'Tel : 00971 46080000',
fontSize: 20, 'textAr': 'الهاتف : 0097146080000'
fontFamily: 'Roboto', },
fontWeight: FontWeight.w500, {
), 'icon': EnquiryAssetIconPath.fax,
), 'text': 'Fax : 0097143273535',
buildTextRow(EnquiryAssetIconPath.building,context.translate('Office : Dubai - Emirates Tower -32nd Floor','المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32')), 'textAr': 'فاكس : 0097143273535'
buildTextRow(EnquiryAssetIconPath.phone,context.translate('Tel : 00971 46080000','الهاتف : 0097146080000'),), },
buildTextRow(EnquiryAssetIconPath.fax, context.translate('Fax : 0097143273535','فاكس : 0097143273535')), {
buildTextRow(EnquiryAssetIconPath.map, context.translate('P.O.Box : 127000 Dubai','ص.ب: : 127000 دبي')), 'icon': EnquiryAssetIconPath.map,
buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : info@fcsc.gov.ae','البريد الإلكتروني : info@fcsc.gov.ae')), 'text': 'P.O.Box : 127000 Dubai',
buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), 'textAr': 'ص.ب: : 127000 دبي'
buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), },
{
'icon': EnquiryAssetIconPath.at,
'text': 'Email Address : info@fcsc.gov.ae',
'textAr': 'البريد الإلكتروني : info@fcsc.gov.ae'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Latitude : 25.223926',
'textAr': 'خط العرض : 25.223926'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Longitude : 55.350526',
'textAr': 'خط الطول : 55.350526'
},
], ],
), ),
), const SizedBox(height: 10),
SizedBox(height: 10,), buildContactCard(
Container( context,
padding: EdgeInsets.all(7.0), title: 'MEDIA SECTION',
decoration: BoxDecoration( titleAr: 'قسم الاعلام',
color: Colors.white, details: [
borderRadius: BorderRadius.circular(4.0), // Slight curve {
), 'icon': EnquiryAssetIconPath.building,
height: screenHeight*0.34, 'text': 'Office : Media Section',
child: Column( 'textAr': 'المقر الرئيسي : قسم الاعلام'
crossAxisAlignment: CrossAxisAlignment.start, },
children: [ {
Text(context.translate('MEDIA SECTION','قسم الاعلام'), 'icon': EnquiryAssetIconPath.phone,
style: TextStyle( 'text': 'Tel : 00971 46080000',
color: Color(0xFF265E84), 'textAr': 'الهاتف : 0097146080000'
fontSize: 20, },
fontFamily: 'Roboto', {
fontWeight: FontWeight.w500, 'icon': EnquiryAssetIconPath.fax,
), 'text': 'Fax : 0097143273535',
), 'textAr': 'فاكس : 0097143273535'
buildTextRow(EnquiryAssetIconPath.building,context.translate('Office : Media Section','المقر الرئيسي : قسم الاعلام')), },
buildTextRow(EnquiryAssetIconPath.phone,context.translate('Tel : 00971 46080000','الهاتف : 0097146080000'),), {
buildTextRow(EnquiryAssetIconPath.fax, context.translate('Fax : 0097143273535','فاكس : 0097143273535')), 'icon': EnquiryAssetIconPath.map,
buildTextRow(EnquiryAssetIconPath.map, context.translate('P.O.Box : 127000 Dubai','ص.ب: : 127000 دبي')), 'text': 'P.O.Box : 127000 Dubai',
buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : GCO@fcsc.gov.ae','البريد الإلكتروني : GCO@fcsc.gov.ae')), 'textAr': 'ص.ب: : 127000 دبي'
buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), },
buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), {
'icon': EnquiryAssetIconPath.at,
'text': 'Email Address : GCO@fcsc.gov.ae',
'textAr': 'البريد الإلكتروني : GCO@fcsc.gov.ae'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Latitude : 25.223926',
'textAr': 'خط العرض : 25.223926'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Longitude : 55.350526',
'textAr': 'خط الطول : 55.350526'
},
], ],
), ),
), const SizedBox(height: 10),
SizedBox(height: 10,), buildContactCard(
Container( context,
decoration: BoxDecoration( title: 'SGDS',
color: Colors.white, titleAr: 'أهداف التنمية المستدامة',
borderRadius: BorderRadius.circular(4.0), // Slight curve details: [
), {
padding: EdgeInsets.all(7.0), 'icon': EnquiryAssetIconPath.building,
height: screenHeight*0.34, 'text': 'Office : SDGs',
child: Column( 'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة'
crossAxisAlignment: CrossAxisAlignment.start, },
children: [ {
Text(context.translate('SGDS','أهداف التنمية المستدامة'), 'icon': EnquiryAssetIconPath.phone,
style: TextStyle( 'text': 'Tel : 00971 46080000',
color: Color(0xFF265E84), 'textAr': 'الهاتف : 0097146080000'
fontSize: 20, },
fontFamily: 'Roboto', {
fontWeight: FontWeight.w500, 'icon': EnquiryAssetIconPath.fax,
), 'text': 'Fax : 0097143273535',
), 'textAr': 'فاكس : 0097143273535'
buildTextRow(EnquiryAssetIconPath.building,context.translate('Office : SDGs','المقر الرئيسي : أهداف التنمية المستدامة')), },
buildTextRow(EnquiryAssetIconPath.phone,context.translate('Tel : 00971 46080000','الهاتف : 0097146080000'),), {
buildTextRow(EnquiryAssetIconPath.fax, context.translate('Fax : 0097143273535','فاكس : 0097143273535')), 'icon': EnquiryAssetIconPath.map,
buildTextRow(EnquiryAssetIconPath.map, context.translate('P.O.Box : 127000 Dubai','ص.ب: : 127000 دبي')), 'text': 'P.O.Box : 127000 Dubai',
buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : sdgs@fcsc.gov.ae','البريد الإلكتروني : sdgs@fcsc.gov.ae')), 'textAr': 'ص.ب: : 127000 دبي'
buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), },
buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), {
'icon': EnquiryAssetIconPath.at,
'text': 'Email Address : sdgs@fcsc.gov.ae',
'textAr': 'البريد الإلكتروني : sdgs@fcsc.gov.ae'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Latitude : 25.223926',
'textAr': 'خط العرض : 25.223926'
},
{
'icon': EnquiryAssetIconPath.map,
'text': 'Longitude : 55.350526',
'textAr': 'خط الطول : 55.350526'
},
], ],
), ),
), ],
], ),
), ),
), ),
), title: Text(context.translate('Contact Us','اتصل بنا')),); title: Text(context.translate('Contact Us', 'اتصل بنا')),
);
}
Widget buildContactCard(BuildContext context,
{required String title,
required String titleAr,
required List<Map<String, String>> details}) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6.0),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 5,
offset: Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.translate(title, titleAr),
style: const TextStyle(
color: Color(0xFF265E84),
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
...details.map((item) => buildTextRow(item['icon']!,
context.translate(item['text']!, item['textAr']!))),
],
),
);
} }
Widget buildTextRow(String iconName, String text) { Widget buildTextRow(String iconName, String text) {
return Padding( return Padding(
padding: const EdgeInsets.only(top:8.0), padding: const EdgeInsets.symmetric(vertical: 5.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
iconName, iconName,
semanticsLabel: 'Filter', semanticsLabel: 'Icon',
width: 24, width: 20,
height: 24, height: 20,
), ),
SizedBox(width: 8), // Add spacing if needed const SizedBox(width: 10),
Text( Expanded(
text, // Dynamic text child: Text(
style: TextStyle( text,
fontSize: 16, style: const TextStyle(
color: Color(0xFF878787), fontSize: 14,
color: Color(0xFF5F5F5F),
),
), ),
), ),
], ],
), ),
); );
} }
} }

View File

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