From c861c6ea3c5fd1a58a1b3a17ea1b6805ad00d6d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Mon, 26 Sep 2022 11:03:44 +0200
Subject: [PATCH] Upgrade Flutter framework and dependencies, clean some code

---
 android/gradle.properties                     |  4 +-
 .../metadata/android/en-US/changelogs/10.txt  |  1 +
 .../metadata/android/fr-FR/changelogs/10.txt  |  1 +
 lib/layout/keyboard.dart                      | 52 +++++++-----------
 lib/provider/data.dart                        | 18 +++---
 lib/screens/home.dart                         | 55 +++++++++----------
 lib/screens/settings.dart                     |  7 +--
 lib/utils/api.dart                            | 17 +-----
 pubspec.lock                                  | 47 +++++++---------
 test/widget_test.dart                         | 14 -----
 10 files changed, 83 insertions(+), 133 deletions(-)
 create mode 100644 fastlane/metadata/android/en-US/changelogs/10.txt
 create mode 100644 fastlane/metadata/android/fr-FR/changelogs/10.txt
 delete mode 100644 test/widget_test.dart

diff --git a/android/gradle.properties b/android/gradle.properties
index 4bb5439..6bf54a6 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.9
-app.versionCode=9
+app.versionName=0.0.10
+app.versionCode=10
diff --git a/fastlane/metadata/android/en-US/changelogs/10.txt b/fastlane/metadata/android/en-US/changelogs/10.txt
new file mode 100644
index 0000000..2bbe4a9
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/10.txt
@@ -0,0 +1 @@
+Upgrade Flutter framework and dependencies, clean some code
diff --git a/fastlane/metadata/android/fr-FR/changelogs/10.txt b/fastlane/metadata/android/fr-FR/changelogs/10.txt
new file mode 100644
index 0000000..864ad0a
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/10.txt
@@ -0,0 +1 @@
+Mise à jour du framework Flutter et de ses dépendances, nettoyage de code
diff --git a/lib/layout/keyboard.dart b/lib/layout/keyboard.dart
index a8b7a69..22cf398 100644
--- a/lib/layout/keyboard.dart
+++ b/lib/layout/keyboard.dart
@@ -1,12 +1,9 @@
-import 'dart:math';
-
 import 'package:flutter/material.dart';
 
 import '../provider/data.dart';
 import '../utils/api.dart';
 
 class Keyboard {
-
   static Container buildWidget(Data myProvider) {
     Widget buildKeyWidget(String direction) {
       String keyText = '';
@@ -36,14 +33,12 @@ class Keyboard {
         style: TextButton.styleFrom(
           padding: const EdgeInsets.all(0),
         ),
-        child: Text(
-          keyText,
-          style: TextStyle(
-            fontSize: 60.0,
-            fontWeight: FontWeight.w800,
-          ),
-          textAlign: TextAlign.center
-        ),
+        child: Text(keyText,
+            style: TextStyle(
+              fontSize: 60.0,
+              fontWeight: FontWeight.w800,
+            ),
+            textAlign: TextAlign.center),
         onPressed: () {
           if (keyText != '') {
             Api.move(myProvider, direction);
@@ -53,36 +48,27 @@ class Keyboard {
     }
 
     return Container(
-      margin: EdgeInsets.symmetric(horizontal: 2),
-      padding: EdgeInsets.all(2),
-
-      child: Table(
-        defaultVerticalAlignment: TableCellVerticalAlignment.middle,
-        children: [
-          TableRow(
-            children: [
+        margin: EdgeInsets.symmetric(horizontal: 2),
+        padding: EdgeInsets.all(2),
+        child: Table(
+          defaultVerticalAlignment: TableCellVerticalAlignment.middle,
+          children: [
+            TableRow(children: [
               TableCell(child: buildKeyWidget('')),
               TableCell(child: buildKeyWidget('north')),
               TableCell(child: buildKeyWidget('')),
-            ]
-          ),
-          TableRow(
-            children: [
+            ]),
+            TableRow(children: [
               TableCell(child: buildKeyWidget('west')),
               TableCell(child: buildKeyWidget('')),
               TableCell(child: buildKeyWidget('east')),
-            ]
-          ),
-          TableRow(
-            children: [
+            ]),
+            TableRow(children: [
               TableCell(child: buildKeyWidget('')),
               TableCell(child: buildKeyWidget('south')),
               TableCell(child: buildKeyWidget('')),
-            ]
-          ),
-        ],
-      )
-    );
+            ]),
+          ],
+        ));
   }
-
 }
diff --git a/lib/provider/data.dart b/lib/provider/data.dart
index 4cc81c0..f691277 100644
--- a/lib/provider/data.dart
+++ b/lib/provider/data.dart
@@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
 import 'package:shared_preferences/shared_preferences.dart';
 
 class Data extends ChangeNotifier {
-
   // Application settings
   String _apiHost = '';
   String _apiStatus = '';
@@ -10,17 +9,22 @@ class Data extends ChangeNotifier {
   String defaultApiHost = '127.0.0.1';
 
   getParameterValue(String parameterCode) {
-    switch(parameterCode) {
-      case 'apiHost': { return _apiHost; }
-      break;
+    switch (parameterCode) {
+      case 'apiHost':
+        {
+          return _apiHost;
+        }
     }
   }
 
   setParameterValue(String parameterCode, String parameterValue) async {
     print('set parameter "' + parameterCode + '" to value "' + parameterValue + '"');
-    switch(parameterCode) {
-      case 'apiHost': { updateApiHost(parameterValue); }
-      break;
+    switch (parameterCode) {
+      case 'apiHost':
+        {
+          updateApiHost(parameterValue);
+        }
+        break;
     }
     final prefs = await SharedPreferences.getInstance();
     prefs.setString(parameterCode, parameterValue);
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index 325686a..064999e 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -27,45 +27,40 @@ class _HomeState extends State<Home> {
     Data myProvider = Provider.of<Data>(context);
 
     return Scaffold(
-      appBar: AppBar(
-        title: new Text('Stepper plotter assistant'),
-
-        actions: [
-          IconButton(
-            icon: Icon(Icons.settings),
-            onPressed: () {
-              Navigator.push(
-                context,
-                MaterialPageRoute(builder: (context) {
-                  return SettingsPage();
-                }),
-              );
-            },
-          )
-        ],
-
-        leading: IconButton(
-          icon: Image.asset('assets/icons/application.png'),
-          onPressed: () { },
+        appBar: AppBar(
+          title: new Text('Stepper plotter assistant'),
+          actions: [
+            IconButton(
+              icon: Icon(Icons.settings),
+              onPressed: () {
+                Navigator.push(
+                  context,
+                  MaterialPageRoute(builder: (context) {
+                    return SettingsPage();
+                  }),
+                );
+              },
+            )
+          ],
+          leading: IconButton(
+            icon: Image.asset('assets/icons/application.png'),
+            onPressed: () {},
+          ),
         ),
-      ),
-      body: SafeArea(
-        child: Center(
-          child: Column(
+        body: SafeArea(
+          child: Center(
+              child: Column(
             children: [
               Keyboard.buildWidget(myProvider),
-              FlatButton(
+              TextButton(
                 child: Container(
                   child: Text('get API status'),
                 ),
                 onPressed: () => Api.updateApiStatus(myProvider),
               ),
               Text(myProvider.apiStatus)
-
             ],
-          )
-        ),
-      )
-    );
+          )),
+        ));
   }
 }
diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart
index f8d3593..4c5ab42 100644
--- a/lib/screens/settings.dart
+++ b/lib/screens/settings.dart
@@ -24,12 +24,11 @@ class _SettingsPageState extends State<SettingsPage> {
   Widget build(BuildContext context) {
     Data myProvider = Provider.of<Data>(context);
 
-    apiHostFieldController.text  = myProvider.getParameterValue('apiHost');
+    apiHostFieldController.text = myProvider.getParameterValue('apiHost');
 
     return Scaffold(
       appBar: AppBar(
         title: new Text('Stepper - settings'),
-
         actions: [
           IconButton(
             icon: Icon(Icons.save),
@@ -39,13 +38,11 @@ class _SettingsPageState extends State<SettingsPage> {
             },
           )
         ],
-
         leading: IconButton(
           icon: Image.asset('assets/icons/application.png'),
-          onPressed: () { },
+          onPressed: () {},
         ),
       ),
-
       body: Padding(
         padding: const EdgeInsets.all(16.0),
         child: TextFormField(
diff --git a/lib/utils/api.dart b/lib/utils/api.dart
index 1971612..10466f7 100644
--- a/lib/utils/api.dart
+++ b/lib/utils/api.dart
@@ -4,14 +4,8 @@ import 'package:http/http.dart' as http;
 import '../provider/data.dart';
 
 class Api {
-
   static Future<void> updateApiStatus(Data myProvider) async {
-    final response = await http.get(
-      Uri.http(
-        myProvider.apiHost,
-        'status'
-      )
-    );
+    final response = await http.get(Uri.http(myProvider.apiHost, 'status'));
 
     String responseData = utf8.decode(response.bodyBytes);
     Map<String, dynamic> status = json.decode(responseData);
@@ -20,18 +14,11 @@ class Api {
   }
 
   static Future<void> move(Data myProvider, String direction) async {
-
-    final response = await http.get(
-      Uri.http(
-        myProvider.apiHost,
-        direction
-      )
-    );
+    final response = await http.get(Uri.http(myProvider.apiHost, direction));
 
     String responseData = utf8.decode(response.bodyBytes);
     Map<String, dynamic> result = json.decode(responseData);
 
     myProvider.updateApiStatus(result['result']);
   }
-
 }
diff --git a/pubspec.lock b/pubspec.lock
index 3f94fa6..327bf29 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,7 +7,7 @@ packages:
       name: async
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.8.2"
+    version: "2.9.0"
   boolean_selector:
     dependency: transitive
     description:
@@ -21,21 +21,14 @@ packages:
       name: characters
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.2.0"
-  charcode:
-    dependency: transitive
-    description:
-      name: charcode
-      url: "https://pub.dartlang.org"
-    source: hosted
-    version: "1.3.1"
+    version: "1.2.1"
   clock:
     dependency: transitive
     description:
       name: clock
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.1.0"
+    version: "1.1.1"
   collection:
     dependency: transitive
     description:
@@ -49,7 +42,7 @@ packages:
       name: fake_async
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.3.0"
+    version: "1.3.1"
   ffi:
     dependency: transitive
     description:
@@ -63,7 +56,7 @@ packages:
       name: file
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "6.1.2"
+    version: "6.1.4"
   flutter:
     dependency: "direct main"
     description: flutter
@@ -85,7 +78,7 @@ packages:
       name: http
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.13.4"
+    version: "0.13.5"
   http_parser:
     dependency: transitive
     description:
@@ -106,21 +99,21 @@ packages:
       name: matcher
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.12.11"
+    version: "0.12.12"
   material_color_utilities:
     dependency: transitive
     description:
       name: material_color_utilities
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.1.4"
+    version: "0.1.5"
   meta:
     dependency: transitive
     description:
       name: meta
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.7.0"
+    version: "1.8.0"
   nested:
     dependency: transitive
     description:
@@ -134,7 +127,7 @@ packages:
       name: path
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.8.1"
+    version: "1.8.2"
   path_provider_linux:
     dependency: transitive
     description:
@@ -155,7 +148,7 @@ packages:
       name: path_provider_windows
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.1.0"
+    version: "2.1.3"
   platform:
     dependency: transitive
     description:
@@ -169,7 +162,7 @@ packages:
       name: plugin_platform_interface
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.1.2"
+    version: "2.1.3"
   process:
     dependency: transitive
     description:
@@ -197,7 +190,7 @@ packages:
       name: shared_preferences_android
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.12"
+    version: "2.0.13"
   shared_preferences_ios:
     dependency: transitive
     description:
@@ -225,7 +218,7 @@ packages:
       name: shared_preferences_platform_interface
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.0.0"
+    version: "2.1.0"
   shared_preferences_web:
     dependency: transitive
     description:
@@ -251,7 +244,7 @@ packages:
       name: source_span
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.8.2"
+    version: "1.9.0"
   stack_trace:
     dependency: transitive
     description:
@@ -272,21 +265,21 @@ packages:
       name: string_scanner
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.1.0"
+    version: "1.1.1"
   term_glyph:
     dependency: transitive
     description:
       name: term_glyph
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "1.2.0"
+    version: "1.2.1"
   test_api:
     dependency: transitive
     description:
       name: test_api
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.4.9"
+    version: "0.4.12"
   typed_data:
     dependency: transitive
     description:
@@ -307,14 +300,14 @@ packages:
       name: win32
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "2.7.0"
+    version: "3.0.0"
   xdg_directories:
     dependency: transitive
     description:
       name: xdg_directories
       url: "https://pub.dartlang.org"
     source: hosted
-    version: "0.2.0+1"
+    version: "0.2.0+2"
 sdks:
   dart: ">=2.17.0 <3.0.0"
   flutter: ">=3.0.0"
diff --git a/test/widget_test.dart b/test/widget_test.dart
deleted file mode 100644
index edc6abb..0000000
--- a/test/widget_test.dart
+++ /dev/null
@@ -1,14 +0,0 @@
-// This is a basic Flutter widget test.
-//
-// To perform an interaction with a widget in your test, use the WidgetTester
-// utility that Flutter provides. For example, you can send tap and scroll
-// gestures. You can also use WidgetTester to find child widgets in the widget
-// tree, read text, and verify that the values of widget properties are correct.
-
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-
-import 'package:plotter/main.dart';
-
-void main() {
-}
-- 
GitLab