chart ui changes

This commit is contained in:
venbaittech 2025-02-12 18:51:07 +05:30
parent 3d6658e7c0
commit 493312e091
9 changed files with 562 additions and 434 deletions

View File

@ -15,12 +15,12 @@ if (localPropertiesFile.exists()) {
def flutterVersionCode = localProperties.getProperty("flutter.versionCode") def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) { if (flutterVersionCode == null) {
flutterVersionCode = "13" flutterVersionCode = "14"
} }
def flutterVersionName = localProperties.getProperty("flutter.versionName") def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = "1.0.12" flutterVersionName = "1.0.13"
} }
def keystorePropertiesFile = rootProject.file("key.properties") def keystorePropertiesFile = rootProject.file("key.properties")

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View File

@ -5,4 +5,5 @@ abstract class UaeNumbersAssetPath {
static const bookmarksUae = '$_basePath/bookmarks.png'; static const bookmarksUae = '$_basePath/bookmarks.png';
static const bookmarksSelectedUae = '$_basePath/bookmarksSelectedUae.png'; static const bookmarksSelectedUae = '$_basePath/bookmarksSelectedUae.png';
static const shareUae = '$_basePath/share.png'; static const shareUae = '$_basePath/share.png';
static const filterUae = '$_basePath/filters.png';
} }

View File

@ -117,11 +117,19 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: "Search", hintText: "Search",
hintStyle: TextStyle(color: Color(0xFF898C81)), hintStyle: TextStyle(color: Color(0xFF898C81)),
prefixIcon: Image.asset(
MiscIconAssetPath.search,
// width: 15, prefixIcon: Image(
// height: 10, image: ExactAssetImage(MiscIconAssetPath.search),
width: 24,
height: 24,
), ),
// prefixIcon: Image.asset(
// MiscIconAssetPath.search,
// // fit: BoxFit.contain,
// ),
border: InputBorder.none, border: InputBorder.none,
contentPadding: contentPadding:
EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0), EdgeInsets.symmetric(vertical: 8.0, horizontal: 18.0),

View File

@ -44,6 +44,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
bool isLoading = true; bool isLoading = true;
List<dynamic> isChartData = []; List<dynamic> isChartData = [];
List<dynamic> nonChartData = []; List<dynamic> nonChartData = [];
Map<String, dynamic> chartScreenData = {};
List<dynamic> filterDataSet = []; List<dynamic> filterDataSet = [];
List<dynamic> filterData = []; List<dynamic> filterData = [];
List<dynamic> chartsData = []; List<dynamic> chartsData = [];
@ -1249,11 +1250,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
chartsData = isChartData; chartsData = isChartData;
cardData = nonChartData; cardData = nonChartData;
chartScreenData = data['chartScreenData'] ?? {};
processChartData(chartsData); processChartData(chartsData);
print('chartsData :- $chartsData'); print('chartsData :- $chartsData');
print('cardData :- $cardData'); print('cardData :- $cardData');
print('chartScreenData :- $chartScreenData');
// print('filterData :- $filterData'); // print('filterData :- $filterData');
isLoading = false; isLoading = false;
}); });
@ -1401,28 +1404,46 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
children: [ children: [
// Header Section // Header Section
Padding( 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( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row(
children: [
Image.asset(
UaeNumbersAssetPath.filterUae,
color:Color(0xFF8E8E8E), // Outline color
width: 24, // Slightly larger
height: 24,
),
SizedBox(width: 8),
Text( Text(
context.translate( context.translate(
'Filters', 'Filters',
'المرشحات', 'المرشحات',
), ),
style: TextStyle( style: TextStyle(
fontSize: 18, color: Color(0xFF8E8E8E),
fontWeight: FontWeight.bold, fontSize: 20,
fontWeight: FontWeight.w500,
fontFamily: 'Roboto',
), ),
), ),
IconButton( ],
icon: Icon(Icons.close),
onPressed: () => Navigator.pop(context),
), ),
// IconButton(
// icon: Icon(Icons.close),
// onPressed: () => Navigator.pop(context),
// ),
], ],
), ),
), ),
// Filters Section // Filters Section
Divider(
color: Color(0xFFA7B5C5),
),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: filters.length, itemCount: filters.length,
@ -1455,7 +1476,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// capitalizeAndSplit(filterKey), // capitalizeAndSplit(filterKey),
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w700,
fontFamily: 'Roboto',
color: Color(0xFF8E8E8E),
), ),
), ),
InkWell( InkWell(
@ -1527,7 +1550,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12.0), horizontal: 16.0, vertical: 12.0),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: Colors.grey), border: Border.all(color: Color(0xFF7296BE)),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
), ),
child: Wrap( child: Wrap(
@ -1546,6 +1569,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
.map<Widget>((value) { .map<Widget>((value) {
return Chip( return Chip(
label: Text(value), label: Text(value),
// backgroundColor: Colors.white, // Default background color
onDeleted: () { onDeleted: () {
setState(() { setState(() {
selectedFilter[ selectedFilter[
@ -1684,16 +1708,16 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 0.0, horizontal: 0.0,
vertical: 16.0), // Added padding vertical: 14.2), // Added padding
child: FittedBox( child: FittedBox(
fit: BoxFit fit: BoxFit
.scaleDown, // Ensures text resizes if necessary .scaleDown, // Ensures text resizes if necessary
child: Text( child: Text(
context.translate( context.translate(
'Apply Filter', 'تطبيق الفلتر'), 'Filter', 'فلتر'),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 13,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
overflow: overflow:
@ -1799,14 +1823,39 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
// Determine a default aspect ratio based on the most common chart type in the list // Determine a default aspect ratio based on the most common chart type in the list
if (cardData.any((item) => if (cardData.any((item) =>
item['chart_type'] == 'total' || item['chart_type'] == 'average')) { 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.0 : 0.7; // Larger Content
// return crossAxisCount == 2 ? 1.5 : 0.9; // return crossAxisCount == 2 ? 1.5 : 0.9;
} else { } else {
return crossAxisCount == 2 ? 1.5 : 0.9; return crossAxisCount == 2 ? 1.5 : 0.9;
// Shorter Content // Shorter Content
} }
} }
// double calculateAspectRatio(int crossAxisCount, List<dynamic> 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final locale = ref.watch(localeProvider); final locale = ref.watch(localeProvider);
@ -1826,7 +1875,14 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
double mywidth = MediaQuery.of(context).size.width; double mywidth = MediaQuery.of(context).size.width;
final color = final color =
Color(int.parse(widget.bgColor.replaceFirst('0x', ''), radix: 16)); 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, key: _scaffoldKey,
// backgroundColor: color, // backgroundColor: color,
// appBar: AppBar( // appBar: AppBar(
@ -1871,7 +1927,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
'UAE Numbers', '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, showBackButton: true,
colorChange:true, colorChange:true,
navBackArrow: Text(widget.keyParam ?? 'Default Value'), navBackArrow: Text(widget.keyParam ?? 'Default Value'),
@ -1884,7 +1944,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
Container( Container(
// height: myheight / 5, // height: myheight / 5,
width: double.infinity, width: double.infinity,
color: color, // color: color,
color: Color(int.parse(chartScreenData['header_color'].replaceFirst('#', '0xff'))),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 30, right: 30, top: 8, bottom: 5), left: 30, right: 30, top: 8, bottom: 5),
@ -1892,7 +1953,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
widget.mainTopic ?? '', // widget.mainTopic ?? '',
chartScreenData['main_topic'] ?? '',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 26, fontSize: 26,
@ -1908,7 +1970,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
color: Colors.white, color: Colors.white,
)), )),
Text( Text(
widget.title, // widget.title,
chartScreenData['data_set_tile_heading'] ?? '',
style: TextStyle(color: Colors.white, fontSize: 20, style: TextStyle(color: Colors.white, fontSize: 20,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontFamily: 'Roboto'), fontFamily: 'Roboto'),
@ -1935,8 +1998,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
], ],
), ),
)), )),
SizedBox( Container(
// color: Colors.redAccent, color: Color(int.parse(chartScreenData['header_color'].replaceFirst('#', '0xff'))),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -2056,6 +2119,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
), ),
Expanded( Expanded(
child: Container(
color: Color(int.parse(chartScreenData['body_color'].replaceFirst('#', '0xff'))),
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: ListView( child: ListView(
@ -2143,12 +2208,23 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
: 130.0; : 130.0;
if (chart_type == 'total') { if (chart_type == 'total') {
return Card( return
Container(
margin: const EdgeInsets.all(10), 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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
elevation: 4, elevation: 0, // Remove shadow to keep only the outli
child: Container( child: Container(
height: cardHeight, height: cardHeight,
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
@ -2247,10 +2323,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
], ],
), ),
), ),
); ),);
} else if (chart_type == 'average') { } else if (chart_type == 'average') {
return Card( return Container(
margin: const EdgeInsets.all(10), 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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
@ -2322,10 +2410,19 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
], ],
), ),
), ),
); ));
} else if (chart_type == 'totals') { } else if (chart_type == 'totals') {
return Card( return Container(
margin: const EdgeInsets.all(10), 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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
@ -2385,10 +2482,20 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
], ],
), ),
), ),
); ));
} else if (chart_type == 'averages') { } else if (chart_type == 'averages') {
return Card( return Container(
margin: const EdgeInsets.all(10), 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( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
), ),
@ -2443,7 +2550,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
], ],
), ),
), ),
); ));
} else { } else {
return const SizedBox return const SizedBox
.shrink(); // Ignore unknown KPIs .shrink(); // Ignore unknown KPIs
@ -2480,10 +2587,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
), ),
), ),
), ),
),
], ],
), ),
), ),
); ),);
} }
Widget _buildArrowButton( Widget _buildArrowButton(

View File

@ -34,6 +34,7 @@ class ApiService {
nonChartData.add(item); nonChartData.add(item);
} }
} }
final Map<String, dynamic> chartScreenData = jsonData['screen_heading_and_color'];
// Save original data for reset // Save original data for reset
// originalChartsData = List.from(isChartData); // Store original data // originalChartsData = List.from(isChartData); // Store original data
@ -43,7 +44,8 @@ class ApiService {
return { return {
'isChartData': isChartData, 'isChartData': isChartData,
'nonChartData': nonChartData, 'nonChartData': nonChartData,
'filterData': jsonData['new_filter_data'] 'filterData': jsonData['new_filter_data'],
'chartScreenData' :chartScreenData
// 'filterData': jsonData['filter_data'] // 'filterData': jsonData['filter_data']
// 'originalChartsData': originalChartsData, // 'originalChartsData': originalChartsData,
// 'originalCardData': originalCardData, // 'originalCardData': originalCardData,

View File

@ -233,7 +233,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
confirmButtonStyle: ButtonStyle( confirmButtonStyle: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xFFAA8E83)), // OK button background color backgroundColor: WidgetStateProperty.all(Color(0xFFAA8E83)), // OK button background color
foregroundColor: WidgetStateProperty.all(Colors.white), // OK button text 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( shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0), // Rounded corners borderRadius: BorderRadius.circular(12.0), // Rounded corners
)), )),
@ -241,7 +242,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
cancelButtonStyle: ButtonStyle( cancelButtonStyle: ButtonStyle(
// backgroundColor: WidgetStateProperty.all(Colors.white), // Cancel button background color // backgroundColor: WidgetStateProperty.all(Colors.white), // Cancel button background color
foregroundColor: WidgetStateProperty.all(Color(0xFFAA8E83)), // Cancel button text 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( shape: WidgetStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0), // Rounded corners borderRadius: BorderRadius.circular(12.0), // Rounded corners
side: const BorderSide(color: Color(0xFFAA8E83), width: 2), // Outline color side: const BorderSide(color: Color(0xFFAA8E83), width: 2), // Outline color

View File

@ -689,12 +689,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
leading: Stack( leading: Stack(
children: [ children: [
if (widget.showBackButton == true) if (widget.showBackButton == true)
Positioned( Align(
top: 10, alignment: Alignment.centerLeft,
left: 18, child: Padding(
padding: EdgeInsets.only(left: 8),
child: IconButton( child: IconButton(
color: Colors.white, color: Colors.white,
icon: const Icon(Icons.arrow_back_ios_new), icon: const Icon(Icons.arrow_back_ios_new, size: 26),
onPressed: () { onPressed: () {
if ((widget.navBackArrow as Text).data == 'home') { if ((widget.navBackArrow as Text).data == 'home') {
context.go('/myhomepage'); context.go('/myhomepage');
@ -703,10 +705,12 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
} }
}, },
), ),
), ),),
Positioned(
top: 8, Align(
right: 4, alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(right: 10),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return IconButton( return IconButton(
@ -719,9 +723,11 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
); );
}, },
), ),
), ),),
], ],
), ),
), ),
drawer: Drawer( drawer: Drawer(
backgroundColor: Colors.white, backgroundColor: Colors.white,

View File

@ -1,7 +1,7 @@
name: uae_stat name: uae_stat
description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness." description: "View statistics about the UAE from the Federal Center for Statistics and Competitiveness."
publish_to: "none" publish_to: "none"
version: 1.0.12+13 version: 1.0.13+14
environment: environment:
sdk: ">=3.2.3 <4.0.0" sdk: ">=3.2.3 <4.0.0"
@ -114,6 +114,7 @@ flutter:
- assets/splash_screen/ - assets/splash_screen/
- assets/icons/uae_numbers/bookmarks.png - assets/icons/uae_numbers/bookmarks.png
- assets/icons/uae_numbers/bookmarksSelectedUae.png - assets/icons/uae_numbers/bookmarksSelectedUae.png
- assets/icons/uae_numbers/filters.png
- assets/icons/uae_numbers/share.png - assets/icons/uae_numbers/share.png
- assets/icons/misc/vector.png - assets/icons/misc/vector.png
- assets/icons/misc/visible_on.png - assets/icons/misc/visible_on.png