diff --git a/app/lib/consts.dart b/app/lib/consts.dart index 3c0d9840e6cc66c50b04dfcaaf56407b9dc72392..f31ec731ae78e1941615e66c4101977a2177c1cc 100644 --- a/app/lib/consts.dart +++ b/app/lib/consts.dart @@ -33,6 +33,6 @@ final titleStyle = GoogleFonts.chakraPetch( fontWeight: FontWeight.bold, ); final regTextStyle = GoogleFonts.chakraPetch(fontSize: 16, color: textColor); -final regTextStyleBig = GoogleFonts.chakraPetch(fontSize: 18, color: textColor); +final regTextStyleBig = GoogleFonts.chakraPetch(fontSize: 20, color: textColor); final chartTextStyle = GoogleFonts.chakraPetch(fontSize: 12, color: textColor); final subHeadingStyle = GoogleFonts.chakraPetch(fontSize: 18, color: textColor, fontWeight: FontWeight.bold); diff --git a/app/lib/utils/format_month.dart b/app/lib/utils/format_month.dart new file mode 100644 index 0000000000000000000000000000000000000000..30f32e57c1b19fdb31790edd2f009ed756923073 --- /dev/null +++ b/app/lib/utils/format_month.dart @@ -0,0 +1,30 @@ +String formatMonth(int month) { + switch (month) { + case 1: + return 'Jan'; + case 2: + return 'Feb'; + case 3: + return 'Mar'; + case 4: + return 'Apr'; + case 5: + return 'May'; + case 6: + return 'Jun'; + case 7: + return 'Jul'; + case 8: + return 'Aug'; + case 9: + return 'Sep'; + case 10: + return 'Oct'; + case 11: + return 'Nov'; + case 12: + return 'Dec'; + default: + return ''; + } +} \ No newline at end of file diff --git a/app/lib/widgets/bar_graph/bar_data.dart b/app/lib/widgets/bar_graph/bar_data.dart index 4b80bacc2d32ccc5107bfb15cdac915438218986..aff6f066aca37d2efe9fa18a30375458ad8437a1 100644 --- a/app/lib/widgets/bar_graph/bar_data.dart +++ b/app/lib/widgets/bar_graph/bar_data.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; import '../../consts.dart'; +import '../../utils/format_month.dart'; class BarData extends StatefulWidget { const BarData({super.key}); @@ -129,6 +130,23 @@ class _BarDataState extends State<BarData> { showTitles: true, reservedSize: 20, getTextStyles: (value) => const TextStyle(color: Colors.white60), + getTitles: (value) { + // Convert bar indexes to dates + if (barData.isNotEmpty && value >= 0 && value < barData.length) { + int index = value.toInt(); + + DateTime today = DateTime.now(); + + // Subtract index from the day of the month of the current date + int day = today.day - (6-index); + + String date = day.toString(); + String month = formatMonth(today.month); + + return '$month $date'; + } + return ''; + }, ), leftTitles: SideTitles( showTitles: true, diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index 021b77fd3bd1ac19baa7a510d1f6c54ac9889c95..5cd63e24b7450b10083a3ec4d715a420ea59aed1 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -12,6 +12,7 @@ import 'choropleth_map.dart'; import '../data_classes.dart'; import 'satellite_layer.dart'; import 'quick_view_chart.dart'; +import '../utils/format_month.dart'; /// MapContainerWidget is the main widget that contains the map with all /// its layers, polygons and markers. @@ -246,19 +247,24 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { 'Time: ${selectedTile?.timeMeasured.hour}:00', style: regTextStyle, ), + const SizedBox(height: contPadding), + Text( + 'Measuring point: (${selectedTile?.measurementID}, ${selectedTile?.measurementID})', + style: regTextStyle, + ), ], ), ), ), ), - const SizedBox(height: contPadding*2), + const SizedBox(height: contPadding*2.5), SizedBox( width: screenWidth * boxWidth * 1.2, child: Center( - child: Text( - 'Measuring point: (${selectedTile?.measurementID}, ${selectedTile?.measurementID})', - style: regTextStyle, - ), + child: Text( + 'Ice layers', + style: regTextStyleBig, + ), ), ), SizedBox( @@ -305,34 +311,3 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { ); } } - -String formatMonth(int month) { - switch (month) { - case 1: - return 'Jan'; - case 2: - return 'Feb'; - case 3: - return 'Mar'; - case 4: - return 'Apr'; - case 5: - return 'May'; - case 6: - return 'Jun'; - case 7: - return 'Jul'; - case 8: - return 'Aug'; - case 9: - return 'Sep'; - case 10: - return 'Oct'; - case 11: - return 'Nov'; - case 12: - return 'Dec'; - default: - return ''; - } -} \ No newline at end of file