From 3b64a5e97037d9035148af030722cec6c3fd1171 Mon Sep 17 00:00:00 2001 From: venbaittech Date: Mon, 10 Mar 2025 09:35:03 +0530 Subject: [PATCH] charts changes --- android/app/build.gradle | 4 +- .../Screens/charts/widgets/chart_widget.dart | 524 ++++++++++-------- .../drawer_routes/Drawer Items/contactUs.dart | 289 ++++++---- pubspec.yaml | 2 +- 4 files changed, 476 insertions(+), 343 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 0546a3d1..8aacea94 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -20,12 +20,12 @@ if (project.hasProperty('google-services.json')) { def flutterVersionCode = localProperties.getProperty("flutter.versionCode") if (flutterVersionCode == null) { - flutterVersionCode = "32" + flutterVersionCode = "33" } def flutterVersionName = localProperties.getProperty("flutter.versionName") if (flutterVersionName == null) { - flutterVersionName = "1.0.31" + flutterVersionName = "1.0.32" } def keystorePropertiesFile = rootProject.file("key.properties") diff --git a/lib/presentation/Screens/charts/widgets/chart_widget.dart b/lib/presentation/Screens/charts/widgets/chart_widget.dart index 8926cf5a..29e0616f 100644 --- a/lib/presentation/Screens/charts/widgets/chart_widget.dart +++ b/lib/presentation/Screens/charts/widgets/chart_widget.dart @@ -571,7 +571,7 @@ class ChartWidget extends StatelessWidget { }, ), ), - SizedBox(height: 45), + SizedBox(height: 55), Expanded( // child: SingleChildScrollView( // scrollDirection: Axis.horizontal, @@ -1037,19 +1037,14 @@ class ChartWidget extends StatelessWidget { final List uniqueColorsLine_trend_2 = [ Color(0xFF6097CD), Color(0xFFD086A7), - Color(0xFF98BCE5), - Color(0xFFA7B5C5), - Color(0xFFBED3EC), - Color(0xFFD4E3F4), ]; Set selectedYears = {1970, 1980, 1990, 2000, 2010, 2020}; Map groupColorMap = {}; int colorIndex = 0; // for (String group in groupByValues) { - // // groupColorMap[group] = adjustColorlineTrend(bodyColor, colorIndex); - // groupColorMap[group] = uniqueColors[colorIndex % uniqueColors.length]; - // // groupColorMap[group] = uniqueColorsLine_trend_2[ - // // colorIndex % uniqueColorsLine_trend_2.length]; + // // groupColorMap[group] = uniqueColors[colorIndex % uniqueColors.length]; + // groupColorMap[group] = uniqueColorsLine_trend_2[ + // colorIndex % uniqueColorsLine_trend_2.length]; // colorIndex++; // } @@ -1089,22 +1084,35 @@ class ChartWidget extends StatelessWidget { var chartBarColors = chartData['chart_bar_color'] ?? {}; Map barColorsMap = {}; + chartBarColors.forEach((key, value) { barColorsMap[key] = value.toString(); // Ensure values are strings }); bool hasBarColors = barColorsMap.isNotEmpty; + // var chartBarColorsRaw = chartData['chart_bar_color'] ?? {}; + // // Convert LinkedMap to Map + // Map chartBarColrs = + // Map.from(chartBarColorsRaw); + // // Now map to Color + // Map parsedChartBarColors = + // chartBarColrs.map((key, value) { + // return MapEntry(key, _hexToColor(value)); + // }); + // - var chartBarColorsRaw = chartData['chart_bar_color'] ?? {}; + List keys = chartBarColors['key'] ?? []; + List colors = chartBarColors['color'] ?? []; - // Convert LinkedMap to Map - Map chartBarColrs = - Map.from(chartBarColorsRaw); + print('RT1keys - $keys'); + print('RT1colors - $colors'); - // Now map to Color - Map parsedChartBarColors = - chartBarColrs.map((key, value) { - return MapEntry(key, _hexToColor(value)); - }); + // Convert to a map for easy lookup + Map parsedChartBarColors = {}; + for (int i = 0; i < keys.length; i++) { + parsedChartBarColors[keys[i].toString()] = + _hexToColor(colors[i].toString()); + } + print('RTLinr1 - $parsedChartBarColors'); for (String group in groupByValues) { if (parsedChartBarColors.containsKey(group)) { @@ -1718,7 +1726,7 @@ class ChartWidget extends StatelessWidget { fitInsideHorizontally: true, fitInsideVertically: true, tooltipPadding: const EdgeInsets.all(5), - tooltipMargin: 5, + tooltipMargin: 12, getTooltipColor: (group) => Colors.transparent, getTooltipItem: (group, groupIndex, rod, rodIndex) { if (rod.toY == 0) return null; @@ -2150,29 +2158,45 @@ class ChartWidget extends StatelessWidget { double minHeight = 300.0; // Minimum chart height double maxHeight = 500.0; // Maximum chart height -// Calculate total height dynamically - double chartHeight = - ((numberOfBars * barHeight) + ((numberOfBars - 1) * barSpacing)) - .clamp(minHeight, maxHeight); + // Calculate total height dynamically + // double chartHeight = + // ((numberOfBars * barHeight) + ((numberOfBars - 1) * barSpacing)) + // .clamp(minHeight, maxHeight); var chartBarColors = chartData['chart_bar_color'] ?? {}; Map barColorsMap = {}; - chartBarColors.forEach((key, value) { - barColorsMap[key] = value.toString(); // Ensure values are strings - }); - bool hasBarColors = barColorsMap.isNotEmpty; + // chartBarColors.forEach((key, value) { + // barColorsMap[key] = value.toString(); // Ensure values are strings + // }); + // bool hasBarColors = barColorsMap.isNotEmpty; var chartBarColorsRaw = chartData['chart_bar_color'] ?? {}; - // Convert LinkedMap to Map - Map chartBarColrs = - Map.from(chartBarColorsRaw); + // // Convert LinkedMap to Map + // Map chartBarColrs = + // Map.from(chartBarColorsRaw); + // + // // Now map to Color + // Map parsedChartBarColors = + // chartBarColrs.map((key, value) { + // print('HorizontalLegends1 -$key'); + // return MapEntry(key, _hexToColor(value)); + // }); - // Now map to Color - Map parsedChartBarColors = - chartBarColrs.map((key, value) { - return MapEntry(key, _hexToColor(value)); - }); + List keys = chartBarColors['key'] ?? []; + List colors = chartBarColors['color'] ?? []; + + print('RT1keys - $keys'); + print('RT1colors - $colors'); + + // Convert to a map for easy lookup + Map 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: [ Text( @@ -2203,221 +2227,220 @@ class ChartWidget extends StatelessWidget { child: SizedBox( // width: 500, // width: 1000, - height: chartHeight, + // height: chartHeight, child: Stack(children: [ - BarChart( - BarChartData( - // maxY: 400000, - maxY: _calculateMaxY(chartData), - rotationQuarterTurns: rotationTurns, - barTouchData: BarTouchData( - // enabled: true, - enabled: false, - touchTooltipData: BarTouchTooltipData( - // getTooltipColor: (group) => Colors.black12, - getTooltipColor: (group) => Colors.transparent, - tooltipHorizontalAlignment: - 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 + BarChart( + BarChartData( + // maxY: 400000, + maxY: _calculateMaxY(chartData), + rotationQuarterTurns: rotationTurns, + barTouchData: BarTouchData( + // enabled: true, + enabled: false, + touchTooltipData: BarTouchTooltipData( + // getTooltipColor: (group) => Colors.black12, + getTooltipColor: (group) => Colors.transparent, + tooltipHorizontalAlignment: FLHorizontalAlignment.center, - // if (groupIndex == touchedGroupIndex) { - // print('Group Index: $groupIndex, Group : $group'); + tooltipRoundedRadius: 8, + 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 - String groupLabel = - groupByValues.elementAt(groupIndex); + tooltipMargin: 20, - // Fetch the crop for the current group from groupedCrops - String cropType = - groupByValues.elementAt(groupIndex); - String crop = groupedCrops[cropType]![rodIndex]; - double value = rod.toY; + // 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 - String formattedValue; - if (value >= 1000000) { - 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 - } + // if (groupIndex == touchedGroupIndex) { + // print('Group Index: $groupIndex, Group : $group'); - // return BarTooltipItem( - // // '$groupLabel\n$crop', - // '$formattedValue', - // const TextStyle( - // color: Colors.black, - // fontWeight: FontWeight.w400, - // fontSize: 12, - // ), - // ); + // Get the group label dynamically + String groupLabel = groupByValues.elementAt(groupIndex); - return BarTooltipItem( - '$formattedValue', // This is your main tooltip text + // Fetch the crop for the current group from groupedCrops + String cropType = groupByValues.elementAt(groupIndex); + String crop = groupedCrops[cropType]![rodIndex]; + double value = rod.toY; - const TextStyle( - color: Colors.black, - fontWeight: FontWeight.w400, + String formattedValue; + if (value >= 1000000) { + 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, ), - 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, + ), + ); + }, + ), + ), + 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 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, - ), - ), - ); - }, - ), - ), - 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, - ); + } + return const SizedBox.shrink(); }, ), - // barGroups: _buildHorizontalRotateBarGroups( - // chartData, groupByValues), - - barGroups: hasBarColors - ? _buildHorizontalRotateBarGroupsBarColors( - chartData, groupByValues, parsedChartBarColors) - : _buildHorizontalRotateBarGroups( - chartData, groupByValues), - - alignment: BarChartAlignment.spaceAround, + ), + 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), + + 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); // colorIndex++; // } + for (String group in groupByValues) { if (chartBarColors.isNotEmpty && chartBarColors.containsKey(group)) { // Use predefined color from chartBarColors @@ -3225,8 +3249,8 @@ class ChartWidget extends StatelessWidget { } // Apply different buffers based on maxY value - return maxY < 500 ? maxY * 3.5 : maxY * 1.5; - // return maxY * 1.5; // Add 10% buffer for better visualization + // return maxY < 500 ? maxY * 3.5 : maxY * 1.5; + return maxY * 1.5; // Add 10% buffer for better visualization } List _buildHorizontalRotateBarGroups( @@ -3313,6 +3337,9 @@ class ChartWidget extends StatelessWidget { Map chartBarColors) { List responseData = chartData['response']; List barGroups = []; + + print('chartBarColorsRota- $chartBarColors'); + // Define two shades for alternating colors List uniqueColorsForTwo = [ chartBarColors['default'] ?? Colors.blue, // Original color @@ -3330,6 +3357,21 @@ class ChartWidget extends StatelessWidget { return entry['ObsKey'][chartData['group_by']] == groupValue; }).toList(); + Map 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 List barRods = groupData.map((data) { double value = @@ -3337,8 +3379,11 @@ class ChartWidget extends StatelessWidget { // Get gender-based color String gender = data['ObsKey']['GENDER'] ?? ""; + // Convert Arabic gender to English if necessary + String normalizedGender = genderMapping[gender] ?? gender; - List barGroups = []; + print('horizontalRotateGender - $gender'); + // Map Arabic gender values to English equivalents // Determine color dynamically Color barColor; @@ -3347,8 +3392,8 @@ class ChartWidget extends StatelessWidget { colorIndex % 2]; // Alternate between two colors colorIndex++; // Update index for next bar } else { - barColor = chartBarColors[gender] ?? - Colors.grey; // Default gender-based color + // barColor = chartBarColors[gender] ?? Colors.grey; // Default gender-based color + barColor = chartBarColors[normalizedGender] ?? Colors.grey; } print('GEG- $gender'); @@ -3391,6 +3436,9 @@ Widget _buildChartLegend( Set uniqueCropTypes = groupedCrops.values.expand((list) => list).toSet(); + print('HorizontalLegends2 -$uniqueCropTypes'); + print('HorizontalLegends -$parsedChartBarColors'); + return Wrap( alignment: WrapAlignment.center, spacing: 12, diff --git a/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart b/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart index bc8cb507..0093f1df 100644 --- a/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart +++ b/lib/presentation/routes/drawer_routes/Drawer Items/contactUs.dart @@ -1,8 +1,13 @@ import 'package:flutter/material.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/presentation/routes/drawer_routes/custom_drawer_routes.dart'; + import 'package:flutter_svg/flutter_svg.dart'; + class Contact extends StatefulWidget { const Contact({super.key}); @@ -13,133 +18,213 @@ class Contact extends StatefulWidget { class _ContactState extends State { @override Widget build(BuildContext context) { - final double screenWidth= MediaQuery.of(context).size.width; - final double screenHeight= MediaQuery.of(context).size.height; + final double screenWidth = MediaQuery.of(context).size.width; + // final double screenHeight = MediaQuery.of(context).size.height; return BaseScaffold( body: Container( color: Colors.grey[200], - width: screenWidth, - padding: EdgeInsets.all(16.0), - child: SingleChildScrollView( - child: Column( - children: [ - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4.0), // Slight curve - ), - padding: EdgeInsets.all(7.0), - height: screenHeight*0.35, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.translate('DUBAI - EMIRATES TOWER -32ND FLOOR','دبي - أبراج الإمارات - الطابق 32'), - style: TextStyle( - color: Color(0xFF265E84), - fontSize: 20, - fontFamily: 'Roboto', - fontWeight: FontWeight.w500, - ), - ), - buildTextRow(EnquiryAssetIconPath.building,context.translate('Office : Dubai - Emirates Tower -32nd Floor','المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32')), - 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 دبي')), - buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : info@fcsc.gov.ae','البريد الإلكتروني : info@fcsc.gov.ae')), - buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), - buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), + width: screenWidth, + padding: const EdgeInsets.all(16.0), + child: SingleChildScrollView( + child: Column( + children: [ + buildContactCard( + context, + title: 'DUBAI - EMIRATES TOWER -32ND FLOOR', + titleAr: 'دبي - أبراج الإمارات - الطابق 32', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : Dubai - Emirates Tower -32nd Floor', + 'textAr': 'المقر الرئيسي : دبي - أبراج الإمارات - الطابق 32' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + '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' + }, ], ), - ), - SizedBox(height: 10,), - Container( - padding: EdgeInsets.all(7.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4.0), // Slight curve - ), - height: screenHeight*0.34, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.translate('MEDIA SECTION','قسم الاعلام'), - style: TextStyle( - color: Color(0xFF265E84), - fontSize: 20, - fontFamily: 'Roboto', - fontWeight: FontWeight.w500, - ), - ), - 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')), - buildTextRow(EnquiryAssetIconPath.map, context.translate('P.O.Box : 127000 Dubai','ص.ب: : 127000 دبي')), - buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : GCO@fcsc.gov.ae','البريد الإلكتروني : GCO@fcsc.gov.ae')), - buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), - buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), + const SizedBox(height: 10), + buildContactCard( + context, + title: 'MEDIA SECTION', + titleAr: 'قسم الاعلام', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : Media Section', + 'textAr': 'المقر الرئيسي : قسم الاعلام' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + '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' + }, ], ), - ), - SizedBox(height: 10,), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(4.0), // Slight curve - ), - padding: EdgeInsets.all(7.0), - height: screenHeight*0.34, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.translate('SGDS','أهداف التنمية المستدامة'), - style: TextStyle( - color: Color(0xFF265E84), - fontSize: 20, - fontFamily: 'Roboto', - fontWeight: FontWeight.w500, - ), - ), - buildTextRow(EnquiryAssetIconPath.building,context.translate('Office : SDGs','المقر الرئيسي : أهداف التنمية المستدامة')), - 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 دبي')), - buildTextRow(EnquiryAssetIconPath.at, context.translate('Email Address : sdgs@fcsc.gov.ae','البريد الإلكتروني : sdgs@fcsc.gov.ae')), - buildTextRow(EnquiryAssetIconPath.map,context.translate( 'Latitude : 25.223926','خط العرض : 25.223926')), - buildTextRow(EnquiryAssetIconPath.map, context.translate('Longitude : 55.350526','خط الطول : 55.350526')), + const SizedBox(height: 10), + buildContactCard( + context, + title: 'SGDS', + titleAr: 'أهداف التنمية المستدامة', + details: [ + { + 'icon': EnquiryAssetIconPath.building, + 'text': 'Office : SDGs', + 'textAr': 'المقر الرئيسي : أهداف التنمية المستدامة' + }, + { + 'icon': EnquiryAssetIconPath.phone, + 'text': 'Tel : 00971 46080000', + 'textAr': 'الهاتف : 0097146080000' + }, + { + 'icon': EnquiryAssetIconPath.fax, + 'text': 'Fax : 0097143273535', + 'textAr': 'فاكس : 0097143273535' + }, + { + 'icon': EnquiryAssetIconPath.map, + 'text': 'P.O.Box : 127000 Dubai', + 'textAr': 'ص.ب: : 127000 دبي' + }, + { + '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> 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) { return Padding( - padding: const EdgeInsets.only(top:8.0), + padding: const EdgeInsets.symmetric(vertical: 5.0), child: Row( - mainAxisAlignment: MainAxisAlignment.start, children: [ SvgPicture.asset( - iconName, - semanticsLabel: 'Filter', - width: 24, - height: 24, + iconName, + semanticsLabel: 'Icon', + width: 20, + height: 20, ), - SizedBox(width: 8), // Add spacing if needed - Text( - text, // Dynamic text - style: TextStyle( - fontSize: 16, - color: Color(0xFF878787), + const SizedBox(width: 10), + Expanded( + child: Text( + text, + style: const TextStyle( + fontSize: 14, + color: Color(0xFF5F5F5F), + ), ), ), ], ), ); } - } diff --git a/pubspec.yaml b/pubspec.yaml index 3e0cc2ad..6283d2ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.31+32 +version: 1.0.32+33 environment: sdk: ">=3.2.3 <4.0.0"