diff --git a/android/app/build.gradle b/android/app/build.gradle index 7f89f75b..d346046c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,12 +15,12 @@ if (localPropertiesFile.exists()) { def flutterVersionCode = localProperties.getProperty("flutter.versionCode") if (flutterVersionCode == null) { - flutterVersionCode = "13" + flutterVersionCode = "14" } def flutterVersionName = localProperties.getProperty("flutter.versionName") if (flutterVersionName == null) { - flutterVersionName = "1.0.12" + flutterVersionName = "1.0.13" } def keystorePropertiesFile = rootProject.file("key.properties") diff --git a/assets/icons/misc/filters.png b/assets/icons/misc/filters.png new file mode 100644 index 00000000..0cc6700c Binary files /dev/null and b/assets/icons/misc/filters.png differ diff --git a/lib/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart b/lib/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart index efda0231..db2e65cd 100644 --- a/lib/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart +++ b/lib/infrastructure/services/img_asset_paths/icons/uae_numbers_asset_path.dart @@ -5,4 +5,5 @@ abstract class UaeNumbersAssetPath { static const bookmarksUae = '$_basePath/bookmarks.png'; static const bookmarksSelectedUae = '$_basePath/bookmarksSelectedUae.png'; static const shareUae = '$_basePath/share.png'; + static const filterUae = '$_basePath/filters.png'; } diff --git a/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart b/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart index ea0e1602..5dd763ad 100644 --- a/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart +++ b/lib/presentation/Screens/Bottom Navigation Pages/UAE_Numbers/uae_numbers.dart @@ -117,11 +117,19 @@ class _UaenumberWidgetState extends ConsumerState { decoration: InputDecoration( hintText: "Search", hintStyle: TextStyle(color: Color(0xFF898C81)), - prefixIcon: Image.asset( - MiscIconAssetPath.search, - // width: 15, - // height: 10, + + + prefixIcon: Image( + image: ExactAssetImage(MiscIconAssetPath.search), + width: 24, + height: 24, ), + + + // prefixIcon: Image.asset( + // MiscIconAssetPath.search, + // // fit: BoxFit.contain, + // ), border: InputBorder.none, contentPadding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0), diff --git a/lib/presentation/Screens/charts/screens/chart_screen.dart b/lib/presentation/Screens/charts/screens/chart_screen.dart index 2834dc6c..afd5b95e 100644 --- a/lib/presentation/Screens/charts/screens/chart_screen.dart +++ b/lib/presentation/Screens/charts/screens/chart_screen.dart @@ -44,6 +44,7 @@ class _ChartScreen1State extends ConsumerState { bool isLoading = true; List isChartData = []; List nonChartData = []; + Map chartScreenData = {}; List filterDataSet = []; List filterData = []; List chartsData = []; @@ -1249,11 +1250,13 @@ class _ChartScreen1State extends ConsumerState { chartsData = isChartData; cardData = nonChartData; + chartScreenData = data['chartScreenData'] ?? {}; processChartData(chartsData); print('chartsData :- $chartsData'); print('cardData :- $cardData'); + print('chartScreenData :- $chartScreenData'); // print('filterData :- $filterData'); isLoading = false; }); @@ -1401,28 +1404,46 @@ class _ChartScreen1State extends ConsumerState { children: [ // Header Section Padding( - padding: const EdgeInsets.all(16.0), + padding: const EdgeInsets.only(top:16.0, bottom: 0.0, left: 16.0, right: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - context.translate( - 'Filters', - 'المرشحات', - ), - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - IconButton( - icon: Icon(Icons.close), - onPressed: () => Navigator.pop(context), + Row( + children: [ + + Image.asset( + UaeNumbersAssetPath.filterUae, + color:Color(0xFF8E8E8E), // Outline color + width: 24, // Slightly larger + height: 24, + ), + SizedBox(width: 8), + Text( + context.translate( + 'Filters', + 'المرشحات', + ), + style: TextStyle( + color: Color(0xFF8E8E8E), + fontSize: 20, + fontWeight: FontWeight.w500, + fontFamily: 'Roboto', + + ), + ), + ], ), + // IconButton( + // icon: Icon(Icons.close), + // onPressed: () => Navigator.pop(context), + // ), ], ), ), // Filters Section + Divider( + color: Color(0xFFA7B5C5), + ), Expanded( child: ListView.builder( itemCount: filters.length, @@ -1455,7 +1476,9 @@ class _ChartScreen1State extends ConsumerState { // capitalizeAndSplit(filterKey), style: TextStyle( fontSize: 16, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w700, + fontFamily: 'Roboto', + color: Color(0xFF8E8E8E), ), ), InkWell( @@ -1527,7 +1550,7 @@ class _ChartScreen1State extends ConsumerState { padding: EdgeInsets.symmetric( horizontal: 16.0, vertical: 12.0), decoration: BoxDecoration( - border: Border.all(color: Colors.grey), + border: Border.all(color: Color(0xFF7296BE)), borderRadius: BorderRadius.circular(8.0), ), child: Wrap( @@ -1546,6 +1569,7 @@ class _ChartScreen1State extends ConsumerState { .map((value) { return Chip( label: Text(value), + // backgroundColor: Colors.white, // Default background color onDeleted: () { setState(() { selectedFilter[ @@ -1684,16 +1708,16 @@ class _ChartScreen1State extends ConsumerState { child: Padding( padding: const EdgeInsets.symmetric( horizontal: 0.0, - vertical: 16.0), // Added padding + vertical: 14.2), // Added padding child: FittedBox( fit: BoxFit .scaleDown, // Ensures text resizes if necessary child: Text( context.translate( - 'Apply Filter', 'تطبيق الفلتر'), + 'Filter', 'فلتر'), style: TextStyle( color: Colors.white, - fontSize: 12, + fontSize: 13, fontWeight: FontWeight.bold, ), overflow: @@ -1799,14 +1823,39 @@ class _ChartScreen1State extends ConsumerState { // Determine a default aspect ratio based on the most common chart type in the list if (cardData.any((item) => item['chart_type'] == 'total' || item['chart_type'] == 'average')) { + // return crossAxisCount == 1 ? 0.2 : (crossAxisCount > 2 ? 0.9 : 0.7); return crossAxisCount == 2 ? 1.0 : 0.7; // Larger Content // return crossAxisCount == 2 ? 1.5 : 0.9; + } else { return crossAxisCount == 2 ? 1.5 : 0.9; // Shorter Content } } + + // double calculateAspectRatio(int crossAxisCount, List cardData) { + // if (cardData.any((item) => + // item['chart_type'] == 'total' || item['chart_type'] == 'average')) { + // if (crossAxisCount == 1) { + // return 0.9 ; // Aspect ratio when crossAxisCount is less than 2 + // } else if (crossAxisCount == 2) { + // return 1.0; // Aspect ratio when crossAxisCount is exactly 2 + // } else if (crossAxisCount > 2) { + // return 1.0; // Aspect ratio when crossAxisCount is greater than 2 + // } + // } else { + // if (crossAxisCount < 2) { + // return 0.8; // Aspect ratio when crossAxisCount is less than 2 + // } else if (crossAxisCount == 2) { + // return 1.5; // Aspect ratio when crossAxisCount is exactly 2 + // } else if (crossAxisCount > 2) { + // return 0.9; // Aspect ratio when crossAxisCount is greater than 2 + // } + // } + // return 1.0; // Default fallback (should never be reached) + // } + @override Widget build(BuildContext context) { final locale = ref.watch(localeProvider); @@ -1826,7 +1875,14 @@ class _ChartScreen1State extends ConsumerState { double mywidth = MediaQuery.of(context).size.width; final color = Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); - return BaseScaffold( + return PopScope( + canPop: false, // Allow back navigation only if not login screen + onPopInvokedWithResult: (didPop, result) { + if (didPop) return; + context.go('/uaenumbers'); // Show exit confirmation dialog + }, + + child: BaseScaffold( key: _scaffoldKey, // backgroundColor: color, // appBar: AppBar( @@ -1871,7 +1927,11 @@ class _ChartScreen1State extends ConsumerState { 'UAE Numbers', 'أرقام الإمارات', ),), - appbarColor: Color(int.parse(widget.bgColor)), // Example color + // appbarColor: Color(int.parse(widget.bgColor)), // Example color + appbarColor: Color( + int.parse((chartScreenData['header_color'] ?? '#ffffff').replaceFirst('#', '0xff')) + ), + // Example color showBackButton: true, colorChange:true, navBackArrow: Text(widget.keyParam ?? 'Default Value'), @@ -1884,7 +1944,8 @@ class _ChartScreen1State extends ConsumerState { Container( // height: myheight / 5, width: double.infinity, - color: color, + // color: color, + color: Color(int.parse(chartScreenData['header_color'].replaceFirst('#', '0xff'))), child: Padding( padding: EdgeInsets.only( left: 30, right: 30, top: 8, bottom: 5), @@ -1892,7 +1953,8 @@ class _ChartScreen1State extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - widget.mainTopic ?? '', + // widget.mainTopic ?? '', + chartScreenData['main_topic'] ?? '', style: TextStyle( color: Colors.white, fontSize: 26, @@ -1908,8 +1970,9 @@ class _ChartScreen1State extends ConsumerState { color: Colors.white, )), Text( - widget.title, - style: TextStyle(color: Colors.white, fontSize: 20, + // widget.title, + chartScreenData['data_set_tile_heading'] ?? '', + style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w400, fontFamily: 'Roboto'), ), @@ -1935,8 +1998,8 @@ class _ChartScreen1State extends ConsumerState { ], ), )), - SizedBox( - // color: Colors.redAccent, + Container( + color: Color(int.parse(chartScreenData['header_color'].replaceFirst('#', '0xff'))), child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -2056,126 +2119,331 @@ class _ChartScreen1State extends ConsumerState { ), ), Expanded( - child: Padding( - padding: const EdgeInsets.all(10.0), - child: ListView( - children: [ - - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // Left arrow button - if (_tabsData.length > 1) - _buildArrowButton( - onPressed: - _activeTabIndex > 0 ? _scrollLeft : null, - icon: Icons.arrow_back_ios_new, - ), - // Tabs with horizontal scroll - if (_tabsData.length > 1) - Expanded( - child: SingleChildScrollView( - controller: _scrollController, - scrollDirection: Axis.horizontal, - child: Row( - children: - List.generate(_tabsData.length, (index) { - return _buildTab( - _tabsData[index], - isActive: index == _activeTabIndex, - ); - }), + child: Container( + color: Color(int.parse(chartScreenData['body_color'].replaceFirst('#', '0xff'))), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: ListView( + children: [ + + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Left arrow button + if (_tabsData.length > 1) + _buildArrowButton( + onPressed: + _activeTabIndex > 0 ? _scrollLeft : null, + icon: Icons.arrow_back_ios_new, + ), + // Tabs with horizontal scroll + if (_tabsData.length > 1) + Expanded( + child: SingleChildScrollView( + controller: _scrollController, + scrollDirection: Axis.horizontal, + child: Row( + children: + List.generate(_tabsData.length, (index) { + return _buildTab( + _tabsData[index], + isActive: index == _activeTabIndex, + ); + }), + ), ), ), + // Right arrow button + if (_tabsData.length > 1) + _buildArrowButton( + onPressed: _activeTabIndex < _tabsData.length - 1 + ? _scrollRight + : null, + icon: Icons.arrow_forward_ios, + ), + ], + ), + // Expanded( + // child: Center( + // child: Text( + // 'Selected Tab: ${_tabsData.isNotEmpty ? _tabsData[_activeTabIndex] : 'None'}', + // style: const TextStyle(fontSize: 18), + // ), + // ), + // ), + // nonChartData Cards + Padding( + padding: const EdgeInsets.all(3.34), + child: GridView.builder( + key: cardKey, + itemCount: cardData.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: cardData.length == 2 + ? 2 + : cardData.length == 3 + ? 3 + : cardData.length == 4 + ? 2 + : 3, // Default to 3 if more than 4 items // 2 cards per row + crossAxisSpacing: 2, + mainAxisSpacing: 5, + childAspectRatio: + calculateAspectRatio(cardData.length, cardData), ), - // Right arrow button - if (_tabsData.length > 1) - _buildArrowButton( - onPressed: _activeTabIndex < _tabsData.length - 1 - ? _scrollRight - : null, - icon: Icons.arrow_forward_ios, - ), - ], - ), - // Expanded( - // child: Center( - // child: Text( - // 'Selected Tab: ${_tabsData.isNotEmpty ? _tabsData[_activeTabIndex] : 'None'}', - // style: const TextStyle(fontSize: 18), - // ), - // ), - // ), - // nonChartData Cards - Padding( - padding: const EdgeInsets.all(3.34), - child: GridView.builder( - key: cardKey, - itemCount: cardData.length, - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: cardData.length == 2 - ? 2 - : cardData.length == 3 - ? 3 - : cardData.length == 4 - ? 2 - : 3, // Default to 3 if more than 4 items // 2 cards per row - crossAxisSpacing: 2, - mainAxisSpacing: 5, - childAspectRatio: - calculateAspectRatio(cardData.length, cardData), - ), - itemBuilder: (context, index) { - final item = cardData[index]; - print('item item item $item'); - final chart_type = item['chart_type']; - final chart_heading = item['chart_heading']; - final card_logo = item['card_logo']; - final data = apiService.processNonChartData(item); - print('processNonChartData'); + itemBuilder: (context, index) { + final item = cardData[index]; + print('item item item $item'); + final chart_type = item['chart_type']; + final chart_heading = item['chart_heading']; + final card_logo = item['card_logo']; + final data = apiService.processNonChartData(item); + print('processNonChartData'); - double cardHeight = (chart_type == 'totals' || - chart_type == 'averages') - ? 180.0 - : 130.0; + double cardHeight = (chart_type == 'totals' || + chart_type == 'averages') + ? 180.0 + : 130.0; - if (chart_type == 'total') { - return Card( - margin: const EdgeInsets.all(10), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Container( - height: cardHeight, - padding: const EdgeInsets.all(10.0), - child: Column( - mainAxisSize: MainAxisSize - .min, // Adjust card height based on content - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // const Icon(Icons.public, - // color: Color(0xFF90B0D5), size: 30), - Image.network( - card_logo ?? '', - width: 30, - height: 30, - errorBuilder: - (context, error, stackTrace) { - return Icon(Icons.public, - color: Color(0xFF90B0D5), - size: 30); // Fallback icon - }, + if (chart_type == 'total') { + return + Container( + margin: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: Color(int.parse(chartScreenData['border_color'].replaceFirst('#', '0xff'))), // Dynamic border color + width: 1, // Adjust border thickness + ), ), - const SizedBox(height: 3), - Flexible( - fit: FlexFit.loose, - child: FittedBox( + child: Card( + margin: const EdgeInsets.all(0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 0, // Remove shadow to keep only the outli + + child: Container( + height: cardHeight, + padding: const EdgeInsets.all(10.0), + child: Column( + mainAxisSize: MainAxisSize + .min, // Adjust card height based on content + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // const Icon(Icons.public, + // color: Color(0xFF90B0D5), size: 30), + Image.network( + card_logo ?? '', + width: 30, + height: 30, + errorBuilder: + (context, error, stackTrace) { + return Icon(Icons.public, + color: Color(0xFF90B0D5), + size: 30); // Fallback icon + }, + ), + const SizedBox(height: 3), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + child: SizedBox( + // height: 70.0, + child: Text( + '${chart_heading ?? 'NA'}', + textAlign: TextAlign.center, + maxLines: 2, // Limit to 2 lines + softWrap: + true, // Enable soft wrapping + // overflow: TextOverflow.ellipsis, // Handle overflow gracefully + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w400, + color: Colors.black87, + ), + ), + ), + ), + ), + const SizedBox(height: 1), + Text( + '(${data['lastYear'] ?? 'NA'})', + style: const TextStyle( + fontSize: 10, color: Colors.grey), + ), + const SizedBox(height: 1), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + fit: BoxFit.contain, + child: Text( + apiService.formatAmount( + data['lastYearValue']), + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.w900, + color: Color(0xFF90B0D5), + ), + ), + ), + ), + SizedBox( + height: 2, // Height of the divider + child: Divider( + color: Colors.grey, + thickness: + 1, // Divider line thickness + ), + ), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + fit: BoxFit.contain, + child: Text( + apiService.formatAmount( + data['secondLastYearValue']), + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFFD83731), + ), + ), + ), + ), + Text( + '(${data['secondLastYear'] ?? 'NA'})', + style: const TextStyle( + fontSize: 9, + fontWeight: FontWeight.w500, + color: Colors.grey), + ), + ], + ), + ), + ),); + + + + } else if (chart_type == 'average') { + return Container( + margin: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: Color(int.parse(chartScreenData['border_color'].replaceFirst('#', '0xff'))), // Dynamic border color + width: 1, // Adjust border thickness + ), + ), + child: Card( + margin: const EdgeInsets.all(0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Container( + height: cardHeight, + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.network( + card_logo ?? '', + width: 30, + height: 30, + errorBuilder: + (context, error, stackTrace) { + return Icon(Icons.public, + color: Color(0xFF90B0D5), + size: 30); // Fallback icon + }, + ), + const SizedBox(height: 1), + Flexible( + fit: FlexFit.loose, + // child: FittedBox( + child: Text( + '${chart_heading ?? 'NA'}', + textAlign: TextAlign.center, + maxLines: 2, // Limit to 2 lines + softWrap: + true, // Enable soft wrapping + // overflow: TextOverflow.ellipsis, // Handle overflow gracefully + style: TextStyle( + fontSize: 9, + fontWeight: FontWeight.w400, + color: Colors.black87, + ), + ), + // ), + ), + const SizedBox(height: 5), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + child:Text( + '(${data['firstYear'] ?? 'NA'} - ${data['lastYear'] ?? 'NA'})', + style: const TextStyle( + fontSize: 10, color: Colors.grey), + ),),), + const SizedBox(height: 1), + Flexible( + fit: FlexFit.loose, child: SizedBox( - // height: 70.0, + height: 50.0, + child: FittedBox( + fit: BoxFit.contain, + child: Text( + '${data['roundedAverage'] ?? 'NA'}', + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.w900, + color: Color(0xFF90B0D5), + ), + ), + ), + ), + ), + ], + ), + ), + )); + } else if (chart_type == 'totals') { + return Container( + margin: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: Color(int.parse(chartScreenData['border_color'].replaceFirst('#', '0xff'))), // Dynamic border color + width: 1, // Adjust border thickness + ), + ), + child: Card( + margin: const EdgeInsets.all(0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Container( + height: cardHeight, + // height: maxHeight, + // padding: const EdgeInsets.all(10.0), + padding: const EdgeInsets.symmetric( + vertical: 0, horizontal: 10), + child: Column( + // mainAxisSize: MainAxisSize.min, // Adjust card height based on content + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.public, + color: Color(0xFF90B0D5), size: 30), + const SizedBox(height: 3), + Flexible( + fit: FlexFit.loose, + child: FittedBox( child: Text( '${chart_heading ?? 'NA'}', textAlign: TextAlign.center, @@ -2184,306 +2452,146 @@ class _ChartScreen1State extends ConsumerState { true, // Enable soft wrapping // overflow: TextOverflow.ellipsis, // Handle overflow gracefully style: TextStyle( - fontSize: 8, + fontSize: 11, fontWeight: FontWeight.w400, color: Colors.black87, ), ), ), ), - ), - const SizedBox(height: 1), - Text( - '(${data['lastYear'] ?? 'NA'})', - style: const TextStyle( - fontSize: 10, color: Colors.grey), - ), - const SizedBox(height: 1), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - fit: BoxFit.contain, - child: Text( - apiService.formatAmount( - data['lastYearValue']), - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w900, - color: Color(0xFF90B0D5), - ), - ), + Text( + '(${data['lastYear'] ?? 'NA'})', + style: const TextStyle( + fontSize: 11, color: Colors.grey), ), - ), - SizedBox( - height: 2, // Height of the divider - child: Divider( - color: Colors.grey, - thickness: - 1, // Divider line thickness - ), - ), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - fit: BoxFit.contain, - child: Text( - apiService.formatAmount( - data['secondLastYearValue']), - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xFFD83731), - ), - ), - ), - ), - Text( - '(${data['secondLastYear'] ?? 'NA'})', - style: const TextStyle( - fontSize: 9, - fontWeight: FontWeight.w500, - color: Colors.grey), - ), - ], - ), - ), - ); - } else if (chart_type == 'average') { - return Card( - margin: const EdgeInsets.all(10), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Container( - height: cardHeight, - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.network( - card_logo ?? '', - width: 30, - height: 30, - errorBuilder: - (context, error, stackTrace) { - return Icon(Icons.public, - color: Color(0xFF90B0D5), - size: 30); // Fallback icon - }, - ), - const SizedBox(height: 1), - Flexible( - fit: FlexFit.loose, - // child: FittedBox( - child: Text( - '${chart_heading ?? 'NA'}', - textAlign: TextAlign.center, - maxLines: 2, // Limit to 2 lines - softWrap: - true, // Enable soft wrapping - // overflow: TextOverflow.ellipsis, // Handle overflow gracefully - style: TextStyle( - fontSize: 9, - fontWeight: FontWeight.w400, - color: Colors.black87, - ), - ), - // ), - ), - const SizedBox(height: 5), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - child:Text( - '(${data['firstYear'] ?? 'NA'} - ${data['lastYear'] ?? 'NA'})', - style: const TextStyle( - fontSize: 10, color: Colors.grey), - ),),), - const SizedBox(height: 1), - Flexible( - fit: FlexFit.loose, - child: SizedBox( - height: 50.0, + Flexible( + fit: FlexFit.loose, child: FittedBox( fit: BoxFit.contain, child: Text( - '${data['roundedAverage'] ?? 'NA'}', + apiService.formatAmount( + data['lastYearValue']), style: const TextStyle( - fontSize: 20, + fontSize: 22, fontWeight: FontWeight.w900, color: Color(0xFF90B0D5), ), ), ), ), - ), - ], + ], + ), ), - ), - ); - } else if (chart_type == 'totals') { - return Card( - margin: const EdgeInsets.all(10), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Container( - height: cardHeight, - // height: maxHeight, - // padding: const EdgeInsets.all(10.0), - padding: const EdgeInsets.symmetric( - vertical: 0, horizontal: 10), - child: Column( - // mainAxisSize: MainAxisSize.min, // Adjust card height based on content - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.public, - color: Color(0xFF90B0D5), size: 30), - const SizedBox(height: 3), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - child: Text( - '${chart_heading ?? 'NA'}', - textAlign: TextAlign.center, - maxLines: 2, // Limit to 2 lines - softWrap: - true, // Enable soft wrapping - // overflow: TextOverflow.ellipsis, // Handle overflow gracefully - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w400, - color: Colors.black87, + )); + + } else if (chart_type == 'averages') { + return Container( + margin: const EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: Color(int.parse(chartScreenData['border_color'].replaceFirst('#', '0xff'))), // Dynamic border color + width: 1, // Adjust border thickness + ), + ), + child: Card( + margin: const EdgeInsets.all(0), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 4, + child: Container( + // height: maxHeight, + // height: 200, + height: cardHeight, + padding: const EdgeInsets.all(5.0), + // padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 10), + child: Column( + // mainAxisSize: MainAxisSize.min, // Adjust card height based on content + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.public, + color: Color(0xFF90B0D5), size: 30), + const SizedBox(height: 5), + Text( + '${chart_heading ?? 'NA'}', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w400, + color: Colors.black87, + ), + ), + Text( + '(${data['lastYear'] ?? 'NA'})', + style: const TextStyle( + fontSize: 11, color: Colors.grey), + ), + const SizedBox(height: 5), + Flexible( + fit: FlexFit.loose, + child: FittedBox( + child: Text( + '${chart_heading ?? 'NA'}', + textAlign: TextAlign.center, + maxLines: 2, // Limit to 2 lines + softWrap: + true, // Enable soft wrapping + // overflow: TextOverflow.ellipsis, // Handle overflow gracefully + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w400, + color: Colors.black87, + ), ), ), ), - ), - Text( - '(${data['lastYear'] ?? 'NA'})', - style: const TextStyle( - fontSize: 11, color: Colors.grey), - ), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - fit: BoxFit.contain, - child: Text( - apiService.formatAmount( - data['lastYearValue']), - style: const TextStyle( - fontSize: 22, - fontWeight: FontWeight.w900, - color: Color(0xFF90B0D5), - ), - ), - ), - ), - ], + ], + ), ), + )); + } else { + return const SizedBox + .shrink(); // Ignore unknown KPIs + } + }, + ), + ), + // chartsData Cards + ListView.builder( + itemCount: chartsData.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + return Card( + margin: const EdgeInsets.all(10), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 10), + Container( + height: 300, + // child: buildChart(chartsData[index]), + child: ChartWidget( + chartData: chartsData[index])), + ], ), - ); - } else if (chart_type == 'averages') { - return Card( - margin: const EdgeInsets.all(10), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 4, - child: Container( - // height: maxHeight, - // height: 200, - height: cardHeight, - padding: const EdgeInsets.all(5.0), - // padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 10), - child: Column( - // mainAxisSize: MainAxisSize.min, // Adjust card height based on content - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.public, - color: Color(0xFF90B0D5), size: 30), - const SizedBox(height: 5), - Text( - '${chart_heading ?? 'NA'}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w400, - color: Colors.black87, - ), - ), - Text( - '(${data['lastYear'] ?? 'NA'})', - style: const TextStyle( - fontSize: 11, color: Colors.grey), - ), - const SizedBox(height: 5), - Flexible( - fit: FlexFit.loose, - child: FittedBox( - child: Text( - '${chart_heading ?? 'NA'}', - textAlign: TextAlign.center, - maxLines: 2, // Limit to 2 lines - softWrap: - true, // Enable soft wrapping - // overflow: TextOverflow.ellipsis, // Handle overflow gracefully - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w400, - color: Colors.black87, - ), - ), - ), - ), - ], - ), - ), - ); - } else { - return const SizedBox - .shrink(); // Ignore unknown KPIs - } + ), + ); }, ), - ), - // chartsData Cards - ListView.builder( - itemCount: chartsData.length, - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - return Card( - margin: const EdgeInsets.all(10), - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 10), - Container( - height: 300, - // child: buildChart(chartsData[index]), - child: ChartWidget( - chartData: chartsData[index])), - ], - ), - ), - ); - }, - ), - ], - ), - ), + ], + ), + ), + ), ), ], ), ), - ); + ),); } Widget _buildArrowButton( @@ -2540,4 +2648,4 @@ class _ChartScreen1State extends ConsumerState { ), ); } -} +} \ No newline at end of file diff --git a/lib/presentation/Screens/charts/services/api_service.dart b/lib/presentation/Screens/charts/services/api_service.dart index a99ecb50..196aed85 100644 --- a/lib/presentation/Screens/charts/services/api_service.dart +++ b/lib/presentation/Screens/charts/services/api_service.dart @@ -34,7 +34,8 @@ class ApiService { nonChartData.add(item); } } - + final Map chartScreenData = jsonData['screen_heading_and_color']; + // Save original data for reset // originalChartsData = List.from(isChartData); // Store original data // originalCardData = List.from(nonChartData); // Store original data @@ -43,7 +44,8 @@ class ApiService { return { 'isChartData': isChartData, 'nonChartData': nonChartData, - 'filterData': jsonData['new_filter_data'] + 'filterData': jsonData['new_filter_data'], + 'chartScreenData' :chartScreenData // 'filterData': jsonData['filter_data'] // 'originalChartsData': originalChartsData, // 'originalCardData': originalCardData, @@ -161,4 +163,4 @@ class ApiService { return '$amount'; } } -} +} \ No newline at end of file diff --git a/lib/presentation/Screens/profilepage.dart b/lib/presentation/Screens/profilepage.dart index 3de32b0e..e3bcbe60 100644 --- a/lib/presentation/Screens/profilepage.dart +++ b/lib/presentation/Screens/profilepage.dart @@ -233,7 +233,8 @@ class _ProfileScreenState extends State { confirmButtonStyle: ButtonStyle( backgroundColor: WidgetStateProperty.all(Color(0xFFAA8E83)), // OK button background color foregroundColor: WidgetStateProperty.all(Colors.white), // OK button text color - minimumSize: WidgetStateProperty.all(Size(150, 50)), + // minimumSize: WidgetStateProperty.all(Size(150, 50)), + minimumSize: WidgetStateProperty.all(Size(100, 40)), shape: WidgetStateProperty.all(RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), // Rounded corners )), @@ -241,7 +242,8 @@ class _ProfileScreenState extends State { cancelButtonStyle: ButtonStyle( // backgroundColor: WidgetStateProperty.all(Colors.white), // Cancel button background color foregroundColor: WidgetStateProperty.all(Color(0xFFAA8E83)), // Cancel button text color - minimumSize: WidgetStateProperty.all(Size(150, 50)), + // minimumSize: WidgetStateProperty.all(Size(150, 50)), + minimumSize: WidgetStateProperty.all(Size(100, 40)), shape: WidgetStateProperty.all(RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), // Rounded corners side: const BorderSide(color: Color(0xFFAA8E83), width: 2), // Outline color diff --git a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart index 8260a020..7ec95b3d 100644 --- a/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart +++ b/lib/presentation/routes/drawer_routes/custom_drawer_routes.dart @@ -689,12 +689,14 @@ class _BaseScaffoldState extends ConsumerState { leading: Stack( children: [ if (widget.showBackButton == true) - Positioned( - top: 10, - left: 18, + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: EdgeInsets.only(left: 8), + child: IconButton( color: Colors.white, - icon: const Icon(Icons.arrow_back_ios_new), + icon: const Icon(Icons.arrow_back_ios_new, size: 26), onPressed: () { if ((widget.navBackArrow as Text).data == 'home') { context.go('/myhomepage'); @@ -703,10 +705,12 @@ class _BaseScaffoldState extends ConsumerState { } }, ), - ), - Positioned( - top: 8, - right: 4, + ),), + + Align( + alignment: Alignment.centerRight, + child: Padding( + padding: EdgeInsets.only(right: 10), child: Builder( builder: (BuildContext context) { return IconButton( @@ -719,9 +723,11 @@ class _BaseScaffoldState extends ConsumerState { ); }, ), - ), + ),), ], ), + + ), drawer: Drawer( backgroundColor: Colors.white, @@ -1017,4 +1023,4 @@ class _BaseScaffoldState extends ConsumerState { break; } } -} +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 22886e9f..929b8cac 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.12+13 +version: 1.0.13+14 environment: sdk: ">=3.2.3 <4.0.0" @@ -114,6 +114,7 @@ flutter: - assets/splash_screen/ - assets/icons/uae_numbers/bookmarks.png - assets/icons/uae_numbers/bookmarksSelectedUae.png + - assets/icons/uae_numbers/filters.png - assets/icons/uae_numbers/share.png - assets/icons/misc/vector.png - assets/icons/misc/visible_on.png