From 685da11f379192c058a11c9d4c6e426d573d1d54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Sat, 11 Nov 2023 22:16:51 +0100
Subject: [PATCH] Fix/improve charts display

---
 android/gradle.properties                     |  4 +--
 .../metadata/android/en-US/changelogs/26.txt  |  1 +
 .../metadata/android/fr-FR/changelogs/26.txt  |  1 +
 .../main_screen/discoveries_chart.dart        |  3 --
 .../main_screen/timeline_chart_counts.dart    |  1 -
 .../widgets/main_screen/topartists_chart.dart | 32 ++++++++++++++-----
 pubspec.yaml                                  |  2 +-
 7 files changed, 29 insertions(+), 15 deletions(-)
 create mode 100644 fastlane/metadata/android/en-US/changelogs/26.txt
 create mode 100644 fastlane/metadata/android/fr-FR/changelogs/26.txt

diff --git a/android/gradle.properties b/android/gradle.properties
index 357cef3..f0fcf6c 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,5 +1,5 @@
 org.gradle.jvmargs=-Xmx1536M
 android.useAndroidX=true
 android.enableJetifier=true
-app.versionName=0.0.25
-app.versionCode=25
+app.versionName=0.0.26
+app.versionCode=26
diff --git a/fastlane/metadata/android/en-US/changelogs/26.txt b/fastlane/metadata/android/en-US/changelogs/26.txt
new file mode 100644
index 0000000..a136710
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/26.txt
@@ -0,0 +1 @@
+Fix/improve charts display.
diff --git a/fastlane/metadata/android/fr-FR/changelogs/26.txt b/fastlane/metadata/android/fr-FR/changelogs/26.txt
new file mode 100644
index 0000000..2219018
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/26.txt
@@ -0,0 +1 @@
+Améliorations visuelles des graphiques.
diff --git a/lib/ui/widgets/main_screen/discoveries_chart.dart b/lib/ui/widgets/main_screen/discoveries_chart.dart
index 991f7c3..4e5ed7d 100644
--- a/lib/ui/widgets/main_screen/discoveries_chart.dart
+++ b/lib/ui/widgets/main_screen/discoveries_chart.dart
@@ -11,9 +11,6 @@ class ChartDiscoveries extends CustomBarChart {
 
   ChartDiscoveries({super.key, required this.chartData});
 
-  final double chartHeight = 120.0;
-  final double verticalTicksInterval = 10;
-
   @override
   Widget build(BuildContext context) {
     return Container(
diff --git a/lib/ui/widgets/main_screen/timeline_chart_counts.dart b/lib/ui/widgets/main_screen/timeline_chart_counts.dart
index c5bf7eb..bdfa0c5 100644
--- a/lib/ui/widgets/main_screen/timeline_chart_counts.dart
+++ b/lib/ui/widgets/main_screen/timeline_chart_counts.dart
@@ -10,7 +10,6 @@ class ChartTimelineCounts extends CustomBarChart {
 
   ChartTimelineCounts({super.key, required this.chartData});
 
-  final double chartHeight = 120.0;
   final double verticalTicksInterval = 50;
 
   @override
diff --git a/lib/ui/widgets/main_screen/topartists_chart.dart b/lib/ui/widgets/main_screen/topartists_chart.dart
index 776508d..0a6bcd8 100644
--- a/lib/ui/widgets/main_screen/topartists_chart.dart
+++ b/lib/ui/widgets/main_screen/topartists_chart.dart
@@ -22,7 +22,7 @@ class ChartTopArtists extends StatelessWidget {
               child: PieChart(
                 PieChartData(
                   sections: getPieChartData(),
-                  sectionsSpace: 1,
+                  sectionsSpace: 2,
                   centerSpaceRadius: 40,
                   startDegreeOffset: -45,
                   pieTouchData: PieTouchData(enabled: false),
@@ -53,7 +53,7 @@ class ChartTopArtists extends StatelessWidget {
       0xffed6f,
     ];
 
-    return Color(hexValues[index] + 0xff000000);
+    return Color(hexValues[index % hexValues.length] + 0xff000000);
   }
 
   List<PieChartSectionData> getPieChartData() {
@@ -66,17 +66,25 @@ class ChartTopArtists extends StatelessWidget {
     int index = 0;
 
     this.chartData.topArtists.forEach((element) {
-      items.add(PieChartSectionData(
+      Color baseColor = getColorIndex(index++);
+
+      final PieChartSectionData item = PieChartSectionData(
         value: element.count.toDouble(),
         title: element.artistName,
-        color: getColorIndex(index++).darken(20),
+        color: baseColor.darken(20),
+        borderSide: BorderSide(
+          color: baseColor.darken(40),
+          width: 1,
+        ),
         radius: radius,
         titleStyle: TextStyle(
           fontSize: fontSize,
           color: AppColors.mainTextColor1,
           shadows: shadows,
         ),
-      ));
+      );
+
+      items.add(item);
     });
 
     return items;
@@ -89,14 +97,20 @@ class ChartTopArtists extends StatelessWidget {
     int index = 0;
 
     this.chartData.topArtists.forEach((element) {
-      items.add(Row(
+      Color baseColor = getColorIndex(index++);
+
+      final Widget item = Row(
         children: <Widget>[
           Container(
             width: itemSize,
             height: itemSize,
             decoration: BoxDecoration(
               shape: BoxShape.rectangle,
-              color: getColorIndex(index++).darken(20),
+              color: baseColor.darken(20),
+              border: Border.all(
+                color: baseColor.darken(40),
+                width: 1,
+              ),
             ),
           ),
           const SizedBox(
@@ -110,7 +124,9 @@ class ChartTopArtists extends StatelessWidget {
             ),
           )
         ],
-      ));
+      );
+
+      items.add(item);
     });
 
     return Column(
diff --git a/pubspec.yaml b/pubspec.yaml
index 61d3639..c6d571c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: Display scrobbles data and charts
 
 publish_to: 'none'
 
-version: 0.0.25+25
+version: 0.0.26+26
 
 environment:
   sdk: '^3.0.0'
-- 
GitLab