From 07d97fa54181d8b28cd5e074a9b01085e096f935 Mon Sep 17 00:00:00 2001 From: Kalonkarthik Date: Thu, 3 Jul 2025 17:18:06 +0530 Subject: [PATCH] country list arabic and bilateral trade dynamic --- .../arm64-v8a/configure_fingerprint.bin | 24 +- .../armeabi-v7a/configure_fingerprint.bin | 24 +- .../29y7472m/x86/configure_fingerprint.bin | 24 +- .../29y7472m/x86_64/configure_fingerprint.bin | 24 +- lib/config/my_router.dart | 3 +- .../DetailedCountryProfilePage.dart | 262 +++++++--- .../Country_Profile/country_profile.dart | 446 ++++++++++++------ 7 files changed, 529 insertions(+), 278 deletions(-) diff --git a/android/app/.cxx/Debug/29y7472m/arm64-v8a/configure_fingerprint.bin b/android/app/.cxx/Debug/29y7472m/arm64-v8a/configure_fingerprint.bin index 79508265..cbcf5935 100644 --- a/android/app/.cxx/Debug/29y7472m/arm64-v8a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/29y7472m/arm64-v8a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logo m kC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2l +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ̀2  2l j -hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\android_gradle_build.json  2 2q +hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\android_gradle_build.json  ̀2 2q o -mC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\android_gradle_build_mini.json  2 2^ +mC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\android_gradle_build_mini.json  ̀2 2^ \ -ZC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build.ninja  2 2b +ZC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build.ninja  ̀2 2b ` -^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build.ninja.txt  2g +^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build.ninja.txt  ̀2g e -cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build_file_index.txt  2 K 2h +cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\build_file_index.txt  ̀2 K 2h f -dC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\compile_commands.json  2l +dC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\compile_commands.json  ̀2l j -hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\compile_commands.json.bin  2 r +hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\compile_commands.json.bin  ̀2 r p -nC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\metadata_generation_command.txt  2 +nC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\metadata_generation_command.txt  ̀2  2e c -aC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\prefab_config.json  2  ( 2j +aC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\prefab_config.json  ̀2  ( 2j h -fC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\symbol_folder_index.txt  2  ] 2O +fC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\arm64-v8a\symbol_folder_index.txt  ̀2  ] 2O M -KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  2  2 \ No newline at end of file +KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  ̀2  2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/29y7472m/armeabi-v7a/configure_fingerprint.bin b/android/app/.cxx/Debug/29y7472m/armeabi-v7a/configure_fingerprint.bin index 1e7843d8..e9ec764c 100644 --- a/android/app/.cxx/Debug/29y7472m/armeabi-v7a/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/29y7472m/armeabi-v7a/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logq o mC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  Ǡ2n +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ̀2  Ǡ2n l -jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\android_gradle_build.json  2 Ǡ2s +jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\android_gradle_build.json  ̀2 Ǡ2s q -oC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\android_gradle_build_mini.json  2 Ǡ2` +oC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\android_gradle_build_mini.json  ̀2 Ǡ2` ^ -\C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build.ninja  2 Š2d +\C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build.ninja  ̀2 Š2d b -`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build.ninja.txt  2i +`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build.ninja.txt  ̀2i g -eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build_file_index.txt  2 K Ǡ2j +eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\build_file_index.txt  ̀2 K Ǡ2j h -fC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\compile_commands.json  2n +fC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\compile_commands.json  ̀2n l -jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\compile_commands.json.bin  2 t +jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\compile_commands.json.bin  ̀2 t r -pC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\metadata_generation_command.txt  2 +pC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\metadata_generation_command.txt  ̀2  Ǡ2g e -cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\prefab_config.json  2  ( Ǡ2l +cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\prefab_config.json  ̀2  ( Ǡ2l j -hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\symbol_folder_index.txt  2  _ Ǡ2O +hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\armeabi-v7a\symbol_folder_index.txt  ̀2  _ Ǡ2O M -KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  2  2 \ No newline at end of file +KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  ̀2  2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/29y7472m/x86/configure_fingerprint.bin b/android/app/.cxx/Debug/29y7472m/x86/configure_fingerprint.bin index 8a6f28eb..236deb23 100644 --- a/android/app/.cxx/Debug/29y7472m/x86/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/29y7472m/x86/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logi g eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  2  2f +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ̀2  2f d -bC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\android_gradle_build.json  2 2k +bC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\android_gradle_build.json  ̀2 2k i -gC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\android_gradle_build_mini.json  2 2X +gC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\android_gradle_build_mini.json  ̀2 2X V -TC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build.ninja  2 2\ +TC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build.ninja  ̀2 2\ Z -XC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build.ninja.txt  2a +XC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build.ninja.txt  ̀2a _ -]C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build_file_index.txt  2 K 2b +]C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\build_file_index.txt  ̀2 K 2b ` -^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\compile_commands.json  2f +^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\compile_commands.json  ̀2f d -bC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\compile_commands.json.bin  2 l +bC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\compile_commands.json.bin  ̀2 l j -hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\metadata_generation_command.txt  2 +hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\metadata_generation_command.txt  ̀2  2_ ] -[C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\prefab_config.json  2  ( 2d +[C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\prefab_config.json  ̀2  ( 2d b -`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\symbol_folder_index.txt  2  W 2O +`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86\symbol_folder_index.txt  ̀2  W 2O M -KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  2  2 \ No newline at end of file +KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  ̀2  2 \ No newline at end of file diff --git a/android/app/.cxx/Debug/29y7472m/x86_64/configure_fingerprint.bin b/android/app/.cxx/Debug/29y7472m/x86_64/configure_fingerprint.bin index 9dedf771..d64e4174 100644 --- a/android/app/.cxx/Debug/29y7472m/x86_64/configure_fingerprint.bin +++ b/android/app/.cxx/Debug/29y7472m/x86_64/configure_fingerprint.bin @@ -2,27 +2,27 @@ C/C++ Structured Logl j hC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\additional_project_files.txtC A -?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  掵2  2i +?com.android.build.gradle.internal.cxx.io.EncodedFileFingerPrint  ̀2  2i g -eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\android_gradle_build.json  掵2 2n +eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\android_gradle_build.json  ̀2 2n l -jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\android_gradle_build_mini.json  掵2 2[ +jC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\android_gradle_build_mini.json  ̀2 2[ Y -WC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build.ninja  掵2 2_ +WC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build.ninja  ̀2 2_ ] -[C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build.ninja.txt  掵2d +[C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build.ninja.txt  ̀2d b -`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build_file_index.txt  掵2 K 2e +`C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\build_file_index.txt  ̀2 K 2e c -aC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\compile_commands.json  掵2i +aC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\compile_commands.json  ̀2i g -eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\compile_commands.json.bin  玵2 o +eC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\compile_commands.json.bin  ̀2 o m -kC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\metadata_generation_command.txt  玵2 +kC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\metadata_generation_command.txt  ̀2  2b ` -^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\prefab_config.json  玵2  ( 2g +^C:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\prefab_config.json  ̀2  ( 2g e -cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\symbol_folder_index.txt  玵2  Z 2O +cC:\Flutter Applications\Git_New\FCSC\android\app\.cxx\Debug\29y7472m\x86_64\symbol_folder_index.txt  ̀2  Z 2O M -KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  玵2  2 \ No newline at end of file +KC:\src\flutter\packages\flutter_tools\gradle\src\main\groovy\CMakeLists.txt  ̀2  2 \ No newline at end of file diff --git a/lib/config/my_router.dart b/lib/config/my_router.dart index 60f755d3..946368d6 100644 --- a/lib/config/my_router.dart +++ b/lib/config/my_router.dart @@ -656,8 +656,7 @@ final GoRouter router = GoRouter( GoRoute( path: '/countryprofile', - builder: (context, state) => const CountryProfilePage(), - + builder: (context, state) => const ListCountriesRoute(), ), GoRoute( path: '/country-profile-detail', diff --git a/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/DetailedCountryProfilePage.dart b/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/DetailedCountryProfilePage.dart index 2ac76d41..fb6e9e68 100644 --- a/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/DetailedCountryProfilePage.dart +++ b/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/DetailedCountryProfilePage.dart @@ -59,7 +59,7 @@ class DetailedCountryProfilePage extends StatelessWidget { ), const SizedBox(height: 8), Text( - countryName.toUpperCase(), + context.translate(countryName.toUpperCase(),country.nameAR), style: const TextStyle( fontSize: 22, fontWeight: FontWeight.bold, @@ -300,11 +300,60 @@ class _CategoryButton extends StatelessWidget { } } -class CategoryPopupContent extends StatelessWidget { +class CategoryPopupContent extends StatefulWidget { final String category; const CategoryPopupContent({super.key, required this.category}); + @override + State createState() => _CategoryPopupContentState(); +} + +class _CategoryPopupContentState extends State { + late String bilateralTrade=context.translate('Import','الواردات'); + late bool selected; + late List> tradeList=importLists; + + String updateTrade(String newTrade) { + setState(() { + bilateralTrade = newTrade; + if (bilateralTrade=='Import'){ + tradeList=importLists; + }else if(bilateralTrade=='Export'){ + tradeList=exportLists; + }else if (bilateralTrade=='ReExport'){ + tradeList=reExportLists; + }else { + tradeList=[]; + } + + }); + print ('my new bilsteral is $bilateralTrade'); + return bilateralTrade; + } + List> importLists=[ + {'image':PopupAssetPath.vegetable,'content-eng':'Vegetable Products','content-ar':'المنتجات النباتية','value': 198.6}, + {'image':PopupAssetPath.food,'content-eng':'Foodstuffs, Beverages, Spirits And Tobacco','content-ar':'المواد الغذائية والمشروبات والمشروبات الروحية والتبغ','value': 89.9}, + {'image':PopupAssetPath.metal,'content-eng':'Base Metals And Articles Of Base Metal','content-ar':'المعادن الأساسية ومصنوعاتها','value': 65.6}, + {'image':PopupAssetPath.animal,'content-eng':'Live Animals And Their Products','content-ar':'الحيوانات الحية ومنتجاتها','value': 23.7}, + {'image':PopupAssetPath.chemical,'content-eng':'Products Of The Chemical or Allied Industries','content-ar':'منتجات الصناعات الكيميائية أو المرتبطة بها','value': 4.7}, + ]; + + List> exportLists=[ + {'image':PopupAssetPath.vegetable,'content-eng':'Vegetable Products','content-ar':'المنتجات النباتية','value': 19.6}, + {'image':PopupAssetPath.food,'content-eng':'Foodstuffs, Beverages, Spirits And Tobacco','content-ar':'المواد الغذائية والمشروبات والمشروبات الروحية والتبغ','value': 9.9}, + {'image':PopupAssetPath.metal,'content-eng':'Base Metals And Articles Of Base Metal','content-ar':'المعادن الأساسية ومصنوعاتها','value': 12.7}, + {'image':PopupAssetPath.animal,'content-eng':'Live Animals And Their Products','content-ar':'الحيوانات الحية ومنتجاتها','value': 0.0}, + {'image':PopupAssetPath.chemical,'content-eng':'Products Of The Chemical or Allied Industries','content-ar':'منتجات الصناعات الكيميائية أو المرتبطة بها','value': 0.0}, + ]; + List> reExportLists=[ + {'image':PopupAssetPath.vegetable,'content-eng':'Vegetable Products','content-ar':'المنتجات النباتية','value': 0.0}, + {'image':PopupAssetPath.food,'content-eng':'Foodstuffs, Beverages, Spirits And Tobacco','content-ar':'المواد الغذائية والمشروبات والمشروبات الروحية والتبغ','value': 0.0}, + {'image':PopupAssetPath.metal,'content-eng':'Base Metals And Articles Of Base Metal','content-ar':'المعادن الأساسية ومصنوعاتها','value': 0.0}, + {'image':PopupAssetPath.animal,'content-eng':'Live Animals And Their Products','content-ar':'الحيوانات الحية ومنتجاتها','value': 23.7}, + {'image':PopupAssetPath.chemical,'content-eng':'Products Of The Chemical or Allied Industries','content-ar':'منتجات الصناعات الكيميائية أو المرتبطة بها','value': 16.3}, + ]; + @override Widget build(BuildContext context) { final lineBorder=Padding( @@ -325,7 +374,7 @@ class CategoryPopupContent extends StatelessWidget { color: Color(0xFFE9BF70), ); final screenWidth=MediaQuery.of(context).size.width; - switch (category) { + switch (widget.category) { case 'Demography': return Column( mainAxisSize: MainAxisSize.min, @@ -546,19 +595,22 @@ class CategoryPopupContent extends StatelessWidget { label: context.translate('Total Import','إجمالي الواردات'), value: '\$390.2M', color: Color(0xFF5BB3AA), - isSelected: true, + isSelected: updateTrade, + defaultTrade:bilateralTrade ), _BilateralTradeValueBox( - label: context.translate('Total Export','إجمالي الصادرات'), - value: '\$42.2M', - color: Color(0xFFB57184), - isSelected: false, + label: context.translate('Total Export','إجمالي الصادرات'), + value: '\$42.2M', + color: Color(0xFFB57184), + isSelected: updateTrade, + defaultTrade: bilateralTrade, ), _BilateralTradeValueBox( - label: context.translate('Total ReExport','إجمالي إعادة التصدير'), - value: '\$40.2M', - color: Color(0xFF243E83), - isSelected: false, + label: context.translate('Total ReExport','إجمالي إعادة التصدير'), + value: '\$40.2M', + color: Color(0xFF243E83), + isSelected: updateTrade, + defaultTrade: bilateralTrade, ), ], ), @@ -567,44 +619,74 @@ class CategoryPopupContent extends StatelessWidget { const SizedBox(height: 24), Center( child: Text( - context.translate('Top 5 Import Commodities','أهم 5 سلع مستوردة'), + context.translate('Top 5 $bilateralTrade Commodities','أهم 5 سلع $bilateralTrade'), style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Color(0xFF4FBFA8),), + fontSize: 20, + fontWeight: FontWeight.bold, + color: Color(0xFF4FBFA8),), ), ), const SizedBox(height: 12), yellowDivider, - _CommodityRow( - icon: PopupAssetPath.vegetable, - label: context.translate('Vegetable Products','المنتجات النباتية'), - value: '\$198.6M',), - yellowDivider, - _CommodityRow( - icon: PopupAssetPath.food, - label: context.translate('Foodstuffs, Beverages, Spirits And Tobacco','المواد الغذائية والمشروبات والمشروبات الروحية والتبغ'), - value: '\$89.9M',), - yellowDivider, - _CommodityRow( - icon: PopupAssetPath.metal, - label: context.translate('Base Metals And Articles Of Base Metal','المعادن الأساسية ومصنوعاتها'), - value: '\$65.6M',), - yellowDivider, - _CommodityRow( - icon: PopupAssetPath.animal, - label: context.translate('Live Animals And Their Products','الحيوانات الحية ومنتجاتها'), - value: '\$23.7M',), - yellowDivider, - _CommodityRow( - icon: PopupAssetPath.chemical, - label: context.translate('Products Of The Chemical or Allied Industries','منتجات الصناعات الكيميائية أو المرتبطة بها'), - value: '\$4.7M',), + Expanded( + child: ListView.separated( + itemCount: tradeList.length, + itemBuilder: (context, index) { + final item = tradeList[index]; + return ListTile( + contentPadding: EdgeInsets.symmetric(horizontal: 10,vertical: 1), + leading: Image.asset( + item['image'], + width: 30, + height: 30, + ), + title: Text( + context.translate(item['content-eng'], item['content-ar']), + style: const TextStyle(fontSize: 15,fontWeight: FontWeight.w500) + ), + trailing: Text( + '\$${item['value']}', + style: const TextStyle(fontSize: 15, + fontWeight: FontWeight.w500, + color: Color(0xFF54AFA6),), + ), + ); + }, + separatorBuilder: (context, index) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + child: yellowDivider, // or use Dash widget if using flutter_dash package + ), + ), + ), + // _CommodityRow( + // icon: PopupAssetPath.vegetable, + // label: context.translate('Vegetable Products','المنتجات النباتية'), + // value: '\$198.6M',), + // yellowDivider, + // _CommodityRow( + // icon: PopupAssetPath.food, + // label: context.translate('Foodstuffs, Beverages, Spirits And Tobacco','المواد الغذائية والمشروبات والمشروبات الروحية والتبغ'), + // value: '\$89.9M',), + // yellowDivider, + // _CommodityRow( + // icon: PopupAssetPath.metal, + // label: context.translate('Base Metals And Articles Of Base Metal','المعادن الأساسية ومصنوعاتها'), + // value: '\$65.6M',), + // yellowDivider, + // _CommodityRow( + // icon: PopupAssetPath.animal, + // label: context.translate('Live Animals And Their Products','الحيوانات الحية ومنتجاتها'), + // value: '\$23.7M',), + // yellowDivider, + // _CommodityRow( + // icon: PopupAssetPath.chemical, + // label: context.translate('Products Of The Chemical or Allied Industries','منتجات الصناعات الكيميائية أو المرتبطة بها'), + // value: '\$4.7M',), const SizedBox(height: 16), ], ); default: - return Center(child: Text('$category details coming soon.')); + return Center(child: Text('${widget.category} details coming soon.')); } } } @@ -862,57 +944,81 @@ Widget _TradeItem({ ); } -class _BilateralTradeValueBox extends StatelessWidget { +class _BilateralTradeValueBox extends StatefulWidget { final String label; final String value; final Color color; - final bool isSelected; + final String Function(String) isSelected; + final String? defaultTrade; const _BilateralTradeValueBox({ required this.label, required this.value, required this.color, required this.isSelected, + this.defaultTrade, }); @override + State<_BilateralTradeValueBox> createState() => _BilateralTradeValueBoxState(); +} + +class _BilateralTradeValueBoxState extends State<_BilateralTradeValueBox> { + late String title; + + @override + void initState() { + super.initState(); + title = widget.label.split(' ').last; + } + + @override + Widget build(BuildContext context) { - return Container( - height: 90, - padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 8), - decoration: BoxDecoration( - color: isSelected?Colors.white:Colors.transparent, - borderRadius: BorderRadius.circular(10), - border: isSelected?Border.all(color:Color(0xFFAA8E83)):null, - boxShadow:isSelected ?[ - BoxShadow( - color: Color(0xFFAA8E83).withValues(alpha: 0.5), - blurRadius: 15, - spreadRadius: 0, - offset: Offset( - 0, - 5, - ), - ), - ]:null, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - label, - style: TextStyle(fontSize: 13), - ), - const SizedBox(height: 4), - Text( - value, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 22, - color: color, + final bool selected=title==widget.defaultTrade; + return GestureDetector( + onTap: (){ + setState(() { + widget.isSelected(title); + }); + }, + child: Container( + height: 90, + padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 8), + decoration: BoxDecoration( + color: selected?Colors.white:Colors.transparent, + borderRadius: BorderRadius.circular(10), + border: selected?Border.all(color:Color(0xFFAA8E83)):null, + boxShadow:selected ?[ + BoxShadow( + color: Color(0xFFAA8E83).withValues(alpha: 0.5), + blurRadius: 15, + spreadRadius: 0, + offset: Offset( + 0, + 5, + ), ), - ), - ], + ]:null, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + widget.label, + style: TextStyle(fontSize: 13), + ), + const SizedBox(height: 4), + Text( + widget.value, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 22, + color: widget.color, + ), + ), + ], + ), ), ); } diff --git a/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/country_profile.dart b/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/country_profile.dart index 8b207e00..6a9a631b 100644 --- a/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/country_profile.dart +++ b/lib/presentation/Screens/Bottom Navigation Pages/Country_Profile/country_profile.dart @@ -1,175 +1,321 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:go_router/go_router.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:uae_stat/domain/use_cases/language.dart'; import 'package:uae_stat/infrastructure/services/img_asset_paths/icons/misc_icon_asset_path.dart'; import 'package:uae_stat/presentation/routes/drawer_routes/custom_drawer_routes.dart'; import 'package:fl_chart/fl_chart.dart'; +import 'package:external_repos/external_repos.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; -final localeProvider = StateProvider((ref) => const Locale('en')); +// final localeProvider = StateProvider((ref) => const Locale('en')); -class CountryProfilePage extends ConsumerStatefulWidget { - const CountryProfilePage({Key? key}) : super(key: key); +// class CountryProfilePage extends ConsumerStatefulWidget { +// const CountryProfilePage({Key? key}) : super(key: key); +// +// @override +// ConsumerState createState() => _CountryProfilePageState(); +// } +// +// class _CountryProfilePageState extends ConsumerState { +// final TextEditingController _searchController = TextEditingController(); +// +// final List> _allCountries = [ +// {"name": "Afghanistan", "flag": "🇦🇫",'code':'AF'}, +// {"name": "Albania", "flag": "🇦🇱",'code':'AL'}, +// {"name": "Algeria", "flag": "🇩🇿",'code':'DZ'}, +// {"name": "American Samoa", "flag": "🇦🇸",'code':'AS'}, +// {"name": "Andorra", "flag": "🇦🇩",'code':'AD'}, +// {"name": "Angola", "flag": "🇦🇴",'code':'AO'}, +// {"name": "Anguilla", "flag": "🇦🇮",'code':'AI'}, +// {"name": "Antigua And Barbuda", "flag": "🇦🇬",'code':'AG'}, +// {"name": "Argentina", "flag": "🇦🇷",'code':'AR'}, +// {"name": "Armenia", "flag": "🇦🇲",'code':'AM'}, +// {"name": "Aruba", "flag": "🇦🇼",'code':'AW'}, +// {"name": "Australia", "flag": "🇦🇺",'code':'AU'}, +// {"name": "Austria", "flag": "🇦🇹",'code':'AT'}, +// {"name": "Azerbaijan", "flag": "🇦🇿",'code':'AZ'}, +// {"name": "Bahamas", "flag": "🇧🇸",'code':'BS'}, +// {"name": "Bahrain", "flag": "🇧🇭",'code':'BH'}, +// {"name": "Bangladesh", "flag": "🇧🇩",'code':'BD'}, +// ]; +// +// String _searchTerm = ''; +// +// void filterData(String value) { +// setState(() => _searchTerm = value); +// } +// +// @override +// Widget build(BuildContext context) { +// final locale = AppLocalizations.of(context)!; +// final filtered = _allCountries +// .where((c) => c['name']!.toLowerCase().contains(_searchTerm.toLowerCase())) +// .toList(); +// +// double myheight = MediaQuery.of(context).size.height; +// double mywidth = MediaQuery.of(context).size.width; +// +// return PopScope( +// canPop: false, +// onPopInvokedWithResult: (didPop, result) { +// if (didPop) return; +// context.go('/myhomepage'); +// }, +// child: BaseScaffold( +// title: Text( +// context.translate( +// 'Country Profile', +// 'ملف الدولة', +// ), +// style: TextStyle( +// fontFamily: context.translate( +// 'Roboto', +// 'NotoKufi', +// ) +// ), +// ), +// body: Column( +// children: [ +// Padding( +// padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0), +// child: Container( +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: BorderRadius.circular(30.0), +// border: Border.all(width: 1, color: Color(0xFFAA8E83)), +// ), +// child: TextField( +// controller: _searchController, +// onChanged: (value) { +// filterData(value); +// }, +// decoration: InputDecoration( +// hintText: AppLocalizations.of(context)!.searchCountry, +// hintStyle: TextStyle( +// color: Color(0xFFAA8E83), +// fontFamily: context.translate('Roboto', 'NotoKufi'), +// fontSize: 14, +// height: 1.8, +// ), +// prefixIconConstraints: BoxConstraints( +// maxWidth: 42, +// maxHeight: 42, +// ), +// prefixIcon: Container( +// padding: EdgeInsets.only(right: 5, left: 5), +// alignment: Alignment.center, +// child: SvgPicture.asset( +// MiscIconAssetPath.Search, +// semanticsLabel: 'Search', +// colorFilter: ColorFilter.mode(Color(0xFFAA8E83), BlendMode.srcIn), +// height: 18, +// width: 18, +// ), +// ), +// suffixIcon: _searchController.text.isNotEmpty +// ? IconButton( +// icon: Icon( +// Icons.clear, +// color: Color(0xFFAA8E83), +// size: 18, +// ), +// onPressed: () { +// _searchController.clear(); +// filterData(''); +// }, +// ) +// : null, +// border: InputBorder.none, +// contentPadding: EdgeInsets.symmetric(vertical: 9, horizontal: 18.0), +// ), +// ), +// ), +// ), +// +// // Updated section for "No country found" +// Expanded( +// child: filtered.isEmpty +// ? Center( +// child: Text( +// 'No country found', +// style: TextStyle( +// fontSize: 16, +// color: Colors.grey, +// fontWeight: FontWeight.w500, +// ), +// ), +// ) +// : ListView.builder( +// itemCount: filtered.length, +// itemBuilder: (context, index) { +// final country = filtered[index]; +// return ListTile( +// leading: Text( +// country['flag']!, +// style: const TextStyle(fontSize: 24), +// ), +// title: Text(country['name']!), +// onTap: () { +// context.push('/country-profile-detail', extra: { +// 'countryName': country['name'] as String, +// 'flag': country['code'] as String, +// }); +// }, +// ); +// }, +// ), +// ), +// ], +// ), +// ), +// ); +// } +// } + +class ListCountriesRoute extends HookConsumerWidget { + const ListCountriesRoute({super.key}); @override - ConsumerState createState() => _CountryProfilePageState(); -} + Widget build(BuildContext context, WidgetRef ref) { + final screenWidth = MediaQuery.of(context).size.width; + final _searchController = useTextEditingController(); + final searchTerm = useState(''); -class _CountryProfilePageState extends ConsumerState { - final TextEditingController _searchController = TextEditingController(); + final filteredCountries = ISOCountry.values.where((country) { + final query = searchTerm.value.trim().toLowerCase(); + if (query.isEmpty) return true; // 🔥 show all if search is empty + return country.nameEN.toLowerCase().contains(query) || + country.nameAR.toLowerCase().contains(query); + }).toList(); - final List> _allCountries = [ - {"name": "Afghanistan", "flag": "🇦🇫",'code':'AF'}, - {"name": "Albania", "flag": "🇦🇱",'code':'AL'}, - {"name": "Algeria", "flag": "🇩🇿",'code':'DZ'}, - {"name": "American Samoa", "flag": "🇦🇸",'code':'AS'}, - {"name": "Andorra", "flag": "🇦🇩",'code':'AD'}, - {"name": "Angola", "flag": "🇦🇴",'code':'AO'}, - {"name": "Anguilla", "flag": "🇦🇮",'code':'AI'}, - {"name": "Antigua And Barbuda", "flag": "🇦🇬",'code':'AG'}, - {"name": "Argentina", "flag": "🇦🇷",'code':'AR'}, - {"name": "Armenia", "flag": "🇦🇲",'code':'AM'}, - {"name": "Aruba", "flag": "🇦🇼",'code':'AW'}, - {"name": "Australia", "flag": "🇦🇺",'code':'AU'}, - {"name": "Austria", "flag": "🇦🇹",'code':'AT'}, - {"name": "Azerbaijan", "flag": "🇦🇿",'code':'AZ'}, - {"name": "Bahamas", "flag": "🇧🇸",'code':'BS'}, - {"name": "Bahrain", "flag": "🇧🇭",'code':'BH'}, - {"name": "Bangladesh", "flag": "🇧🇩",'code':'BD'}, - ]; - - String _searchTerm = ''; - - void filterData(String value) { - setState(() => _searchTerm = value); - } - - @override - Widget build(BuildContext context) { - final locale = AppLocalizations.of(context)!; - final filtered = _allCountries - .where((c) => c['name']!.toLowerCase().contains(_searchTerm.toLowerCase())) - .toList(); - - double myheight = MediaQuery.of(context).size.height; - double mywidth = MediaQuery.of(context).size.width; - - return PopScope( - canPop: false, - onPopInvokedWithResult: (didPop, result) { - if (didPop) return; - context.go('/myhomepage'); - }, - child: BaseScaffold( - title: Text( - context.translate( - 'Country Profile', - 'ملف الدولة', - ), - style: TextStyle( - fontFamily: context.translate( - 'Roboto', - 'NotoKufi', - ) - ), - ), - body: Column( - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0), - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(30.0), - border: Border.all(width: 1, color: Color(0xFFAA8E83)), - ), - child: TextField( - controller: _searchController, - onChanged: (value) { - filterData(value); - }, - decoration: InputDecoration( - hintText: AppLocalizations.of(context)!.searchCountry, - hintStyle: TextStyle( - color: Color(0xFFAA8E83), - fontFamily: context.translate('Roboto', 'NotoKufi'), - fontSize: 14, - height: 1.8, - ), - prefixIconConstraints: BoxConstraints( - maxWidth: 42, - maxHeight: 42, - ), - prefixIcon: Container( - padding: EdgeInsets.only(right: 5, left: 5), - alignment: Alignment.center, - child: SvgPicture.asset( - MiscIconAssetPath.Search, - semanticsLabel: 'Search', - colorFilter: ColorFilter.mode(Color(0xFFAA8E83), BlendMode.srcIn), - height: 18, - width: 18, - ), - ), - suffixIcon: _searchController.text.isNotEmpty - ? IconButton( - icon: Icon( - Icons.clear, - color: Color(0xFFAA8E83), - size: 18, - ), - onPressed: () { - _searchController.clear(); - filterData(''); - }, - ) - : null, - border: InputBorder.none, - contentPadding: EdgeInsets.symmetric(vertical: 9, horizontal: 18.0), - ), - ), + final body = BaseScaffold( + body: Column( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0), + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(30.0), + border: Border.all(width: 1, color: Color(0xFFAA8E83)), ), - ), - - // Updated section for "No country found" - Expanded( - child: filtered.isEmpty - ? Center( - child: Text( - 'No country found', - style: TextStyle( - fontSize: 16, - color: Colors.grey, - fontWeight: FontWeight.w500, + child: SearchBar( + constraints: BoxConstraints( + maxWidth: MediaQuery.of(context).size.width*0.9, + maxHeight: 50, + ), + elevation: WidgetStatePropertyAll(0), + backgroundColor: WidgetStatePropertyAll(Colors.white), + controller: _searchController, + hintText: AppLocalizations.of(context)!.searchCountry, + hintStyle: WidgetStateProperty.all( + TextStyle( + color: Color(0xFFAA8E83), + fontFamily: context.translate('Roboto', 'NotoKufi'), + fontSize: 14, + height: 1.8, ), ), - ) - : ListView.builder( - itemCount: filtered.length, - itemBuilder: (context, index) { - final country = filtered[index]; - return ListTile( - leading: Text( - country['flag']!, - style: const TextStyle(fontSize: 24), - ), - title: Text(country['name']!), - onTap: () { - context.push('/country-profile-detail', extra: { - 'countryName': country['name'] as String, - 'flag': country['code'] as String, - }); - }, - ); + leading: Container( + padding: EdgeInsets.only(right: 5, left: 5), + alignment: Alignment.center, + constraints: BoxConstraints( + maxWidth: 42, + maxHeight: 42, + ), + child: SvgPicture.asset( + MiscIconAssetPath.Search, + semanticsLabel: 'Search', + colorFilter: ColorFilter.mode(Color(0xFFAA8E83), BlendMode.srcIn), + height: 18, + width: 18, + ), + ), + onChanged: (value){ + searchTerm.value=value; }, ), ), - ], + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: _searchController, + builder: (context, value, child){ + if (filteredCountries.isEmpty) { + return Center( + child: Text( + context.translate( + 'No countries match your search term.', + 'لا توجد بلدان تتطابق مع مصطلح البحث الخاص بك.', + ), + ), + ); + } + return ListView.builder( + itemCount: filteredCountries.length, + itemBuilder: (context, index)=> _CountryListTile( + key: ValueKey(filteredCountries[index].alpha2), + countryCode: filteredCountries[index].alpha2,), ); + },), + ) + ], + ), title: Text('Country Profile'), + ); + return body; + } +} + +class _CountryListTile extends ConsumerWidget { + const _CountryListTile({ + required super.key, + required this.countryCode, + }); + + final String countryCode; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final country = ISOCountry.fromAlpha2(countryCode); + final flag = Image.asset( + country.flagImgPath, + fit: BoxFit.contain, + height: 18, + width: 18 * (3 / 2), + cacheHeight: 32, + cacheWidth: 48, + ); + return ListTile( + leading: flag, + contentPadding: const EdgeInsets.symmetric( + horizontal: 24, + vertical: 0, ), - ), + dense: true, + minTileHeight: 40, + title: Text( + context.translate( + country.nameEN, + country.nameAR, + ), + style: TextStyle( + fontFamily: context.translate( + 'Roboto', + 'NotoKufi', + ), + fontSize: 14, + fontWeight: FontWeight.w400, + ), + ), + onTap: () => context.push('/country-profile-detail', extra: { + 'countryName': country.nameEN, + 'flag': country.alpha2, + }) ); } } +