From 4016f4d19b103e90aaf4cc873fc0dda8fe9bc910 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Tue, 12 Mar 2024 14:48:08 +0100
Subject: [PATCH] Improve/clean some code

---
 android/gradle.properties                     |   4 +-
 assets/skins/default_button_mark_mine_off.png | Bin 1076 -> 1076 bytes
 assets/skins/default_button_mark_mine_on.png  | Bin 1043 -> 1043 bytes
 assets/translations/en.json                   |   2 +-
 .../metadata/android/en-US/changelogs/39.txt  |   1 +
 .../metadata/android/fr-FR/changelogs/39.txt  |   1 +
 icons/skins/default/button_mark_mine_off.svg  |   6 +--
 icons/skins/default/button_mark_mine_on.svg   |   6 +--
 icons/skins/default/indicator_report_off.svg  |   2 +-
 icons/skins/default/indicator_report_on.svg   |   2 +-
 lib/config/menu.dart                          |   1 +
 lib/cubit/bottom_nav_cubit.dart               |   1 +
 lib/entities/cell.dart                        |   1 +
 lib/main.dart                                 |  49 +++++++++---------
 lib/provider/data.dart                        |   3 +-
 .../widgets/game/mode_indicator_report.dart   |   2 +-
 lib/ui/widgets/settings/theme_card.dart       |  48 +++++++++--------
 lib/utils/game_utils.dart                     |   2 +-
 pubspec.yaml                                  |   2 +-
 19 files changed, 71 insertions(+), 62 deletions(-)
 create mode 100644 fastlane/metadata/android/en-US/changelogs/39.txt
 create mode 100644 fastlane/metadata/android/fr-FR/changelogs/39.txt

diff --git a/android/gradle.properties b/android/gradle.properties
index 9ebd19f..456b137 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.1.17
-app.versionCode=38
+app.versionName=0.1.18
+app.versionCode=39
diff --git a/assets/skins/default_button_mark_mine_off.png b/assets/skins/default_button_mark_mine_off.png
index d74e7ea0ca6a648c0ffdcaffcb6177ffc4c03d02..26e9654a2b744fb089d924eb8ad14bffa9f85d30 100644
GIT binary patch
delta 318
zcmdnOv4vwoW_?3LLtkHC0}QmawLzGzt*sD7b8|C<(a_M)1O{+!LqkI&48YlNMq^_m
foDE?hYlN~v_CuKiLK%@}YvinlZkuN^&SnAt;2NGM

delta 318
hcmdnOv4vwoW<A5ef`PW*h&1niTAO-z^GwFsOaLML2yFlW

diff --git a/assets/skins/default_button_mark_mine_on.png b/assets/skins/default_button_mark_mine_on.png
index 05a61d277c45179ebca7e624451c704f3538ae90..fc90ca62d18b045ef850cc50498d964bb6dc1097 100644
GIT binary patch
delta 303
zcmbQtF_~jRW_?3L!>U!Q8X6ipIyxE}8rs01p`oF*wY8z4p#=;YV4w*MAiSogrbZZm
jh(Jh)7@Up9fN&8c$bJNm{w!qzRz~$mOxxVW*vSL{4TY9A

delta 303
hcmbQtF_~jRW<A5ef`PVQnSl4_=c;LJ?qcj@0sxQd26O-b

diff --git a/assets/translations/en.json b/assets/translations/en.json
index a598046..e1e3191 100644
--- a/assets/translations/en.json
+++ b/assets/translations/en.json
@@ -2,7 +2,7 @@
   "app_name": "Minehunter",
 
   "long_press_to_quit": "Long press to quit game...",
-  
+
   "bottom_nav_home": "Game",
   "bottom_nav_settings": "Settings",
   "bottom_nav_about": "About",
diff --git a/fastlane/metadata/android/en-US/changelogs/39.txt b/fastlane/metadata/android/en-US/changelogs/39.txt
new file mode 100644
index 0000000..c72c2da
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/39.txt
@@ -0,0 +1 @@
+Improve/clean some code.
diff --git a/fastlane/metadata/android/fr-FR/changelogs/39.txt b/fastlane/metadata/android/fr-FR/changelogs/39.txt
new file mode 100644
index 0000000..a485bd5
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/39.txt
@@ -0,0 +1 @@
+Améliorations/corrections de code.
diff --git a/icons/skins/default/button_mark_mine_off.svg b/icons/skins/default/button_mark_mine_off.svg
index 4ce9b64..5360d94 100644
--- a/icons/skins/default/button_mark_mine_off.svg
+++ b/icons/skins/default/button_mark_mine_off.svg
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
-    <switch transform="matrix(-.65646 0 0 .65646 79.689 14.015)" fill="#000000">
-        <g fill="#000">
-            <path d="m96.4 47.2-37.2-37.1c-1.5-1.5-4-1.5-5.5 0l-9.1 9.1c-1.5 1.5-1.5 4 0 5.5l14.9 14.9h-53c-2.2 0-3.9 1.8-3.9 3.9v12.9c0 2.2 1.8 3.9 3.9 3.9h53l-15 15c-1.5 1.5-1.5 4 0 5.5l9.1 9.1c1.5 1.5 4 1.5 5.5 0l37.1-37.1c1.7-1.6 1.7-4 0.2-5.6z" fill="#000"/>
+    <switch transform="matrix(-.65646 0 0 .65646 79.689 14.015)" fill="#808080">
+        <g fill="#808080">
+            <path d="m96.4 47.2-37.2-37.1c-1.5-1.5-4-1.5-5.5 0l-9.1 9.1c-1.5 1.5-1.5 4 0 5.5l14.9 14.9h-53c-2.2 0-3.9 1.8-3.9 3.9v12.9c0 2.2 1.8 3.9 3.9 3.9h53l-15 15c-1.5 1.5-1.5 4 0 5.5l9.1 9.1c1.5 1.5 4 1.5 5.5 0l37.1-37.1c1.7-1.6 1.7-4 0.2-5.6z" fill="#808080"/>
         </g>
     </switch>
 </svg>
diff --git a/icons/skins/default/button_mark_mine_on.svg b/icons/skins/default/button_mark_mine_on.svg
index 0d0eec9..2424c7e 100644
--- a/icons/skins/default/button_mark_mine_on.svg
+++ b/icons/skins/default/button_mark_mine_on.svg
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
-    <switch transform="matrix(.65646 0 0 .65646 13.976 14.015)" fill="#000000">
-        <g fill="#000">
-            <path d="m96.4 47.2-37.2-37.1c-1.5-1.5-4-1.5-5.5 0l-9.1 9.1c-1.5 1.5-1.5 4 0 5.5l14.9 14.9h-53c-2.2 0-3.9 1.8-3.9 3.9v12.9c0 2.2 1.8 3.9 3.9 3.9h53l-15 15c-1.5 1.5-1.5 4 0 5.5l9.1 9.1c1.5 1.5 4 1.5 5.5 0l37.1-37.1c1.7-1.6 1.7-4 0.2-5.6z" fill="#000"/>
+    <switch transform="matrix(.65646 0 0 .65646 13.976 14.015)" fill="#808080">
+        <g fill="#808080">
+            <path d="m96.4 47.2-37.2-37.1c-1.5-1.5-4-1.5-5.5 0l-9.1 9.1c-1.5 1.5-1.5 4 0 5.5l14.9 14.9h-53c-2.2 0-3.9 1.8-3.9 3.9v12.9c0 2.2 1.8 3.9 3.9 3.9h53l-15 15c-1.5 1.5-1.5 4 0 5.5l9.1 9.1c1.5 1.5 4 1.5 5.5 0l37.1-37.1c1.7-1.6 1.7-4 0.2-5.6z" fill="#808080"/>
         </g>
     </switch>
 </svg>
diff --git a/icons/skins/default/indicator_report_off.svg b/icons/skins/default/indicator_report_off.svg
index ecea79f..64fa1a1 100644
--- a/icons/skins/default/indicator_report_off.svg
+++ b/icons/skins/default/indicator_report_off.svg
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="-.0013123" y="-.0014381" width="93.668" height="93.679" ry="0" fill="#9f9f9f" stroke="#fff" stroke-width=".24146"/><path d="m63.009 39.288c-4.4337 1.6324-7.8123 2.7951-10.784 6.4707-2.6476 3.2753-6.4707 4.4107-10.784 2.2516v11.768h-2.1568v-29.117c0-0.5961 0.48232-1.0784 1.0784-1.0784s1.0784 0.48232 1.0784 1.0784c2.3949 3.4817 6.5567 4.2526 10.784 4.3136 6.4707 0.09477 10.784 4.3136 10.784 4.3136zm-19.412 14.306v2.1948c2.5444 0.52025 4.3136 1.624 4.3136 2.911 0 1.7861-3.3806 3.2353-7.5489 3.2353-4.1683 0-7.5489-1.4492-7.5489-3.2353 0-1.287 1.7693-2.3907 4.3136-2.911v-2.1947c-3.9177 0.67828-6.4707 2.5781-6.4707 5.1056 0 3.1742 3.9914 5.392 9.7059 5.392 5.7145 0 9.7059-2.2179 9.7059-5.392 0-2.5275-2.5528-4.4273-6.4707-5.1056z" fill="#af0303" stroke="#730202" stroke-linejoin="round" stroke-width=".86919"/></svg>
+<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="-.0013123" y="-.0014381" width="93.668" height="93.679" ry="0" fill="#9f9f9f" stroke="#fff" stroke-width=".24146"/><path d="m63.009 39.288c-4.4337 1.6324-7.8123 2.7951-10.784 6.4707-2.6476 3.2753-6.4707 4.4107-10.784 2.2516v11.768h-2.1568v-29.117c0-0.5961 0.48232-1.0784 1.0784-1.0784s1.0784 0.48232 1.0784 1.0784c2.3949 3.4817 6.5567 4.2526 10.784 4.3136 6.4707 0.09477 10.784 4.3136 10.784 4.3136zm-19.412 14.306v2.1948c2.5444 0.52025 4.3136 1.624 4.3136 2.911 0 1.7861-3.3806 3.2353-7.5489 3.2353s-7.5489-1.4492-7.5489-3.2353c0-1.287 1.7693-2.3907 4.3136-2.911v-2.1947c-3.9177 0.67828-6.4707 2.5781-6.4707 5.1056 0 3.1742 3.9914 5.392 9.7059 5.392s9.7059-2.2179 9.7059-5.392c0-2.5275-2.5528-4.4273-6.4707-5.1056z" fill="#af0303" stroke="#730202" stroke-linejoin="round" stroke-width=".86919"/></svg>
diff --git a/icons/skins/default/indicator_report_on.svg b/icons/skins/default/indicator_report_on.svg
index b9c0581..a72968f 100644
--- a/icons/skins/default/indicator_report_on.svg
+++ b/icons/skins/default/indicator_report_on.svg
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="-.0013123" y="-.0014381" width="93.668" height="93.679" ry="0" fill="#ea9c1f" stroke="#fff" stroke-width=".24146"/><path d="m78.682 31.974c-8.7296 3.214-15.381 5.5032-21.232 12.74-5.2129 6.4487-12.74 8.6842-21.232 4.4332v23.169h-4.2465v-57.328c0-1.1736 0.94963-2.1232 2.1232-2.1232 1.1735 0 2.1232 0.94963 2.1232 2.1232 4.7153 6.855 12.91 8.3728 21.232 8.4931 12.74 0.18659 21.232 8.4931 21.232 8.4931zm-38.22 28.168v4.3213c5.0096 1.0243 8.4931 3.1974 8.4931 5.7314 0 3.5167-6.656 6.3699-14.863 6.3699-8.207 0-14.863-2.8532-14.863-6.3699 0-2.534 3.4834-4.707 8.4931-5.7314v-4.3211c-7.7135 1.3355-12.74 5.076-12.74 10.052 0 6.2497 7.8586 10.616 19.11 10.616s19.11-4.3668 19.11-10.616c0-4.9764-5.0262-8.7168-12.74-10.052z" fill="#af0303" stroke="#730202" stroke-linejoin="round" stroke-width="1.7113"/></svg>
+<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 93.665 93.676" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect x="-.0013123" y="-.0014381" width="93.668" height="93.679" ry="0" fill="#ea9c1f" stroke="#fff" stroke-width=".24146"/><path d="m78.682 31.974c-8.7296 3.214-15.381 5.5032-21.232 12.74-5.2129 6.4487-12.74 8.6842-21.232 4.4332v23.169h-4.2465v-57.328c0-1.1736 0.94963-2.1232 2.1232-2.1232 1.1735 0 2.1232 0.94963 2.1232 2.1232 4.7153 6.855 12.91 8.3728 21.232 8.4931 12.74 0.18659 21.232 8.4931 21.232 8.4931zm-38.22 28.168v4.3213c5.0096 1.0243 8.4931 3.1974 8.4931 5.7314 0 3.5167-6.656 6.3699-14.863 6.3699s-14.863-2.8532-14.863-6.3699c0-2.534 3.4834-4.707 8.4931-5.7314v-4.3211c-7.7135 1.3355-12.74 5.076-12.74 10.052 0 6.2497 7.8586 10.616 19.11 10.616s19.11-4.3668 19.11-10.616c0-4.9764-5.0262-8.7168-12.74-10.052z" fill="#af0303" stroke="#730202" stroke-linejoin="round" stroke-width="1.7113"/></svg>
diff --git a/lib/config/menu.dart b/lib/config/menu.dart
index 689ccfa..09df83b 100644
--- a/lib/config/menu.dart
+++ b/lib/config/menu.dart
@@ -1,5 +1,6 @@
 import 'package:easy_localization/easy_localization.dart';
 import 'package:flutter/material.dart';
+
 import 'package:minehunter/ui/screens/about_page.dart';
 import 'package:minehunter/ui/screens/game_page.dart';
 import 'package:minehunter/ui/screens/settings_page.dart';
diff --git a/lib/cubit/bottom_nav_cubit.dart b/lib/cubit/bottom_nav_cubit.dart
index 5426139..487ffb2 100644
--- a/lib/cubit/bottom_nav_cubit.dart
+++ b/lib/cubit/bottom_nav_cubit.dart
@@ -1,4 +1,5 @@
 import 'package:hydrated_bloc/hydrated_bloc.dart';
+
 import 'package:minehunter/config/menu.dart';
 
 class BottomNavCubit extends HydratedCubit<int> {
diff --git a/lib/entities/cell.dart b/lib/entities/cell.dart
index ff05ad8..a70bd02 100644
--- a/lib/entities/cell.dart
+++ b/lib/entities/cell.dart
@@ -1,4 +1,5 @@
 import 'package:flutter/material.dart';
+
 import 'package:minehunter/provider/data.dart';
 import 'package:minehunter/utils/board_animate.dart';
 import 'package:minehunter/utils/board_utils.dart';
diff --git a/lib/main.dart b/lib/main.dart
index 15ee029..4041938 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -50,32 +50,33 @@ class MyApp extends StatelessWidget {
         BlocProvider<ThemeCubit>(create: (context) => ThemeCubit()),
       ],
       child: BlocBuilder<ThemeCubit, ThemeModeState>(
-          builder: (BuildContext context, ThemeModeState state) {
-        return ChangeNotifierProvider(
-          create: (BuildContext context) => Data(),
-          child: Consumer<Data>(
-            builder: (context, data, child) {
-              return OverlaySupport(
-                child: MaterialApp(
-                  title: 'Minehunter',
-                  home: const SkeletonScreen(),
+        builder: (BuildContext context, ThemeModeState state) {
+          return ChangeNotifierProvider(
+            create: (BuildContext context) => Data(),
+            child: Consumer<Data>(
+              builder: (context, data, child) {
+                return OverlaySupport(
+                  child: MaterialApp(
+                    title: 'Minehunter',
+                    home: const SkeletonScreen(),
 
-                  // Theme stuff
-                  theme: lightTheme,
-                  darkTheme: darkTheme,
-                  themeMode: state.themeMode,
+                    // Theme stuff
+                    theme: lightTheme,
+                    darkTheme: darkTheme,
+                    themeMode: state.themeMode,
 
-                  // Localization stuff
-                  localizationsDelegates: context.localizationDelegates,
-                  supportedLocales: context.supportedLocales,
-                  locale: context.locale,
-                  debugShowCheckedModeBanner: false,
-                ),
-              );
-            },
-          ),
-        );
-      }),
+                    // Localization stuff
+                    localizationsDelegates: context.localizationDelegates,
+                    supportedLocales: context.supportedLocales,
+                    locale: context.locale,
+                    debugShowCheckedModeBanner: false,
+                  ),
+                );
+              },
+            ),
+          );
+        },
+      ),
     );
   }
 }
diff --git a/lib/provider/data.dart b/lib/provider/data.dart
index c37658a..0ab7710 100644
--- a/lib/provider/data.dart
+++ b/lib/provider/data.dart
@@ -1,9 +1,10 @@
 import 'dart:convert';
 
 import 'package:flutter/foundation.dart';
-import 'package:minehunter/entities/cell.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 
+import 'package:minehunter/entities/cell.dart';
+
 typedef Board = List<List<Cell>>;
 typedef AnimatedBoard = List<List<bool>>;
 typedef AnimatedBoardSequence = List<AnimatedBoard>;
diff --git a/lib/ui/widgets/game/mode_indicator_report.dart b/lib/ui/widgets/game/mode_indicator_report.dart
index aac8757..6387149 100644
--- a/lib/ui/widgets/game/mode_indicator_report.dart
+++ b/lib/ui/widgets/game/mode_indicator_report.dart
@@ -9,7 +9,7 @@ class GameModeIndicatorReport extends StatelessWidget {
 
   @override
   Widget build(BuildContext context) {
- final    String reportModeSuffix = myProvider.reportMode ? 'on' : 'off';
+    final String reportModeSuffix = myProvider.reportMode ? 'on' : 'off';
 
     return TextButton(
       child: Image(
diff --git a/lib/ui/widgets/settings/theme_card.dart b/lib/ui/widgets/settings/theme_card.dart
index f90b335..964e0a9 100644
--- a/lib/ui/widgets/settings/theme_card.dart
+++ b/lib/ui/widgets/settings/theme_card.dart
@@ -16,30 +16,32 @@ class ThemeCard extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return BlocBuilder<ThemeCubit, ThemeModeState>(
-        builder: (BuildContext context, ThemeModeState state) {
-      return Card(
-        elevation: 2,
-        shadowColor: Theme.of(context).colorScheme.shadow,
-        color: state.themeMode == mode
-            ? Theme.of(context).colorScheme.primary
-            : Theme.of(context).colorScheme.surface,
-        shape: const RoundedRectangleBorder(
-          borderRadius: BorderRadius.all(Radius.circular(12)),
-        ),
-        margin: const EdgeInsets.all(5),
-        child: InkWell(
-          onTap: () => BlocProvider.of<ThemeCubit>(context).getTheme(
-            ThemeModeState(themeMode: mode),
+      builder: (BuildContext context, ThemeModeState state) {
+        return Card(
+          elevation: 2,
+          shadowColor: Theme.of(context).colorScheme.shadow,
+          color: state.themeMode == mode
+              ? Theme.of(context).colorScheme.primary
+              : Theme.of(context).colorScheme.surface,
+          shape: const RoundedRectangleBorder(
+            borderRadius: BorderRadius.all(Radius.circular(12)),
           ),
-          borderRadius: const BorderRadius.all(Radius.circular(12)),
-          child: Icon(
-            icon,
-            size: 32,
-            color:
-                state.themeMode != mode ? Theme.of(context).colorScheme.primary : Colors.white,
+          margin: const EdgeInsets.all(5),
+          child: InkWell(
+            onTap: () => BlocProvider.of<ThemeCubit>(context).getTheme(
+              ThemeModeState(themeMode: mode),
+            ),
+            borderRadius: const BorderRadius.all(Radius.circular(12)),
+            child: Icon(
+              icon,
+              size: 32,
+              color: state.themeMode != mode
+                  ? Theme.of(context).colorScheme.primary
+                  : Colors.white,
+            ),
           ),
-        ),
-      );
-    });
+        );
+      },
+    );
   }
 }
diff --git a/lib/utils/game_utils.dart b/lib/utils/game_utils.dart
index 383a287..c173564 100644
--- a/lib/utils/game_utils.dart
+++ b/lib/utils/game_utils.dart
@@ -4,7 +4,7 @@ import 'package:minehunter/utils/board_utils.dart';
 import 'package:minehunter/utils/tools.dart';
 
 class GameUtils {
-  static Future<void> quitGame(Data myProvider) async {
+  static quitGame(Data myProvider) {
     myProvider.updateGameIsRunning(false);
     if (BoardUtils.checkGameIsFinished(myProvider)) {
       myProvider.resetCurrentSavedState();
diff --git a/pubspec.yaml b/pubspec.yaml
index 72d953f..389e3a3 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -2,7 +2,7 @@ name: minehunter
 description: A minehunter game application.
 
 publish_to: 'none'
-version: 0.1.17+38
+version: 0.1.18+39
 
 environment:
   sdk: '^3.0.0'
-- 
GitLab