chart ui changes
This commit is contained in:
parent
3d6658e7c0
commit
493312e091
@ -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")
|
||||
|
||||
BIN
assets/icons/misc/filters.png
Normal file
BIN
assets/icons/misc/filters.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 525 B |
@ -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';
|
||||
}
|
||||
|
||||
@ -117,11 +117,19 @@ class _UaenumberWidgetState extends ConsumerState<uaenumberWidget> {
|
||||
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),
|
||||
|
||||
@ -44,6 +44,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
bool isLoading = true;
|
||||
List<dynamic> isChartData = [];
|
||||
List<dynamic> nonChartData = [];
|
||||
Map<String, dynamic> chartScreenData = {};
|
||||
List<dynamic> filterDataSet = [];
|
||||
List<dynamic> filterData = [];
|
||||
List<dynamic> chartsData = [];
|
||||
@ -1249,11 +1250,13 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
|
||||
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<ChartScreen1> {
|
||||
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: [
|
||||
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(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF8E8E8E),
|
||||
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
|
||||
Divider(
|
||||
color: Color(0xFFA7B5C5),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filters.length,
|
||||
@ -1455,7 +1476,9 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
// 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<ChartScreen1> {
|
||||
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<ChartScreen1> {
|
||||
.map<Widget>((value) {
|
||||
return Chip(
|
||||
label: Text(value),
|
||||
// backgroundColor: Colors.white, // Default background color
|
||||
onDeleted: () {
|
||||
setState(() {
|
||||
selectedFilter[
|
||||
@ -1684,16 +1708,16 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
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<ChartScreen1> {
|
||||
// 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<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
|
||||
Widget build(BuildContext context) {
|
||||
final locale = ref.watch(localeProvider);
|
||||
@ -1826,7 +1875,14 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
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<ChartScreen1> {
|
||||
'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<ChartScreen1> {
|
||||
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<ChartScreen1> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.mainTopic ?? '',
|
||||
// widget.mainTopic ?? '',
|
||||
chartScreenData['main_topic'] ?? '',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 26,
|
||||
@ -1908,7 +1970,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
color: Colors.white,
|
||||
)),
|
||||
Text(
|
||||
widget.title,
|
||||
// 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<ChartScreen1> {
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(
|
||||
// color: Colors.redAccent,
|
||||
Container(
|
||||
color: Color(int.parse(chartScreenData['header_color'].replaceFirst('#', '0xff'))),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
@ -2056,6 +2119,8 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: Color(int.parse(chartScreenData['body_color'].replaceFirst('#', '0xff'))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(
|
||||
@ -2143,12 +2208,23 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
: 130.0;
|
||||
|
||||
if (chart_type == 'total') {
|
||||
return Card(
|
||||
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,
|
||||
elevation: 0, // Remove shadow to keep only the outli
|
||||
|
||||
child: Container(
|
||||
height: cardHeight,
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
@ -2247,10 +2323,22 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),);
|
||||
|
||||
|
||||
|
||||
} else if (chart_type == 'average') {
|
||||
return Card(
|
||||
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),
|
||||
),
|
||||
@ -2322,10 +2410,19 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
} else if (chart_type == 'totals') {
|
||||
return Card(
|
||||
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),
|
||||
),
|
||||
@ -2385,10 +2482,20 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
|
||||
} else if (chart_type == 'averages') {
|
||||
return Card(
|
||||
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),
|
||||
),
|
||||
@ -2443,7 +2550,7 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
} else {
|
||||
return const SizedBox
|
||||
.shrink(); // Ignore unknown KPIs
|
||||
@ -2480,10 +2587,11 @@ class _ChartScreen1State extends ConsumerState<ChartScreen1> {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),);
|
||||
}
|
||||
|
||||
Widget _buildArrowButton(
|
||||
|
||||
@ -34,6 +34,7 @@ class ApiService {
|
||||
nonChartData.add(item);
|
||||
}
|
||||
}
|
||||
final Map<String, dynamic> chartScreenData = jsonData['screen_heading_and_color'];
|
||||
|
||||
// Save original data for reset
|
||||
// originalChartsData = List.from(isChartData); // 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,
|
||||
|
||||
@ -233,7 +233,8 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
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<ProfileScreen> {
|
||||
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
|
||||
|
||||
@ -689,12 +689,14 @@ class _BaseScaffoldState extends ConsumerState<BaseScaffold> {
|
||||
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<BaseScaffold> {
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
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<BaseScaffold> {
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
),
|
||||
drawer: Drawer(
|
||||
backgroundColor: Colors.white,
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user